/*
Five statements problem in Picat.
From
"Puzzle: Joyner’s five statements"
http://strathmaths.wordpress.com/2012/10/17/puzzle-joyners-five-statements/
"""
The following little logical teaser appears as "Ponderable 1.1.3" in
David Joyner's book Adventures in Group Theory (Johns Hopkins University
Press, 2008; also available to download for free).
Determine which of the following statements is true.
- Exactly one of these statements is false.
- Exactly two of these statements are false.
- Exactly three of these statements are false.
- Exactly four of these statements are false.
- Exactly five of these statements are false.
(Enthusiasts might like to consider the "natural" generalisation to n statements,
and in particular the case n=1…) Thanks to Dr André Sonnet for pointing this
one out to me!
"""
This Picat model was created by Hakan Kjellerstrand, hakank@gmail.com
See also my Picat page: http://www.hakank.org/picat/
*/
% import util.
import cp.
main => go.
go ?=>
N = 5,
X = new_list(N),
X :: 0..1,
foreach(I in 1..N)
X[I] #= 1 #<=> sum([X[J] #= 0 : J in 1..N ]) #= I
end,
solve(X),
writeln(X),
fail,
nl.
go => true.