# Telling the truth

Atal said Sonia did it.
Sonia said Kumar did it.
kumar said George did it.

George said that he didn't do it
and Laloo confessed that he did it if Atal didn't do it.

One of the five of them did it and only one of them is telling the truth, who did it ?

The answer is simple, once you realise that one of the statements is true in all bar one possible case.

George did it, and Kumar is telling the truth.

Here's how you can spot it quickly:

George's own statement is true if George didn't do it. Therefore, if George didn't do it, all of the others are lying.

From this, we know that, if George didn't do it, then Sonia didn't do it (Atal is lying), Kumar didn't do it (Sonia is lying), and neither Atal nor Laloo did it (Laloo is lying - as the statement is conditional, it is only a lie if the antecedent (Atal didn't do it) is true and the consequent (Laloo did it) is false)

Therefore, if George is telling the truth, nobody did it. By process of elimination, we therefore conclude that George did it.

Note that this is consistent, as Atal is lying (Sonia didn't do it), Sonia is lying (Kumar didn't do it), and Laloo is lying (neither Atal nor Laloo did it), and of course George is lying while Kumar is telling the truth.

• Does rely on Laloo using material implication rather than counterfactual implication. Laloo's lying means different things depending on whether she knows what Atal did... – Peter Jul 10 '16 at 17:42
• @Peter - It doesn't actually matter which implication, because in this situation, there are three possibilities with regards to Laloo's statement: Atal did it, Laloo did it, or neither Atal nor Laloo did it. For the statement to be true, then either Atal did it, or Laloo did it, irrespective of the type of implication. This is because it specifies the case - "I would have done it if X didn't do it", rather than "I would have done it if nobody else did it". If someone other than Atal or Laloo did it, the statement is a lie. – Glen O Jul 10 '16 at 17:54
• I guess it hinges on the definition of lie. If "Laloo lied" means "we can show from the facts that he told an untruth", then you're right, that's only the case if neither Atal nor Laloo did it. But him lying may also mean that he lied about doing it if Atal hadn't done it, but that never came to pass, so his lie wasn't exposed. – Peter Jul 10 '16 at 18:16
• Although, reading the puzzle again, it's quite difficult to read it that way. – Peter Jul 10 '16 at 18:17

It can be done using a computer program (following is the code in Racket programming language):

; function to test if only one of the 5 statements is true:
(define (oneof v w x y z)
(or (and v (not w) (not x) (not y)  (not z))
(and w (not v) (not x) (not y)  (not z))
(and x (not v) (not w) (not y)  (not z))
(and y (not v) (not w) (not x)  (not z))
(and z (not v) (not w) (not x)  (not y))  ))
; above form can be shorter but it will become less clearer;

; test all 5 possibilities:
(for ((i 5))
(define templist (build-list 5 (lambda (j) (= i j)))) ; create a list with one as true and others false;
(printf "Testing combination: ~a~n" templist)
(match-let (((list a s k g l) templist))              ; assign values

(when  (oneof  s  k  g  (not g) (when (not a) l) )    ; only one of these statements is true;
(println "Combination found: ")
(println (list "a" "s" "k" "g" "l") )               ; print allocation when match found;
(println templist)  )))


The output indicates George did it:

Testing combination: (#t #f #f #f #f)
Testing combination: (#f #t #f #f #f)
Testing combination: (#f #f #t #f #f)
Testing combination: (#f #f #f #t #f)
"Combination found: "
'("a" "s" "k" "g" "l")
'(#f #f #f #t #f)
Testing combination: (#f #f #f #f #t)


This is similar to https://stackoverflow.com/questions/38816383/solving-a-puzzle-in-racket solution of Who committed the crime?.