Merge pull request #432 from triska/master

correct overeager CLP(ℤ) goal expansion
This commit is contained in:
Mark Thom
2020-05-01 13:41:43 -03:00
committed by GitHub

View File

@@ -3038,13 +3038,13 @@ expansion_simpler((A0,B0), (A,B)) :- !,
expansion_simpler(Var is Expr0, Goal) :- expansion_simpler(Var is Expr0, Goal) :-
ground(Expr0), !, ground(Expr0), !,
phrase(expr_conds(Expr0, Expr), Gs), phrase(expr_conds(Expr0, Expr), Gs),
( maplist(call, Gs) -> Var is Expr, Goal = true ( maplist(call, Gs) -> Value is Expr, Goal = (Var = Value)
; Goal = false ; Goal = false
). ).
expansion_simpler(Var =:= Expr0, Goal) :- expansion_simpler(Var =:= Expr0, Goal) :-
ground(Expr0), !, ground(Expr0), !,
phrase(expr_conds(Expr0, Expr), Gs), phrase(expr_conds(Expr0, Expr), Gs),
( maplist(call, Gs) -> Goal = (Var =:= Expr) ( maplist(call, Gs) -> Value is Expr, Goal = (Var =:= Value)
; Goal = false ; Goal = false
). ).
expansion_simpler(between(L,U,V), Goal) :- maplist(integer, [L,U,V]), !, expansion_simpler(between(L,U,V), Goal) :- maplist(integer, [L,U,V]), !,