The Foundations Logic and Proofs EECS 1019 Discrete

  • Slides: 49
Download presentation
The Foundations: Logic and Proofs EECS 1019: Discrete Math for CS Prof. Andy Mirzaian

The Foundations: Logic and Proofs EECS 1019: Discrete Math for CS Prof. Andy Mirzaian © 2019 Mc. Graw-Hill Education. All rights reserved. Authorized only for instructor use in the classroom. No reproduction or further distribution permitted without the prior written consent of Mc. Graw-Hill Education.

Summary Predicate Logic (aka: First-Order Logic, Predicate Calculus) • The Language of Quantifiers •

Summary Predicate Logic (aka: First-Order Logic, Predicate Calculus) • The Language of Quantifiers • Logical Equivalences • Nested Quantifiers • Translation from Predicate Logic to English • Translation from English to Predicate Logic 2 © 2019 Mc. Graw-Hill Education

Predicates and Quantifiers Section 1. 4 Friedrich Ludwig Gottlob Frege (1848 -1925) Charles Sanders

Predicates and Quantifiers Section 1. 4 Friedrich Ludwig Gottlob Frege (1848 -1925) Charles Sanders Peirce (1839 -1914) 3 © 2019 Mc. Graw-Hill Education

Section Summary 1 • Predicates • Variables • Quantifiers § Universal Quantifier § Existential

Section Summary 1 • Predicates • Variables • Quantifiers § Universal Quantifier § Existential Quantifier • Negating Quantifiers § De Morgan’s Laws for Quantifiers • Translating English to Logic • Logic Programming (not covered) 4 © 2019 Mc. Graw-Hill Education

Propositional Logic Not Enough If we have: “All men are mortal. ” “Socrates is

Propositional Logic Not Enough If we have: “All men are mortal. ” “Socrates is a man. ” Does it follow that “Socrates is mortal” ? Can’t be represented in propositional logic. Need a language that talks about objects, their properties, and their relations. Later we’ll see how to draw inferences. © 2019 Mc. Graw-Hill Education 5

Introducing Predicate Logic • Predicate logic uses the following new features: § Variables: x,

Introducing Predicate Logic • Predicate logic uses the following new features: § Variables: x, y, z, p, q, … § Predicates: P(x), Q(x) § Quantifiers (to be covered in a few slides) • Propositional functions are a generalization of propositions. § They contain variables and a predicate, e. g. , P(x) § Variables can be replaced by elements from their domain. 6 © 2019 Mc. Graw-Hill Education

Propositional Functions Propositional functions become propositions (and have truth values) when their variables are

Propositional Functions Propositional functions become propositions (and have truth values) when their variables are each replaced by a value from the domain (or bound by a quantifier, as we will see later). The statement P(x) is said to be the value of the propositional function P at x. Example: Let P(x) denote “x > 0” and the domain be the integers. Then: P(-3) is false. P(0) is false. P(3) is true. Often the domain is denoted by U (the Universe). So in this example U is the integers. 7 © 2019 Mc. Graw-Hill Education

Examples of Propositional Functions • Let “x + y = z” be denoted by

Examples of Propositional Functions • Let “x + y = z” be denoted by R(x, y, z) and U (for all three variables) be the integers. Find these truth values: R(2, -1, 5) Solution: F R(3, 4, 7) Solution: T R(x, 3, z) Solution: Not a Proposition • Now let “x - y = z” be denoted by Q(x, y, z), with U as the integers. Find these truth values: Q(2, -1, 3) Solution: T Q(3, 4, 7) Solution: F Q(x, 3, z) Solution: Not a Proposition 8 © 2019 Mc. Graw-Hill Education

Compound Expressions 9 © 2019 Mc. Graw-Hill Education

Compound Expressions 9 © 2019 Mc. Graw-Hill Education

Quantifiers • We need quantifiers to express the meaning of English words including all

Quantifiers • We need quantifiers to express the meaning of English words including all and some: o “All men are Mortal. ” o “Some cats do not have fur. ” • The two most important quantifiers are: o Universal Quantifier, “for all, ” symbol: o Existential Quantifier, “there exists, ” symbol: • We write as in x P(x) and x P(x) asserts P(x) is true for every x in the domain. x P(x) asserts P(x) is true for some x in the domain. • The quantifiers are said to bind the variable x in these expressions. 10 © 2019 Mc. Graw-Hill Education

Universal Quantifier 11 © 2019 Mc. Graw-Hill Education

Universal Quantifier 11 © 2019 Mc. Graw-Hill Education

Existential Quantifier 12 © 2019 Mc. Graw-Hill Education

Existential Quantifier 12 © 2019 Mc. Graw-Hill Education

Uniqueness Quantifier 13 © 2019 Mc. Graw-Hill Education

Uniqueness Quantifier 13 © 2019 Mc. Graw-Hill Education

