# Clever Jack - A logical fairy tale

As so often happens in fairy tales, there once was a king who had an intractable problem, one that even his wisest advisers could not solve. After many years of frustration, the exasperated king eventually declared that any who could solve his dilemma would earn his favor and join his royal court.

And as so often happens in these tales, these decrees eventually reached the ears of an clever commoner named Jack. Jack and his two brothers, Kevin (strong as an ox and nearly as bright) and Lewis (simple-minded but generous) set out, and against all odds found a solution to the kings dilemma.

Unfortunately, as happens too often in these tales, the king had second thoughts about his promises after his crisis was resolved. As mere commoners, Jack and his brothers would ill-suit the Kings royal court, thus he schemed to cheat the brothers out of their reward. He claimed that what he actually said was that the people who solved his dilemma would come to live at the castle, but not necessarily as nobility...

In this vein, he has gathered nine people from around the castle, nobility, but also commoners and servants; and the brothers can choose three of the presented people and take their places at the castle.

The king allows one question to be asked to each person present, but aware of Jacks sharp wit, prevents him from asking any of the questions.

Kevin and Lewis query the nine people, but being much less bright than their brother they fail to ask the most useful questions; and receive the less-than-helpful statements below:

• Andrew: “I am a higher rank than Edward”
• Bernard: “Ivan is a noble”
• Charlie: “Andrew is a lower rank than me”
• David: “Charlie is not the same rank as me”
• Edward: “I am not the same rank as Bernard”
• Frederick: “George is not a servant”
• George: “That's right, I'm not a servant”
• Harold: “Frederick told me he is a servant”
• Ivan: “Harold is a commoner”

Despite this, clever Jack believes he can still best the king, and elevate himself and his brothers to nobility. He quickly deduces the following facts about the people gathered before him:

1. Despite his disinclination to actually grant his promised reward, the king wants to at least appear fair.
Thus there must be at least three nobles amongst the people presented.

2. Nobles would fear to lose their own position to a commoner, but would find amusement in the idea of their peers losing theirs.
As such they would lie about themselves, but tell the truth about anyone else in the castle, including other nobles.

3. Commoners would have nothing to gain or lose, but would be jealous of their countrymen being elevated.
Thus they will lie about nobles to prevent Jack picking them, but otherwise tell the truth about themselves and others.

4. Servants would grasp this opportunity to escape their life of servitude, and do anything to be picked.
Thus they will lie about themselves and anyone of higher rank than themselves to make their position sound better; though they tell the truth about other servants, who present no competition.

Note that these rules are subjective, and not necessarily consistent; It’s hard for liars to keep their stories straight!

Thus:

• A noble asked if he is the same rank as a servant would say yes, as he lies about himself.
• The same noble asked if the servant is the same rank as him would say no, as he tells the truth about servants.

From this, which three people of the nine presented should Jack choose so that he and his brothers become nobility?

(Clarifications moved up from the comments)

Ok, sorry does seem to be more uncertainty here than expected; none of it intended to add complications.

1 - To confirm what people have inferred, the ranks at the castle go Noble > Commoner > Servant. There are no intended "ranks within ranks", eg every noble is the same rank as every other noble.

I don't think it matters, but FWIW Jack and his brothers are considered commoners.

2 - All statements are made with the truth values above, even between individuals presented. Thus "X told me he is a Y" is true only if X could tell Jack he is a Y.

The truth value of the second order statement is only intended to be about whether X truly did say Y, modified by whether or not the speaker of the second order statement lies about people of X's rank.

The intention was not to create a lie from whole cloth (X said Y is a lie because X never said Y nor anything like it).

I have spent 15 minutes trying to put my intentions around this clause into clear language, and am still pretty sure I failed. In retrospect this means I should have avoided that sentence type. Live and learn I guess...

3 - My intended syntax and phrasing for determining who the subject of a statement is (in lieu of looking up grammar and syntax etc) is that a sentence is always about the first person mentioned in it, eg: 'I am better than X' is a sentence about oneself, and will be true or false based on whether one lies about themselves; 'X is better than I am' is a sentence about X (even though it refers to ones self), and is true or false depending whether one lies about people of X's rank.

This seems natural to me, but may not be standard (or even technically correct) - and is probably hell for non-native English speakers. Sorry.

• Welcome to Puzzling! This is a really interesting question, and very well constructed too. – Deusovi Jul 13 '16 at 2:24
• @Deusovi thank you; took longer than i expected to make and test, but i really wanted something that clearly wasn't a puzzle from Raymond Smullyan with the names filed off. Now I only hope its actually solvable when you approach it without knowing the shape of the answer in advance... – crcroberts Jul 13 '16 at 3:51
• @Eikre: to clarify, (in lieu of looking up grammar and syntax etc); a sentence is always about the first person mentioned in it, eg: 'I am better than X' is a sentence about oneself, and will be true or false based on whether one lies about themselves; 'X is better than I am' is a sentence about X (even though it refers to ones self), and is true or false depending whether one lies about people of X's rank – crcroberts Jul 13 '16 at 3:54
• Is there a difference between "“Frederick told me he is a servant” and "frederick is a servent" Would Frederick (potentially) lie to other people as well? And would Harold (potentially) lie about what he is told? – gtwebb Jul 13 '16 at 4:23
• Are all nobles considered equal? Or is "X ranks higher than Y" still true if both are nobles? I assume the same will be true for servants and commoners. – Trenin Jul 13 '16 at 16:47

There is exactly one set of ranks consistent with what we have been told (at least, if I am interpreting the rules correctly when it comes to H's statement about what F said):

A,B,E are servants; C,G,I are commoners; D,F,H are nobles. So J,K,L should ask to take the places of D,F,H.

Here is a proof.

First, G says he isn't a servant. A noble talking about himself will lie, so G is not a noble. Could he be a servant? No, because then F would tell the truth about him (everyone tells the truth about a servant, apart from himself). So G is a commoner.

Now F says that G is not a servant, and is telling the truth about a commoner. A noble or commoner could do this, but not a servant. So F is not a servant.

H says that F says that F is a servant. Who could actually claim to be a servant? Only a noble, as it turns out. (Commoners tell the truth about themselves and servants lie about themselves.) So H is claiming F is a noble. If H is a noble he tells the truth about everyone else, so this works iff F is also a noble; if H is a commoner he lies about nobles and tells the truth about others, neither of which lets him truthfully call someone else a noble; if H is a servant he tells the truth about other servants (so can't call them nobles) but lies about others (so can call them nobles iff they're commoners). So either F and H are both nobles, or F is a commoner and H is a servant.

In particular, H is not a commoner. So I is lying about him. So I is not a noble (who tells the truth about others). Both commoners and servants tell the truth about (other) servants so H is not a servant; so H is a noble and hence F is also a noble.

Now, B falsely calls I a noble. So B isn't a noble (nobles tell the truth about others); nor is B a commoner (commoners tell the truth about non-nobles). So B is a servant. If I were a servant then B would tell the truth about him; so in fact I is a commoner.

E says (about himself) that he is not of the same rank as B. In other words, he is claiming not to be a servant. Nobles lie about themselves so can't do this; commoners tell the truth about themselves so also can't do it. So E is a servant.

A says (about himself) that he is of higher rank than E. This is in fact exactly the same situation as in the previous paragraph, and the conclusion is the same: A is a servant.

Now C again claims to be of higher rank than Andrew, but this is different because now C is talking about Andrew rather than himself. Everyone tells the truth about (other) servants, so indeed C is not a servant.

D says that C is of different rank. This is impossible if D is a servant (it would be true but servants tell the truth only about other servants) or a commoner (if C is a noble it would be true, but commoners lie about nobles; if C is a commoner it would be false, but commoners tell the truth about other commoners; and C is not a servant). Therefore D is a noble.

At this point we have found the three nobles we need, but we might as well add that nobles tell the truth about others, so (since we already know C is not a servant and D, a noble, says he isn't a noble) C is a commoner. And now we know what everyone is.

I actually found this solution with a hacked-together computer program -- which of course provides some verification that the above is correct. Here is the program, for anyone who wants to check my cross-checking.

for a in range(3):
for b in range(3):
for c in range(3):
# C says (about A) "A<C".
# If C=2 he tells the truth so A<C.
# If C=1 and A=2 he lies so A>=C, which works.
# If C=1 and A<2 he tells the truth so A<C so A=0.
# If C=0 and A>0 he lies so A<C, impossible.
# If C=0 and A=0 he tells the truth so 0<0, impossible.
if c==0 or (c==1 and a==1) or (c==2 and a==2): continue
for d in range(3):
# D says (about C): "C!=D".
# If D=2 he tells the truth so C!=D i.e., C<2.
# If D=1 and C=2 he lies so C=D, impossible.
# If D=1 and C<2 he tells the truth so C!=D so C=0 or equivly C<D.
# If D=0 and C>0 he lies so C=D, contradiction.
# If D=0 and C=0 he tells the truth so C!=D, contradiction.
if c>=d: continue
for e in range(3):
# A says (about A) "A > E". If A=2 he lies so must have E=2;
# if A=1 he tells the truth so must have E=0;
# if A=0 he lies which is OK.
if a>0 and (a,e) not in ((2,2),(1,0)): continue
# E says (about E) "B!=E".
# If E=2 he lies so B=E=2.
# If E=1 he tells the truth so B!=E.
# If E=0 he lies so B=E=0.
if (b,e) not in ((2,2),(1,0),(1,2),(0,0)): continue
for f in range(3):
# see commented-out code below: we must have g=1 and then f=1 or f=2
if f==0: continue
for g in (1,):
# for g in range(3):
# F says (about G): "G>0".
# If F=2 he tells the truth so G>0.
# If F=1 he lies if G=2, contradiction, but tells the truth if G<2 so G=1.
# If F=0 he lies if G>0, contradiction, but tells the truth if G=0, contradiction.
# if f==0 or (f,g) not in ((2,1),(2,2),(1,1)): continue
# G says (about G): "G>0".
# If G=2 he lies, contradiction.
# If G=1 he tells the truth, OK.
# If G=0 he lies, OK. BUT F's statement means G=0 is impossible; see above.
# if g!=1: continue
for h in range(3):
# H says (about F) that F says (about F) that F=0.
# F could say F=0 if F=2 but not if F=1 (commoners tell the truth
# So effectively H says that F=2.
# If H=2 he tells the truth about F so we need F=2.
# If H=1 and F=2 he lies, so F<2 contradiction.
# If H=1 and F<2 he tells the truth, so F=2, contradiction.
# If H=0 and F>0 he lies so F<2 so in fact F=1.
# If H=0 and F=0 he tells the truth so F=2, contradiction.
if (f,h) not in ((2,2),(1,0)): continue
for i in range(3):
if (a==2)+(b==2)+(c==2)+(d==2)+(e==2)+(f==2)+(g==2)+(h==2)+(i==2)<3: continue
# B says (about I) "I=2". If B=2 he tells the truth so I=2;
# if B=1 and I=2 he lies so I<2, contradiction;
# if B=1 and I<2 he tells truth so I=2, contradiction;
# if B=0 and I>0 he lies so I<2 so I=1;
# if B=0 and I=0 he tells truth so I=2, contradiction.
if (b,i) not in ((2,2),(0,1)): continue
# I says (about H) "H=1".
# If I=2 he tells the truth so H=1.
# If I=1 he tells the truth if H<2 so H=1; lies if H=2 so H=2.
# If I=0 he lies if H>0, requiring H=2; tells truth if H=0, contradiction.
if (h,i) not in ((1,2),(1,1),(2,1),(2,0)): continue
print (a,b,c,d,e,f,g,h,i)
• Hmm, I am awaiting clarification on H's statement - Imagine H is a commoner and F is a noble, then H can can be lying about the statement that was actually made to him by F, "I am a commoner". Edit - I see you made a similar comment... – Jonathan Allan Jul 13 '16 at 13:09
• Oops, spoke too soon - I did get the same set of nobles, but ended up with two possible combinations. For E, you reason that "commoners tell the truth about themselves so also can't do it" - but if B is correct, then E would be telling the truth about himself, right? So E could be either. (Maybe I should just post my own answer?) – user812786 Jul 13 '16 at 16:40
• Your answer opens with "a servant talking about himself will tell the truth" while determining G, but the question says "Servants... will lie about themselves... to make their position sound better". – Billy Mailman Jul 13 '16 at 17:14
• ... Nope. It is a mistake and an embarrassing one, but it doesn't make any difference. If G is a servant then F can't say he's not. (Everyone tells the truth about servants other than themselves.) So in fact G can't be a servant after all. I'll edit my answer to fix this, though. – Gareth McCaughan Jul 13 '16 at 20:14
• @whrrgarbl - confirmed in my late answer, along with another, again with the same $3$. – Jonathan Allan Jul 14 '16 at 5:23

I am going to step in late and say that

Gareth McCaughan's answer is almost right...

Let us label people with their initial, subscripted by two letters:

1. Whether they are lying or being truthful as $_L$ or $_T$; and
2. Their rank noble, commoner, or servant as $_N$, $_C$, or $_S$

So, a servant named Xavier making a true statement would be $X_{TS}$.

We have

Gareth's solution as:
$A_{LS}\space B_{LS}\space C_{TC}\space D_{TN}\space E_{LS}\space F_{TN}\space G_{TC}\space H_{TN}\space I_{LC}$

The desired meaning, now confirmed by crcroberts, of $H$ 's statement implies

as Gareth points out, that $H$ 's statement may as well be "$F$ is a Noble"

Now

testing out that labelling works just fine
...however, are there other possible scenarios?

Note that

we could keep everyone the same except make $E_{TC}$ instead
the only affected statements are those of $A$ and $E$:
$A$: “$A$ is a higher rank than $E$”; and
$E$: “$E$ is not the same rank as $B$”

$A_{LS}$ is still a servant lying about himself ($R(A_{LS})\not\gt R(E_{TC})$), and
$E_{TC}$ is now a commoner telling the truth about himself ($R(E_{TC})\neq R(B_{LS})$)
- fitting the rules given.

That is:
$A_{LS}\space B_{LS}\space C_{TC}\space D_{TN}\space E_{TC}\space F_{TN}\space G_{TC}\space H_{TN}\space I_{LC}$

Furthermore

the only statements referring to $A,C,D,$ and $E$ are those made by $A,C,D,$ and $E$:
$A$: “$A$ is a higher rank than $E$”
$C$: “$A$ is a lower rank than $C$”
$D$: “$C$ is not the same rank as $D$”
$E$: “$E$ is not the same rank as $B$”

and the only logical link to the others is what $E$ says about $B$.

So maybe we can keep everyone outside this subgroup (including $B_{LS}$) the same and keep $E_{LS}$ but make $A_{TC}$?

That satisfies the statements made by $A$ and $E$, but $C$ can no longer be a commoner as commoners tell the truth about other commoners yet their statement would be a lie.

If $C$ were a noble then $D$ cannot be a noble since a noble tells the truth about other nobles but the statement made by $D$ would be a lie about another noble.

But $D$ could not be a commoner or a servant either as they do lie about nobles yet the same statement would now be true.

So $C$ must be a servant. Furthermore, due to the statement made by $C$ we have $C_{LS}$ since no one, including $A_{TC}$, is of a lower rank than a servant.

$D$ could now be a truthful noble or a truthful commoner, but Jack thinks the king is appearing to be fair, so $D_{TN}$ to keep $3$ nobles in the whole group.

That is:
$A_{TC}\space B_{LS}\space C_{LS}\space D_{TN}\space E_{LS}\space F_{TN}\space G_{TC}\space H_{TN}\space I_{LC}$

Note that

The two scenarios here have the same $3$ nobles as Gareth's solution, so would not change Jack's decision.

Lastly

Are there any other scenarios (maybe by relaxing the link at $B$?
I could not think of any that worked, so I wrote some code, below, which confirms that these $3$ are the only ones - if it is bug free and my logic is correct, of course. Unlike Gareth's I have split everything out into logical functions, so one may inspect individual scenarios if one so wishes.

from itertools import product

# People
A, B, C, D, E, F, G, H, I = (i for i in range(9))

# Ranks
NOBLE=2
COMMONER=1
SERVANT=0

# Each of the statements as a tuple of relevant information:
STATEMENTS = ((lambda m, o: m > o           , E    , True ),
(lambda m, o: o == NOBLE      , I    , False),
(lambda m, o: o < m           , A    , False),
(lambda m, o: o != m          , C    , False),
(lambda m, o: m != o          , B    , True ),
(lambda m, o: o != SERVANT    , G    , False),
(lambda m, o: m != SERVANT    , G    , True ),
(lambda m, o: o == NOBLE      , F    , False),
(lambda m, o: o == COMMONER   , H    , False))

'''Returns True if a statement made by a myRank ranked individual would tell the truth in a
statement involving another individual of rank otherRank otherwise returns False
- isAboutSelf should be True if the statements primary subject is the individual making the
statement and False otherwise.'''
if isAboutSelf not in (True, False):
raise ValueError("isAboutSelf must be in (True, False)")
if otherRank not in (NOBLE, COMMONER, SERVANT):
raise ValueError("otherRank must be in (NOBLE, COMMONER, SERVANT) = {0}".format({NOBLE, COMMONER, SERVANT}))
if myRank == NOBLE:
elif myRank == COMMONER:
return isAboutSelf or otherRank != NOBLE
elif myRank == SERVANT:
return not isAboutSelf and otherRank == SERVANT
else:
raise ValueError("myRank must be in (NOBLE, COMMONER, SERVANT) = {0}".format({NOBLE, COMMONER, SERVANT}))

def analyseState(ranks, statements=STATEMENTS):
'''Returns a list of which individuals are telling the truth (True) and which are lying (False)
if the ranks provided is a possible scenario, otherwise returns None.
- ranks should be an enumerable of ranks (NOBLE, COMMONER, SERVANT), of the same length, and in
the same oreder, as statements, representing the rank of each individual.
- statements should be an enumerable of tuples of:
describing the statements being made by each individual
where:
- statementTruthFunction returns the truth of the statement, given the ranks
- other is the index of the other individual in the statement (in both ranks and statements)
- isAboutSelf is True if the primary subject of the statement is the indivdual making it.'''
nNobles = sum(1 for myRank in ranks if myRank == NOBLE)
if nNobles < 3:
return
areTellingTruth = []
if tt != st:
return
areTellingTruth.append(tt)
return areTellingTruth

def testAllPossibleStates(verbose=True, truthText='LT', classText='SCN', format='{0}{1}'):
results = []
for ranks in product((SERVANT, COMMONER, NOBLE), repeat=9):
areTellingTruth = analyseState(ranks, STATEMENTS)
if areTellingTruth:
results.append((ranks, areTellingTruth))
if verbose:
for ranks, anlysis in results:
print(' '.join(format.format(truthText[t], classText[c]) for c, t in zip(ranks, anlysis)))
else:
return results

Running in it's default form yields the result (left to right alphabetical):

>>> testAllPossibleStates()
LS LS TC TN LS TN TC TN LC
LS LS TC TN TC TN TC TN LC
TC LS LS TN LS TN TC TN LC
>>>

• Impressive! I was getting very worried there might be multiple solutions I hadn't discovered, but I'm pleased to see an in depth analysis returning only variations on my intended answer! That said, you mentioned 15 solutions on a comment under Trenins answer; can you explain what you meant there? Trying to understand my unforseen cases... – crcroberts Jul 14 '16 at 7:07
• With regard to the $15$, that is the number of solutions if we completely disregard $H$ 's statement and say what rank $H$ is, but not whether or not he is lying (so $30$ really!). I found them with a slight modification to my code to ignore the check in analyseState when madeByIndex == H. EDIT: Also note that there are no individuals who are consistently nobles in those cases. – Jonathan Allan Jul 14 '16 at 7:17
• Great addendum!!! Since Gareths answer only finds one solution, without proving there can't be other solutions, which might pose problems. - With this solutions it is clear that Jack can choose those three nobles without being exactly sure about the others :-) – Falco Jul 14 '16 at 14:32

I ended up with the same list of nobles as Gareth McCaughan's answer, but a different solution.

The nobles are:

David, Frederick, Harold

The full rankings are:

Servants: A, B; Commoners: C, E, G, I; Nobles: D, F, H
or
Servants: B, C, E; Commoners: A, G, I; Nobles: D, F, H

Reasoning:

1. G's Statement

if G is n, then would lie about self -> !n
if G is c, then would tell truth -> valid
if G is s, then would lie about self -> maybe, except
F wouldn't (if F is n, truth about s,
if F is c truth about s,
if F is s, truth about s)
> G is a commoner
> F is not a servant

2. B's Statement

if I is n: B would be telling truth, n (!c, !s)
if I is c: B lie, (!n, !c,) s
if I is s: B lie, (!n, !c, !s)
> I is not a servant > B is not a commoner

3. H's Statement This is the tricky one. When I interpreted the statement as

H: "F is a servant"

I only got two nobles, and couldn't solve it. If, as per Gareth McCaughan's answer, I interpret like:

H: "F: I am a servant"

We end up with...

if F is n: H true, H is n
if F is c: H lie, H is s
if F is s: H lie, invalid
> Either F and H are both nobles, or F is a commoner and H is a servant

1. I's Statement

if H is n: I lie, c or s
if H is s: I lie, invalid
> H is a noble
> F is a noble (by 3)
> I is a commoner (by 2)
> B is a servant (by 2)

2. E's Statement

if E is n: E truth, invalid
if E is c: E truth, valid
if E is s: E lie, valid
> E is not a noble

3. A's Statement

if A is n: truth, invalid
if A is c and E is c: lie, invalid
if A is c and E is s: truth, valid
if A is s and E is c: lie, valid
if A is s and E is s: truth, invalid
> A is not a noble
> Either A is commoner and E is servant, or A is servant and E is commoner

4. C's Statement

By 6, we know A is not a noble. That leaves:
if C is n and A is c: truth, valid
if C is n and A is s: truth, valid
if C is c and A is c: lie, invalid
if C is c and A is s: truth, valid
if C is s and A is c: lie, valid
if C is s and A is s: lie, invalid
>(C=n, A=c), (C=n, A=s), (C=c, A=s), (C=s, A=c)

5. D's Statement

if C is n and D is n: lie, invalid
if C is n and D is c: truth, invalid
if C is n and D is s: truth, invalid
if C is c and D is n: truth, valid
if C is c and D is c: lie, invalid
if C is c and D is s: truth, invalid
if C is s and D is n: truth, valid
if C is s and D is c: truth, valid
if C is s and D is s: lie, invalid
> (C=c, D=n), (C=s, D=n), (C=s, D=c)
> C is not a noble
> D is not a servant
> From 7, this leaves: C is commoner, A is servant or C is servant, A is commoner

At this point, we know:

B is servant, F is noble, G is commoner, H is noble, I is commoner

There are at least three nobles, and

By 5, E is not a noble. By 6, A is not a noble. By 8, C is not a noble.
So D must be our final noble, consistent with 8.

But

There are two possible ways for D to be a noble:
C is a commoner, or C is a servant.

If

C is a commoner, then A must be a servant (by 7), then E must be a commoner (by 6)
C is a servant, A must be a commoner (by 7), then E must be a servant (by 6)

However

Either way, our nobles must be D, F, and H.

I believe he should pick:

Bernard, Frederick and Ivan

Looking first at:

• Bernard: “Ivan is a noble”

If Bernard was a commoner, and Ivan was a noble, then:

(because commoners lie about nobles,) Bernard would not say that Ivan a noble.

If Bernard was a commoner, and Ivan was not a noble, then:

(because commoners not not lie about non-nobles,) Bernard would not say that Ivan a noble.

Therefore, since Bernard did say that Ivan was a noble, then

Bernard is not a commoner

If Bernard was a servant, then:

(because servants lie to make themselves sound better,) Bernard would not call Ivan (or anyone) a noble.

Therefore:

Bernard is not a servant.

Therefore:

BERNARD IS A NOBLE

If Ivan was not a noble, then:

(because nobles do not lie about other people,) Bernard would not call Ivan a noble.

If Ivan was a noble, then:

(because nobles do not lie about other people,) Bernard would call Ivan a noble.

So:

IVAN IS A NOBLE

From:

• Ivan: “Harold is a commoner”

Then:

Because Ivan is a noble and does not lie about other people, HAROLD IS A COMMONER.

From:

• Harold: “Frederick told me he is a servant”

Then:

Because Harold is a commoner, he would say that a noble or a servant is a servant but would not lie about a commoner. Therefore Frederick is not a commoner. So Frederick is a noble or a servant.

From:

• Frederick: “George is not a servant”

So:

If Frederick is a noble, George is not a servant (because nobles do not lie about other people).

and

If Frederick is a servant, he woudln't say that someone is not a servant. (Servants woudl happily call anyone a servant to make themselves look better!)

So:

FREDERICK IS A NOBLE

So now, we've already found three nobles, so do we really need to continue...?

• Like Furkan Kor, you've taken the stated rules to indicate e.g. that servants will only lie about other people to reduce their status. I don't think that's what the questioner intended, but a puzzle with that sort of constraint in it might be very interesting. – Gareth McCaughan Jul 13 '16 at 17:04
• The OP stated the servants' motive and that the deductions written out were not consistent, but subjective. I take that to mean that it is more likely that the deductions have exceptions than the motives. – Ali Jul 13 '16 at 17:13
• You could certainly be right. Perhaps at some point crcroberts will tell us... – Gareth McCaughan Jul 13 '16 at 18:38
• my intent in pointing out that statements were subjective was primarily to illustrate that "I am better than X" and "X is worse than me", despite being equivalent in english, will have different truth values according to the rules. The rules about who lies when are always in effect, even when making a statement to another presented person (as in the case of Harold), and even when, realistically speaking its unnecesary or even disadvantageous to the speakers "motivation" - the motivations are primarily to justify a convoluted truth table. – crcroberts Jul 14 '16 at 0:45
• Aww, back to the drawing board. Thanks for clearing that up. – Ali Jul 14 '16 at 8:53

Assumption: All nobles are of the same rank. One noble cannot be ranked higher than another noble.

# Solution

Look at $B$s statement about $I$. If false, then $I$ is not a noble and $B$ has a reason to lie. Commoners only lie about nobles, nobles only lie about themselves, and servants only lie about nobles and themselves. Since $B$ is talking about $I$ (i.e. not himself) and $I$ is not a noble, $B$ has no reason to lie and must be telling the truth. This leads to a contradiction since we assumed $B$ was lying. Thus, $B$ is telling the truth and $I$ is a noble.

As a consequence, we know that $B$ cannot be a commoner or a servant since he would have lied. Thus, $B$ is also a noble.

$E$ says that he is not the same rank as $B$. If $E$ was a servant, this would be a truth, yet $E$ should have lied according to the rules, so $E$ cannot be a servant. The statement is about both $B$ and $E$, so if $E$ is a commoner, then he should lie about nobles, which he did not do, so $E$ is not a commoner. Thus, $E$ is also a noble.

Since we were only required to find three nobles, we are done! The brothers pick these three to swap with and live on as nobles in the castle!

# Caveat

There is a comment that statements of the form "X ... Y" are about X, not Y. Thus, our last deduction is not necessarily correct. $E$'s statement is only about $E$, and thus, $E$ could be a commoner (they don't lie about themselves) or a noble (they do lie about themselves).

$A$ says he is higher rank than $E$. If $A$ spoke true, then $E$ must be a commoner since we already eliminated $E$ as a servant and $E$ as a noble would be a contradiction. But then $A$ should have lied about himself since he was either a servant or a noble talking about himself, both of which lie about themselves. So we know that $A$'s statement is false.

If $A$ is a commoner, then he'd have no reason to lie about himself so he should have told the truth, so $A$ is not a commoner. If $A$ is a servant, then he would lie about himself, and his statement would only be a lie if $E$ was a noble or a servant (but we already know $E$ is not a servant). If $A$ was a noble, then again he would lie about himself. The statement is only a lie if $E$ is also a noble. Thus, $A$ can be either a noble or a servant, but either way $E$ must be a noble.

Thus, even with this rule change, Bernard, Ivan, and Edward are the nobles who the brothers should swap with.

• I concur. Only one (I believe, inconsequential) thing: you say in the first paragraph of the solution that, "servants only lie about nobles and themselves" but they lie about themselves and anyone of higher rank than themselves (which includes commoners). – Jonathan Allan Jul 13 '16 at 17:26
• Ah... I thought servants were higher than commoners. Let me rethink that. – Trenin Jul 13 '16 at 17:49
• Yeah, there are possible scenarios where it does not work. If, for example, A and E are servants then A's statement (about himself) will be a lie, and a servant is not a higher rank than another servant. An example where, if we ignore H's statement completely would be (L=Lying, T=Truthful, ?=unknown, classes:N,C,S): aLS, bLS, cTC, dTN, eLS, fTN, gTC, h?N, iLC. – Jonathan Allan Jul 13 '16 at 18:31
• Funny that I picked @GarethMcCaughan solution out of, what I now know, are the $15$ that are possible if we ignore H's statement completely! – Jonathan Allan Jul 14 '16 at 5:36

Here is my reasoning:

From the first statements:

• Andrew: “I am a higher rank than Edward

Andrew=servant -> Edward=any
Andrew=commoner -> Edward=servant
Andrew=nobility -> Edward=nobility

• Bernard: “Ivan is a noble”

Bernard=servant -> Ivan=commoner
Bernard=commoner -> impossible
Bernard=nobility -> Ivan=nobility

• Charlie: “Andrew is a lower rank than me”

Charlie=servant -> Andrew = commoner/nobility
Charlie=commoner -> Andrew = servant/nobility
Charlie=nobility -> Andrew =servant/commoner

• David: “Charlie is not the same rank as me”

David=servant -> impossible
David=commoner -> Charlie = servant
David=nobility -> Charlie =servant/commoner

• Edward: “I am not the same rank as Bernard”

Edward=servant -> Bernard=servant
Edward=commoner -> Bernard =servant/nobility
Edward=nobility -> Bernard =nobility

• Frederick: “George is not a servant”

Frederick=servant -> impossible
Frederick=commoner -> George = commoner
Frederick=nobility -> George = commoner/nobility

• George: “That's right, I'm not a servant”

George = servant ok
George = commoner ok
George = nobility impossible

• Harold: “Frederick told me he is a servant”

1)Frederick: "I am a servant"
Frederick=servant impossible
Frederick=commoner impossible
Frederick=nobilty ok
2)"he told me that"
Harold=servant & Frederick=servant -> impossible
Harold=servant & Frederick=commoner -> ok (lie on the fact that he said it)
Harold=servant & Frederick=nobilty -> (even if Frederick could have said it, he may have not said anything to Harold)
Harold=commoner & Frederick=servant -> impossible
Harold=commoner & Frederick=commoner -> impossible
Harold=commoner & Frederick=nobilty -> ok (even if Frederick could have said it, he may have not said anything to Harold)
Harold=nobilty & Frederick=servant -> impossible
Harold=nobilty & Frederick=commoner ->impossible
Harold=nobilty & Frederick=nobilty -> ok

