The Lunch Problem
Source
Galen Harris Valle, Teaching English in Asia, p85
Roger Gower, Speaking, OUP
The Problem
(Statement):
(01): Anne, Betty and Cindy order either a cup of coffee or a cup of tea each after lunch.
(02): If Anne has coffee then Betty orders the drink that Cindy orders.
(03): If Betty orders coffee then Anne orders the drink that Cindy does not order.
(04): If Cindy orders tea then Anne orders the drink that Betty orders.
(Question): Who orders the SAME drink after lunch? Which drink?, and How do you know?
Solution using the Propositional Calculus
Symbols
- A::=Anne orders coffee,
- B::=Betty orders coffee,
- C::=Cindy orders coffee.
- P<->Q::= (P/\Q)\/(~P/\~Q), P if and only if Q.
- (it_can_be_shown) |- (P<->Q) = (P->Q)/\(Q->P) = (P->Q)/\(~P->~Q).
Givens
- (01) |- ~A = Anne orders tea, ~B=Betty orders tea, ~C=Cindy orders tea.
- (02) |- (P1): A -> ( B<-> C ).
- (03) |- (P2): B -> ~(A<->C).
- (04) |- (P3): ~C -> (A<->B).
Goal
Verify that Anne orders tea.
- (P1, P2, P3) |- (goal): ~A.
Proof of goal
Strategy is to use RAA, Reducto Ad Absurdum.
Let- (P4): ~~A.
- (P4, notnote) |- (P5): A.
- (P5, P1, ife) |- (P6): B<->C.
- (above) |- (P11): ~B.
Proof P11
Let- (P7): B
- (P7, P6, <->) |- (P8): C.
- (P7, P2, ife) |- (P9): ~(A<->C).
- (P5, P9, <->) |- (P10): ~C.
- (P8, P10) |- RAA
(Close Let P7)
- (P6, P11, <->) |- (P12): ~C.
- (P12, P3, ife) |- (P13): A<->B.
- (P13, P11, <->) |- (P14): ~A.
- (P5, P14) |- RAA
(Close Let P4)
. . . . . . . . . ( end of section Solution using the Propositional Calculus) <<Contents | Index>>
Solution using Boolean Algebra
Symbols
- a::=Anne
- b::=Betty
- c::=Cindy
- Cx::=x orders Coffee
- Tx::=x orders tea
Givens
- (01, translation2LPC) |- (1): for all x, Cx <> Tx.
- (02, translation2LPC) |- (2): if Ca then Cb = Cc.
- (03, translation2LPC) |- (3): if Cb then Ca <> Cc.
- (04, translation2LPC) |- (4): if Tc then Ca = Cb.
Boolean Form
Transform
-
Use Boolean with additive notation: + for "either _ or _ " etc.
- PQ means P and Q
- -P means not P
- 0 means false and 1 means true.
- if P then Q becomes -P + Q.
- P = Q becomes PQ + (-P) (-Q).
- For all x, -Cx = Tx.
- CxTx = 0 and Cx+Tx = 1.
- (2) |- (2a): Ta + CbCc + TbTc.
- (3) |- (3a): Tb + CaTc + TaCc.
- (4) |- (4a): Cc + CaCb + TaTb.
Reduction
- (2a, 3a) |- (5): (Ta + CbCc + TbTc)(Tb + CaTc + TaCc)(Cc + CaCb + TaTb),
- iff
- (Ta(Tb + CaTc + TaCc) + (Tb + CaTc + TaCc)CbCc + (Tb + CaTc + TaCc)TbTc)(Cc + CaCb + TaTb),
- iff
- (TaTb + TaCaTc + TaTaCc + TbCbCc + CaTcCbCc + TaCcCbCc + TbTbTc + CaTcTbTc + TaCcTbTc)(Cc + CaCb + TaTb),
- iff
- (TaTb + TaCc + TaCbCc + TbTc + CaTbTc)(Cc + CaCb + TaTb),
- iff
- (TaTb + TaCc + TaCbCc + TbTc + CaTbTc)Cc + (TaTb + TaCc + TaCbCc + TbTc + CaTbTc)CaCb + (TaTb + TaCc + TaCbCc + TbTc + CaTbTc)TaTb
- iff
- TaTbCc + TaCc + TaCbCc + TaTb + TaTbCc + TaTbTc,
- iff
- Ta(TbCc + Cc + CbCc + Tb + TbCc + TbTc),
- iff
- Ta(TbCc + Cc + CbCc + Tb),
- iff
- Ta(Cc + Tb).
Conclusion
Anne always orders tea and either Cindy orders coffee or Betty orders tea.
. . . . . . . . . ( end of section Solution using Boolean Algebra) <<Contents | Index>>
Confirmation
There is a Prolog program
[ lunch.plg ]
that tries all possible combinations of tea and coffee
and lists those that are compatible with the given
facts.
Glossary
- translation2LPC::=standard intuitive translation to the lower predicate calculus with equality.
. . . . . . . . . ( end of section The Lunch Problem) <<Contents | Index>>