cse
play

CSE not every positive integer is prime 311 some positive integer - PowerPoint PPT Presentation

Negations of quantifiers CSE not every positive integer is prime 311 some positive integer is not prime prime numbers do not exist Foundations of every positive integer is not prime Computing I Fall 2014 Negations of


  1. Negations of quantifiers CSE • not every positive integer is prime 311 • some positive integer is not prime • prime numbers do not exist Foundations of • every positive integer is not prime Computing I Fall 2014 Negations of Quantifiers De Morgan’s Laws for Quantifiers • ∀ x PurpleFruit(x) Domain: ¬∀ x P(x) ≡ ∃ x ¬ P(x) Fruit • “All fruits are purple” • What is ¬∀ x PurpleFruit(x)? ¬∃ x P(x) ≡ ∀ x ¬ P(x) PurpleFruit(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!

  2. De Morgan’s laws for Quantifiers Scope of Quantifiers Example: NotLargest(x) ≡ ∃ y Greater (y, x) ¬∀ x P(x) ≡ ∃ x ¬ P(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 ∀ x ( ∃ y (P(x,y) → ∀ x Q(y, x))) “ For every integer there is a larger integer ” scope of quantifiers CSE 311: Foundations of Computing Fall 2014 vs. ∃ x (P(x) ∧ ∧ Q(x)) ∃ x P(x) ∧ ∧ ∃ x Q(x) ∧ ∧ ∧ ∧ 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.

  3. 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 ∀ x ∃ y P(x, y) ≡ ∀ a ∃ b P(a, b) distance between them increases by one node per step. • 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 expression when true when false y ∀ x ∀ y P(x, y) ∃ x ∃ y P(x, y) x P(x,y) ∀ x ∃ y P(x, y) ∃ y ∀ x P(x, y)

  4. Logical Inference Applications of Logical Inference • So far we’ve considered: • Software Engineering – Express desired properties of program as set of logical – How to understand and express things using constraints propositional and predicate logic – Use inference rules to show that program implies that – How to compute using Boolean (propositional) logic those constraints are satisfied – How to show that different ways of expressing or • Artificial Intelligence computing them are equivalent to each other – Automated reasoning • Algorithm design and analysis • Logic also has methods that let us infer implied – e.g., Correctness, Loop invariants. properties from ones that we know • Logic Programming, e.g. Prolog – Equivalence is a small part of this – 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 p, p → q • Write this rule as ∴ 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.

  5. 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: Excluded middle plus two inference rules per binary A, B ...which means that if both A and B connective, one to eliminate it and one to introduce it ∴ C,D are true then you can infer C and 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 x p ∨ q , ¬ p • Sometimes rules don’t need anything to start with. ∴ p ∨ q, q ∨ p ∴ q These rules are called axioms: p ⇒ q – e.g. Excluded Middle Axiom p, p → q Direct Proof Rule ∴ p ∨¬ p ∴ q ∴ p → q Not like other rules

  6. Important: Applications of inference rules Direct Proof of an Implication • p ⇒ q denotes a proof of q given p as an • You can use equivalences to make substitutions assumption of any sub-formula. • The direct proof rule: • Inference rules only can be applied to whole formulas (not correct otherwise). If you have such a proof then you can conclude that p → q is true e.g. 1. p → q given 2. ( p ∨ r) → q intro ∨ from 1. proof subroutine Example: 1. p assumption Does not follow! e.g . p=F F F, q=F F F, r=T F F T T T 2. p ∨ q intro for ∨ from 1 3. p → (p ∨ q) direct proof rule

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend