scryer-prolog: dif/2 incorrect
?- A=[A],C=[D|E],B=[D],D=[C|F], dif_si(A,B).
error(instantiation_error,dif_si/2).
?- A=[A],C=[D|E],B=[D],D=[C|F], dif(A,B).
A = [A], C = [[C|F]|E], D = [[D|E]|F], B = [[C|F]], dif:dif([...],[[[...|_A]|F]]).
?- dif(A,B),A=[A],C=[D|E],B=[D],D=[C|F].
A = [A], B = [[C|F]], C = [[C|F]|E], D = [[D|E]|F], unexpected.
(ediftcrvl-nth(5:4254341554)
About this issue
- Original URL
- State: closed
- Created 9 months ago
- Comments: 18 (11 by maintainers)
Commits related to this issue
- correct skipping of not fully visited lists in stackful heap iterator (#2056, #2063, #2065) — committed to mthom/scryer-prolog by mthom 9 months ago
- Add tests for #2056 — committed to bakaq/scryer-prolog by bakaq 9 months ago
- Merge pull request #2066 from bakaq/dif_tests Add tests for #2056 — committed to mthom/scryer-prolog by mthom 9 months ago
I think I’ve fixed the iterator used by
term_variables/2. This should also address the other issues you recently opened @bakaq.I haven’t pushed anything to master yet.
I think so, yes.
The reason for this seems to be that
dif/2isn’t putting attributes in any variables (and especially not inEwhich is relevant in this case) here:Apparently the
terms_variables/2indif/2doesn’t findE, or any other variables in the case above:Is this a bug in
term_variables/2?This may also be the cause for #2057.
Ais bound to a list so it’s not a variable, same forCandD. That leavesEas a variable.