CSC195, Class 6: Boolean Proof Summary: * Review: Why prove? * Laws and Rules * Twelve key laws * Rule of subsititution * Rule of transitivity Notes: * I hate + paperwork + one-hour meetings that take two hours * Homework 2 due. * Homework 3 assigned. * Goal * Sam's six+ P's http://glimmer.cs.grinnell.edu/Scheme/pdoc.html * Javadoc /** * The value true. */ public class True { class definitions field definitions method definitions constructor definitions ---------------------------------------- Comment: We will want to prove things in Boolean logic What? This assertion holds (always) Why? Put checks in our program + Things the computer checks + Things you check Techniques for proving that a proposition is a tautology * Proof by truth table * Prove equivalent to a simpler expression and prove that that expression is a tautology We can make big improvements by "simplifying" expressions Incorrect theorem ((a or b or c or d or (not a) or (not b)or (not c)) equals d) Theorem ((a + b + c + d + (-a) + (-b) + (-c)) = d Proof ((a + (-a) + b + (-b) + c + (-c) + d) = d By the extended commutative property of addition (0 + 0 + 0 + d) = d By the rule sometimes known as addition of inverses d = d By the additive identity property Q.E.D. 1. Commutativity (E1 v E2) = (E2 v E1) (E1 ^ E2) = (E2 ^ E1) (E1 = E2) = (E2 = E1) (E1 => E2) = (E2 => E1) FALSE How do we prove these laws? Truth table. How do we disprove the the fallacy? Let E1 by false, Let E2 be true (false => true) = (true => false) true = (true => false) true = false false Erik's claim (E1 => E2) = ((not E2) => (not E1)) Let E1 be false, E2 be true (false => true) = ((not true) => (not false)) 2. "Excluded middle" E or (not E) = True 3. Law of contradiction E and (not E) = False 4. Law of "additive identity" E or false = E false or E = E 5. Law of "multiplicative identity" E and true = E true and E = E 6. Distributive property (of multiplication across addition) a * (b + c) = (a * b) + (a * c) a ^ (b v c) = (a ^ b) v (a ^ c) a v (b ^ c) = (a v b) ^ (a v c) 7. De Morgan's laws not (b v c) = (not b) ^ (not c) not (b ^ c) = (not b) v (not c) 8. Associativity (a v b) v c = a v (b v c) (a ^ b) ^ c = a ^ (b ^ c) ((a = b) = c) = (a = (b = c)) 9. Law of negation (not (not a)) = a 10. Law of implication (E1 = E2) = ((E1 => E2) and (E2 => E1)) Others in the book. ---------------------------------------- Two rules (different than laws) What's the differnce between a rule and a law (at least to Gries, who is careful in his terminology)? Rule of substitution If E1 = E2 and P is a proposition involving variable p Then "P with E1 substituted for p" = "P with E2 substituted for p" Proposition: (foo and bar) (not (not a)) = a ((not (not a)) and bar) = (a and bar) a = 0 p++ a++ = 0++ Rule of transitivity If A = B and B = C then A = C