1 / 21

CSE 311 Foundations of Computing I

CSE 311 Foundations of Computing I. Autumn 2011, Lecture 3 Propositional Logic, Proofs, Predicate Calculus. Administrative. Course web: http://www.cs.washington.edu/311 Homework, Lecture slides, Office Hours ... Homework: Due Wednesday at the start of class

btonya
Download Presentation

CSE 311 Foundations of Computing I

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSE 311 Foundations of Computing I Autumn 2011, Lecture 3 Propositional Logic, Proofs, Predicate Calculus

  2. Administrative • Course web: http://www.cs.washington.edu/311 • Homework, Lecture slides, Office Hours ... • Homework: • Due Wednesday at the start of class • Paul Beame is travelling this week – so Richard Anderson will cover both lectures

  3. Highlights of week 1 • Predicate calculus • Basic logical connectives • If pigs can whistle, then horses can fly

  4. Combinational Logic Circuits Design a 3 input circuit to compute the majority of 3. Output 1 if at least two inputs are 1, output 0 otherwise OR AND AND What about a majority of 5 circuit?

  5. Logical equivalence • Terminology: A compound proposition is a • Tautology if it is always true • Contradiction if it is always false • Contingency if it can be either true or false pp p p (pq) p (pq)  (pq)  (pq)  (pq)

  6. Logical Equivalence • p and q are logically equivalent iffp q is a tautology • i.e. p and q have the same truth table • The notation pq denotes p and q are logically equivalent • Example: pp

  7. De Morgan’s Laws •  (p  q)  p  q •  (p  q)  p  q • What are the negations of: • The Yankees and the Phillies will play in the World Series • It will rain today or it will snow on New Year’s Day

  8. De Morgan’s Laws Example:  (p q)  (p q)

  9. Law of Implication Example: (p q)  (pq)

  10. Understanding connectives • Reflect basic rules of reasoning and logic • Allow manipulation of logical formulas • Simplification • Testing for equivalence • Applications • Query optimization • Search optimization and caching • Artificial Intelligence • Program verification

  11. Properties of logical connectives • Identity • Domination • Idempotent • Commutative • Associative • Distributive • Absorption • Negation pTp pFF ppp pqqp (pq) r p (qr) p (qr)  (pq)  (pr) p (pq) p p p  F

  12. Equivalences relating to implication • p  q  p  q • p  q  q  p • p  q  p  q • p  q  (p  q) • p  q  (p q)  (q  p) • p  q  p  q • p  q  (p  q)  ( p  q) •  (p  q)  p  q

  13. Logical Proofs • To show P is equivalent to Q • Apply a series of logical equivalences to subexpressions to convert P to Q • To show P is a tautology • Apply a series of logical equivalences to subexpressions to convert P to T

  14. Show (pq)  (pq) is a tautology

  15. Show (p  q)  r and p  (q  r) are not equivalent All false works

  16. Predicate Calculus • Predicate or Propositional Function • A function that returns a truth value • “x is a cat” • “x is prime” • “student x has taken course y” • “x > y” • “x + y = z” Prime(65353)

  17. Quantifiers • x P(x) : P(x) is true for every x in the domain • x P(x) : There is an x in the domain for which P(x) is true Relate  and  to  and 

  18. Statements with quantifiers Domain: Positive Integers • x Even(x) • x Odd(x) • x (Even(x)  Odd(x)) • x (Even(x)  Odd(x)) • x Greater(x+1, x) • x (Even(x)  Prime(x)) Even(x) Odd(x) Prime(x) Greater(x,y) Equal(x,y)

  19. Statements with quantifiers Domain: Positive Integers • xy Greater (y, x) • xy Greater (x, y) • xy (Greater(y, x)  Prime(y)) • x (Prime(x)  (Equal(x, 2)  Odd(x)) • xy(Equal(x, y + 2)  Prime(x)  Prime(y)) Even(x) Odd(x) Prime(x) Greater(x,y) Equal(x,y)

  20. Statements with quantifiers Domain: Positive Integers Even(x) Odd(x) Prime(x) Greater(x,y) Equal(x,y) • “There is an odd prime” • “If x is greater than two, x is not an even prime” • xyz ((Equal(z, x+y)  Odd(x)  Odd(y)) Even(z)) • “There exists an odd integer that is the sum of two primes”

  21. Goldbach’s Conjecture • Every even integer greater than two can be expressed as the sum of two primes Even(x) Odd(x) Prime(x) Greater(x,y) Equal(x,y) • xyz ((Greater(x, 2)  Even(x))  (Equal(x, y+z)  Prime(y)  Prime(z)) Domain: Positive Integers

More Related