CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett
Today’s Topics: Necessary and sufficient Converse error Normal forms: DNFs, CNFs Converting from Truth Table to Proposition
1. Necessary and sufficient Or, how to sound smart and win arguments on Reddit
Necessary and Sufficient p is NECESSARY for q ¬p→¬q (“no p, no q!”) p is SUFFICIENT for q p→q (“p is all we need to know!”) Note that ¬p→¬q is equivalent to q→p So if p is necessary and sufficient for q, then p iff q.
Your turn: Practice p = Get an A on the final. q = Get an A in the class. r = Do the homework. s = Get an A on everything. p is necessary for q p is sufficient for q r is necessary for p r is sufficient for s s is sufficient for q How many of the necessary / sufficient sentences are true? 0 or 1 2 3 4 5
Be a beacon of rational thought in the online world 1 point extra credit on the midterm: Make correct, good, topical use necessary or sufficient (1/2 pt each) in an online discussion Link to your comment/post on TED to collect your points. Obviously no venues or topics that are NSFW/racist/sexist/etc. Max 1pt per person
2. Converse error Or, how to lose arguments on Reddit
Converse error Confusing 𝑝→𝑞 with 𝑞→𝑝 p q p→q q→p T F
She’s a witch! See if you can spot the converse error in this video clip: http://www.youtube.com/watch?v=zrzMhU_4m-g
Remember this. If something is made out of wood, then it floats Remember this? If something is made out of wood, then it floats. Therefore, if she floats, then she is made out of wood (and therefore a witch!) What is the argument form: (p → q) (q → p) (¬p → ¬q) (¬q → ¬p) (p → q) (p → q) (¬p → ¬q) (¬p → ¬q) Other/none/more than one
Step-by-step truth table for (p→q) → (q→p) So, is the argument form valid? Valid Not valid In your groups, say in words what it is about this table that shows it is valid or not valid.
Converse error Here is another example with the same form: If this shape is a square, then this shape is a rectangle. Therefore, if this shape is a rectangle, then this shape is a square. No! p→ q and q→p are the converse of each other. It is not safe to assume that if p→q is true, then q→p is also true! The converse could be true though…as in the equal sides/square example. If both p→q and q→p are true, then we say p↔q (“p iff q”).
3. Negating a Disjunctive or Conjunctive Proposition DeMorgan’s Law
Be the fact-checker! My opponent says I have 10 speeding tickets and took bribes from that oil company. That is not true! p = has 10 speeding tickets q = took bribes Which of the following is equivalent to (p ∧ q)? ¬p ∧ ¬q ¬p ∨ ¬q ¬p ¬∧ ¬q ¬p → ¬q p ∨ q
Laws to memorize DeMorgan’s Distributive Associative (p ∧ q) ≡ ¬p ∨ ¬q (p ∨ q) ≡ ¬p ∧ ¬q Distributive Associative
4. Converting from Truth Table to Proposition Disjunctive and Conjunctive Normal Forms
DNF and CNF DNF: Disjunctive Normal Form CNF: Conjunctive Normal Form OR of ANDs (terms) e.g. (p∧¬q) ∨ (¬p∧¬r) CNF: Conjunctive Normal Form AND of ORs (clauses) e.g. (p∨¬q) ∧ (¬p∨¬r)
DNF and CNF (p∧¬q) ∨ (¬p∧¬r) (¬p∧(p∨q)∧¬r) ∨ (p∧r) (p ∧ r) ∨ ¬(r ∧ ¬q) (p∨q∨r) ∧ (p∨¬q) Categorize the above propositions: I is CNF and IV is DNF I and III are DNF and IV is CNF I is DNF and IV is CNF I, II and III are DNF and IV is CNF None/more/other
Equivalence of p → q and ¬p ∨ q When we write a proposition, we are trying to describe what is true One way to think about this: Look for the rows that are true Describe the input values for that row “or” them together p q ¬p p → q ¬p ∨ q T F
Disjunctive normal form (DNF) p q p → q T F pq OR pq pq pq (pq) (pq) (pq) terms
Disjunctive normal form (DNF) Convert the predicate pq to DNF (pq)(pq) (pq)(pq) (pq)(pq) (pq)(pq) None/more/other
Conjunctive normal form (CNF) p q p q T F pq AND p q pq (p q) (p q) clauses
Conjunctive normal form (CNF) Convert the predicate pq to CNF pq pq (pq)(pq) (pq)(pq) None/more/other
CNFs vs DNFs Every predicate can be written both as a CNF and as a DNF Which one is more effective (requires less connectives to write): CNF DNF Both require the same number Depends on predicate None/more/other
Negating a CNF Say s is a predicate with a DNF s (pq)(pr)(pr)(pq) We want to compute s. By simply applying de-Morgan laws, what do you get? CNF for s DNF for s Both are equally easy to compute None/more/other
CNFs vs DNFs Negating a CNF gives us a DNF, and vice versa So, if a Boolean formula f can be expressed by a CNF with S clauses Then its negation ~f can be expressed by a DNF with S terms Conclusion: #formulas expressed as a CNF with S clauses = #formulas expressed as a DNF with S terms
CNFs vs DNFs Another way to prove this: #clauses in CNF = #F in truth table #terms in DNF = #T in truth table #functions with S many F in truth table = #functions with S many T in truth table
CNFs vs DNFs In general, both are very inefficient ways Function on n inputs has 2n rows in truth table Typically about half T, half F Both CNFs and DNFs need size ~2n-1 n=100 299 > # atoms in universe