Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Liars and Truthtellers problem [duplicate]

What would be the approach to a kind of problem that sounds like this:

A says B lies

B says C lies

D says B lies

C says B lies

E says A and D lie

How many lie and how many tell the truth? I am not looking for the answer to the problem above, but the approach to this kind of problem. Thanks a lot.

like image 931
DDD Avatar asked Jan 24 '26 00:01

DDD


2 Answers

A -> !B
B -> !C
D -> !B
C -> !B
E -> !A & !D

Reminder:

X -> Y  <=>  !X | Y

Transform the 5 equations into logical propositions, and you will find answers.

like image 174
Vincent Cantin Avatar answered Jan 25 '26 17:01

Vincent Cantin


To solve equations of the form

X1 = NOT X 3

X5 = NOT X 2

etc

Form a graph with nodes as Xi and connecting Xi and X j iff the equation Xi = NOT X j appears.

Now try to 2-colour the graph using Breadth First Search.


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!