All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Logic > Liars and Knights
Legally Blonde (Posted on 2016-12-19) Difficulty: 1 of 5
You meet three blonde women, A, B, and C. Each of them is either a knight or a liar. Exactly one of them is Elle Woods.

A:I am Elle Woods.
B:I am Elle Woods.
C:At least two of us are liars.

What are A, B, and C, and who is Elle Woods?

No Solution Yet Submitted by Math Man    
Rating: 3.0000 (2 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Can hair be lying? | Comment 6 of 8 |

Evidentally, A or B (or both) must be a liar.
Suppose C is also a liar. Then C's statement would be true, which is not possible. Since therefore C must be a knight, it follows from C's statement that A and B are both liars.
So only C can be Elle Woods.
(But maybe all of them are implicitly lying about the colour of their hair.)


?- blondewomen(A,B,C).

A = a(0,0),
B = b(0,0),
C = c(1,1)

:- op(1050, xfy, =>).           % operator definition '=>'

X => Y :- \+ X, !.                % de Morgan: (P -> Q) <=> (~P v Q)
X => Y :- Y.


blondewomen(a(S1,E1),b(S2,E2),c(S3,E3)) :-
    TruthSum is (S1+S2+S3),

    ((S1=1) => (E1=1)),
    ((S2=1) => (E2=1)),
    ((S3=1) => (TruthSum =<1)),

    ((S1=0) => \+ (E1=1)),
    ((S2=0) => \+ (E2=1)),
    ((S3=0) => \+ (TruthSum =<1)),

    EW_identitySum is (E1+E2+E3),
    EW_identitySum is 1.

  Posted by ollie on 2016-12-19 14:51:11
Please log in:
Remember me:
Sign up! | Forgot password

Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (3)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Copyright © 2002 - 2021 by Animus Pactum Consulting. All rights reserved. Privacy Information