Thinking about Quantifiers 14 © 2019 Mc. Graw-Hill Education

Thinking about Quantifiers 14 © 2019 Mc. Graw-Hill Education

Properties of Quantifiers 15 © 2019 Mc. Graw-Hill Education

Properties of Quantifiers 15 © 2019 Mc. Graw-Hill Education

Precedence of Quantifiers 16 © 2019 Mc. Graw-Hill Education

Precedence of Quantifiers 16 © 2019 Mc. Graw-Hill Education

Translating from English to Logic 1 17 © 2019 Mc. Graw-Hill Education

Translating from English to Logic 1 17 © 2019 Mc. Graw-Hill Education

Translating from English to Logic 2 18 © 2019 Mc. Graw-Hill Education

Translating from English to Logic 2 18 © 2019 Mc. Graw-Hill Education

Returning to the Socrates Example 19 © 2019 Mc. Graw-Hill Education

Returning to the Socrates Example 19 © 2019 Mc. Graw-Hill Education

Equivalences in Predicate Logic 20 © 2019 Mc. Graw-Hill Education

Equivalences in Predicate Logic 20 © 2019 Mc. Graw-Hill Education

Thinking about Quantifiers as Conjunctions and Disjunctions If the domain is finite, a universally

Thinking about Quantifiers as Conjunctions and Disjunctions If the domain is finite, a universally quantified proposition is equivalent to a conjunction of propositions without quantifiers and an existentially quantified proposition is equivalent to a disjunction of propositions without quantifiers. If U consists of the integers 1, 2, and 3: Even if the domains are infinite, you can still think of the quantifiers in this fashion, but the equivalent expressions without quantifiers will be infinitely long. © 2019 Mc. Graw-Hill Education 21

Negating Quantified Expressions 1 22 © 2019 Mc. Graw-Hill Education

Negating Quantified Expressions 1 22 © 2019 Mc. Graw-Hill Education

Negating Quantified Expressions 2 23 © 2019 Mc. Graw-Hill Education

Negating Quantified Expressions 2 23 © 2019 Mc. Graw-Hill Education

De Morgan’s Laws for Quantifiers The rules for negating quantifiers are: TABLE 2 De

De Morgan’s Laws for Quantifiers The rules for negating quantifiers are: TABLE 2 De Morgan’s Laws for Quantifiers. Negation Equivalent Statement When Is Negation True? When False? For every x, P(x) is false. There is x for which P(x) is true. There is an x for which P P(x) is true for (x) is false. every x. The reasoning in the table shows that: These are important. You will use these. © 2019 Mc. Graw-Hill Education 24

Translation from English to Logic 25 © 2019 Mc. Graw-Hill Education

Translation from English to Logic 25 © 2019 Mc. Graw-Hill Education

System Specification Example 26 © 2019 Mc. Graw-Hill Education

System Specification Example 26 © 2019 Mc. Graw-Hill Education

Lewis Carroll Example Charles Lutwidge Dodgson (aka Lewis Caroll) (1832 -1898) 27 © 2019

Lewis Carroll Example Charles Lutwidge Dodgson (aka Lewis Caroll) (1832 -1898) 27 © 2019 Mc. Graw-Hill Education

Some Predicate Calculus Definitions 28 © 2019 Mc. Graw-Hill Education

Some Predicate Calculus Definitions 28 © 2019 Mc. Graw-Hill Education

More Predicate Calculus Definitions 29 © 2019 Mc. Graw-Hill Education

More Predicate Calculus Definitions 29 © 2019 Mc. Graw-Hill Education

Nested Quantifiers Section 1. 4 30 © 2019 Mc. Graw-Hill Education

Nested Quantifiers Section 1. 4 30 © 2019 Mc. Graw-Hill Education

Section Summary 2 • Nested Quantifiers • Order of Quantifiers • Translating from Nested

Section Summary 2 • Nested Quantifiers • Order of Quantifiers • Translating from Nested Quantifiers into English • Translating Mathematical Statements into Statements involving Nested Quantifiers. • Translated English Sentences into Logical Expressions. • Negating Nested Quantifiers. © 2019 Mc. Graw-Hill Education 31

Nested Quantifiers 32 © 2019 Mc. Graw-Hill Education

Nested Quantifiers 32 © 2019 Mc. Graw-Hill Education

Thinking of Nested Quantification 33 © 2019 Mc. Graw-Hill Education

Thinking of Nested Quantification 33 © 2019 Mc. Graw-Hill Education

Order of Quantifiers 34 © 2019 Mc. Graw-Hill Education

Order of Quantifiers 34 © 2019 Mc. Graw-Hill Education

Questions on Order of Quantifiers 1 Answer: False Answer: True 35 © 2019 Mc.

Questions on Order of Quantifiers 1 Answer: False Answer: True 35 © 2019 Mc. Graw-Hill Education

