Saturday, October 19, 2013

Blow-ups Happen super-spoiler


In the 1960's Robert A. Heinlein published a book called "The Man Who Sold the Moon". One story in the book helped select my career path. It was called "Blow-ups happen". In one scene a consultant "Lentz" hands a problem to the director of the breeder reactor: 

"Lentz had assigned symbols to a great number of factors, some social, some psychological, some physical, some economic. He had thrown them together into a structural relationship using the symbols of calculus of statement." 

The director is told to "solve it" and uses a pencil and paper to solve the problem. Could there be a "calculus of statement"? 

The first thing is that we don't have the formalized knowledge of psychology and economics that is current in Heinlein's story. But I have observed that some thing very like the process mentioned in the story occurs when Boolean Algebra is used to solve puzzles.  For example consider "The Lunch Problem" described by  Galen Harris Valle in his paper "Teaching English in Asia" (p85 of "Speaking" by Roger Gower, OUP).

Problem

(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.

  Who orders the SAME drink after lunch?  Which drink?, and how do you know?

Solution using Boolean Algebra


Additive notation for Boolean Algebra

        P+Q for "either P or Q ".
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).

Symbols

a::=Anne orders coffee.
b::=Betty orders coffee.
c::=Cindy orders coffee.
~a::=Anne orders tea.
~b::=Betty orders tee.
~c::=Cindy orders tea.

Axioms

(2): if  a then  b =  c.
~a  +  b c +  ~b ~c.
(3): if  b then  ~a =  c.
~b +  a ~c + ~a  c.
(4:) if ~c then  a =  b.
c +  a b + ~a  ~b.

So the expression of the problem is the conjunction of the three axioms:
 (~a  +  b c +  ~b ~c)( ~b +  a ~c + ~a  c)( c +  a b + ~a  ~b),

Solution

Multiply the first two factors out (distributive laws)
(~a ( ~b +  a ~c + ~a  c) + ( ~b +  a ~c + ~a  c) b c + ( ~b +  a ~c + ~a  c) ~b ~c)( c +  a b + ~a  ~b),
(~a  ~b + ~a  a ~c + ~a ~a  c +  ~b b c +  a ~c b c + ~a  c b c +  ~b ~b ~c +  a ~c ~b ~c + ~a  c ~b ~c)( c +  a b + ~a  ~b),

Simplify using ~P P = 0 and P P = P.
(~a  ~b + ~a  c  + ~a  b c +  ~b ~c +  a ~b ~c)( c +  a b + ~a  ~b),

Multiply out the two factors  (distributive laws)
(~a  ~b + ~a  c  + ~a  b c +  ~b ~c +  a ~b ~c) c + (~a  ~b + ~a  c  + ~a  b c +  ~b ~c +  a ~b ~c) a b + (~a  ~b + ~a  c  + ~a  b c +  ~b ~c +  a ~b ~c)~a  ~b

Simplify using ~P P = 0 and P P = P.
~a  ~b c + ~a  c  + ~a  b c + ~a  ~b + ~a  ~b c + ~a  ~b ~c,

Extract the common factor ~a ( Anne orders tea).
~a ( ~b c +  c  +  b c +  ~b +  ~b c +  ~b ~c),

Simplify using PQ+P =P (Absorbative law)
~a ( ~b c +  c  +  b c +  ~b),

And again
~a ( c +  ~b).

Conclusion

Anne always orders tea and either Cindy orders coffee or Betty orders tea.

You can verify this result by using Prolog, and/or tables,  or even Karnaugh maps.


Sunday, October 6, 2013

Autumn wind

Like leaves in the wind,
My thoughts are free of the tree. 
I must clean the pool.