Vous êtes sur la page 1sur 35

Predicates &

quantifiers

PREDICATES
Consider these statement having variable:

x > 3

X= statement
Is greater than 3 = predicate

Where predicate refers to a property that


the subject of the statement can have.

We can denote x is greater than 3 by


P(x), where P denotes the predicate is
greater than 3 and x is the variable.
- the statement P(x) is also said to be the
value of the propositional function P at
x.

Property

One place predicate

Ex. Tom is a cat


Arity
number of elements in a predicate

Ex1 . Jane is a mother of Mary ( arity is 2)


Ex2 . The sum of 2 and 3 is 6 ( arity is 3)

Domain

Is a collection of all persons, ideas,


symbols , data structures and , so on, that
affect the logical argument under
consideration.

Example 1 : Let P(x) denote the


statement x > 3. What are the truth
values of P(4) and P(2)?
Solution: We obtain the statement P(4) by
setting x = 4 in the statement x > 3.
Hence,
P(4), which is the statement 4 > 3, is true.
However, P(2), which is the statement 2 >
3,
is false.

EXAMPLE 2:

Consider the statement ,

if x > 0 then x := x + 1.

When this statement is encountered in a program, the


value of the variable x at that point in the execution of
the program is inserted into P(x), which is x > 0. If P(x)
is true for this value
of x, the assignment statement x := x + 1 is executed, so
the value of x is increased by 1. If
P(x) is false for this value of x, the assignment statement
is not executed, so the value of x is
not changed.

Preconditions &
Postconditions

The statements that describe valid input are


known as preconditions and the
conditions that the output should satisfy
when the program has run are known as
postconditions.

QUANTIFICATION

to create a proposition from a propositional


function. Quantification expresses the
extent to which a predicate is true over a
range of elements.

Universal Quantifier

The universal quantification of P(x) is the


statement

P(x) for all values of x in the domain.

The notation xP(x) denotes the universal


quantification of P(x). Here is called the
universal quantifier. We read xP(x) as for all
xP(x) or for every xP(x). An element
for which P(x) is false is called a
counterexample of xP(x).

Table 1 - Quantifiers
Statement

When True?

xP(x)

P(x) is true for every There is an x for


x.
which P(x) is
false.
There is an x for
P(x) is false for
which P(x) is true.
every x.

xP(x)

When False?

Example 1 :

Let

P(x) be the statement x + 1 >


x.

What is the truth value of the quantification


xP(x), where the domain consists of all
real numbers?

Solution:

Because P(x) is true for all real numbers x,


the quantification xP(x) is true.

Example 2:

Let Q(x) be the statement x < 2. What is


the truth value of the quantification xQ(x),
where the domain consists of all real
numbers?

Solution:
Q(x) is not true for every real number x,
because, for instance, Q(3) is false. That is,
x = 3 is a counterexample for the statement
xQ(x). Thus xQ(x) is false.

Existential Quantifier

The existential quantification of P(x) is the


proposition

There exists an element x in the


domain such that P(x).

We use the notation xP(x) for the


existential quantification of P(x). Here
is called the existential quantifier.

Existential Quantifier

xP(x) - is read as
There is an x such that P(x),
There is at least one x such that P(x),
or
For some xP(x).

Example 1:

Let P(x) denote the statement x > 3.


What is the truth value of the quantification
xP(x),
where the domain consists of all real
numbers?

Solution: Because x > 3 is sometimes true


for instance, when x = 4the existential
quantification of P(x), which is xP(x), is
true.

Example 2:

Let Q(x) denote the statement x = x+ 1.


What is the truth value of the quantification
xQ(x),where the domain consists of all real
numbers?

Solution:

Because Q(x) is false for every real number


x, the existential quantification of Q(x),
which is xQ(x), is false.

Uniqueness Quantifier

denoted by ! or 1.The notation !xP(x)


[or 1xP(x)] states There exists a unique x
such that P(x) is true.

Example 1:

!x(x 1 = 0), where the domain is the set


of real numbers, states that there is a
unique real number x such that x 1 = 0.
This is a true statement, as x = 1 is the
unique real number such that x 1 = 0.

Precedence of Quantifiers

The quantifiers and have higher


precedence than all logical operators from
propositional calculus. For example, xP(x)
Q(x) is the disjunction of xP(x) and Q(x).
In other words, it means (xP(x)) Q(x)
rather than x(P(x) Q(x)).

Logical Equivalences Involving


Quantifiers

Statements
involving
predicates
and
quantifiers are logically equivalent if and
only if they have the same truth value no
matter which predicates are substituted into
these statements and which domain of
discourse is used for the variables in these
propositional functions. We use the notation
S T to indicate that two statements S and
T involving predicates and quantifiers are
logically equivalent.

Negating Quantified
Expressions
Example 1 : Every student in your class
has taken a course in calculus.
This statement is a universal quantification,
namely,
xP(x),

It is not the case that every student in


your class has taken a course in calculus.
or the equivalent
There is a student in your class
who has not taken a course in calculus.
And this is simply the existential
quantification of the negation of the original
propositional function, namely,
x P(x).
This example illustrates the following logical
equivalence:

xP(x) x P(x).

Example 2:

There is an honest politician

Let H(x) denote x is honest.


There
is
an
honest
politician
is
represented by xH(x), where the domain
consists of all politicians.
The negation of this statement is

xH(x), which is equivalent to x H(x).


This negation can be expressed as Every
politician is dishonest.

TABLE 2 De Morgans Laws for


Quantifiers.
Negation

Equivalent
Statement

When Is
Negation
True?

xP(x)

x P(x)

For every x,
P(x) is false.

xP(x)

x P(x)

There is an x for P(x) is true for


which P(x) is
every x.
false.

There is an x for
which
P(x) is true.

Translating from English into


Logical Expressions

Example 1:
Every student in this class has studied
calculus
xC(x)
where C(x), which is the statement x has
studied calculus.

Example 1:
Assume:
F(x): x is a fox.
S(x): x is sly.

Everything is a fox: xF(x)


All foxes are sly: x[F(x) S(x)]

Exercises:
1. Let P(x) denote the statement x 4.
What are these truth values?
a) P(0)
b) P(4)
c) P(6)

Let P(x) be the statement x can speak


Russian and let Q(x) be the statement x
knows the computer language C++.
Express each of these sentences in terms of
P(x),Q(x), quantifiers, and logical connectives.
The domain for quantifiers consists of all
students at your school.
a) There is a student at your school who can
speak Russian and who knows C++.
b) There is a student at your school who can
speak Russian but who doesnt know C++.
c) Every student at your school either can speak
Russian or knows C++.
d) No student at your school can speak Russian
or knows C++.

Answers:
a) x(P(x) Q(x))
b) x(P(x) Q(x))
c) x(P(x)Q(x))
d) x (P (x)Q(x))

Assignment:
A. Let P(x) be the statement x spends more
than five hours every weekday in class,
where the domain for x consists of all
students.
Express
each
of
these
quantifications in English.
a) xP(x)
b) xP(x)
c) x P(x)
d) x P(x)

Assignment: (Cont)
B. 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.
a) x(C(x) F(x))
b) x(C(x) F(x))
c) x(C(x) F(x))
d) x(C(x) F(x))

Vous aimerez peut-être aussi