There are three people. One of them states 'Exactly two of us are truth-tellers." Every person is either a truth-teller or a liar. I was hoping someone could help me figure out how to create a truth table in Mathematica for this statement. I found that this logical statement is equivalent to the statement "Exactly two people are truth-tellers" from this link: https://mathematica.stackexchange.com/questions/14051/how-to-solve-the-liar-problem ∃x∃y((x≠y∧P(x)∧P(y))∧∀z(P(z)→(z=x∨z=y))).
I used Boolean Table but couldn't generate the right input for Boolean Table to get a truth table. I am trying to figure out the following puzzle using Mathematica's computational abilites:
There are three people.
Person A states, "Exactly two people are truth-tellers." Person B states,"I and Person C are truth-tellers." Person C states "Person A or B is a liar."
How can I use the solving features in Mathematica to input logical statements and figure out who is telling the truth and who is lying?
How to create a truth table in Mathematica out of the logical statement “Exactly two out of three people are truth-tellers”
logicmathematica
Best Answer
Truth-Tables are for propositional logic only. They don;t work for full first-order logic statements with quantifiers.
If you are ok doing this in propositional logic, you can use $A,B,C$ for the three people being truth-tellers respectively, and use the statement:
$$(A \land B \land \neg C) \lor (A \land \neg B \land C) \lor (\neg A \land B \land C)$$
So, with $A$ being the person making the making that 'exactly two of us are truth-tellers, you can encode that bit of information as:
$$A \leftrightarrow [(A \land B \land \neg C) \lor (A \land \neg B \land C) \lor (\neg A \land B \land C)]$$
$B$ saying that "I and C are truth-tellers" would be:
$$B \leftrightarrow (B \land C)$$
$C$ saying that "Person A or B is a liar" would be:
$$C \leftrightarrow (\neg A \lor \neg B)$$