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

Similar documents
Math.3336: Discrete Mathematics. Nested Quantifiers

Announcements. CS311H: Discrete Mathematics. Propositional Logic II. Inverse of an Implication. Converse of a Implication

Announcements. CS243: Discrete Structures. Propositional Logic II. Review. Operator Precedence. Operator Precedence, cont. Operator Precedence Example

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

Math.3336: Discrete Mathematics. Propositional Equivalences

Introduction to Sets and Logic (MATH 1190)

Mathematical Logic Part Three

Discrete Mathematics and Its Applications

Section Summary. Section 1.5 9/9/2014

Mathematical Logic Part Three

Mat 243 Exam 1 Review

Math.3336: Discrete Mathematics. Nested Quantifiers/Rules of Inference

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

Lecture Predicates and Quantifiers 1.5 Nested Quantifiers

ICS141: Discrete Mathematics for Computer Science I

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

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

First order Logic ( Predicate Logic) and Methods of Proof

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

Propositional Logic Not Enough

Predicate Calculus lecture 1

Predicate Logic: Sematics Part 1

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

Discrete Structures for Computer Science

Thinking of Nested Quantification

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

Lecture 4. Predicate logic

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

Overview. CS389L: Automated Logical Reasoning. Lecture 7: Validity Proofs and Properties of FOL. Motivation for semantic argument method

Example ( x.(p(x) Q(x))) ( x.p(x) x.q(x)) premise. 2. ( x.(p(x) Q(x))) -elim, 1 3. ( x.p(x) x.q(x)) -elim, x. P(x) x.

Predicate Logic & Quantification

MAT2345 Discrete Math

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

Lecture 3 : Predicates and Sets DRAFT

Mathematical Logic Part Three

Math 3336: Discrete Mathematics Practice Problems for Exam I

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

Mathematical Logic Part Three

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

Predicates, Quantifiers and Nested Quantifiers

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

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

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

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

Review: Potential stumbling blocks

Logical Operators. Conjunction Disjunction Negation Exclusive Or Implication Biconditional

CS70 is a course about on Discrete Mathematics for Computer Scientists. The purpose of the course is to teach you about:

First-Order Logic (FOL)

Course Staff. Textbook

Section 2.1: Introduction to the Logic of Quantified Statements

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

- First-order formula. Instructor: Yu Zhen Xie

Predicate Logic. Example. Statements in Predicate Logic. Some statements cannot be expressed in propositional logic, such as: Predicate Logic

Proposi'onal Logic Not Enough

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

Discrete Mathematics and Probability Theory Spring 2014 Anant Sahai Note 1

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

THE LOGIC OF QUANTIFIED STATEMENTS

Predicate Calculus - Syntax

Discrete Mathematics and Probability Theory Fall 2012 Vazirani Note 1

CS 1571 Introduction to AI Lecture 14. First-order logic. CS 1571 Intro to AI. Midterm

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

3/29/2017. Logic. Propositions and logical operations. Main concepts: propositions truth values propositional variables logical operations

DISCRETE MATHEMATICS BA202

Mathematical Logic Part Two

Why Learning Logic? Logic. Propositional Logic. Compound Propositions

ECOM Discrete Mathematics

Propositional and Predicate Logic

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

Logic and Proof. Aiichiro Nakano

COMP9414: Artificial Intelligence First-Order Logic

Propositional and Predicate Logic

Predicates and Quantifiers. CS 231 Dianna Xu

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

Discrete Structures Lecture 5

Department of Computer Science & Software Engineering Comp232 Mathematics for Computer Science

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

Sample Problems for all sections of CMSC250, Midterm 1 Fall 2014

Propositional and First-Order Logic

Announcements CompSci 102 Discrete Math for Computer Science

Motivation. CS389L: Automated Logical Reasoning. Lecture 10: Overview of First-Order Theories. Signature and Axioms of First-Order Theory

