1 / 41

First Order Logic

First Order Logic. Lecture 3: Sep 8. (chapter 2 of the book). c. b. a. Limitation of Propositional Logic. Propositional logic – logic of simple statements. How to formulate Pythagoreans’ theorem using propositional logic?.

Download Presentation

First Order Logic

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. First Order Logic Lecture 3: Sep 8 (chapter 2 of the book)

  2. c b a Limitation of Propositional Logic Propositional logic – logic of simple statements How to formulate Pythagoreans’ theorem using propositional logic? How to formulate the statement that there are infinitely many primes?

  3. Predicates Predicates are propositions with variables The domain of a variable is the set of all values that may be substituted in place of the variable. Example: P (x,y) ::= x + 2 = y x = 1 and y = 3: P(1,3) is true x = 1 and y = 4: P(1,4) is false P(1,4) is true

  4. Set means that x is an element of A means that x is not an element of A Sets can be defined directly: e.g. {1,2,4,8,16,32,…}, {CSC1130,CSC2110,…}

  5. Truth Set Sets can be defined by a predicate Given a predicate P(x) and x has domain D, the truth set of P(x) is the set of all elements of D that make P(x) true. e.g. Let P(x) be “n is the square of a number”, and the domain D of x is set of positive integers. e.g. Let P(x) be “n is a prime number”, and the domain D of x is set of positive integers.

  6. c b a The Universal Quantifier For ALLx x  x Z  y Z, x + y = y + x.

  7. The Existential Quantifier y There EXISTS some y Domain Truth value integers  positive integers + negative integers - negative reals -

  8. Translating Mathematical Theorem Fermat (1637): If an integer n is greater than 2, then the equation an + bn = cn has no solutions in non-zero integers a, b, and c. http://en.wikipedia.org/wiki/Fermat's_last_theorem Andrew Wiles (1994)

  9. Translating Mathematical Theorem Goldbach’s conjecture: Every even number is the sum of two prime numbers. How to write prime(p)?

  10. Negations of Quantified Statements Everyone likes football. What is the negation of this statement? (DeMorgan)

  11. Negations of Quantified Statements There is a plant that can fly. What is the negation of this statement? (DeMorgan)

  12. Order of Quantifiers There is an anti-virus program killing every computer virus. How to interpret this sentence? For every computer virus, there is an anti-virus program that kills it. • For every attack, I have a defense: • against MYDOOM, useDefender • against ILOVEYOU, useNorton • against BABLAS, useZonealarm …  is expensive!

  13. Order of Quantifiers There is an anti-virus program killing every computer virus. How to interpret this sentence? There is one single anti-virus program that kills all computer viruses. I have one defense good against every attack. Example: d is CSE-antivirus, protects against ALL viruses That’s much better! Order of quantifiers is very important!

  14. More Negations There is an anti-virus program killing every computer virus. What is the negation of this sentence? For every program, there is some virus that it can not kill.

  15. Exercises • There is a smallest positive integer. • There is no smallest positive real number. • There are infinitely many prime numbers.

  16. Predicate Calculus Validity Propositional validity Trueno matter what the truth values of A and B are Predicate calculus validity z [Q(z) P(z)] → [x.Q(x)  y.P(y)] • Trueno matter what • the Domain is, • or the predicates are. That is, logically correct, independent of the specific content.

  17. Arguments with Quantified Statements Universal instantiation: Universal modus ponens: Universal modus tollens:

  18. Universal Generalization valid rule providing c is independent of A e.g. given any number x, 2x is an even number => for all x, 2x is an even number.

  19. Not Valid z [Q(z) P(z)] → [x.Q(x)  y.P(y)] Proof: Give countermodel, where z [Q(z)P(z)]is true, but x.Q(x)y.P(y)isfalse. In this example, let domain be integers, Q(z) be true if z is an even number, i.e. Q(z)=even(z) P(z) be true if z is an odd number, i.e. P(z)=odd(z) Find a domain, and a predicate.

  20. Validity z [Q(z) P(z)] → [x.Q(x)  y.P(y)] Proof strategy: We assume z [Q(z) P(z)] and provex.Q(x) y.P(y)

  21. Proof and Logic We prove mathematical statement by using logic. not valid To prove something is true, we need to assume some axioms! This is invented by Euclid in 300 BC, who begins with 5 assumptions about geometry, and derive many theorems as logical consequences. http://en.wikipedia.org/wiki/Euclidean_geometry (see page 18 of the notes for the ZFC axioms for set theory)

  22. Power and Limits of Logic Good news: Gödel's Completeness Theorem That is, starting from a few propositional & simple predicate validities, every valid assertion can be proved using just universal generalization and modus ponens repeatedly! Only need to know a few axioms & rules, to prove all validities. modus ponens

  23. Power and Limits of Logic Thm 2, bad news: Given a set of axioms, there is noprocedure that decides whether quantified assertions are valid. (unlike propositional formulas).

  24. Power and Limits of Logic Gödel's Incompleteness Theorem for Arithmetic Thm 3, worse news: For any “reasonable” theory that proves basic arithemetic truth, an arithmetic statement that is true, but not provable in the theory, can be constructed. No hope to find a complete and consistent set of axioms! An excellent project topic:

  25. Application: Logic Programming

  26. Application: Logic Programming

  27. Other Applications Digital logic: Database system: Making queries Data mining

  28. Proofs

  29. Proving an Implication Goal: If P, then Q. (P implies Q) Method 1: Write assume P, then show that Q logically follows. Claim: If , then

  30. Proving an Implication Goal: If P, then Q. (P implies Q) Method 1: Write assume P, then show that Q logically follows. Claim: If r is irrational, then √r is irrational. How to begin with? What if I prove “If √r is rational, then r is rational”, is it equivalent? Yes, this is equivalent; proving “if P, then Q” is equivalent to proving “if not Q, then not P”.

  31. Proving an Implication Goal: If P, then Q. (P implies Q) Method 2: Prove the contrapositive, i.e. prove “not Q implies not P”. Claim: If r is irrational, then √r is irrational.

  32. Proving an “if and only if” Goal: Prove that two statements P and Q are “logically equivalent”, that is, one holds if and only if the other holds. Example: An integer is a multiple of 3 if and only if the sum of its digits is a multiple of 3. Method 1: Prove P implies Q and Q implies P. Method 1’: Prove P implies Q and not P implies not Q. Method 2: Construct a chain of if and only if statement. (see page 21 of the notes)

  33. Proof the Contrapositive Statement: If m2 is even, then m is even Try to prove directly.

  34. Proof the Contrapositive Statement: If m2 is even, then m is even Contrapositive: If m is odd, then m2 is odd. Proof (the contrapositive):

  35. Proof by Contradiction To prove P, you prove that not P would lead to ridiculous result, and so P must be true. You are working as a clerk. If you have won Mark 6, then you would not work as a clerk. You have not won Mark 6.

  36. Proof by Contradiction Theorem:is irrational. Proof (by contradiction):

  37. Proof by Contradiction Theorem:is irrational. Proof (by contradiction): • Suppose was rational. • Choose m, n integers without common prime factors (always possible) such that • Show that m and n are both even, thus having a common factor 2, • a contradiction!

  38. Proof by Contradiction Theorem:is irrational. Proof (by contradiction): Want to prove both m and n are even.

  39. so m is even. Proof by Contradiction Theorem:is irrational. Proof (by contradiction): Want to prove both m and n are even. so can assume so n is even.

  40. Proof by Cases e.g. want to prove a nonzero number always has a positive square. x is positive or x is negative if x is positive, then x2 > 0. if x is negative, then x2 > 0. x2 > 0.

  41. Rational vs Irrational Question: If a and b are irrational, can ab be rational?? We know that √2 is irrational, what about √2√2 ? Case 1: √2√2 is rational Case 2: √2√2 is irrational So in either case there are a,b irrational and ab be rational. We don’t need to know which case is true!

More Related