/* Satisfication problem in Picat. From the Alma-0 model satisfy.a0 (http://www.cwi.nl/en/alma) """ The problem is to generate all interpretations that satisfy a given propositional formula. """ There are 6 solutions: [0,0,1,1] [0,1,1,1] [1,0,1,1] [1,1,0,0] [1,1,0,1] [1,1,1,0] This program was created by Hakan Kjellerstrand, hakank@gmail.com See also my Picat page: http://www.hakank.org/picat/ */ import cp. main => go. go => N = 4, X = new_list(N), X :: 0..1, (X[1] #= 1 #/\ X[2] #= 1) #\/ (X[3] #= 1 #/\ X[4] #= 1), (X[1] #!= X[3]) #\/ (X[2] #!= X[4]), solve(X), println(X), fail, nl.