From c9ecfb11d9d2c39eb519d42f8d24cc51b2d4475e Mon Sep 17 00:00:00 2001 From: Markus Triska Date: Wed, 8 Mar 2023 20:50:33 +0100 Subject: [PATCH 1/2] ENHANCED: more compact definition of dif/2 As outlined in #1753. --- src/lib/dif.pl | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/lib/dif.pl b/src/lib/dif.pl index a59052ac..20842b27 100644 --- a/src/lib/dif.pl +++ b/src/lib/dif.pl @@ -59,11 +59,8 @@ verify_attributes(Var, Value, Goals) :- dif(X, Y) :- X \== Y, ( X \= Y -> true - ; ( term_variables(X, XVars), - term_variables(Y, YVars), - dif_set_variables(XVars, X, Y), - dif_set_variables(YVars, X, Y) - ) + ; term_variables(dif(X,Y), Vars), + dif_set_variables(Vars, X, Y) ). gather_dif_goals(_, []) --> []. From 884b0ca10eac28e300dbfddb1455f3cfd7ad0aa6 Mon Sep 17 00:00:00 2001 From: Markus Triska Date: Wed, 8 Mar 2023 21:16:54 +0100 Subject: [PATCH 2/2] FIXED: Take all variables into account during goal projection. This addresses #1751. --- src/lib/dif.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/dif.pl b/src/lib/dif.pl index 20842b27..73d65518 100644 --- a/src/lib/dif.pl +++ b/src/lib/dif.pl @@ -65,7 +65,7 @@ dif(X, Y) :- gather_dif_goals(_, []) --> []. gather_dif_goals(V, [(X \== Y) | Goals]) --> - ( { term_variables(X, [V0 | _]), + ( { term_variables(X-Y, [V0 | _]), V == V0 } -> [dif:dif(X, Y)] ; []