import CHR ------------------------------------------------------------------------------ -- CHR definition of Boolean constraints and = C_Bool_Bool_Bool "and" or = C_Bool_Bool_Bool "or" neg = C_Bool_Bool "neg" andRules = [and x y z <=> x .=. False |> z .=. False, and x y z <=> y .=. False |> z .=. False, and x y z <=> x .=. True |> y .=. z, and x y z <=> y .=. True |> x .=. z, and x y z <=> z .=. True |> x .=. True /\ y .=. True, and x y z <=> x .=. y |> y .=. z] where x,y,z free orRules = [or x y z <=> x .=. False |> z .=. y, or x y z <=> y .=. False |> z .=. x, or x y z <=> x .=. True |> z .=. True, or x y z <=> y .=. True |> z .=. True, or x y z <=> z .=. False |> x .=. False /\ y .=. False, or x y z <=> x .=. y |> y .=. z] where x,y,z free negRules = [neg False x <=> x .=. True, neg x False <=> x .=. True, neg True x <=> x .=. False, neg x True <=> x .=. False, neg x x <=> fail] where x free main = compileCHR "Bool" (andRules++orRules++negRules) -- and x y z & neg False z --> x=y=z=True