]> Repositorios git - scryer-prolog.git/commitdiff
FIXED: Queue triggered propagators to be processed after pexp/3 finishes
authorMarkus Triska <[email protected]>
Mon, 9 Oct 2023 18:42:28 +0000 (20:42 +0200)
committerMarkus Triska <[email protected]>
Mon, 9 Oct 2023 18:42:28 +0000 (20:42 +0200)
If reification constraints (such as reified equality) are triggered
here, then they may wish to disable this propagator and remove
attributes from auxiliary variables. If the pexp/3 propagation is
interrupted for that purpose, then the attributes will be
unintentionally reattached by the following fd_put/3 calls in this
propagator. We must ensure that this propagator completely finishes,
so we queue the triggered propagators for later processing.

geq/2 implements propagator activation outside the queue, and thus
should not be used in propagators in the way it was used here.

pexp/3 by itself may not seem particularly important. However, it can
arise by metamorphosis from Var*Var. Example:

    ?- A#<==> -1#=C*C, C in 0..1.
       A = 0, clpz:(C in 0..1).

This addresses #2089.

src/lib/clpz.pl

index 0b789774cde684b19be47449a9f9b2ae1875e3cd..4308e038103f0dabaa2def557e0df5348d80400a 100644 (file)
@@ -5498,7 +5498,9 @@ run_propagator(pexp(X,Y,Z), MState) -->
             )
         ;   nonvar(Y), Y > 0 ->
             (   { even(Y) } ->
-                { geq(Z, 0) }
+                { fd_get(Z, ZD0, ZPs0),
+                  domain_remove_smaller_than(ZD0, 0, ZDG0) },
+                fd_put(Z, ZDG0, ZPs0)
             ;   true
             ),
             (   { fd_get(X, XD, XL, XU, _), fd_get(Z, ZD, ZL, ZU, ZPs) } ->