Predicate Logic, Logical Inference

Predicate Logic, Logical Inference

Negations of quantifiers CSE • not every positive integer is prime 311 • some positive integer is not prime • prime numbers do not exist Foundations of • Computing I every positive integer is not prime Fall 2014 Negations of Quantifiers De Morgan’s Laws for Quantifiers • ∀x PurpleFruit(x) Domain: • “All fruits are purple” Fruit ¬∀x P(x) ≡ ∃x ¬P(x) • ¬∀ What is x PurpleFruit(x)? PurpleFruit(x) ¬∃ x P(x) ≡ ∀x ¬P(x) • “Not all fruits are purple” • How about ∃x PurpleFruit(x)? • “There is a purple fruit” • If it’s the negation, all situations should be covered by a statement and its negation • Consider the domain {Orange} : Neither statement is true! • No! • How about ∃x ¬PurpleFruit(x)? • “There is a fruit that isn’t purple” • Yes! De Morgan’s laws for Quantifiers Scope of Quantifiers ¬∀ x P(x) ≡ ∃x ¬P(x) Example: NotLargest(x) ≡ ∃ y Greater (y, x) ≡ ∃ z Greater (z, x) ¬ ∃x P(x) ≡ ∀x ¬P(x) truth value: “ ” There is no largest integer doesn’t depend on y or z “bound variables” ¬ ∃ x ∀ y ( x ≥ y) does depend on x “free variable” ≡∀ x ¬ ∀y ( x ≥ y) ≡∀ ∃ ¬ x y ( x ≥ y) quantifiers only act on free variables of the formula ≡∀ x ∃ y (y > x) they quantify ∀ ∃ → ∀ “For every integer there is a larger integer ” x ( y (P( x,y) x Q( y, x))) scope of quantifiers CSE 311: Foundations of Computing ∃x (P( x) ∧∧∧ Q( x)) vs. ∃x P( x) ∧∧∧ ∃x Q( x) Fall 2014 Lecture 6: Predicate Logic, Logical Inference This one asserts P This one asserts P and Q and Q of the same x. of potentially different x’s. Turtles All The Way Down Nested Quantifiers If the tortoise walks at a rate of one node per step, and the • Bound variable names don’t matter hare walks at a rate of two nodes per step, then the ∀ ∃ ≡ ∀ ∃ distance between them increases by one node per step. x y P(x, y) a b P(a, b) • Positions of quantifiers can sometimes change If the tortoise is on node x, and the hare is on node 2x, then ∀ x (Q(x) ∧ ∃ y P(x, y)) ≡ ∀ x ∃ y (Q(x) ∧ P(x, y)) the distance between them increases by one node per step • But: order is important ... OnNode(x) Domain: Non-negative Integers Predicate with Two Variables Quantification with Two Variables y expression when true when false ∀x ∀ y P(x, y) ∃ ∃ x P(x,y) x y P(x, y) ∀ x ∃ y P(x, y) ∃ y ∀ x P(x, y) Logical Inference Applications of Logical Inference • So far we’ve considered: • Software Engineering – How to understand and express things using – Express desired properties of program as set of logical propositional and predicate logic constraints – How to compute using Boolean (propositional) logic – Use inference rules to show that program implies that – those constraints are satisfied How to show that different ways of expressing or • computing them are equivalent to each other Artificial Intelligence – Automated reasoning • • Logic also has methods that let us infer implied Algorithm design and analysis – properties from ones that we know e.g., Correctness, Loop invariants. • – Equivalence is a small part of this Logic Programming, e.g. Prolog – Express desired outcome as set of constraints – Automatically apply logic inference to derive solution Proofs An inference rule: Modus Ponens • Start with hypotheses and facts • If p and p → q are both true then q must be true • Use rules of inference to extend set of facts • Result is proved when it is included in the set • Write this rule as p, p → q ∴ q • Given: – If it is Monday then you have a 311 class today. – It is Monday. • Therefore, by modus ponens: – You have a 311 class today. Proofs Proofs can use equivalences too Show that r follows from p, p → q, and q → r Show that ¬p follows from p → q and ¬q 1. p given 1. p → q given → 2. p q given 2. ¬ q given → 3. q r given 3. ¬ q → ¬ p contrapositive of 1 4. q modus ponens from 1 and 2 4. ¬ p modus ponens from 2 and 3 5. r modus ponens from 3 and 4 Inference Rules Simple Propositional Inference Rules • Each inference rule is written as: A, B Excluded middle plus two inference rules per binary ...which means that if both A and B connective, one to eliminate it and one to introduce it are true then you can infer C and ∴ C,D you can infer D. p ∧ q p, q – For rule to be correct (A ∧ B) → C and ∴ p, q ∴ p ∧ q (A ∧ B) → D must be a tautologies p ∨ q , ¬p p x • Sometimes rules don’t need anything to start with. ∴ q ∴ p ∨ q, q ∨ p These rules are called axioms : – e.g. Excluded Middle Axiom → p ⇒ q p, p q Direct Proof Rule ∴ p ∨¬ p ∴ q ∴ p → q Not like other rules Important: Applications of inference rules Direct Proof of an Implication • You can use equivalences to make substitutions • p ⇒ q denotes a proof of q given p as an of any sub-formula. assumption • Inference rules only can be applied to whole • The direct proof rule: formulas (not correct otherwise). If you have such a proof then you can conclude e.g. 1. p → q given that p → q is true 2. ( p ∨ r) → q intro ∨ from 1. Example: proof subroutine 1. p assumption Does not follow! e.g . p=FFFF, q=FFFF, r=TTTT 2. p ∨ q intro for ∨ from 1 3. p → (p ∨ q) direct proof rule.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    6 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us