/* Ten sentences relaxed in Picat. From Adrian Groza "Modelling Puzzles in First Order Logic" """ Puzzle 143. Ten sentences relaxed In a list of 10 statements, the nth statement says there are at least n false items in the list. Which of the statements, if any, are false? """ The solution: [1,1,1,1,1,0,0,0,0,0] i.e. the sentences 1..5 are true and sentences 6..10 are false. 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 = 10, X = new_list(N), X :: 0..1, foreach(I in 1..N) X[I] #<=> sum([X[J] #= 0 : J in 1..N] ) #>= I end, solve(X), println(X), fail, nl.