Professional Documents
Culture Documents
Lec 6-7-8 DS
Lec 6-7-8 DS
Lec 6-7-8 DS
Lecture # 6,7,8
Muhammad Sultan Zia Assistant Professor COMSATS, Institute of Information Technology, Sahiwal
Overview
Predicate Logic
Propositional logic provides a useful setting in which we can analyze many types of logical argument There are situations, however, where propositional logic is inadequate. e.g.
All even numbers are integers. 8 is an even number. Therefore 8 is an integer. It is not true that all prime numbers are odd. Therefore there must be at least one prime number that is not odd.
COMSATS, Institute of Information Technology, Sahiwal
Predicate Logic
There are situations (as in previous examples) where propositional logic is inadequate, because it cannot deal with the logical structure that is sometimes present within atomic propositions In order to analyze such arguments, we need to look at the logical structure within atomic propositions. Predicate logic allows us to do this
COMSATS, Institute of Information Technology, Sahiwal
Predicate/Propositional Function
A predicate is a statement containing one or more variables. If values are assigned to all the variables in a predicate, the resulting statement is a proposition. Examples x is a multiple of 5 P(x) = x < 5
Predicate/Propositional Function
Functions with multiple variables:
P(x,y) = x + y == 0
P(1,2) is false, P(1,-1) is true
P(x,y,z) = x + y == z
P(3,4,5) is false, P(1,2,3) is true
P(x1,x2,x3 xn) =
COMSATS, Institute of Information Technology, Sahiwal
Predicate/Propositional Function
Functions with multiple variables:
x is taller than y a is greater than one of b, c x is at least n inches taller than y
Quantifiers
Why quantifiers?
Many things (in this course and beyond) are specified using quantifiers
Universal Quantification
Represented by an upside-down A:
It means for all Let P(x) = x+1 > x
Universal Quantification
But is that always true?
x P(x)
Universal Quantification
Let the universe be the real numbers. Let P(x) = x/2 < x
Not true for the negative numbers! Thus, x P(x) is false
When the domain is all the real numbers
In order to prove that a universal quantification is true, it must be shown for ALL cases In order to prove that a universal quantification is false, it must be shown to be false for only ONE case
COMSATS, Institute of Information Technology, Sahiwal
Universal Quantification
Given some propositional function P(x) And values in the universe x1 .. xn The universal quantification x P(x) implies: P(x1) P(x2) P(xn)
COMSATS, Institute of Information Technology, Sahiwal
Existential Quantification
Represented by an backwards E:
It means there exists Let P(x) = x+1 > x
Existential Quantification
Note that you still have to specify your universe Let P(x) = x+1 < x
There is no numerical value x for which x+1<x Thus, x P(x) is false
Existential Quantification
Let P(x) = x+1 > x
There is a numerical value for which x+1>x In fact, its true for all of the values of x! Thus, x P(x) is true
In order to show an existential quantification is true, you only have to find ONE value In order to show an existential quantification is false, you have to show its false for ALL values
COMSATS, Institute of Information Technology, Sahiwal
Existential Quantification
Given some propositional function P(x) And values in the universe x1 .. xn The existential quantification x P(x) implies: P(x1) P(x2) P(xn)
COMSATS, Institute of Information Technology, Sahiwal
A Note on Quantifiers
Recall that P(x) is a propositional function
Let P(x) be x == 0
Provide a quantification
For example, x P(x) is false and x P(x) is true
Let the universe of discourse be the real numbers
COMSATS, Institute of Information Technology, Sahiwal
Binding Variables
Let P(x,y) be x > y Consider: x P(x,y)
This is not a proposition! What is y?
If its 5, then x P(x,y) is false If its x-1, then x P(x,y) is true
Example 1
Write the following propositions in symbols:
For every number x there is a number y such that y = x + 1. There is a number y such that, for every number x, y = x + 1.
Solution:
Let P(x,y) denote the predicate y = x + 1.
Multivariate Quantification
When two or more variables are involved each of which is bound by a quantifier, the order of the binding is important and the meaning often requires some thought.
Quantifiers
When evaluating an expression such as x y z P (x,y,z ) Translate the proposition in the same order to English: There is an x such that for all y there is a z such that P (x,y,z) holds.
Parsing Example
P (x,y,z ) = y - x z There is an x such that for all y there is a z such that y - x z. There is some number x which when subtracted from any number y results in a number bigger than some number z. Q: If the universe of discourse for x, y, and z is the non-negative integers {0,1,2,3,4,5,6,7,} whats the truth value of xy z P (x,y,z )?
COMSATS, Institute of Information Technology, Sahiwal
Parsing Example
A: True. For any exists we need to find a positive instance. Since x is the first variable in the expression and is existential, we need a number that works for all other y, z. Set x = 0 (want to ensure that y -x is not too small). Now for each y we need to find a positive instance z such that y - x z holds. Plugging in x = 0 we need to satisfy y z so we have many solutions like z := y or z := 0 or some other valid solution.
COMSATS, Institute of Information Technology, Sahiwal
Parsing Example
Q: Isnt it simpler to satisfy x y z (y - x z ) by setting x := y and z := 0 ? A: No, this is illegal ! The existence of x comes before we know about y. I.e., the scope of x is higher than the scope of y so as far as y can tell, x is a constant and cannot affect x.
COMSATS, Institute of Information Technology, Sahiwal
Order Matters
Set the universe of discourse to be whole numbers {0, 1, 2, 3, }. Let R (x,y ) = x < y. Q1: What does x y R (x,y ) mean?
All numbers x admit a bigger number y
True
False
a) Seat s has been booked. b) Person p has booked a (that is, at least one) seat. c) All the seats are booked. d) No seat is booked by more than one person.
COMSATS, Institute of Information Technology, Sahiwal
x (S(x)C(x))
This is wrong! Why?
x (S(x)C(x))
Let:
S(x) be x is a student in this class M(x) be x has visited Mexico C(x) be x has visited Canada
x M(x)
True if the universe of discourse is all students
x (S(x) M(x))
COMSATS, Institute of Information Technology, Sahiwal
x (S(x)(M(x)C(x))
When the universe of discourse is all people
COMSATS, Institute of Information Technology, Sahiwal
Negating Quantifications
Consider the statement:
All students in this class have black hair
Negating Quantifications
Consider the statement:
There is a student in this class with red hair
Negation Example
Compute: x y x2 y
In English, we are trying to find the opposite of every x admits a y greater or equal to xs square. The opposite is that some x does not admit a y greater or equal to xs square Algebraically, one just flips all quantifiers from to and vice versa, and negates the interior propositional function. In our case we get:
x y ( x 2 y ) x y x 2 > y
COMSATS, Institute of Information Technology, Sahiwal