#### Transcript Introduction to Database Systems

```Predicate Logic
•
Purpose of Section: To introduce predicate logic (or firstorder logic) which the language of mathematics.
We will see how predicate logic extends the language of
propositional calculus studied in Sections 1.1, 1.2 and 1.3 by
the inclusion of universal and existential quantifiers, logical
functions and variables.
Instructor: Hayk Melikya
Introduction to Abstract Mathematics
[email protected]
1
Predicates
Propositional logic as studied in lectures 1, 2 and 3 involve the truth or
falsity of simple sentences, whereas predicate logic is richer and allows
one to express concepts about collections of objects (maybe real numbers,
natural numbers, or functions).
All man are mortal.
Socrates is a man .
Therefore, Socrates is mortal
or
“for any real number x there exists a real number y that satisfies x < y ”
( we are making a claim about the validity of x < y over a collection of numbers x
and y )
or
“ x + 4 > 11”
Introduction to Abstract Mathematics
2
A sentences that have variables into which we can substitute values
to make them propositions we call predicates (open sentences)
P(x) := “ x + 2 = 9 ”
(substitute x by any real number )
Q(x, y) := “ if x and y are integers then x + 3y is multiple of 5 ”
( substitute x and y by any integer )
R(x, y, z):= “ x + (y + z) = (x + y ) + z ”
(substitute x, y, and z by any rational number)
A Universe (also called universe of discourse) is the set of
values one can substitute for variables
Introduction to Abstract Mathematics
3
Truth Set
Let P(x) be an open sentence or predicate with the specified universe
(also called universe of discourse) U, then the collection of all
objects from U that may be substituted to make an open sentence
P(x) a true proposition is called the truth set of predicate P(x).
Example: The truth set of the proposition Q(x) := “ x2 = 16 ”
is depends of choice of universe. If universe is specified to be set
of natural numbers N then the truth set is {4} .
With the universe specified to be set of all integers Z then the truth
set is {4, -4}.
Introduction to Abstract Mathematics
4
You should remember the symbols used to denote for each set such as
increasing collection of set N, Z, Q, R, C since we will be referring
to these sets in the remainder of the book.
Introduction to Abstract Mathematics
5
More examples
Prime(n) :=“ n is a prime number”
▪ Student(x) := “ x is a student if mathematics”
▪ A(x) := “ x will get an A in the course”
▪ P(x, y) := “ x divides y ”
▪ S(x, y, z) := “ x2 + y2 + z2 = 1”
Introduction to Abstract Mathematics
6
Quantification
The phrase “for all,” is called the universal quantifier and is denoted by 
(upside down capital A), and
“there exists” is called the existential quantifier and denoted 
(backwards capital E).
• Universal quantifier:
( x U) P(x) means
“For all (or any) x in the set U, the expression P(x) ”
Existential quantifier:
( xU) P(x) means
“There exists an x in the set U such that the expression P(x) ”
Introduction to Abstract Mathematics
7
Examples:
Example 1.
▪ ( x R )(( x < 0) ( x > -3))
For all real numbers x either x is less than zero or x is greater than to
negative three.
Example 2.
▪ ( x R )( x R )( x < y)
For all (or any) real numbers x there exists a real number y that satisfies
x < y.
Introduction to Abstract Mathematics
8
Margin Note:

In books when one sees a statement like “If x is an integer then x is a
rational number,” one means
( x Z)(x Z  x Q) or ( x Z)(x Q)
In other words the universal quantifier is understood.

Existential quantifier is always explicitly be present to mean that.
Introduction to Abstract Mathematics
9
Universal quantifier
If P(x) is an open sentence with the single variable x then (x U)P(x) is a
proposition and it is true if the truth set of P(x) is the entire universe U and
false otherwise.
Example:
P(x):= “ x + 2 > x” then (xR)P(x) is true proposition.
Example:
Q(x):= “ x + 2 > 11” then (xR)Q(x) is false proposition.
Introduction to Abstract Mathematics
10
Existential quantifier
If P(x) is an open sentence with the single variable x then (x U)P(x) is a
proposition and it is true if the truth set of P(x) is not empty and it is
false if the truth set is empty.
Example:
Q(x):= “ x + 2 > 11” then (xR)Q(x) is true proposition.
H(x) := “ x2 = 5 ” then (xZ)H(x) is false proposition.
Introduction to Abstract Mathematics
11
Below are English language interpretations of predicate logic sentences.
Some sentences include more than one quantifier.
Introduction to Abstract Mathematics
12
Interchanging Quantifiers  
Does the order of the quantifiers make a difference in the
 meaning of the sentence?
 The four drawings a), b), c) and d) in Figure 1 illustrate
visually the following implication
( x)( y)P(x, y)  ( x)( y)P(x, y)  ( y)( y)P(x, y)  ( x)( y)P(x, y)
Introduction to Abstract Mathematics
13
( x)( y)P(x, y)  ( x)( y)P(x, y)  ( y)( y)P(x, y)  ( x)( y)P(x, y)
Introduction to Abstract Mathematics
14
If the proposition ( x)( y)P(x, y) true then for all x and y , the predicate
P(x, y) is true. That is, the statement is true if P(x, y) is true everywhere in
The theorem (y)(x)P(x, y) means there exists a y, say y0, such that for all
x the statement P(x, y0) is true. We draw the horizontal line y = y0 illustrating
that the theorem is true if P(x, y) is true everywhere on this line.
If we permute the quantifiers the theorem becomes (x)(y)P(x, y)
which says for all x there exists a y = f (x) such that P(x, y) is true. Note that
the constant function in b), being a special case of the arbitrary function f(x)
in c) shows the important implication
( x)( y)P(x, y)  ( y)( x)P(x, y)
The implication does not go the other way as proven by the following
counterexample ( P(x, y):= “ x < y ” )
( x)( y)(x< y)  ( x)( y)(x <y)
Here the hypothesis is true but the conclusion is false.
Introduction to Abstract Mathematics
15
( x)( y)P(x, y)  ( y)( x)P(x, y)
The implication does not go the other way as proven by the following
counterexample ( P(x, y):= “ x < y ” )
( x)( y)(x< y)  ( x)( y)(x <y)
Here the hypothesis is true but the conclusion is false.
The statement ( y)(y)P(x, y) is a pure existence theorem and is
true if there exists at least one point ( x0 , y0 ) where P( x, y) is true.
This statement is the weakest of the four statement
Introduction to Abstract Mathematics
16
Elements of Predicate Calculus
We will extend logical operations , , ~, ,  introduce in
propositional calculus for predicates as follows:
1. If X and Y are two predicates then
X  Y , X  Y, X  Y, X  Y and ~X
are predicates and for any assignment of variables the truth value of
resulting predicate is defined according the truth table of respective
propositional operation.
2. If P is a predicate and x a variable then
(x)P and (x)P both are predicate
Recall that any propositions itself is a predicate too
Introduction to Abstract Mathematics
17
Equivalence of two predicates
Two predicated P(x) and Q(x) with the specified universe U are said to be
equivalent over the universe U of they have same truth set. We will write
P(x) U Q(x)
if P(x) and Q(x) are equivalent of the universe U.
Two quantified predicates are said to be equivalent if they are equivalent
over the any universe.
Example:
(x) (x > 3) Z (x) (x > 3.7 )
But it is not true
(x) (x > 3) R (x) (x > 3.7 ) .
Compare their truth set.
Example:
If P(x) and Q(x) are predicates then (x) (P(x)  Q(x)) and (x)(Q(x))  P(x))
are equivalent over any universe
(x) (P(x)  Q(x))  (x)(Q(x))  P(x) )
Introduction to Abstract Mathematics
18
Negating quantified predicates:
Theorem: Let P(x) be a predicate with variable x then
(x) (P(x)  ( x) P(x) )
( x) (P(x)  ( x) P(x) )
Proof.
If U is the universe, then (x) (P(x) is true in U if (x)(P(x) is
false in U which means that the truth set of it is not the univese
or for some a from universe P(a) is not true hance P(a) is true
which tells us that (x) P(x) true.
This theorem is very useful for finding denials of quantified
sentences
Introduction to Abstract Mathematics
19
More Examples
The following table shows how statements in predicate logicare
negated.
Introduction to Abstract Mathematics
20
Some Examples:
Every day it rains.
There exists a day when it doesn’t rain.
There exists a number that is positive.
Every number is not positive
All prime numbers are odd.
There exists a prime number that is not odd.
At least one day I will go to class.
I will never go to class.
Introduction to Abstract Mathematics
21
There exists unique !
For an open sentence P(x), the proposition (!x)P(x) is read
“ there exists unique x such that P(x)” and it is true if the truth set
of P(x) has exactly one element from the universe.
It is true that
(!x)P(x)  (x)P(x)
(x)P(x)  (!x)P(x) ?
Introduction to Abstract Mathematics
22
Example:
Recall from the calculus that the limit of f(x) as x approaches a to is L if for
Each ε>0 there is a δ>0 such that if | x -a|< δ and x a then |f(x) -L|< ε .
This definition of limit involves several quantifiers.
Let symbolically define the limit and then negate it .
( ε>0) ( δ>0 ) ( x)(0 < | x -a|< δ |f(x) - L|< ε)
Negation
( ε>0) ( δ>0 ) (  x)(0 < | x -a|< δ |f(x) - L| ε)
Introduction to Abstract Mathematics
23
```