Knights, normals and spies
Merlin's Book of Logic Puzzles p65#1
Knights tell the truth, spies lie, and normals do both.
Merlin interviews three people: A,B,C: one spy, one knight
and one normal but doesn't know who is which.
 A says C is not a spy.
 B says A is not a knight
 B says B is a knight.
Who is the spy, knight and normal in A, B, and C.
 K(x)::= x is a knight,
 S(x)::= x is a spy,
 N(x)::= x is normal.
 says(x,P)::=x says P.
Axioms
Knights tell the truth, spies lie, and normals do both:
 says(x,P)= (K(x) and P) or (S(x) and not P ) or N(x).
The above is not true of the real world, but fits the
world of the puzzle well.
Three people a,b,c, with one K , one S and one N .
Some observations
 if x=y then (N(x) and N(y)) = N(y) else (N(x) and N(y)) = false.
 if x=y then (S(x) and S(y)) = S(y) else (S(x) and S(y)) = false.
 if x=y then (K(x) and K(y)) = K(y) else (K(x) and K(y)) = false.
 if x<>z then (N(x) and not N(z)) = N(x).
 if x<>z then (S(x) and not S(z)) = S(x).
 if x<>z then (K(x) and not K(z)) = K(x).
The Three Statements
Net
 says(a, not S(c)).
 says(b, not K(a)).
 says(c, K(b)).
(End of Net)


Leave out "(", ")"

Use nothing for "and".
 PQ
 P and Q.

Use prefix "" for "not".
 P
 not P.

Use infix "" as "and not"
 PQ
 P*(Q).

Use "+" for "or".
 P+Q
 P or Q.

For example
 Kx = K(x) = x is a knight.
 says(x,P) = KxP + SxP + Nx.
 says(a, not Sc) = KaSc + SaSc + Na.
 SaSc = Sa.
Consider
(A): KaSc + SaSc + Na
 = KaSc + 0 + Na
 = KaSc + Na.
(B): KbKa + SbKa + Nb
 =Kb + SbKa +Nb.
(C): KcKb + ScKb + Nc
 = ScKb + Nc.
 (A, C)  (AC):
 (KaSc + Na) (ScKb + Nc)
 = KaScScKb + NaScKb + KaScNc + NaNc
 = 0 + NaScKb + 0 + NaNc
 = NaKbSc + KaNc.
 (AC, B) 
 (NaKbSc + KaNc) (Kb + SbKa + Nb)
 = NaKbSc(Kb + SbKa + Nb) + KaNc (Kb + SbKa + Nb)
 = NaNbSc + KaSbNc
 = 0 + KaSbNc
 = KaSbNc.
(Close Consider )
So
 A is a knight, B is a Spy, and C is Normal.
[ kns1.plg ]