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

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

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

Propositional Logic Not Enough

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

Section Summary. Section 1.5 9/9/2014

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

ICS141: Discrete Mathematics for Computer Science I

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

Predicate Logic. Andreas Klappenecker

Lecture Predicates and Quantifiers 1.5 Nested Quantifiers

Rules Build Arguments Rules Building Arguments

Review: Potential stumbling blocks

Review. Propositions, propositional operators, truth tables. Logical Equivalences. Tautologies & contradictions

Introduction to Sets and Logic (MATH 1190)

CSCI-2200 FOUNDATIONS OF COMPUTER SCIENCE

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

Proposi'onal Logic Not Enough

Discrete Mathematics and Its Applications

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

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

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

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

1.3 Predicates and Quantifiers

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

Sec$on Summary. Valid Arguments Inference Rules for Propositional Logic. Inference Rules for Quantified Statements. Building Arguments

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

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

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

Discrete Structures for Computer Science

Predicate Logic & Quantification

Predicate Calculus lecture 1

Logical Operators. Conjunction Disjunction Negation Exclusive Or Implication Biconditional

Math.3336: Discrete Mathematics. Nested Quantifiers

First order Logic ( Predicate Logic) and Methods of Proof

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

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).

Chapter 3. The Logic of Quantified Statements

SYMBOLIC LOGIC UNIT 10: SINGULAR SENTENCES

ICS141: Discrete Mathematics for Computer Science I

Predicates and Quantifiers. CS 231 Dianna Xu

Sec$on Summary. Valid Arguments Inference Rules for Propositional Logic. Inference Rules for Quantified Statements. Building Arguments

Formal (Natural) Deduction for Predicate Calculus

Predicate Logic Quantifier Rules

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

Logic and Proof. Aiichiro Nakano

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

The Foundations: Logic and Proofs. Chapter 1, Part III: Proofs

MACM 101 Discrete Mathematics I. Exercises on Predicates and Quantifiers. Due: Tuesday, October 13th (at the beginning of the class)

Proofs. Example of an axiom in this system: Given two distinct points, there is exactly one line that contains them.

Predicates, Quantifiers and Nested Quantifiers

Logic. Logic is a discipline that studies the principles and methods used in correct reasoning. It includes:

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

Thinking of Nested Quantification

Logic Overview, I. and T T T T F F F T F F F F

Predicate Logic combines the distinctive features of syllogistic and propositional logic.

COMP 182 Algorithmic Thinking. Proofs. Luay Nakhleh Computer Science Rice University

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

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

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

CPSC 121: Models of Computation

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

Chapter 2: The Logic of Quantified Statements

Mathacle. PSet ---- Algebra, Logic. Level Number Name: Date: I. BASICS OF PROPOSITIONAL LOGIC

DISCRETE MATHEMATICS BA202

Announcements CompSci 102 Discrete Math for Computer Science

Chapter 1, Part II: Predicate Logic

Section 2.1: Introduction to the Logic of Quantified Statements

4 Quantifiers and Quantified Arguments 4.1 Quantifiers

Lecture 3 : Predicates and Sets DRAFT

(Refer Slide Time: 02:20)

Why Learning Logic? Logic. Propositional Logic. Compound Propositions

Philosophy 240 Symbolic Logic Russell Marcus Hamilton College Fall 2014

Intro to Logic and Proofs

CS2742 midterm test 2 study sheet. Boolean circuits: Predicate logic:

Mat 243 Exam 1 Review

Before you get started, make sure you ve read Chapter 1, which sets the tone for the work we will begin doing here.

Topic #3 Predicate Logic. Predicate Logic

Outline. Rules of Inferences Discrete Mathematics I MATH/COSC 1056E. Example: Existence of Superman. Outline

DISCRETE MATH: LECTURE Chapter 3.3 Statements with Multiple Quantifiers If you want to establish the truth of a statement of the form

Full file at Chapter 1

University of Ottawa CSI 2101 Midterm Test Instructor: Lucia Moura. March 1, :00 pm Duration: 1:15 hs


software design & management Gachon University Chulyun Kim

1 Predicates and Quantifiers

CS 2336 Discrete Mathematics

Lecture 4. Predicate logic

THE ISLAMIC UNIVERSITY OF GAZA ENGINEERING FACULTY DEPARTMENT OF COMPUTER ENGINEERING DISCRETE MATHMATICS DISCUSSION ECOM Eng. Huda M.

ECOM Discrete Mathematics

Math 3336: Discrete Mathematics Practice Problems for Exam I

Full file at

With Question/Answer Animations. Chapter 1, Part III: Proofs

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

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

Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques

Phil 2B03 (McMaster University Final Examination) Page 1 of 4

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

Propositional and First-Order Logic

Solutions to Exercises (Sections )

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:

Discrete Structures for Computer Science

Transcription:

Predicate Logic Predicate Logic (Rosen, Chapter 1.4-1.6) TOPICS Predicate Logic Quantifiers Logical Equivalence Predicate Proofs Some statements cannot be expressed in propositional logic, such as: All men are mortal. Some trees have needles. X > 3. Predicate logic can express these statements and make inferences on them. 10/1/12 CS160 Fall Semester 2012 2 P(x,y) Statements in Predicate Logic Two parts: Predicate P describes a relation or property, Variables (x,y) can take arbitrary values from some domain. Still have two truth values for statements (T and F) When we assign values to x and y, then P has a truth value. 10/1/12 CS160 Fall Semester 2012 3 Example Let Q(x,y) denote x=y+3. What are truth values of: Q(1,2) Q(3,0) Let R(x,y) denote x beats y in Rock/Paper/Scissors with 2 players with following rules: Rock smashes scissors, Scissors cuts paper, Paper covers rock. What are the truth values of: R(rock, paper) R(scissors, paper) false true false 10/1/12 CS160 Fall Semester 2012 4 true 1

Why is Predicate Logic Useful? Verifying Program Correctness Given if (x<0) x = -x; What is true before? (called precondition) x has some value What is true after? (called postcondition) greaterthan(x,0) Systems Specifications E.g., Every mail message larger than one megabyte will be compressed. Check Let Q(x,y) denote the statement x is the capital of y What are the truth values of the following Q(Denver, Colorado) A True, B - False Q(Detroit, Michigan) A True, B False Q(Los Angeles, California) A True, B - False 10/1/12 CS160 Fall Semester 2012 5 10/1/12 CS160 Fall Semester 2012 6 Quantifiers Quantification expresses the extent to which a predicate is true over a set of elements. Two forms: Universal Existential Universal Quantifier P(x) is true for all values in the domain x D, P(x) For every x in D, P(x) is true. An element x for which P(x) is false is called a counterexample. Given P(x) as x+1>x and the domain of R, what is the truth value of: x P(x) true 10/1/12 CS160 Fall Semester 2012 7 10/1/12 CS160 Fall Semester 2012 8 2

Check Let C(x) denote x is a comedian. Let F(x) denote x is funny. The domain of x is all people Given x(c(x) -> F(x)) A. There exists an x such that x is a comedian and x is funny B. Every person is a funny comedian Example Let P(x) be that x>0 and x is in domain of R. Give a counterexample for: x P(x) x = -5 10/1/12 CS160 Fall Semester 2012 9 10/1/12 CS160 Fall Semester 2012 10 Existential Quantifier P(x) is true for at least one value in the domain. x D, P(x) For some x in D, P(x) is true. Let the domain of x be animals, M(x) be x is a mammal and E(x) be x lays eggs, what is the truth value of: x (M(x) E(x)) true Platypuses echidnas English to Logic Some person in this class has visited the Grand Canyon. Domain of x is the set of all persons C(x): x is a person in this class V(x): x has visited the Grand Canyon x(c(x) V(x)) 10/1/12 CS160 Fall Semester 2012 11 10/1/12 CS160 Fall Semester 2012 12 3

Hmm. 10/1/12 CS160 Fall Semester 2012 13 English to Logic For every one there is someone to love. Domain of x and y is the set of all persons L(x, y): x loves y x y L(x,y) Is it necessary to explicitly include that x and y must be different people (i.e. x y)? Just because x and y are different variable names doesn t mean that they can t take the same values 10/1/12 CS160 Fall Semester 2012 14 English to Logic No one in this class is wearing shorts and a ski parka. Domain of x is persons in this class S(x): x is wearing shorts P(x): x is wearing a ski parka x(s(x) P(x)) Domain of x is all persons C(x): x belongs to the class x(c(x) S(x) P(x)) 10/1/12 CS160 Fall Semester 2012 15 Check Let P(x) denote x can speak French. Let Q(x) denote x can speak German. The domain of x is the students in this class There is a student in this class that can speak French and German A. x (P(x) v Q(x)) B. x(p(x) ^ Q(x)) C. x (P(x) ^ Q(x)) 10/1/12 CS160 Fall Semester 2012 16 4