CS100: DISCRETE STRUCTURES. Lecture 5: Logic (Ch1)

Section 1.7 Proof Methods and Strategy. Existence Proofs. xp(x). Constructive existence proof:

III. Elementary Logic

CS 730/730W/830: Intro AI

Mathematical Logic. Reasoning in First Order Logic. Chiara Ghidini FBK-IRST, Trento, Italy. May 2, 2013

Introduction to first-order logic:

CS156: The Calculus of Computation Zohar Manna Winter 2010

4 Quantifiers and Quantified Arguments 4.1 Quantifiers

For all For every For each For any There exists at least one There exists There is Some

COMP Intro to Logic for Computer Scientists. Lecture 10

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

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

MATH 22 INFERENCE & QUANTIFICATION. Lecture F: 9/18/2003

A. Propositional Logic

CS1021. Why logic? Logic about inference or argument. Start from assumptions or axioms. Make deductions according to rules of reasoning.

THE LOGIC OF QUANTIFIED STATEMENTS

2/18/14. What is logic? Proposi0onal Logic. Logic? Propositional Logic, Truth Tables, and Predicate Logic (Rosen, Sections 1.1, 1.2, 1.

Introduction to Decision Sciences Lecture 2

2-4: The Use of Quantifiers

Transcription:

Announcements CS311H: Discrete Mathematics Introduction to First-Order Logic Instructor: Işıl Dillig Homework due at the beginning of next lecture Please bring a hard copy of solutions to class! Instructor: Işıl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 1/30 Instructor: Işıl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 2/30 Why First-Order Logic? A Motivating Example For instance, consider the statement Anyone who drives fast gets a speeding ticket So far, we studied the simplest logic: propositional logic But for some applications, propositional logic is not expressive enough First-order logic is more expressive: allows representing more complex facts and making more sophisticated inferences From this, we should be able to conclude If Joe drives fast, he will get a speeding ticket Similarly, we should be able to conclude If Rachel drives fast, she will get a speeding ticket and so on. But PL does not allow inferences like that because we cannot talk about concepts like everyone, someone etc. First-order logic (predicate logic) allows making such kinds of inferences Instructor: Işıl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 3/30 Instructor: Işıl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 4/30 Building Blocks of First-Order Logic The building blocks of propositional logic were propositions In first-order logic, there are three kinds of basic building blocks: constants, variables, predicates Constants: refer to specific objects (in a universe of discourse) Examples: George, 6, Austin, CS311,... Variables: range over objects (in a universe of discourse) Examples: x,y,z,... If universe of discourse is cities in Texas, x can represent Houston, Austin, Dallas, San Antonio,... Building Blocks of First-Order Logic, cont. Predicates describe properties of objects or relationships between objects Examples: ishappy, betterthan, loves, >... Predicates can be applied to both constants and variables Examples: ishappy(george), betterthan(x,y), loves(george, Rachel), x > 3,... A predicate P(c) is true or false depending on whether property P holds for c Example: ishappy(george) is true if George is happy, but false otherwise Instructor: Işıl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 5/30 Instructor: Işıl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 6/30 1

Predicate Examples Formulas in First Order Logic Consider predicate even which represents if a number is even What is truth value of even(2)? Formulas in first-order logic are formed using predicates and logical connectives. What is truth value of even(5)? What is truth value of even(x)? Another example: Suppose Q(x, y) denotes x = y + 3 What is the truth value of Q(3, 0)? What is the truth value of Q(1, 2)? Example: Example: Example: Example: even(2) is a formula even(x) is also a formula even(x) odd(x) is also a formula (odd(x) even(x)) even(x) Instructor: Işıl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 7/30 Instructor: Işıl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 8/30 Semantics of First-Order Logic In propositonal logic, the truth value of formula depends on a truth assignment to variables. More Examples Consider interpretation I over domain D = {1, 2} In FOL, truth value of a formula depends interpretation of predicate symbols and variables over some domain D P(1, 1) = P(1, 2) = true, P(2, 1) = P(2, 2) = false Q(1) = false, Q(2) = true Consider a FOL formula P(x) A possible interpretation: D = {, }, P( ) = true, P( ) = false, x = Under this interpretation, what s truth value of P(x)? x = 1, y = 2 What is truth value of P(x, y) Q(y) under I? What is truth value of P(y, x) Q(y) under I? What is truth value of P(x, y) Q(x) under I? What about if x =? Instructor: Işıl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 9/30 Instructor: Işıl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 10/30 Quantifiers Universal Quantifiers Real power of first-order logic over propositional logic: quantifiers Quantifiers allow us to talk about all objects or the existence of some object There are two quantifiers in first-order logic: 1. Universal quantifier ( ): refers to all objects 2. Existential quantifier ( ): refers to some object Universal quantification of P(x), x.p(x), is the statement P(x) holds for all objects x in the universe of discourse. x.p(x) is true if predicate P is true for every object in the universe of discourse, and false otherwise Consider domain D = {, }, P( ) = true, P( ) = false What is truth value of x.p(x)? Object o for which P(o) is false is counterexample of x.p(x) What is a counterexample for x.p(x) in previous example? Instructor: Işıl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 11/30 Instructor: Işıl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 12/30 2

More Universal Quantifier Examples Existential Quantifiers Consider the domain D of real numbers and predicate P(x) with interpretation x 2 x What is the truth value of x.p(x)? What is a counterexample? What if the domain is integers? Observe: Truth value of a formula depends on a universe of discourse! Existential quantification of P(x), written x.p(x), is There exists an element x in the domain such that P(x). x.p(x) is true if there is at least one element in the domain such that P(x) is true In first-order logic, domain is required to be non-empty. Consider domain D = {, }, P( ) = true, P( ) = false What is truth value of x.p(x)? Instructor: Işıl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 13/30 Instructor: Işıl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 14/30 Existential Quantifier Examples Quantifiers Summary Consider the domain of reals and predicate P(x) with interpretation x < 0. What is the truth value of x.p(x)? What if domain is positive integers? Let Q(y) be the statement y > y 2 What s truth value of y.q(y) if domain is reals? Statement When True? When False? x.p(x) P(x) is true for every x P(x) is false for some x x.p(x) P(x) is true for some x P(x) is false for every x Consider finite universe of discourse with objects o 1,..., o n x.p(x) is true iff P(o 1 ) P(o 2 )... P(o n ) is true x.p(x) is true iff P(o 1 ) P(o 2 )... P(o n ) is true What about if domain is integers? Instructor: Işıl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 15/30 Instructor: Işıl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 16/30 Quantified Formulas More Examples of Quantified Formulas So far, only discussed how to quantify individual predicates. But we can also quantify entire formulas containing multiple predicates and logical connectives. x.(even(x) gt(x, 100)) is a valid formula in FOL What s truth value of this formula if domain is all integers? assuming even(x) means x is even and gt(x, y) means x > y What about x.(even(x) gt(x, 100))? Consider the domain of integers and the predicates even(x) and div4(x) which represents if x is divisible by 4 What is the truth value of the following quantified formulas? x. (div4(x) even(x)) x. (even(x) div4(x)) x. ( div4(x) even(x)) x. ( div4(x) even(x)) x. ( div4(x) even(x)) Instructor: Işıl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 17/30 Instructor: Işıl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 18/30 3

Translating English Into Quantified Formulas DeMorgan s Laws for Quantifiers Assuming freshman(x) means x is a freshman and incs311(x) x is taking CS311, express the following in FOL Someone in CS311 is a freshman No one in CS311 is a freshman Everyone taking CS311 are freshmen Every freshman is taking CS311 Learned about DeMorgan s laws for propositional logic: (p q) p q (p q) p q DeMorgan s laws extend to first-order logic, e.g., (even(x) div4(x)) ( even(x) div4(x)) Two new DeMorgan s laws for quantifiers: x.p(x) x. P(x) x.p(x) x. P(x) When you push negation in, flips to and vice versa Instructor: Işıl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 19/30 Instructor: Işıl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 20/30 Using DeMorgan s Laws Nested Quantifiers Expressed Noone in CS311 is a freshman as x.(incs311(x) freshman(x)) Let s apply DeMorgan s law to this formula: Using the fact that p q is equivalent to p q, we can write this formula as: Therefore, these two formulas are equivalent! Sometimes may be necessary to use multiple quantifiers For example, can t express Everybody loves someone using a single quantifier Suppose predicate loves(x, y) means Person x loves person y What does x. y.loves(x, y) mean? What does y. x.loves(x, y) mean? Observe: Order of quantifiers is very important! Instructor: Işıl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 21/30 Instructor: Işıl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 22/30 More Nested Quantifier Examples Summary of Nested Quantifiers Using the loves(x,y) predicate, how can we say the following? Someone loves everyone There is somone who doesn t love anyone There is someone who is not loved by anyone Statement x. y.p(x, y) y. x.p(x, y) x. y.p(x, y) x. y.p(x, y) x. y.p(x, y) y. x.p(x, y) When True? P(x, y) is true for every pair x, y For every x, there is a y for which P(x, y) is true There is an x for which P(x, y) is true for every y There is a pair x, y for which P(x, y) is true Everyone loves everyone There is someone who doesn t love herself/himself. Observe: Order of quantifiers is only important if quantifiers of different kinds! Instructor: Işıl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 23/30 Instructor: Işıl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 24/30 4

Understanding Quantifiers Understanding Quantifiers, cont. Which formulas are true/false? If false, give a counterexample x. y. (sameshape(x, y) differentcolor(x, y)) x. y. (samecolor(x, y) differentshape(x, y)) x. (triangle(x) ( y. (circle(y) samecolor(x, y)))) Which formulas are true/false? If false, give a counterexample x. y. ((triangle(x) square(y)) samecolor(x, y)) x. y. sameshape(x, y) x. (circle(x) ( y.( circle(y) samecolor(x, y)))) Instructor: Işıl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 25/30 Instructor: Işıl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 26/30 Translating First-Order Logic into English Translating English into First-Order Logic Given predicates student(x), atut (x), and friends(x, y), what do the following formulas say in English? x. ((atut(x) student(x)) ( y.(friends(x, y) atut (y)))) x.((student(x) atut(x)) y.friends(x, y)) x. y.((student(x) student(y) friends(x, y)) (atut(x) atut(y))) Given predicates student(x), atut (x), and friends(x, y), how do we express the following in first-order logic? Every UT student has a friend At least one UT student has no friends All UT students are friends with each other Instructor: Işıl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 27/30 Instructor: Işıl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 28/30 Satisfiability, Validity in FOL The concepts of satisfiability, validity also important in FOL An FOL formula F is satisfiable if there exists some domain and some interpretation such that F evaluates to true Example: Prove that x.p(x) Q(x) is satisfiable. An FOL formula F is valid if, for all domains and all interpretations, F evaluates to true Prove that x.p(x) Q(x) is not valid. Formulas that are satisfiable, but not valid are contingent, e.g., x.p(x) Q(x) Equivalence Two formulas F 1 and F 2 are equivalent if F 1 F 2 is valid In PL, we could prove equivalence using truth tables, but not possible in FOL However, we can still use known equivalences to rewrite one formula as the other Example: Prove that ( x. (P(x) Q(x))) and x. (P(x) Q(x)) are equivalent. Example: Prove that x. y.p(x, y) and x. y. P(x, y) are equivalent. Instructor: Işıl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 29/30 Instructor: Işıl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 30/30 5