Predicate Logic. CSE 191, Class Note 02: Predicate Logic Computer Sci & Eng Dept SUNY Buffalo

Similar documents
Section Summary. Section 1.5 9/9/2014

Predicate Calculus lecture 1

Introduction to Sets and Logic (MATH 1190)

Discrete Mathematics and Its Applications

ICS141: Discrete Mathematics for Computer Science I

Recall that the expression x > 3 is not a proposition. Why?

Predicate Calculus - Syntax

Transparencies to accompany Rosen, Discrete Mathematics and Its Applications Section 1.3. Section 1.3 Predicates and Quantifiers

Propositional Logic Not Enough

Predicate Logic: Sematics Part 1

Lecture Predicates and Quantifiers 1.5 Nested Quantifiers

Introduction to Predicate Logic Part 1. Professor Anita Wasilewska Lecture Notes (1)

Mat 243 Exam 1 Review

3. The Logic of Quantified Statements Summary. Aaron Tan August 2017

Proposi'onal Logic Not Enough

Thinking of Nested Quantification

2. Use quantifiers to express the associative law for multiplication of real numbers.

THE LOGIC OF QUANTIFIED STATEMENTS. Predicates and Quantified Statements I. Predicates and Quantified Statements I CHAPTER 3 SECTION 3.

Announcements. CS311H: Discrete Mathematics. Introduction to First-Order Logic. A Motivating Example. Why First-Order Logic?

2-4: The Use of Quantifiers

Philosophy 240 Symbolic Logic Russell Marcus Hamilton College Fall 2014

Predicates and Quantifiers. Nested Quantifiers Discrete Mathematic. Chapter 1: Logic and Proof

Logical Operators. Conjunction Disjunction Negation Exclusive Or Implication Biconditional

Formal Logic: Quantifiers, Predicates, and Validity. CS 130 Discrete Structures

Math.3336: Discrete Mathematics. Nested Quantifiers

Today s Lecture. ICS 6B Boolean Algebra & Logic. Predicates. Chapter 1: Section 1.3. Propositions. For Example. Socrates is Mortal

cse 311: foundations of computing Fall 2015 Lecture 6: Predicate Logic, Logical Inference

2/2/2018. CS 103 Discrete Structures. Chapter 1. Propositional Logic. Chapter 1.1. Propositional Logic

Predicate Logic Thursday, January 17, 2013 Chittu Tripathy Lecture 04

CSI30. Chapter 1. The Foundations: Logic and Proofs Nested Quantifiers

Section Summary. Predicate logic Quantifiers. Negating Quantifiers. Translating English to Logic. Universal Quantifier Existential Quantifier

Quantifiers. P. Danziger

Lecture 3. Logic Predicates and Quantified Statements Statements with Multiple Quantifiers. Introduction to Proofs. Reading (Epp s textbook)

Section Summary. Predicate logic Quantifiers. Negating Quantifiers. Translating English to Logic. Universal Quantifier Existential Quantifier

Review. Propositional Logic. Propositions atomic and compound. Operators: negation, and, or, xor, implies, biconditional.

Predicates, Quantifiers and Nested Quantifiers

Predicate Calculus - Semantics 1/4

G52DOA - Derivation of Algorithms Predicate Logic

III. Elementary Logic

Predicates and Quantifiers. CS 231 Dianna Xu

Math Fundamentals of Higher Math

First-Order Logic (FOL)

Rosen, Discrete Mathematics and Its Applications, 6th edition Extra Examples

Predicate Logic & Quantification

Introduction to first-order logic:

Predicate in English. Predicates and Quantifiers. Predicate in Logic. Propositional Functions: Prelude. Propositional Function

1.3 Predicates and Quantifiers

CSE 311: Foundations of Computing. Lecture 6: More Predicate Logic

Symbolising Quantified Arguments

Discrete Structures Lecture 5

! Predicates! Variables! Quantifiers. ! Universal Quantifier! Existential Quantifier. ! Negating Quantifiers. ! De Morgan s Laws for Quantifiers

Discrete Structures for Computer Science

CS 220: Discrete Structures and their Applications. Predicate Logic Section in zybooks

PREDICATE LOGIC. Schaum's outline chapter 4 Rosen chapter 1. September 11, ioc.pdf

First order Logic ( Predicate Logic) and Methods of Proof

Today. Proof using contrapositive. Compound Propositions. Manipulating Propositions. Tautology

First-order logic Syntax and semantics

Quantifiers Here is a (true) statement about real numbers: Every real number is either rational or irrational.

Nested Quantifiers. Predicates and. Quantifiers. Agenda. Limitation of Propositional Logic. Try to represent them using propositional.

