/* Global constraint imply in Picat. From Global Constraint Catalogue http://www.emn.fr/x-info/sdemasse/gccat/Cimply.html """ imply(VAR,VARIABLES) Purpose Let VARIABLES be a collection of 0-1 variables VAR1,VAR2. Enforce VAR=(VAR1 -> VAR2). Example (1,<0, 0>) (1,<0, 1>) (0,<1, 0>) (1,<1, 1>) """ This Picat model was created by Hakan Kjellerstrand, hakank@gmail.com See also my Picat page: http://www.hakank.org/picat/ */ import cp. main => go. go ?=> Vars = new_list(2), Vars :: 0..1, V :: 0..1, imply(V, Vars), solve(Vars ++ [V]), println([v=V,vars=Vars]), fail, nl. go => true. imply(V, Vars) => V #<=> (Vars[1] #=> Vars[2]).