Controversial logic problem from brilliant. Misinterpreted logic or flawed question? You are offered two cupcakes. One is poisoned and the other is safe to eat.
You happen to be in a village full of knights (who always tell the truth) and knaves (who always lie), but you can't tell which is which by their appearance.
You ask one of them, "Which cupcake is safe to eat?" To this he makes the following two statements,
"If I were a knave, I'd say the one on the right."
"But I'd say the one on the left, if I were a knight."
Which cupcake is safe to eat?
Assumption: The person you ask knows which cupcake is which.
This problem appears on brilliant in the practice section (truth tellers and liars level 3 challenges) and it's causing a bit of a heated discussion. The answer is supposedly the cupcake on the left. Is this question flawed or are people misinterpreting the logic?
 A: In mathematical logic, the statement "If $A$, then $B$" means a very precise thing, in a way that it is not always interpreted as in everyday conversation. It means no more and no less than the following statement: "It is not the case that $A$ is true and $B$ is false".
For instance, "If $2+2=5$, then $2+2=6$" is an example of a true implication. We're only committing to the second half of the statement if the first half is true, which it's not - so the statement remains true! An "if" statement is only false when the first part is true but the second part is false. See the Wikipedia article for a more in-depth treatment.
With that cleared up, let's take a look at this problem, and name our mystery person P. In fact, we only need to look at the second sentence.

P: "But I'd say the one on the left, if I were a knight."

They're saying "If (P is a knight), then (P would answer "the one on the left" to your question)".
When is this statement false? It's false when (P is a knight) is true, but (P would answer "the one on the left" to your question) is false. So this will be false only in those scenarios where P is a knight and would tell you the safe cupcake is on the right.
What can we conclude from this? Well, P can't be a knave, because then the statement would be false, but it can only be false when P is a knight! So P is a knight, and therefore the statement is true. So, we can conclude that P really would tell you "the one on the left", and because they're a knight, that answer would be the correct one.