Logical equivalences 12/8/2015. S T: Two statements S and T involving predicates and quantifiers are logically equivalent

Mathematical Logic Part Three

Predicate Calculus. Lila Kari. University of Waterloo. Predicate Calculus CS245, Logic and Computation 1 / 59

Negations of Quantifiers

ECOM Discrete Mathematics

Predicate Logic: Introduction and Translations

Announcement. Homework 1

Propositional Functions. Quantifiers. Assignment of values. Existential Quantification of P(x) Universal Quantification of P(x)

1.1 Language and Logic

AAA615: Formal Methods. Lecture 2 First-Order Logic

Predicate Logic. Andreas Klappenecker

Proseminar on Semantic Theory Fall 2013 Ling 720 First Order (Predicate) Logic: Syntax and Natural Deduction 1

1.1 Language and Logic

Chapter 2: The Logic of Quantified Statements. January 22, 2010

University of Aberdeen, Computing Science CS2013 Predicate Logic 4 Kees van Deemter

LING 501, Fall 2004: Quantification

EECS 1028 M: Discrete Mathematics for Engineers

software design & management Gachon University Chulyun Kim

Examples: P: it is not the case that P. P Q: P or Q P Q: P implies Q (if P then Q) Typical formula:

Denote John by j and Smith by s, is a bachelor by predicate letter B. The statements (1) and (2) may be written as B(j) and B(s).

Packet #2: Set Theory & Predicate Calculus. Applied Discrete Mathematics

Quantifiers. Alice E. Fischer. CSCI 1166 Discrete Mathematics for Computing February, 2018

Semantics I, Rutgers University Week 3-1 Yimei Xiang September 17, Predicate logic

Logical Structures in Natural Language: First order Logic (FoL)

THE LOGIC OF QUANTIFIED STATEMENTS

Section Summary. Predicates Variables Quantifiers. Negating Quantifiers. Translating English to Logic Logic Programming (optional)

Syntax. Notation Throughout, and when not otherwise said, we assume a vocabulary V = C F P.

MAT2345 Discrete Math

Section 2.1: Introduction to the Logic of Quantified Statements

CSCE 222 Discrete Structures for Computing. Predicate Logic. Dr. Hyunyoung Lee. !!!!! Based on slides by Andreas Klappenecker

COMP9414: Artificial Intelligence First-Order Logic

Predicate Logic: Syntax

DISCRETE MATHEMATICS BA202

Mathematical Logic Part Three

Variable Names. Some Ques(ons about Quan(fiers (but answers are not proven just stated here!) x ( z Q(z) y P(x,y) )

Lecture 3 : Predicates and Sets DRAFT

4 Quantifiers and Quantified Arguments 4.1 Quantifiers

SYMBOLIC LOGIC UNIT 10: SINGULAR SENTENCES

Chapter 2: The Logic of Quantified Statements

Announcements CompSci 102 Discrete Math for Computer Science

Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques

Transcription:

Predicate Logic CSE 191, Class Note 02: Predicate Logic Computer Sci & Eng Dept SUNY Buffalo c Xin He (University at Buffalo) CSE 191 Discrete Structures 1 / 22

Outline 1 From Proposition to Predicate c Xin He (University at Buffalo) CSE 191 Discrete Structures 2 / 22

From Proposition to Predicate 3 + 2 = 5 is a proposition. But is X + 2 = 5 a proposition? Because it has a variable X in it, we cannot say it is T or F. So, it is not a proposition. It is called a predicate. c Xin He (University at Buffalo) CSE 191 Discrete Structures 3 / 22

From Proposition to Predicate 3 + 2 = 5 is a proposition. But is X + 2 = 5 a proposition? Because it has a variable X in it, we cannot say it is T or F. So, it is not a proposition. It is called a predicate. Definition A predicate is a function. It takes some variable(s) as arguments; it returns either True or False (but not both) for each combination of the argument values. In contrast, a proposition is not a function. It does not have any variable as argument. It is either True or False (but not both). The variables are always associated with a universe (or domain) of discourse, which tells us what combinations of the argument values are allowed. c Xin He (University at Buffalo) CSE 191 Discrete Structures 3 / 22

Predicate vs. Proposition Suppose P(x) is a predicate, where the universe of discourse for x is {1, 2, 3}. Then P(x) is not a proposition, but P(1) is a proposition. In general, a predicate is not a proposition. But when you assign values to all its argument variables, you get a proposition. c Xin He (University at Buffalo) CSE 191 Discrete Structures 4 / 22

Predicate vs. Proposition Suppose P(x) is a predicate, where the universe of discourse for x is {1, 2, 3}. Then P(x) is not a proposition, but P(1) is a proposition. In general, a predicate is not a proposition. But when you assign values to all its argument variables, you get a proposition. P(x, y) : x + 2 = y is a predicate. It has two variables x and y; Universe of Discourse: x is in {1, 2, 3}; y is in {4, 5, 6}. P(1, 4) : P(2, 4) : 1 + 2 = 4 is a proposition (it is F); 2 + 2 = 4 is a proposition (it is T); P(2, 3): meaningless (in this example), because 3 is not in the specified universe of discourse for y. c Xin He (University at Buffalo) CSE 191 Discrete Structures 4 / 22

Example Example Suppose Q(x, y) : integer pairs. x + y > 4, where the universe of discourse is all Which of the following are predicates? Which are propositions? Q(1, 2) Q(1000, 2) Q(x, 2) Q(1000, y) Q(x, y) c Xin He (University at Buffalo) CSE 191 Discrete Structures 5 / 22

Universal quantification Universal quantification is another way of converting a predicate into a proposition. Definition Suppose P(x) is a predicate on some universe of discourse. The universal quantification of P(x) is the proposition: P(x) is true for all x in the universe of discourse. We write xp(x), and say for all x, P(x). xp(x) is TRUE if P(x) is true for every single x. xp(x) is FALSE if there is an x for which P(x) is false. c Xin He (University at Buffalo) CSE 191 Discrete Structures 6 / 22

Universal quantification example P(x) : x + 2 = 5, universe of discourse: {1, 2, 3}. x P(x) means: for all x in {1, 2, 3}, x + 2 = 5. In other words, it means: 1+2=5, 2+2=5, and 3+2=5, which is false. So it is a proposition. More example: A(x) : x = 1 B(x) : x > 2 C(x) : x < 2 Universe of discourse is {1, 2, 3}. True or False? a) x (C(x) A(x)) b) x (C(x) B(x)) c Xin He (University at Buffalo) CSE 191 Discrete Structures 7 / 22