• Ivan: “Harold is a commoner”

Ivan=servant->impossible
Ivan=commoner-> harold=commoner/nobility
Ivan=nobilty -> harold =commoner

We use each statement:

• Andrew:

Andrew=servant -> Edward=any
Andrew=commoner -> Edward=servant
Andrew=nobility -> Edward=nobility

• Bernard

Bernard=servant -> Ivan=commoner
Bernard=nobility -> Ivan=nobility

• Charlie

Charlie=servant -> Andrew = commoner/nobility
Charlie=commoner -> Andrew = servant/nobility

• David

David=commoner -> Charlie = servant
David=nobility -> Charlie =servant/commoner

• Edward

Edward=servant -> Bernard=servant
Edward=nobility -> Bernard =nobility

• Frederick

Frederick=nobility

• George

George = commoner

• Harold

Harold=commoner
Harold=nobility

• Ivan

Ivan=commoner-> Harold=commoner/nobility
Ivan=nobility -> Harold =commoner

Now we make a guess: Bernard is/isn't a noble
1) He is

with the information that we have at least 3 nobles we get:
(N = noble , C = commoner , S = servant)
Andrew S/C
Bernard S
Charlie S/C
David N
Edward S
Frederick N
George C
Harold N
Ivan C

2)He isn't

Andrew S/N
Bernard N
Charlie C
David N
Edward N
Frederick N
George C
Harold C
Ivan N

