Predicates & Quantifiers Goal: Introduce predicate logic, including existential & universal quantification Introduce translation between English sentences.

Slides:



Advertisements
Similar presentations
Nested Quantifiers Section 1.4.
Advertisements

1.3 Predicates and Quantifiers
The Logic of Quantified Statements
Section 1.3. More Logical Equivalences Constructing New Logical Equivalences We can show that two expressions are logically equivalent by developing.
Chapter 1: The Foundations: Logic and Proofs 1.1 Propositional Logic 1.2 Propositional Equivalences 1.3 Predicates and Quantifiers 1.4 Nested Quantifiers.
Predicates and Quantifiers
1 Predicates and quantifiers Chapter 8 Formal Specification using Z.
Discrete Mathematics Math 6A Instructor: M. Welling.
Sets. Copyright © Peter Cappello Definition Visualize a dictionary as a directed graph. Nodes represent words If word w is defined in terms of word.
Nested Quantifiers Goals: Explain how to work with nested quantifiers
Introduction to Proofs Goals 1.Introduce notion of proof & basic proof methods. 2.Distinguish between correct & incorrect arguments 3.Understand & construct.
CSE115/ENGR160 Discrete Mathematics 01/20/11 Ming-Hsuan Yang UC Merced 1.
Predicates and Quantifiers
Chapter 1: The Foundations: Logic and Proofs
Discrete Mathematics Goals of a Discrete Mathematics Learn how to think mathematically 1. Mathematical Reasoning Foundation for discussions of methods.
The Foundations: Logic and Proofs
Logical Equivalence & Predicate Logic
MATH 224 – Discrete Mathematics
Nested Quantifiers. 2 Nested Iteration Let the domain be {1, 2, …, 10}. Let P(x, y) denote x > y.  x,  y, P(x, y) means  x, (  y, P(x, y) ) Is the.
Chapter 1, Part II: Predicate Logic With Question/Answer Animations.
Copyright © Cengage Learning. All rights reserved. CHAPTER 3 THE LOGIC OF QUANTIFIED STATEMENTS THE LOGIC OF QUANTIFIED STATEMENTS.
© Jalal Kawash 2010Peeking into Computer Science George Boole English Mathematician His The Mathematical Analysis of Logic, 1848 is the first.
Chapter 1, Part II: Predicate Logic With Question/Answer Animations.
Propositional Calculus CS 270: Mathematical Foundations of Computer Science Jeremy Johnson.
Math 51/COEN 19 Day 3, 1.4 Quantifiers 1. 3 Predicates A lot like functions that return booleans Let P(x) denote x
Chapter 2 The Logic of Quantified Statements. Section 2.1 Intro to Predicates & Quantified Statements.
Sets Goal: Introduce the basic terminology of set theory.
1 Sections 1.3 and 1.4 Predicates & Quantifiers. 2 Propositional Functions In a mathematical assertion, such as x < 3, there are two parts: –the subject,
Chapter 2 Logic 2.1 Statements 2.2 The Negation of a Statement 2.3 The Disjunction and Conjunction of Statements 2.4 The Implication 2.5 More on Implications.
1 Introduction to Abstract Mathematics Predicate Logic Instructor: Hayk Melikya Purpose of Section: To introduce predicate logic (or.
CSS342: Quantifiers1 Professor: Munehiro Fukuda. CSS342: Quantifiers2 Review of Propositions Proposition: a statement that is either true or false, but.
Lecture Predicates and Quantifiers 1.4 Nested Quantifiers.
Fall 2008/2009 I. Arwa Linjawi & I. Asma’a Ashenkity 1 The Foundations: Logic and Proofs Predicates and Quantifiers.
Discrete Structures – CNS 2300
CS 285- Discrete Mathematics Lecture 4. Section 1.3 Predicate logic Predicate logic is an extension of propositional logic that permits concisely reasoning.
Discrete Structures Predicate Logic 1 Dr. Muhammad Humayoun Assistant Professor COMSATS Institute of Computer Science, Lahore.
Predicates and Quantifiers Dr. Yasir Ali. 1.Predicates 2.Quantifiers a.Universal Quantifiers b.Existential Quantifiers 3.Negation of Quantifiers 4.Universal.
Predicate Logic One step stronger than propositional logic Copyright © Curt Hill.
Copyright © Peter Cappello 2011 Predicates & Quantifiers.
PREDICATES AND QUANTIFIERS COSC-1321 Discrete Structures 1.
Section 1.4. Propositional Functions Propositional functions become propositions (and have truth values) when their variables are each replaced by a value.
رياضيات متقطعة لعلوم الحاسب MATH 226. Chapter 1 Predicates and Quantifiers 1.4.
Introduction to Proofs Goals 1.Introduce notion of proof & basic proof methods. 2.Distinguish between correct & incorrect arguments 3.Understand & construct.
Sets.
Chapter 7. Propositional and Predicate Logic
3. The Logic of Quantified Statements Summary
Propositional Equivalence
(State) Model-Based Approaches I Software Specification Lecture 35
CSE15 Discrete Mathematics 01/23/17
Predicates & Quantifiers
Rules of inference for quantifiers
Nested Quantifiers Goals: Explain how to work with nested quantifiers
Propositional Calculus: Boolean Functions and Expressions
Chapter 1 The Foundations: Logic and Proofs
The Foundations: Logic and Proofs
CS201: Data Structures and Discrete Mathematics I
1.4 Predicates and Quantifiers
CS 220: Discrete Structures and their Applications
Copyright © Cengage Learning. All rights reserved.
Mathematics for Computer Science MIT 6.042J/18.062J
Nested Quantifiers Nested quantifiers are often necessary to express the meaning of sentences in English as well as important concepts in computer science.
Discrete Mathematics Lecture 4 & 5: Predicate and Quantifier
Discrete Mathematics Lecture 3: Predicate and Quantifier
Discrete Mathematics CMP-200 Propositional Equivalences, Predicates & Quantifiers, Negating Quantified Statements Abdul Hameed
Chapter 7. Propositional and Predicate Logic
Discrete Mathematics Lecture 4 & 5: Predicate and Quantifier
George Boole English Mathematician
Predicates and Quantifiers
CS201: Data Structures and Discrete Mathematics I
Presentation transcript:

Predicates & Quantifiers Goal: Introduce predicate logic, including existential & universal quantification Introduce translation between English sentences & logical expressions.

Copyright © Peter Cappello The Limits of Propositional Logic Consider the argument – All computer science courses are easy. –CS 2 is a computer science course. –Therefore, CS 2 is easy. Translating into propositions, gives the form: –p –q –Therefore, r. But, (p  q)  r is not a tautology: The argument is not valid in propositional logic.

Copyright © Peter Cappello Declaration = subject + predicate A declarative sentence has a subject & a predicate. –A subject is a thing (e.g., object, entity, concept). –A predicate asserts that its subject has some property.

Copyright © Peter Cappello Examples Joe’s serves prime rib. [ P( Joe’s ) ] 7 is a prime number. [Q( 7 ) ] Jill is a prime candidate. [R( Jill ) ] Variable values are in a set called the domain. Each proposition above has a different domain (i.e., restaurants, integers, candidates, respectively).

Copyright © Peter Cappello Using variables Consider the argument: If ( x is a CS course )  ( x is easy ) AND CS 2 is a CS course. then CS 2 is easy. “x is a CS course” is not a proposition because x is a variable.

Copyright © Peter Cappello Propositional Function Denote “x is a CS class” by P( x ). P( Math 3A ) is a proposition. Denote “x 2 + y 2 = z 2 ” by P( x, y, z ). P( -1, 1, 17 ) is a proposition.

Copyright © Peter Cappello Preconditions & Postconditions The Java assert statement incorporates an executable propositional function. assert x != null;

Copyright © Peter Cappello Preconditions & Postconditions Integer abs( Integer x ) { assert x != null; if ( x < 0 ) x = new Integer( -x ); assert x >= 0; return x; }

Copyright © Peter Cappello Quantifiers A propositional function also is converted to a proposition via quantification. Let C denote the set of all UCSB courses. Let C be the domain of discourse or domain. Let P( x ) denote “x is a CS class”.

Copyright © Peter Cappello Universal Quantification Universal quantification of P( x ) is –“For all x in the domain, P( x )” –“For all x in C, P( x )” –“For all x, P( x )” –“  x P( x )” This is a proposition. If C denotes the set of all UCSB courses, is  x P( x ) true?

 x P( x ): Logical Equivalence If S, a set with n elements, e i, 1 ≤ i ≤ n, is the domain of propositional function P( x ), Then  x P( x ) ≡ P( e 1 ) ∧ P( e 2 ) ∧ … ∧ P( e n ) What if S is infinite? Copyright © Peter Cappello

Computational Interpretation // Pseudo-Java notation boolean forAllxPx( Set domain ) { for ( Object element : domain ) { if ( ! P( element ) ) return false; } return true; }

Copyright © Peter Cappello Existential Quantification Existential quantification of P( x ) is –“There exists an x in the domain, P( x )” –“There exists an x in C, P( x )” –“There exists an x, P( x )” –“  x P( x )” This is a proposition. Is  x P( x ) true?

 x P( x ): Logical Equivalence If S, a set with n elements, e i, 1 ≤ i ≤ n, is the domain of propositional function P( x ), Then  x P( x ) ≡ P( e 1 ) ∨ P( e 2 ) ∨ … ∨ P( e n ) What if S is infinite? Copyright © Peter Cappello

Computational Interpretation // Pseudo-Java notation boolean thereExistsxPx( Set domain ) { for ( Object element : domain ) { if (P( element ) ) return true; } return false; }

Copyright © Peter Cappello Precedence of Quantifiers  and  have higher precedence than logical operators.  x P( x )   P( x ) means (  x P( x ) )   P( x ) Is (  x P( x ) )   P( x ) a proposition? x in “  P( x )” is called an unbound or free variable

Copyright © Peter Cappello Logical Equivalence Let S & T be statements with predicates & quantifiers. For example S denotes “  x ( P( x )  Q (x ) ) T denotes “  x P( x )   x Q( x ) S is logically equivalent to T, denoted S ≡ T, when they have the same truth value regardless of which –Predicates are substituted into the statements –Domain of discourse is used for the variables. Is  x ( P( x )   P( x ) ) ≡  x P( x )   x  P( x ) ?

Copyright © Peter Cappello Logically Equivalent Forms Below, “one” means “at least one” “all true”  x P( x ) ≡ ~  x ~P( x ) “none false” “all false”  x ~P( x ) ≡ ~  x P( x ) “none true” “not all true” ~  x P( x ) ≡  x ~P( x ) “one false” “not all false” ~  x ~P( x ) ≡  x P( x ) “one true”

Copyright © Peter Cappello Translate English to a Logical Expression “A student is eligible to receive an MS degree, if the student has: –at least 60 units, or at least 45 units and written a master’s thesis –received a grade no lower than B in all required courses. ” Where –M( s ) denotes “student s is eligible to receive an MS degree.” –U( s, u ) denotes “student s has at least u units.” –T( s ) denotes “student s has written a master’s thesis.” –G( s ) denotes “student s received at least a B in all required courses.

Copyright © Peter Cappello One Translation –M( s ): “s eligible to receive an MS degree.” –U( s, u ): “s has taken at least u units.” –T( s ): “s has written a master’s thesis.” –G( s ): “s received at least a B in all required courses.  s ( ( ( U( s, 60 )  ( U( s, 45 )  T( s ) ) )  G(s) )  M( s ) ) Is this what you think the department wanted?

Copyright © Peter Cappello Translate English to a Logical Expression “There is a student who has taken more than 21 units in a quarter and received all As.” Where P( s, q ) denotes “s took > 21 units in quarter q.” Q( s, q ) denotes “s got all As in quarter q.” (Is Q defined correctly?)

Copyright © Peter Cappello One Translation  s  q ( P( s, q )  Q( s, q ) ), where P( s, q ): “s took > 21 units in quarter q.” Q( s, q ): “Student s got all As in quarter q.” This is an example of nested quantifiers, our next topic.