Existential quantification Existential quantification is yet another way of converting a predicate into a proposition. Definition Suppose P(x) is a predicate on some universe of discourse. The existential quantification of P(x) is the proposition: P(x) is true for some x in the universe of discourse. We write x P(x), and say there exists x, P(x). x P(x) is TRUE if P(x) is true for any x. x P(x) is FALSE if for every x, P(x) is false. c Xin He (University at Buffalo) CSE 191 Discrete Structures 8 / 22

Existential quantification example P(x) : x + 2 = 5, universe of discourse: {1, 2, 3}. x P(x) means: for some x in {1, 2, 3}, x + 2 = 5. In other words, it means: 1 + 2 = 5, or 2 + 2 = 5, or 3 + 2 = 5 which is true. So it is a proposition. More examples on existential quantifier: A(x) : x = 1, B(x) : x > 5, C(x) : x < 5. Universe of discourse is {1, 2, 3}. True or False? a) x (C(x) A(x)) b) x B(x) c Xin He (University at Buffalo) CSE 191 Discrete Structures 9 / 22

More examples A(x): x lives in Amherst. B(x): x is a CSE 191 student. C(x): x has a good GPA. D(x): x majors in computer science. Universe of discourse: all UB students. All CSE 191 students have good GPA: x (B(x) C(x)) No CSE 191 student lives in Amherst: x (B(x) A(x)) CSE 191 students who do not live in Amherst major in computer science: x (B(x) A(x) D(x)) c Xin He (University at Buffalo) CSE 191 Discrete Structures 10 / 22

Quantifier negation Consider the following two propositions: Not every UB student majors in computer science: x D(x). There is UB student who does not major in computer science: x D(x). Do these two statements have the same meaning? YES. Consider the following two propositions: There is no UB student living in Amherst: x A(x). Every UB student lives in a town other than Amherst: x A(x). Do these two statements have the same meaning? YES. c Xin He (University at Buffalo) CSE 191 Discrete Structures 11 / 22

Quantifier negation Quantifier negation: In general we have: x P(x) x P(x) x P(x) x P(x) Where means logical equivalence as we have seen. Rule: to negate a quantifier: move the negation to the inside; and switch to, to. c Xin He (University at Buffalo) CSE 191 Discrete Structures 12 / 22

Nested Quantifier Sometimes we have more complicated logical formulas that require nested quantifiers. Nested means one quantifier s scope contains another quantifier. x yp(x, y) = T if P(x, y) = T for all x and y. x yp(x, y) = T if for any x there exists y such that P(x, y) = T. x yp(x, y) = T if there exists x such that P(x, y) = T for all y. x yp(x, y) = T if these exists x and there exists y such that P(x, y) = T. c Xin He (University at Buffalo) CSE 191 Discrete Structures 13 / 22

Examples for translating logic formulas to sentences Suppose P(x, y) means: x (the first variable in P(. ) loves y (the second variable in (P(, ) ), where the domain of x is the students in this class and the domain of y is the courses offered by UB CSE. Note: The variable is defined by its position in P(, ). We might use different names for them. So when we write P(y, w), we are saying y loves w. P(Alice, CSE191): Alice loves CSE191. y P(Alice, y): Alice loves a UB CSE course. x (P(x, CSE191) P(x, CSE250)): A student in this class loves both CSE 191 and CSE 250. x y z ((x y) (P(x, z) P(y, z))): There are two different students x and y in this class such that if x loves a UB CSE course, then y loves it as well. c Xin He (University at Buffalo) CSE 191 Discrete Structures 14 / 22

Example for translating sentences to logic formulas Now we consider translations in the other direction. Suppose P(x, y) means: x loves y, where the domain of x is the students in this class and the domain of y is the courses offered by UB CSE. Every UB CSE course is loved by some student in this class: y x P(x, y). No student in this class loves both CSE 191 and CSE 250: x (P(x, CSE191) P(x, CSE250)). c Xin He (University at Buffalo) CSE 191 Discrete Structures 15 / 22

Nested quantifier: examples A(x): x lives in Amherst. C(x, y): x and y are friends. D(x): x majors in computer science. Universe of discourse: all UB students. There is a computer science major who has a friend living in Amherst: x (D(x) y (A(y) C(x, y))) A(x): x lives in Amherst. B(x): x is a CSE 191 student. C(x, y): x and y are friends. D(x): x majors in computer science. Universe of discourse: all UB students. Either there is a computer science major who has a friend living in Amherst, or all CSE 191 students major in computer science: x (D(x) y (A(y) C(x, y))) x (B(x) D(x)) c Xin He (University at Buffalo) CSE 191 Discrete Structures 16 / 22

Compare examples A(x): x lives in Amherst. B(x): x is a CSE 191 student. C(x, y): x and y are friends. D(x): x majors in computer science. Universe of discourse: all UB students. Consider the following two statements: x y(c(x, y) B(y)): All UB students have friends taking CSE191. y x (C(x, y) B(y)): There is a UB student who is the friend of all UB students and takes CSE 191. Do they mean the same thing? NO. c Xin He (University at Buffalo) CSE 191 Discrete Structures 17 / 22

Order Matters Difference in orders of quantifiers may lead to difference in truth values. Let the universe of discourse be pairs of real numbers. x y (y > x) True But y x (y > x) False In general: x yp(x, y) = T iff y xp(x, y) = T. x yp(x, y) = T iff y xp(x, y) = T. If x yp(x, y) = T, then y xp(x, y) = T. If y xp(x, y) = T, x yp(x, y) might be F. c Xin He (University at Buffalo) CSE 191 Discrete Structures 18 / 22

Compare examples A(x): x lives in Amherst. B(x): x is a CSE 191 student. C(x, y): x and y are friends. D(x): x majors in computer science. Universe of discourse: all UB students. x D(x) x y (A(y) C(x, y)): There is a computer science major and there is a UB student who has a friend living in Amherst. Compared with: x (D(x) y (A(y) C(x, y))): There is a computer science major who has a friend living in Amherst. The meaning of the two statements are different. This is because the scopes of the variable x in the two formula are different. c Xin He (University at Buffalo) CSE 191 Discrete Structures 19 / 22

Scope matters In general, difference in scopes of quantifiers can lead to difference in truth values. x (P(x) P(x)) True But the truth value of x P(x) P(x) depends on the truth value of free variable x. (The second x is not bounded by any quantifier.) So this formula is not even a proposition! c Xin He (University at Buffalo) CSE 191 Discrete Structures 20 / 22

Nested quantifier: more examples A(x): x lives in Amherst. B(x): x is a CSE 191 student. C(x): x has a good GPA. D(x): x majors in computer science. Universe of discourse: all UB students. If all computer science majors have friends taking CSE191, then there are a pair of friends both taking CSE191. x (D(x) y (B(y) C(x, y))) x y (B(x) B(y) C(x, y)) c Xin He (University at Buffalo) CSE 191 Discrete Structures 21 / 22

Rules for quantifier scope We have the following important rules: x (P(x) Q(y)) x P(x) Q(y) x (P(x) Q(y)) x P(x) Q(y) x (P(x) Q(y)) x P(x) Q(y) x (P(x) Q(y)) x P(x) Q(y) In general, as long as a subformula does not contain a quantifier s bound variable, you can arbitrarily put it into the scope of that quantifier, or take it out of the scope of that quantifier. c Xin He (University at Buffalo) CSE 191 Discrete Structures 22 / 22