Three young men named Ernesto, Fontleroy, and Gildenstern arrived singly at an inn and awaited the innkeeper. When she arrived at the front desk, all three asked for the best room. The innkeeper explained that, since it was not possible for them all to have the best room, the man who had arrived first could have a spacious room overlooking the village square, the second to arrive could have a small room with a partial view of the garden, and the third would have to settle for a drafty loft by the back alley, but it was the last room she had to offer. The following conversation ensued:
Ernesto: I am a knight.
Fontleroy: While I am only a knave.
Gildenstern: I agree with you there, Fontleroy.
Ernesto: Gildenstern is a knight.
Fontleroy: No, he is a liar.
Gildenstern: Then let me say: I did not arrive first.
Ernesto: Fontleroy is the liar.
Fontleroy: Following Gildenstern's lead, let me say: I did not arrive first.
Gildenstern: Ernesto is a knave.
Ernesto: If that is so, then the most honest of us did not arrive last.
Fontleroy: Ernesto, you are a knight.
Gildenstern: Ha!
The innkeeper knew that everyone in these parts was either a knight who always told the truth, a liar who never told the truth, or a knave whose statements strictly alternated between truth and untruth. Using deductive reasoning, what is the disposition of each man, and what room did the innkeeper assign to each?
If I am not mistaken, then we are assuming that each of the three men: Ernesto, Fontleroy and Gildenstern belong to different categories. That is, exactly one of them is a Knight, exactly one of them is a Knave and exactly one of them is a Liar.
Let us first assume that Ernesto is a Knight. But we see that Ernesto says in his second comment: "Gildenstern is a Knight". Ernesto being a Knight cannot Lie and therefore Gildenstern has to be a Knight. But again this is not possible, since each of the three belong to different categories. So our assumption that Ernesto is a Knight is wrong. Hence, Ernesto is not a Knight.
Now, let us suppose that Ernesto is a Knave. It is obvious that his first statement: "I am a Knight" is false, since if it were true, then he would have been a Knight and not a Knave (and in case if he were a Liar, still his statement had to be false). Therefore, his second statement must be True and his Third statement must be False, since he being a Knave, no two consecutive statements of his will be both True or both False, as according to the problem a knave's statements strictly alternates between truth and untruth. Then using this reasoning, we see that Gildendtern is a Knight and Fontleroy is NOT the Liar, which implies Fontleroy is either a Knight or a Knave, but according to our assumption, Ernesto is a Knave and his second statement being True, Gildenstern is a Knight, and since no two of the three belong to the same category, and Fontleroy cannot be the Liar, Fontleroy does not belong to any of the three categories. So once again we arrive at a contradiction, thus proving that Ernesto cannot be a Knave.
Till now we have proved that Ernesto can neither be a Knight nor a Knave. Therefore, Ernesto has to be a Liar. Now, consider the comments of Ernesto where he says: "Gildenstern is a Knight" and "Fontleroy is the Liar". Since Ernesto is a Liar, both his statements are false implying Gildenstern is a Knave and Fontleroy is a Knight. (Since if Fontleroy were a Knave, Gildenstern would be a Knight, contradictiong that Ernesto's statement is false). But we again arrive at a contradiction when we consider Fontleroy's statements: "....I am only a Knave", and "Ernesto, you are a Knight", since no Knight would say that about himself and a Liar (Ernesto). So once again we arrive at a contradiction, which means that our assumption that Ernesto is a Liar is wrong.
Thus we see that Ernesto does not belong to either of the three categories: Knight, Knave and Liar.
(Now, I know that this is not possible and so I have made a mistake somewhere, but I am not able to find out where I am going wrong. Someone please help me with this).