Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.

Similar presentations


Presentation on theme: "CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett."— Presentation transcript:

1 CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett

2 Today’s Topics: More Propositional Logic 1. Necessary and sufficient 2. Negating a Disjunctive or Conjunctive Proposition  DeMorgan’s Law 3. Converting from Truth Table to Proposition 2

3 1. Necessary and sufficient Or, how to sound smart and win arguments on Reddit or other blog/forum of your choice 3

4 Necessary and Sufficient 4  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.

5 Your turn: Practice i. p = Get an A on the final. ii. q = Get an A in the class. iii. r = Do the homework. iv. 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? A. 0 or 1 B. 2 C. 3 D. 4 E. 5 5

6 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 6

7 2. Negating a Disjunctive or Conjunctive Proposition DeMorgan’s Law 7

8 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)? A. ¬p ∧ ¬q B. ¬p ∨ ¬q C. ¬p ¬ ∧ ¬q D. ¬p → ¬q E. p ∨ q 8 Be the fact-checker!

9 Laws to memorize 9  DeMorgan’s   (p ∧ q) ≡ ¬p ∨ ¬q   (p ∨ q) ≡ ¬p ∧ ¬q  Distributive  Associative

10 2. Converting from Truth Table to Proposition Disjunctive and Conjunctive Normal Forms 10

11 DNF and CNF  DNF: Disjunctive 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) 11

12 DNF and CNF I. (p ∧ ¬q) ∨ (¬p ∧ ¬r) II. (¬p ∧ (p ∨ q) ∧ ¬r) ∨ (p ∧ r) III. (p ∧ r) ∨ ¬(r ∧ ¬q) IV. (p ∨ q ∨ r) ∧ (p ∨ ¬q) Categorize the above propositions: A. I is CNF and IV is DNF B. I and III are DNF and IV is CNF C. I is DNF and IV is CNF D. I, II and III are DNF and IV is CNF E. None/more/other 12

13 Equivalence of p → q and ¬p ∨ q 13  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 pq¬pp → q ¬p ∨ q TTFTT TFFFF FTTTT FFTTT

14 Disjunctive normal form (DNF) 14 pqp → q TT T TFF FT T FF T pqpq pqpq pqpq p  q  (p  q)  (  p  q)  (  p   q) OR

15 Disjunctive normal form (DNF) 15  Convert the predicate p  q to DNF A. (p  q)  (  p   q) B. (p  q)  (  p   q) C. (p  q)  (  p   q) D. (p  q)  (  p  q) E. None/more/other

16 Conjunctive normal form (CNF) 16 pq p  q TTT TF F FT F FFT pqpq p  q  (  p  q)  (p   q) AND p qp q

17 Conjunctive normal form (CNF) 17  Convert the predicate p  q to CNF A. p   q B. p   q C. (p  q)  (  p   q) D. (p  q)  (  p  q) E. None/more/other

18 CNF vs DNF  Every predicate can be written both as a CNF and as a DNF  Which one is more effective (requires less connectives to write): A. CNF B. DNF C. Both require the same number D. Depends on predicate E. None/more/other

19 Negating a CNF  Say s is a predicate with a DNF s  (p  q)  (  p  r)  (p   r)  (  p   q)  We want to compute  s. Which one of the following is easiest to compute: A. CNF for  s B. DNF for  s C. Both are equally easy to compute D. None/more/other


Download ppt "CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett."

Similar presentations


Ads by Google