Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected behaviour of lib_machine::Machine::run_query #2341

Closed
zshehov opened this issue Feb 24, 2024 · 3 comments
Closed

Unexpected behaviour of lib_machine::Machine::run_query #2341

zshehov opened this issue Feb 24, 2024 · 3 comments

Comments

@zshehov
Copy link

zshehov commented Feb 24, 2024

There seems to be a bug in lib_machine::Machine::run_query that results in wrong resolutions. To reproduce:

      let mut machine = Machine::new_lib();

      machine.load_module_string(
          "facts",
          String::from(
              r#"
          male(stephen).
          parent(albert,edward).
          father(F,C):-parent(F,C),male(F).
      "#,
          ),
      );

      let query = String::from(r#"father(F,C)."#);
      let output = machine.run_query(query);

Expected output: QueryResolution::False
Actual output: Matches([QueryMatch { bindings: {"C": String("edward"), "F": String("albert")} }])

Note: running the same program in scryer-prolog:

$ scryer-prolog
?- [user].
male(stephen).
parent(albert,edward).
father(F,C):-parent(F,C),male(F).

?- father(F,C).
   false.
@triska
Copy link
Contributor

triska commented Feb 28, 2024

@lucksus, could you please help with this issue? Is this maybe even addressed with the recently merged #2309?

mthom added a commit that referenced this issue Feb 29, 2024
@mthom
Copy link
Owner

mthom commented Feb 29, 2024

This appears already to be solved! I added a test case for it to lib_machine.rs in f2d3779.

@zshehov
Copy link
Author

zshehov commented Mar 3, 2024

Confirming this is working as expected in v0.9.4 and closing the issue. Thanks!

@zshehov zshehov closed this as completed Mar 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants