You are on page 1of 40

UNIVERSITY OF SANTO TOMAS

INSTITUTE OF INFORMATION AND COMPUTING SCIENCES

PREDICATED LOGIC

LECTURE BY:
MS. CHERRY ROSE ESTABILLO

CS201 - CRRESTABILLO
UNIVERSITY OF SANTO TOMAS
INSTITUTE OF INFORMATION AND COMPUTING SCIENCES

PREDICATED LOGIC
Predicate Logic is an extension of
Propositional Logic.
It was used to express the meaning of
wide range of statements in
mathematics and computer science in
ways that permit us to reason and
explore relationships between objects

CS201 - CRRESTABILLO
UNIVERSITY OF SANTO TOMAS
INSTITUTE OF INFORMATION AND COMPUTING SCIENCES

Consider the statement:


x>5
x=y+2
Computer x is under attack by
hackers.

neither true nor false when the values


of the variables are not specified
CS201 - CRRESTABILLO
UNIVERSITY OF SANTO TOMAS
INSTITUTE OF INFORMATION AND COMPUTING SCIENCES

Two components:

The variable subject of the


statement
Predicate refers to a
property that the subject of
the statement can have.
CS201 - CRRESTABILLO
UNIVERSITY OF SANTO TOMAS
INSTITUTE OF INFORMATION AND COMPUTING SCIENCES

Consider, x > 5
variable: x
P: is greater than 5
Propositional function P at x: P(x)

P(8)
P(1)
CS201 - CRRESTABILLO
UNIVERSITY OF SANTO TOMAS
INSTITUTE OF INFORMATION AND COMPUTING SCIENCES

Consider, x=y+2
variable: x, y
Predicate: Q
Propositional function Q at x,y: Q(x,y)

Q(1,3)
Q(7,5)
CS201 - CRRESTABILLO
UNIVERSITY OF SANTO TOMAS
INSTITUTE OF INFORMATION AND COMPUTING SCIENCES

A statement can have more


than one variable.
A statement of the form
(1 , 2 , , )is the value of the
propositional function P at the n-tuple
(1 , 2 , , ).
P is called a n-place predicate or a
n-ary predicate.
CS201 - CRRESTABILLO
UNIVERSITY OF SANTO TOMAS
INSTITUTE OF INFORMATION AND COMPUTING SCIENCES

Exercise
1.) Let P(x) denote the statement
x4. What are the truth values?
a.) P(0) b) P(4) c.) P(6)
2.) Let P(x) denote the statement the
word x contains the letter a. What are
the truth values?
a.) P(orange) b) P(lemon)
c.) P(true) d) P(false)
CS201 - CRRESTABILLO
UNIVERSITY OF SANTO TOMAS
INSTITUTE OF INFORMATION AND COMPUTING SCIENCES

THE TRUTH VALUES


Determine the truth values of the ff.
statements
(1) P(x) : 3x + 5 < 3 ; P(2), P(4)

(2) P(x, y) : 2x 3y = 4 ; P(0, 1) , P(6, 1)

(3) P(x, y, z) : x y < z ; P(1, 1,1), P(2, -1, 0)


CS201 - CRRESTABILLO
UNIVERSITY OF SANTO TOMAS
INSTITUTE OF INFORMATION AND COMPUTING SCIENCES

These propositions can be negated or


conjoined
Z: is an integer f: nine
Q: is a rational number t: zero

Nine is not an integer.


Nine is an integer and zero is a rational number.
If nine is an integer, then zero is a rational
number.
CS201 - CRRESTABILLO
UNIVERSITY OF SANTO TOMAS
INSTITUTE OF INFORMATION AND COMPUTING SCIENCES

PROPOSITIONAL FUNCTION
Let P(x) be a statement involving the
variable x and let D be a set. We call P a
PROPOSITIONAL FUNCTION (wrt D) if for
each x in D, P(x) is a PROPOSITION. We
call D the DOMAIN OF DISCOURSE.

CS201 - CRRESTABILLO
UNIVERSITY OF SANTO TOMAS
INSTITUTE OF INFORMATION AND COMPUTING SCIENCES

Let:
P(x) : x + 2x2 is a rational number.
D: set of rational numbers

P(x) : Student x scored perfect in the


test.
D: set of students
CS201 - CRRESTABILLO
UNIVERSITY OF SANTO TOMAS
INSTITUTE OF INFORMATION AND COMPUTING SCIENCES

QUANTIFICATION
- used to create a proposition from a
propositional function. It expresses
the extent to which a predicate is true
over a range of elements.

TWO TYPES OF QUANTIFICATION


(1)UNIVERSAL QUANTIFICATION
(2)EXISTENTIAL QUANTIFICATION

CS201 - CRRESTABILLO
UNIVERSITY OF SANTO TOMAS
INSTITUTE OF INFORMATION AND COMPUTING SCIENCES

THE UNIVERSAL QUANTIFIER


Let P(x) be a proposition function with domain
of discourse D.
The statement for every x, P(x) is said to be
UNIVERSAL QUANTIFIED STATEMENT.
The symbol (universal quantifier) means for
every or for All
The statement for all x, P(x) can be written as
xP(x).
CS201 - CRRESTABILLO
UNIVERSITY OF SANTO TOMAS
INSTITUTE OF INFORMATION AND COMPUTING SCIENCES

THE UNIVERSAL QUANTIFIER

The statement for all x, P(x) is TRUE


if P(x) is true for every x in D.

The statement for all x, P(x) is FALSE


if P(x) is false for at least one x in D.

CS201 - CRRESTABILLO
UNIVERSITY OF SANTO TOMAS
INSTITUTE OF INFORMATION AND COMPUTING SCIENCES

Examples
(1)Let P(x) be the statement x + 2 > 2.
What is the truth value of the
quantification xP(x), where the domain
consist of all non-negative integers?
(2) What is the truth value of xP(x), where
P(x) is the statement x2 < 9 and the
domain consists of the positive integers
less than 3?

CS201 - CRRESTABILLO
UNIVERSITY OF SANTO TOMAS
INSTITUTE OF INFORMATION AND COMPUTING SCIENCES

THE EXISTENTIAL QUANTIFIER


Let P(x) be a proposition function with
domain of discourse D.
The statement for some x, P(x) is said to be
EXISTENTIALLY QUANTIFIED STATEMENT.
The symbol (existential quantifier) means
for some or there exists.
The statement for some x, P(x) can be
written as xP(x).
CS201 - CRRESTABILLO
UNIVERSITY OF SANTO TOMAS
INSTITUTE OF INFORMATION AND COMPUTING SCIENCES

THE EXISTENTIAL QUANTIFIER


The statement for some x, P(x) is TRUE if
P(x) is true for at least one x in D.
The statement for some x, P(x) is FALSE if
P(x) is false for every x in D.

CS201 - CRRESTABILLO
UNIVERSITY OF SANTO TOMAS
INSTITUTE OF INFORMATION AND COMPUTING SCIENCES

Examples
(1)Let P(x) be the statement x + 2 > 2.
What is the truth value of the
quantification xP(x), where the domain
consist of all non-negative integers?
(2) What is the truth value of xP(x), where
P(x) is the statement x2 < 9 and the
domain consists of the positive integers
not exceeding 3?

CS201 - CRRESTABILLO
UNIVERSITY OF SANTO TOMAS
INSTITUTE OF INFORMATION AND COMPUTING SCIENCES

Exercises
Let P(x) be the statement x has visited
the Museum where the domain consists
of the students UST. Express each of
these quantifications in English.
(1)xP(x)
(2)x P(x)
(3)xP(x)
(4)x P(x)
CS201 - CRRESTABILLO
UNIVERSITY OF SANTO TOMAS
INSTITUTE OF INFORMATION AND COMPUTING SCIENCES

Exercises
Translate these statements into English,
where C(x) is x is a comedian and F(x) is
x is funny and the domain consists of
all people.
(1)x(C(x) F(x))
(2)x (C(x) F(x))
(3)x(C(x) F(x))
(4)x (C(x) F(x))
CS201 - CRRESTABILLO
UNIVERSITY OF SANTO TOMAS
INSTITUTE OF INFORMATION AND COMPUTING SCIENCES

Exercise
Let C(x) be the statement x has a cat, let D(x) be the
statement x has a dog, and let H(x) be the statement x
has a hamster. Express each of these statement in terms
of C(x), D(x), H(x), quantifiers, and logical connectives. Let
the domain consist of all students in your class.
1.) A student in your class has a cat, a dog and a hamster.
2.) All student in your class has a cat, a dog or a hamster.
3.) Some student in your class has a cat and a hamster, but
not a dog.

CS201 - CRRESTABILLO
UNIVERSITY OF SANTO TOMAS
INSTITUTE OF INFORMATION AND COMPUTING SCIENCES

OTHER QUANTIFIERS
UNIQUENESS QUANTIFIER
The statement There exists a unique x
such that P(x) is true or there is exactly
one or there is one and only one is an
example of quantification using
UNIQUENESS QUANTIFIER.
And this can be written as !xP(x).
CS201 - CRRESTABILLO
UNIVERSITY OF SANTO TOMAS
INSTITUTE OF INFORMATION AND COMPUTING SCIENCES

Quantifiers with Restricted Domain


To restrict a domain, an abbreviated notation
is often used

Example 1: x<0 (x>0) where the


domain is all real numbers
The square of a negative real number is
positive. x(x<0 x>0)
CS201 - CRRESTABILLO
UNIVERSITY OF SANTO TOMAS
INSTITUTE OF INFORMATION AND COMPUTING SCIENCES

Example 2: y0 (y 0) where
the domain is all real numbers
The cube of a nonzero real number is nonzero.

y(y0 y0)

CS201 - CRRESTABILLO
UNIVERSITY OF SANTO TOMAS
INSTITUTE OF INFORMATION AND COMPUTING SCIENCES

PRECEDENCE QUANTIFIER
The quantifiers and have higher
precedence than all logical operations.

Example.
The conjunction of xP(x) and Q(x) :
(xP(x))Q(x) rather than x(P(x)Q(x)).

CS201 - CRRESTABILLO
UNIVERSITY OF SANTO TOMAS
INSTITUTE OF INFORMATION AND COMPUTING SCIENCES

DEFINITION
The occurrence of the variable is said to be
BOUND when the quantifier is used on the
variable.
The occurrence of the variable that is not bound
by a quantifier is said to be FREE.
The part of a logical expression to which a
quantifier is applied called the SCOPE of
quantifier.
CS201 - CRRESTABILLO
UNIVERSITY OF SANTO TOMAS
INSTITUTE OF INFORMATION AND COMPUTING SCIENCES

Example
(1) x(4x + 4y <2z)
Bound: x (by universal quantifier)
Free: y & z

(2) x(P(x)Q(x))xR(x)
Bound: all variables
Free: DOES NOT EXIST
Scope of x: P(x)Q(x) Scope of x: R(x)
CS201 - CRRESTABILLO
UNIVERSITY OF SANTO TOMAS
INSTITUTE OF INFORMATION AND COMPUTING SCIENCES

NEGATING QUANTIFIED EXPRESSIONS


NEGATION EQUIVALENT WHEN IS WHEN IS NEGATION
STATEMENT NEGATION TRUE? FALSE?

xP(x) xP(x) For every x, There is an x


P(x) is false for which P(x)
is true.
xP(x) xP(x) There is an x P(x) is true for
for which every x.
P(x) is false.
Note: The rules for negations for quantifiers are
called DE MORGANS LAWS FOR QUANTIFIERS
CS201 - CRRESTABILLO
UNIVERSITY OF SANTO TOMAS
INSTITUTE OF INFORMATION AND COMPUTING SCIENCES

Examples
What are the negations of
1.) x(x>x)
2.) x(x=9)

Show that x(P(x) Q(x)) and


x(P(x) Q(x)) are logically
equivalent.
CS201 - CRRESTABILLO
UNIVERSITY OF SANTO TOMAS
INSTITUTE OF INFORMATION AND COMPUTING SCIENCES

TWO PLACE PREDICATES


TWO-PLACE PREDICATES are referred to as
relational predicates, they express a
relation between two components.
Let P(x,y): x is easier than y
xP(x, y): Some x is easier than y.
yP(x,y): x is easier than every y.

CS201 - CRRESTABILLO
UNIVERSITY OF SANTO TOMAS
INSTITUTE OF INFORMATION AND COMPUTING SCIENCES

