Knights and Knaves

Knights and Knaves is a type of logic puzzle where some characters can only answer questions truthfully, and others only falsely.  The name was coined by Raymond Smullyan in his 1978 work What Is the Name of This Book? 

The puzzles are set on a fictional island where all inhabitants are either knights, who always tell the truth, or knaves, who always lie.   The puzzles involve a visitor to the island who meets small groups of inhabitants.   Usually the aim is for the visitor to deduce the inhabitants' type from their statements, but some puzzles of this type ask for other facts to be deduced.   The puzzle may also be to determine a yes-no question which the visitor can ask in order to discover a particular piece of information. 

One of Smullyan's examples of this type of puzzle involves three inhabitants referred to as A, B and C.  The visitor asks A what type he is, but does not hear A's answer.   B then says "A said that he is a knave" and C says "Don't believe B; he is lying!"  To solve the puzzle, note that no inhabitant can say that he is a knave.   Therefore, B's statement must be untrue, so he is a knave, making C's statement true, so he is a knight.  Since A's answer invariably would be "I'm a knight", it is not possible to determine whether A is a knight or knave from the information provided. 

Maurice Kraitchik presents the same puzzle in the 1953 book Mathematical Recreations, where two groups on a remote island – the Arbus and the Bosnins – either lie or tell the truth, and respond to the same question as above. 

In some variations, inhabitants may also be alternators, who alternate between lying and telling the truth, or normals, who can say whatever they want.  A further complication is that the inhabitants may answer yes/no questions in their own language, and the visitor knows that "bal" and "da" mean "yes" and "no" but does not know which is which.  These types of puzzles were a major inspiration for what has become known as "the hardest logic puzzle ever". 

Examples 

A large class of elementary logical puzzles can be solved using the laws of Boolean algebra and logic truth tables.  Familiarity with Boolean algebra and its simplification process will help with understanding the following examples. 

John and Bill are residents of the island of knights and knaves. 

Both knaves 
John says, "We are both knaves." 

In this case, John is a knave and Bill is a knight.  John's statement cannot be true, because a knave admitting to being a knave would be the same as a liar telling the lie "I am a liar", which is known as the liar paradox.  Since John is a knave this means he must have been lying about them both being knaves, and so Bill is a knight. 

Same or different kinds 
John says, "We are the same kind," but Bill says, "We are of different kinds." 

In this scenario they are making contradictory statements, so one must be a knight and one must be a knave.  Since that is exactly what Bill said, Bill must be the knight, and John is the knave. 

Identity alone 
If all we want to know is whether a man is a knight or a knave, this can be tested by simply asking a question to which the answer is already known.  In the film The Enigma of Kaspar Hauser, Kaspar solves the puzzle of whether a man is a knight or a knave by suggesting asking the man "whether he was a tree frog". 

Fork in the road 
This is perhaps the most famous rendition of this type of puzzle:  This version of the puzzle was further popularised by a scene in the 1986 fantasy film, Labyrinth, in which the protagonist finds herself faced with two doors with guardians who follow the rules of the puzzle.  One door leads to the castle at the centre of the labyrinth, and one to certain death.  It had also appeared some ten years previously, in a very similar form, in the Doctor Who story Pyramids of Mars. 
This version of the puzzle was also used in the 4th season of the Belgian reality TV show De Mol in 2016. 
There are several ways to find out which way leads to freedom.  All can be determined by using Boolean algebra and a truth table. 

In Labyrinth, the protagonist's solution is to ask one of the guards: "Would  tell me that  door leads to the castle?"  With this question, the knight will tell the truth about a lie, while the knave will tell a lie about the truth.  Therefore, the given answer will always be the opposite of the correct one. 

Another posited solution is to ask either man if they would say that their own path leads to freedom.  In this case, the idea is that the knave, rather than lying about a truthful answer, will be forced to lie about the lie he would tell (ie, answer with a double negative), thus both knight and knave will give the correct answer. 

Goodman's 1931 variant 
The philosopher Nelson Goodman anonymously published another version in the Boston Post issue of June 8, 1931, with nobles never lying and hunters never telling the truth.  Three inhabitants A, B, C meet some day, and A says either "I am a noble" or "I am a hunter", we don't yet know which.  Then B, in reply to a query, says "A said, 'I am a hunter'".  After that, B says "C is a hunter".  Then, C says "A is noble".  Now the problem is, which is each, and why? 

Since a hunter always lies, they cannot admit their own identity: therefore, A could not have admitted to being a hunter.  This means that B must be a hunter, his allegation directed at C must be false, and therefore A and C must be nobles. 

Goodman reports the puzzle came back to him from various directions, including a 1936 Warsaw Logicians' meeting via Carnap; some echo versions were corrupted by joining B's two utterances into a single one, which make the puzzle unsolvable.  Some years later, Goodman heard about the #Fork in the road variant; having scruples about counterfactuals, he devised a non-subjunctive, non-contrary-to-fact question that can be asked. 

References

External links
  — A note on some philosophical implications of the Knights and Knaves puzzle for the concept of knowability
A complete list and analysis of Knight, Knave, and Spy puzzles, where spies are able to lie or tell the truth. 
Collection of computer-generated Knights and knaves puzzles

Category:Logic puzzles