CS 641 meeting -*- Outline -*- * boolean operators (Cohen, Ch. 2) In the following, we write ``==>'' for implication, ``<=='' for consequence, ``equiv'' for equivalence, ``diffs'' for discrepancy, and ``~'' for negation. Note: all the theorems are here from Cohen's book, but it's not useful to just list them. Refer the students to the book or this file, and just work a few of their proofs. When doing proofs, be sure to point out heuristics (like starting from the more complex side) and discuss why each step was chosen. HOW (to do proofs) IS THE POINT ** why manipulation of predicates needed to develop programs (e.g., for rule of consequence...) Presentation designed for symbolic manipulation by humans, esp. in calculations equational: focuses on equivalence presents some difficulties with intuition at first, but is much more powerful than truth tables also the style we'll study is used by Hesselink ** equivalence (2.1) equiv is just boolean equality, but helpful to give it a different symbol because this other symbol (equiv) has lower precedence, and is associative (unlike = in general, as 3 = 4 = 5 is nonsense). ------------------ POSTULATES FOR EQUIVALENCE equiv is associative: ((P equiv Q) equiv R) equiv (P equiv (Q equiv R)) equiv is symmetric: (P equiv Q) equiv (Q equiv P) equiv has unit true: (P equiv true) equiv P ------------------ hence it's reflexive ** disjunction (2.2) \/ binds tighter than equiv. ------------------- POSTULATES FOR DISJUNCTION disjunction is associative and symmetric disjuction is idempotent: P \/ P equiv P it distributes over equivalence: P \/ (Q equiv R) equiv P \/ Q equiv P \/ R -------------------- Thm: the disjunction distributes over itself. Thm: disjunction has zero true. Proof: X \/ true equiv < P equiv P equiv true, with P := Y > X \/ (Y equiv Y) equiv < \/ distriubtes over equiv > X \/ Y equiv X \/ Y equiv < P equiv P > true ** conjunction (2.3) /\ binds same as disjunction (may seem unusual) this treatment doesn't use negation to define conjunction! -------------------- POSTULATE FOR CONJUNCTION The "Golden Rule": P /\ Q equiv P equiv Q equiv P \/ Q -------------------- Q: can you prove that conjunction is symmetric? associative? idempotent? Thm: conjunction has unit true. Thm: conjunction distributes over itself. Note that conjunction does not distribute over equivalence. We have instead X /\ Y equiv X /\ Z equiv X /\ (Y equiv Z) equiv X where the last X makes distribution not work. However, if we use an even number of equivalences, we get two of these, so... Thm: conjunction distributes over an even number of equivalences. Thm: disjunction distributes over conjunction. to show the proof, write it out, look for the complex side, and simplify, using the Golden Rule twice Thms: absorbtion laws (i) X \/ (X /\ Y) equiv X (ii) X /\ (X \/ Y) equiv X ** implication (2.5) implication binds tighter than equivalence, but less tightly than conjunction and disjunction ------------------- POSTULATE FOR IMPLICATION P ==> Q equiv P \/ Q equiv Q ------------------- Thm: X ==> X Thm: X ==> true Thm: X /\ Y ==> X Thm: X ==> X \/ Y Thm: true ==> X equiv X Thm: X ==> Y equiv X /\ Y equiv X (can convert implications into conjunction and equivalence too) Thm: X ==> (Y ==> Z) equiv X /\ Y ==> Z Thm: X /\ (X ==> Y) equiv X /\ Y Thm: implication is transtive Thm: (X ==> Y) \/ (Y ==> Z) Thm (mutual implication): (X ==> Y) /\ (Y ==> X) equiv X equiv Y Thm: X equiv Y equiv X \/ Y ==> X /\ Y Implication plays a secondary role to equivalence, because it's not as symmetric. ** consquence (2.6) same binding as implication, just goes in reverse handy so proofs can run in either direction --------------------- POSTULATE FOR CONSEQUENCE P <== Q equiv P \/ Q equiv P ------------------- Thm: (X <== Y) equiv (Y ==> X) ** negation (2.7) negation binds tightest --------------------- POSTULATES FOR NEGATION ~(P equiv Q) equiv ~P equiv Q Excluded middle: P \/ ~P false equiv ~true --------------------- Thm: ~X equiv Y equiv X equiv ~Y Thm (negation is self-dual): ~~X equiv X Thm: ~X \/ Y equiv X \/ Y equiv Y Thm (DeMorgan's laws): (i) ~X /\ ~Y equiv ~(X \/ Y) (ii) ~X \/ ~Y equiv ~(X /\ Y) Thm (Complement rules): (i) X \/ (~X /\ Y) equiv X \/ Y (ii) X /\ (~X \/ Y) equiv X /\ Y Thm: ~X \/ Y equiv X ==> Y Thm (Shuffle): (X /\ Y) ==> Z equiv (X ==> ~Y \/ Z) sometimes the above is called "shunting" too Thm (false is unit of disjunction): X \/ false equiv X Thm: ~false equiv true Thm (false is zero of conjunction): X /\ false equiv false Thm: X equiv ~X equiv false Thm: false ==> X Thm (Contradiction): X /\ ~X equiv false ** discrepancy (2.8) discrepancy has same binding power as equivalence ------------------------ POSTULATES FOR DISCREPANCY associative and symmetric P diffs Q equiv ~(P equiv Q) ------------------------ Cohen's other postulate P equiv (Q diffs R) equiv (P equiv Q) diffs R can be proved as a theorem. Thm: X diffs false equiv X ** summary of binding powers (2.9) -------------------------- SUMMARY OF BINDING POWERS tighest ~ \/ /\ ==> <== loosest equiv diffs --------------------------