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 evaluation_error for CLP(ℤ) goal expansion #228

Closed
triska opened this issue Oct 30, 2019 · 5 comments
Closed

Unexpected evaluation_error for CLP(ℤ) goal expansion #228

triska opened this issue Oct 30, 2019 · 5 comments

Comments

@triska
Copy link
Contributor

triska commented Oct 30, 2019

With clpz3.pl from https://www.metalevel.at/clpz/scryer/clpz3.pl, I get:

?- clpz:goal_expansion(cis(A,B), Y).
caught: error(evaluation_error((clpz:goal_expansion)/2),goal_expansion/2)

Expected: Success, with

A = B,
Y = true.
@triska triska changed the title Unexpected evaluation_error for CLPZ(ℤ) goal expansion Unexpected evaluation_error for CLP(ℤ) goal expansion Nov 1, 2019
@triska
Copy link
Contributor Author

triska commented Nov 26, 2019

I now get:

?- clpz:goal_expansion(cis(A,B), Y).
Y = true .

However, I expect the binding A = B in addition to that.

(Please also see #237 for the unexpected blank symbol that occurs before the ..)

@mthom
Copy link
Owner

mthom commented Nov 26, 2019

Yes, I figured. I'm not sure how to implement that in pure Prolog without scouring the variable list, and checking that the attached labels aren't equal. Otherwise, the toplevel will post many X = X goals, which I want to avoid.

@triska
Copy link
Contributor Author

triska commented Nov 26, 2019

Ideally, the toplevel should use the variable_names/1 option of read_term/3 (or one of its bootstrapped built-in predicates) to read the query together with the variable names that are used:

http://www.complang.tuwien.ac.at/ulrich/iso-prolog/WDCor3#7.10.3

These variable names should then be used when the residual goals are displayed. A binding like X = X need not be emitted. Only created bindings and residual goals need to be displayed, and the variable names only need to be plugged in when printing the answer.

@triska
Copy link
Contributor Author

triska commented Nov 26, 2019

Maybe an internal Prolog predicate that determines whether its argument is a free variable could help with this? It should succeed for WAM cells that point to themselves (if indeed variables are represented in this way in Scryer!). For such variables, it is not necessary to emit a binding.

mthom pushed a commit that referenced this issue Dec 6, 2019
@triska
Copy link
Contributor Author

triska commented Dec 6, 2019

The binding works nicely now, so I'm closing this issue, thank you a lot!

Please see #253 for the crash that can now be observed with this query!

@triska triska closed this as completed Dec 6, 2019
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

2 participants