Questions on Order of Quantifiers 2 Answer: False Answer: True 36 © 2019 Mc.

Questions on Order of Quantifiers 2 Answer: False Answer: True 36 © 2019 Mc. Graw-Hill Education

Quantifications of Two Variables Statement When True? When False P(x, y) is true for

Quantifications of Two Variables Statement When True? When False P(x, y) is true for every pair x, y. There is a pair x, y for which P(x, y) is false. For every x there is a y There is an x such that for which P(x, y) is true. P(x, y) is false for every y. There is an x for which P(x, y) is true for every y. For every x there is a y for which P(x, y) is false. There is a pair x, y for which P(x, y) is true. P(x, y) is false for every pair x, y 37 © 2019 Mc. Graw-Hill Education

Translating Nested Quantifiers into English 38 © 2019 Mc. Graw-Hill Education

Translating Nested Quantifiers into English 38 © 2019 Mc. Graw-Hill Education

Translating Mathematical Statements into Predicate Logic Example : Translate this sentence into a logical

Translating Mathematical Statements into Predicate Logic Example : Translate this sentence into a logical expression: “The sum of two positive integers is always positive”. Solution: 1. Rewrite the statement to make the implied quantifiers and domains explicit: “For every two integers, if these integers are both positive, then the sum of these integers is positive. ” 2. Introduce the variables x and y, and specify the domain, to obtain: “For all positive integers x and y, x + y is positive. ” 3. The result is: where the domain of both variables consists of all integers 39 © 2019 Mc. Graw-Hill Education

Translating English into Logical Expressions Example 40 © 2019 Mc. Graw-Hill Education

Translating English into Logical Expressions Example 40 © 2019 Mc. Graw-Hill Education

Negating Nested Quantifiers 41 © 2019 Mc. Graw-Hill Education

Negating Nested Quantifiers 41 © 2019 Mc. Graw-Hill Education

Student Question: Would it be okay if I write ∃��∃��∀�� (�� , �� )∧��

Student Question: Would it be okay if I write ∃��∃��∀�� (�� , �� )∧�� (�� , �� )) instead of ∃��∀��∃�� (�� , �� )∧�� (�� , �� )) ? Answer: Let's first examine the difference between ∃��∀�� �� (�� , �� ) and ∀��∃�� �� (�� , �� ) carefully. The first one says "there is a flight f that belongs to every airline a". The second one says "every airline has some flight f". Did that clear up the issue? Clearly the first is not the intended sentence. Each airline has many flights. But different flights belong to different airlines. There is a one-to-many relationship between airlines and flights. There is no single flight that is shared by every airline. So, clearly we don't want to say the first one. Remember how much we emphasized in class that different type quantifiers do not commute (check your lecture slide pages). Now consider the full sentences ∃��∃��∀�� (�� , �� )∧�� (�� , �� )) versus ∃��∀��∃�� (�� , �� )∧�� (�� , �� )). The first one says "there is a woman w who has taken a flight f that is a flight on every airline a". The second one says "there is a women w, such that for every airline a, w has taken some flight f on a". In short, the second one says "there is a woman who has taken a flight on every airline". 42 © 2019 Mc. Graw-Hill Education

Questions on Translation from English Choose the obvious predicates and express in predicate logic.

Questions on Translation from English Choose the obvious predicates and express in predicate logic. • “Brothers are siblings. ” Solution: x y (B(x, y) S(x, y)) • “Siblinghood is symmetric. ” Solution: x y (S(x, y) S(y, x)) • “Everybody loves somebody. ” • “Everyone loves himself/herself” Solution: x y L(x, y) Solution: x L(x, x) • “There is someone who loves someone. ” Solution: x y L(x, y) • “There is someone who is loved by everyone. ” Solution: y x L(x, y) 43 © 2019 Mc. Graw-Hill Education

Calculus in Predicate Logic 44 © 2019 Mc. Graw-Hill Education

Calculus in Predicate Logic 44 © 2019 Mc. Graw-Hill Education

Calculus in Predicate Logic 45 © 2019 Mc. Graw-Hill Education

Calculus in Predicate Logic 45 © 2019 Mc. Graw-Hill Education

Calculus in Predicate Logic 46 © 2019 Mc. Graw-Hill Education

Calculus in Predicate Logic 46 © 2019 Mc. Graw-Hill Education

Some Questions about Quantifiers 47 © 2019 Mc. Graw-Hill Education

Some Questions about Quantifiers 47 © 2019 Mc. Graw-Hill Education

Some Questions about Quantifiers 48 © 2019 Mc. Graw-Hill Education

Some Questions about Quantifiers 48 © 2019 Mc. Graw-Hill Education

49 © 2019 Mc. Graw-Hill Education

49 © 2019 Mc. Graw-Hill Education