And we got:

We got 2 nobles in common: David and Frederick, but the puzzle states we can find the 3 nobles so I must be wrong somewhere

• I think the mistake is in the statement: Harold: “Frederick told me he is a servant”. I made some assumptions for this one and I don't know if they're true. – Sechiro Jul 13 '16 at 9:37
• Without reading the spoiler-text, I'm curious how you arrived to the conclusion that we needed to guess about Bernard's nobility? – Iszi Jul 13 '16 at 19:11
• Your solution 1 is basically correct (some ambiguity about two members, but only between non-noble states so technically not relevent to the solution). That said, you seem to have the "guess if bernard is/isn't" solution states reversed? don't know if that was an edit? Regardless you shouldn't have to guess: you seem to have correctly identified he can't be a commoner; We can establish Ivan isn't a noble through the statements of F,G,I&H; thus B is lying about a commoner, thus he is a servant – crcroberts Jul 14 '16 at 0:04

Jack should name

Bernard,Ivan and Frederick

There are multiple consistent arrangements.

They are: Using the notation A0-Andrew servant, A1-Andrew commoner, A2-Andrew Nobility

D1C0A2E2B2I2H1F2G1
D2C1A2E2B2I2H1F2G1
D2C1A0E2B2I2H1F2G1
D2C1A0E1B2I2H1F2G1