NESTED QUANTIFIERS
Two quantifiers are NESTED if one quantifier is
within the scope of the other quantifier.
EXAMPLE
xy((x<0)(y<0))(xy < 0)
Consider that the domain of discourse for both
variables are real numbers.
For all real number x and for all real number y,
if x is less than 0 or y less than 0, then xy is
less than 0.
CS201 - CRRESTABILLO
UNIVERSITY OF SANTO TOMAS
INSTITUTE OF INFORMATION AND COMPUTING SCIENCES

Exercise
Let P(x,y) be the statement student x has
taken y, where domain of x consists of all
students of IICS and y consists of all Math
courses. Express each of these
quantifications in English sentences.
1.) xyP(x,y) 4.) xyP(x,y)
2.) yxP(x,y) 5.) xyP(x,y)
3.) xyP(x,y) 6.) yxP(x,y)

CS201 - CRRESTABILLO
UNIVERSITY OF SANTO TOMAS
INSTITUTE OF INFORMATION AND COMPUTING SCIENCES

THE ORDER OF QUANTIFIERS


Let P(x, y): 2xy = 3x + y
What are the truth values of
xyP(x, y) yxP(x, y)
xyP(x, y) xyP(x, y)
xyP(x, y) yxP(x, y)
where the domain for all variables consists
of all real numbers?
CS201 - CRRESTABILLO
UNIVERSITY OF SANTO TOMAS
INSTITUTE OF INFORMATION AND COMPUTING SCIENCES

QUANTIFICATION OF TWO VARIABLES


STATEMENT WHEN TRUE? WHEN FALSE?
xyP(x, y) P(x, y) is true for There is a pair x, y for
yxP(x, y) every pair x, y. which P(x, y) is false.

xyP(x, y) For every x, there is There is an x such that


a y for which P(x, y) P(x, y) is false for every
is true. y.
xyP(x, y) There is an x for For every x there is a y
which P(x, y) is true for which P(x, y) is false.
for every y.
xyP(x, y) There is pair x, y for P(x, y) is false for every
yxP(x, y) which P(x, y) is true. x, y.

CS201 - CRRESTABILLO
UNIVERSITY OF SANTO TOMAS
INSTITUTE OF INFORMATION AND COMPUTING SCIENCES

Exercise
Let P(x, y): 2x + y =5
What are the truth values of
xyP(x, y) yxP(x, y)
xyP(x, y) xyP(x, y)
xyP(x, y) yxP(x, y)
where the domain for all variables consists
of all integers?
CS201 - CRRESTABILLO
UNIVERSITY OF SANTO TOMAS
INSTITUTE OF INFORMATION AND COMPUTING SCIENCES

Exercise
1.)Let P(x, y): x + 1 > y + 1
What are the truth values of
a.)xyP(x, y) c.) xyP(x, y)
b.) xyP(x, y) d.) xyP(x, y)
where the domain for all variables consists of all
integers?
2.) Express the negations of each statements so that
negation symbols immediately precedes predicates.
a.) xy(P(x,y)Q(x,y))
b.) xyP(x,y)xyQ(x,y)
CS201 - CRRESTABILLO
UNIVERSITY OF SANTO TOMAS
INSTITUTE OF INFORMATION AND COMPUTING SCIENCES

PRACTICE
Let Q(x) be the statement x+1>2x. If the
domain consists of the integers, what are
the truth values?
(1)Q(0) (4) xQ(x)
(2)Q(-1) (5) xQ(x)
(3)Q(1) (6) xQ(x)
(7) xQ(x)
CS201 - CRRESTABILLO
UNIVERSITY OF SANTO TOMAS
INSTITUTE OF INFORMATION AND COMPUTING SCIENCES

PRACTICE
Determine the truth value of each of these
statements if the domain for all variables
consists of integers.
1.) nm(n<m)
2.) nm(n+m=0)
3.) nm(n<m)
4.) nm(n+m=5)
CS201 - CRRESTABILLO
UNIVERSITY OF SANTO TOMAS
INSTITUTE OF INFORMATION AND COMPUTING SCIENCES

PRACTICE
Let P(x, y): x+2=3xy
What are the truth values of
xyP(x, y) xyP(x, y)
xyP(x, y) xyP(x, y)
where the domain for all variables consists of
a.) integers
b.) nonzero real numbers
c.) non-negative real numbers
CS201 - CRRESTABILLO

You might also like