Open chalst opened 2 years ago
Thanks for these references! Julog.jl actually supports a version of DFS search now, but it looks like I forget to update the README. I didn't implement BFS for any strong reason, and I'm actually thinking of switching the default behavior to DFS eventually. Per the following comment however, it looks like I'll have to refactor how the code is written to reproduce the same DFS algorithm that, e.g., SWI-Prolog uses, which may take me a while to get to: https://github.com/ztangent/Julog.jl/pull/18#issuecomment-1108095933
The README states:
No reason for this unusual choice is given, however I'm aware that there are good reasons why one might prefer breadth-first semantics. Three doctoral dissertations explore this choice; in the first and last, the researchers have implemented a breadth-first LPL, while the second explores expressions in Haskell using Wadler's 'list of successes' paradigm:
The issue that drives the preference comes from algebraic semantics: if you regard the semantics of a query as a collection of satisfiers, left-to-right depth-first search gives conjunction a bias where (A,B) might not terminate if A gives an unbounded search, even if B has only finitely many satisfiers consistent with A; the requirement that the semantics lacks this kind of biases is called fairness, and breadth-first search makes this easier to achieve.
It might be worth adding a paragraph to the README mentioning the idea of fairness in logic-programming semantics and gesturing at the literature.