In addtion the following arrangements are consistent with the answers, but not with the requirement that there be 3 nobles.
D1C0A1E0B0I1H1F2G1
D2C0A1E0B0I1H1F2G1
D2C1A0E0B0I1H1F2G1
D2C1A0E1B0I1H1F2G1

However The three named persons are nobles in any valid arrangement.

Going through the first valid sequence, D1C0A2E2B2I2H1F2G1, for consistency:
S3:Lie servant about other non servant

• This answers interprets “Frederick told me he is a servant” as “Frederick is a servant”. I think it's also valid if it can be assumed that the castle dvellers always speaks the thruth to each other. – Taemyr Jul 13 '16 at 14:15

I'm writing up the details but for now I think I have an answer:

He should pick Bernard, David and Ivan

I just scrapped the numbers. I think it made it more confusing.

1 - Let's start with Bernard's statement: if Bernard is noble, the statement is true. If he's a commoner, he can't lie about commoners/servants being noble and also wouldn't confirm a noble being noble. If he's a servant, he wouldn't call anyone other than himself noble as it reduces his chances. This confirms both Ivan and Bernard to be nobles.

2 - Since Ivan is noble his statement is also true: Harold is a commoner.

3 - Harold's statement could mean 2 things: He's telling the truth and Frederick is a servant or he's lying and Frederick is noble(Frederick=Servant/Noble)

4 - Frederick's statement could be stated like "George is a commoner/noble". If he's a servant, he wouldn't call anyone noble, he could however be calling a nobility common. If he's noble, both could be true.(George=Commoner/Noble)

5 - George's Statement: He's saying he's not a servant. If he's noble, he could be saying he's a commoner. If he's a commoner, he could confirm to be one. Anyway, his commoner/noble state doesn't change.

6 - Edward's statement is the same as saying "I am not noble". A servant wouldn't do this. A commoner could say this as it is the truth. A nobility could also say it as they lie about themselves. (Edward=Commoner/Noble)

7 - Andrew's statement can be changed to "I am a higher rank than commoner/noble". A commoner couldn't say this as it isn't true. A nobility wouldn't say this as it confirms him to be noble. This only leaves servant as possibility. (Andrew=Servant)Now for the second part. Since they cannot lie about the 2nd part of the statements or change the facts, it must be actually possible to be a higher rank than Edward. This means Edward is a commoner.

8 - Charlie's statement is about Andrew and not himself. No one lies about servants and since the statement is not about the person himself the whole statement is true. This means Charlie is either a commoner or noble. (Charlie=Commoner/Noble)

9 - Finally we come to David's statement: “Charlie is not the same rank as me”. Again, the statement is about another person meaning David doesn't/can't lie about his own rank. Here I checked all possibilities one by one.
List Form:

(Servant)         Andrew: “I am a higher rank than Edward”

(Noble)           Bernard: “Ivan is a noble”
(Commoner/Noble) Charlie: “Andrew is a lower rank than me”
(Noble if Charlie=Commoner, Servant/Commoner if Charlie=Noble) David: “Charlie is not the same rank as me”
(Commoner) Edward: “I am not the same rank as Bernard” = "I am not noble"
(Servant/Noble) Frederick: “George is not a servant” = "George is a commoner/noble"
(Commoner/Noble) George: “That's right, I'm not a servant” "I am a commoner/noble"
(Commoner) Harold: “Frederick told me he is a servant”
(Noble) Ivan: “Harold is a commoner”

Looking at it multiple times over again, I kinda doubt my first answer was legit. I'm pretty sure about the ones I did find are correct. Just can't figure out how to get the 3rd noble.

• Please add your explanation in as soon as possible. Welcome to the site! – user58 Jul 13 '16 at 8:45
• Welcome to Puzzling! I helped out a little with the formatting, I hope it's OK. – Jonathan Allan Jul 13 '16 at 10:32
• @JonathanAllan It looks much better, thank you. – Shotstic Jul 13 '16 at 10:37
• In your very first step, you say "If he's a servant, he wouldn't call anyone other than himself noble as it reduces his chances." but what we're actually told is that servants always lie about (1) themselves and (2) other people who aren't servants. BUT your way of looking at it makes good sense "psychologically" -- if we take seriously the explanations in the statement of the puzzle, then maybe servants should only ever be adjusting other people's status downward. – Gareth McCaughan Jul 13 '16 at 17:00
• I'm pretty sure the questioner's intent was just that servants always lie about themselves and non-servants -- that this is a liars-and-truthtellers puzzle with some backstory to kinda-justify the pattern of lying. (@crcroberts, if you're reading, it would be good to know for sure!) But it might be really interesting to have some puzzles with constraints not only on whether people are lying but also how... – Gareth McCaughan Jul 13 '16 at 17:02

I've got the answer .....but before that remember one thing - it is clearly stated in the question that among the nine people there are at least three Nobles among the people (it doesn't mean there are only three,it could be greater than three as well).

1. Andrew - Noble
2. Bernard - Servant
3. Charlie - Commoner
4. David - Noble
5. Edward - Noble
6. Frederick - Noble
7. George - Commoner
8. Harold - Commoner
9. Ivan - Commoner

Well, accordingly the answer could be any three of

Andrew, David, Edward and Frederick.

I will try to write a short explanation for this later, because explaining this would take ages....

If you are not satisfied with my answer you could crosscheck it.

• Please hurry up with that explanation - it's site policy to include one. Welcome to Puzzling.SE! – user58 Jul 13 '16 at 10:50

-->According to me,Its Bernard,David, Fredrick and Ivan.

-->Andrew is a servant trying to make his position sound better.

-->Bernard is a noble telling truth about another noble,since a noble can state truth about anyone in the castle except themselves ,commoners can only state that a noble is a lower rank than them ,can't lie about others and slaves would only try to make their position sound better

-->Charlie is a commoner speaking truth about Andrew

-->David is a noble speaking truth about Charlie

-->Edward is a commoner speaking truth about himself

-->Fredrick is a noble speaking truth about George

-->George is a commoner speaking truth about himself

-->Harold is a commoner telling lies about Fredrick since he can lie about nobles