Evaluating Expressions: Precedence and Variable Bindings Precedence: Quantifiers and negation are evaluated before operators Otherwise left to right Bound: Variables can be given specific values or Can be constrained by quantifiers How about Predicate Proofs? How do we formally prove a theorem about quantified predicates? The canonical example: All people are mortal. Socrates is a person. Prove that Socrates is mortal 10/1/12 CS160 Fall Semester 2012 17 10/1/12 CS160 Fall Semester 2012 18 Inference over Predicates A predicate applied to constants is equivalent to a Proposition Let the domain of discourse be tree types Let P(x) x has needles Then P(pine) is T Then P(palm) is T Therefore, all the propositional inference rules apply to predicates of constants! 10/1/12 CS160 Fall Semester 2012 19 What about quantifiers? Unfortunately, many predicate statements involve quantified variables In English: All people are mortal In predicate logic: x, P(x) M(x) We introduce four new rules to handle quantified variables: Universal instantiation (UI) Universal generalization (UG) Existential instantiation (EI) Existential generalization (EG) We will take these one at a time 10/1/12 CS160 Fall Semester 2012 20 5

Universal Instantiation x P(x) P(c) Rationale: if something is true for every element in the domain, then it is true for any element (use a constant for the element). Use: we can substitute any constant for any universally quantified variable in any propositional statement. 10/1/12 CS160 Fall Semester 2012 21 UI Example All people are mortal; Sue is a person; Show that Sue is mortal 1 x P(x) M(x) Premise 2 P(Sue) Premise 3 P(Sue) M(Sue) UI (1) 4 M(Sue) Modus Ponens, (2) & (3) 10/1/12 CS160 Fall Semester 2012 22 Existential Generalization (EG) P(c) x P(x) Rationale: if something is true for one thing (the constant), then it is true for something Use: we can replace constants with existentially quantified variables. EG Example Everyone is mortal. Show that someone is mortal 1 x M(x) Premise 2 M(sue) UI (1) 3 x M(x) EG (2) 10/1/12 CS160 Fall Semester 2012 23 10/1/12 CS160 Fall Semester 2012 24 6

Existential Instantiation (EI) x P(x) P(c) Rationale: if a statement is true for something, then call that something c. The constant c must be new (never before used). Use: we can replace existentially quantified variables with constants (even though we don t know their names). 10/1/12 CS160 Fall Semester 2012 25 EI Example All people are mortal. People (a person) exist. Show that something is mortal. 1 x P(x) M(x) Premise 2 xp(x) Premise 3 P(c) EI(2) 4 P(c) M(c) UI(1) 5 M(c) Modus ponens (3),(4) 6 xm(x) EG(5) 10/1/12 CS160 Fall Semester 2012 26 Universal Generalization (UG) P(c) x P(x) Restrictions on UG UG is only truth-preserving under certain circumstances: Rationale: if a statement is true for an arbitrary thing, it must be true for all things. Really? Are you sure? All the time? 10/1/12 CS160 Fall Semester 2012 27 UG may not be applied to any constant that appears in a premise, assumption, or any line derived by Existential Instantiation (EI) 10/1/12 CS160 Fall Semester 2012 28 7

1 x M(x) Premise 2 M(sue) EI (1) Fallacy! Fallacy! Some people are mortal, therefore all people are mortal. 3 x M(x) UG (2) Violates rules! Predicate Logic Equivalences Statements are logically equivalent iff they have the same truth value under all possible bindings. For example: x(p(x) Q(x)) xp(x) xq(x) In English, given domain of students in CS160, all students have passed MCC124 course (P) and are registered at CSU (Q); hence, all students have passed MCC124 and all students are registered at CSU. 10/1/12 CS160 Fall Semester 2012 29 10/1/12 CS160 Fall Semester 2012 30 Other Equivalences x(p(x) Q(x)) xp(x) xq(x) Someone likes skiing (P) or likes swimming (Q); hence, there exists someone who likes skiing or there exists someone who likes swimming. Note that on the right side, it may not be the same person who likes skiing and who likes swimming. x P(x) x P(x) Not everyone likes to go to the dentist; hence there is someone who does not like to go to the dentist. x P(x) x P(x) There is not anyone who likes to go to the dentist; hence everyone does not like to go to the dentist. 10/1/12 CS160 Fall Semester 2012 31 Why Another Version is not Equivalence xp(x) xp(x) The left and right hand sides are not equivalent because universal quantification requires P to hold for all possible x s, while existential quantification requires it to hold for at least one. However xp(x) xp(x) 10/1/12 CS160 Fall Semester 2012 32 8

Stepping Back What should you be able to do? Given assumptions as propositions, formally prove a conclusion Given assumptions in the form of predicates, formally prove a conclusion 10/1/12 CS160 Fall Semester 2012 33 9