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

Slides:



Advertisements
Similar presentations
CSE 20 DISCRETE MATH Prof. Shachar Lovett Clicker frequency: CA.
Advertisements

Disjunctive Normal Form CS 680: Formal Methods Jeremy Johnson.
Logic Use mathematical deduction to derive new knowledge.
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 1: (Part 2): The Foundations: Logic and Proofs.
F22H1 Logic and Proof Week 7 Clausal Form and Resolution.
CSE 20 DISCRETE MATH Prof. Shachar Lovett Clicker frequency: CA.
CS128 – Discrete Mathematics for Computer Science
Discussion #12 1/22 Discussion #12 Deduction, Proofs and Proof Techniques.
Syllabus Every Week: 2 Hourly Exams +Final - as noted on Syllabus
Chapter 9: Boolean Algebra
CSCI2110 – Discrete Mathematics Tutorial 8 Propositional Logic Wong Chung Hoi (Hollis)
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
Normal Forms, Tautology and Satisfiability 2/3/121.
CS1502 Formal Methods in Computer Science
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
(CSC 102) Lecture 3 Discrete Structures. Previous Lecture Summary Logical Equivalences. De Morgan’s laws. Tautologies and Contradictions. Laws of Logic.
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
Fallacies The proposition [(p  q)  q]  p is not a tautology, because it is false when p is false and q is true. This type of incorrect reasoning is.
Lecture 4. CONDITIONAL STATEMENTS: Consider the statement: "If you earn an A in Math, then I'll buy you a computer." This statement is made up of two.
1 CMSC 250 Discrete Structures CMSC 250 Lecture 1.
CS 381 DISCRETE STRUCTURES Gongjun Yan Aug 25, November 2015Introduction & Propositional Logic 1.
CS Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution.
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
September1999 CMSC 203 / 0201 Fall 2002 Week #1 – 28/30 August 2002 Prof. Marie desJardins.
Propositional Logic. Propositions Any statement that is either True (T) or False (F) is a proposition Propositional variables: a variable that can assume.
Disjunctive Normal Form CS 270: Math Foundation of CS Jeremy Johnson.
Mathematics for Comter I Lecture 2: Logic (1) Basic definitions Logical operators Translating English sentences.
Symbolic Logic The Following slide were written using materials from the Book: The Following slide were written using materials from the Book: Discrete.
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
The Logic of Boolean Connectives Chapter 4 Language, Proof and Logic.
CS.462 Artificial Intelligence SOMCHAI THANGSATHITYANGKUL Lecture 04 : Logic.
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
Simple Logic.
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
Discrete Structures for Computer Science Presented By: Andrew F. Conn Slides adapted from: Adam J. Lee Lecture #1: Introduction, Propositional Logic August.
Chapter 1 Propositional Logic
Discrete Mathematical
Truth Table to Statement Form
2. The Logic of Compound Statements Summary
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett
CSNB 143 Discrete Mathematical Structures
Lecture 1 – Formal Logic.
Knowledge Representation and Reasoning
Discrete Mathematics Logic.
Niu Kun Discrete Mathematics Chapter 1 The Foundations: Logic and Proof, Sets, and Functions Niu Kun 离散数学.
COT 3100, Spr Applications of Discrete Structures
(CSC 102) Discrete Structures Lecture 2.
Discussion #10 Logical Equivalences
ARTIFICIAL INTELLIGENCE
Proposition & Predicates
Disjunctive Normal Form
The Boolean Connectives
MATH 15A – Discrete Mathematics
Propositional Calculus: Boolean Functions and Expressions
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett
Propositional Calculus: Boolean Algebra and Simplification
Elementary Metamathematics
Information Technology Department
Propositional Equivalence (§1.2)
Logics for Data and Knowledge Representation
CS201: Data Structures and Discrete Mathematics I
Logic Use mathematical deduction to derive new knowledge.
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett
TRUTH TABLES continued.
Disjunctive Normal Form
Discrete Mathematics Logic.
PROPOSITIONAL LOGIC - SYNTAX-
CS201: Data Structures and Discrete Mathematics I
The Foundations: Logic and Proofs
If v.s. Only If v.s. If and Only If (Iff)
Presentation transcript:

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 pq OR pq pq pq  (pq)  (pq)  (pq) terms

Disjunctive normal form (DNF) Convert the predicate pq to DNF (pq)(pq) (pq)(pq) (pq)(pq) (pq)(pq) None/more/other

Conjunctive normal form (CNF) p q p q T F pq AND p q pq  (p q)  (p  q) clauses

Conjunctive normal form (CNF) Convert the predicate pq to CNF pq pq (pq)(pq) (pq)(pq) 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  (pq)(pr)(pr)(pq) 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