From a39f4b4487588f4ca7e43dbd92ea9503b830fa4b Mon Sep 17 00:00:00 2001 From: Markus Triska Date: Thu, 30 Apr 2020 18:10:09 +0200 Subject: [PATCH] =?utf8?q?correct=20verify=5Fattributes/3=20for=20variable?= =?utf8?q?s=20that=20have=20no=20CLP(=E2=84=A4)=20attribute=20attached=20(?= =?utf8?q?#373)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Example: ?- freeze(B, queen_value_truth(C,N,B)), Q #= N #<==> B. clpz:(Q#=N#<==>B), clpz:(B in 0..1), freeze:freeze(B,queen_value_truth(C,N,B)) ; false. --- src/prolog/lib/clpz.pl | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/prolog/lib/clpz.pl b/src/prolog/lib/clpz.pl index ebfbc547..0937d538 100644 --- a/src/prolog/lib/clpz.pl +++ b/src/prolog/lib/clpz.pl @@ -7371,7 +7371,8 @@ goals_entail(Goals, E) :- verify_attributes(Var, Other, Gs) :- % portray_clause(Var = Other), - ( get_attr(Var, clpz, clpz_attr(_,_,_,Dom,Ps,Q)) -> + ( get_atts(Var, clpz(CLPZ)) -> + CLPZ = clpz_attr(_,_,_,Dom,Ps,Q), ( nonvar(Other) -> ( integer(Other) -> true ; type_error(integer, Other) @@ -7379,14 +7380,17 @@ verify_attributes(Var, Other, Gs) :- domain_contains(Dom, Other), phrase(trigger_props(Ps), [Q], [_]), Gs = [phrase(do_queue, [Q], _)] - ; fd_get(Other, OD, OPs), - domains_intersection(OD, Dom, Dom1), - append_propagators(Ps, OPs, Ps1), - new_queue(Q0), - variables_same_queue([Var,Other]), - phrase((fd_put(Other,Dom1,Ps1), - trigger_props(Ps1)), [Q0], _), - Gs = [phrase(do_queue, [Q0], _)] + ; ( get_atts(Other, clpz(clpz_attr(_,_,_,OD,OPs,_))) -> + domains_intersection(OD, Dom, Dom1), + append_propagators(Ps, OPs, Ps1), + new_queue(Q0), + variables_same_queue([Var,Other]), + phrase((fd_put(Other,Dom1,Ps1), + trigger_props(Ps1)), [Q0], _), + Gs = [phrase(do_queue, [Q0], _)] + ; put_atts(Other, clpz(CLPZ)), + Gs = [] + ) ) ; Gs = [] ). -- 2.54.0