You are on page 1of 18

Logic in Computer Science (CoSc3141)

CHAPTER THREE
PREDICATE LOGIC

3.1. Introduction
We now turn our attention to a generalization of propositional logic, called “predicate,” or “first-
order-logic”. Predicates are functions of zero or more variables that return Boolean values. Thus
predicates can be true sometimes and false sometimes, depending on the values of their
arguments.

While propositional logic deals with simple declarative propositions, predicate logic additionally
covers predicates and quantification. A predicate takes an entity or entities in the domain of
discourse as input while outputs are either True or False. Consider the two sentences "Socrates
is a philosopher" and "Plato is a philosopher". In propositional logic, these sentences are viewed
as being unrelated and might be denoted, for example, by variables such as p and q. The
predicate "is a philosopher" occurs in both sentences, which have a common structure of "a is a
philosopher". The variable a is instantiated as "Socrates" in the first sentence and is instantiated
as "Plato" in the second sentence. While first-order logic allows for the use of predicates, such as
"is a philosopher" in this example, propositional logic does not.

Relationships between predicates can be stated using logical connectives. Consider, for example,
the predicate formula "if a is a philosopher, then a is a scholar". This formula is a conditional
statement with "a is a philosopher" as its hypothesis and "a is a scholar" as its conclusion. The
truth of this formula depends on which object is denoted by a, and on the interpretations of the
predicates "is a philosopher" and "is a scholar".

Using predicates as atomic operands, instead of propositional variables, gives us a more


powerful language than expressions involving only propositions. In fact, predicate logic is
expressive enough to form the basis of a number of useful programming languages, such as
Prolog (which stands for “Programming in logic”) and the language SQL. Predicate logic is also
used in reasoning systems or “expert” systems, such as automatic medical diagnosis programs
and theorem-proving programs.

3.2. The need for a richer language


We begin this chapter by pointing out the limitations of propositional logic with respect to
encoding declarative sentences. Propositional logic dealt quite satisfactorily with sentence

1 of 18 Kotebe Metropolitan University - Department of Computer Science


Logic in Computer Science (CoSc3141)

components like not, and, or and if ...then, but the logical aspects of natural and artificial
languages are much richer than that. What can we do with modifiers like there exists ..., all...,
among ... and only...? Here, propositional logic shows clear limitations and the desire to express
subtler declarative sentences led to the design of predicate logic, which is also called first-order
logic.

For example, consider the following two statements:

➢ Every computer science student must study discrete mathematics.


➢ Solomon is a computer science student.

It looks “logical" to deduce that therefore, Solomon must study discrete mathematics. However,
this cannot be expressed by propositional logic (you may try it, but you can already notice that
none of the logical operators we have learnt are applicable here).

Let us consider the declarative sentence:


Every student is younger than some instructor.

In propositional logic, we could identify this assertion with a propositional atom p. However,
that fails to reflect the finer logical structure of this sentence. What is this statement about? Well,
it is about being a student, being an instructor and being younger than somebody else. These are
all properties of some sort, so we would like to have a mechanism for expressing them together
with their logical relationships and dependences.

We now use predicates for that purpose. For example, we could write S(kebede) to denote that
Kebede is a student and I(hailu) to say that Hailu is an instructor. Likewise, Y(kebede, hailu)
could mean that Kebede is younger than Hailu. The symbols S, I and Y are called predicates. Of
course, we have to be clear about their meaning. The predicate Y could have meant that the first
person is younger than the second one, so we need to specify exactly what these symbols refer
to.

Having such predicates at our disposal, we still need to formalize those parts of the sentence
above which speak of every and some. Obviously, this sentence refers to the individuals that
make up some academic community (left implicit by the sentence), like KMU or the University
of A.A, and it says that for each student among them there is an instructor among them such that
the student is younger than the instructor.

2 of 18 Kotebe Metropolitan University - Department of Computer Science


Logic in Computer Science (CoSc3141)

These predicates are not yet enough to allow us to express the above sentence. We don’t really
want to write down all instances of S(·)where · is replaced by every student’s name in turn.

Therefore, we employ the concept of a variable. Variables are written u, v, w, x, y, z, or x1, y3,
u5,.. and can be thought of as place holders for concrete values (like a student). Using variables,
we can now specify the meanings of S, I and Y more formally:

S(X): X is a student.
I(X): X is an instructor.
Y(X, Y): X is younger than y.

Note that the names of the variables are not important, provided that we use them consistently.
We can state the intended meaning of I by writing
I(Y): Y is an instructor.
or, equivalently, by writing.
I(Z): Z is an instructor.

Variables are mere place holders for objects. The availability of variables is still not sufficient for
capturing the essence of the example sentence above. We need to convey the meaning of ‘Every
student x is younger than some instructor y.’ This is where we need to introduce quantifiers! A
predicate is a statement that contains variables (predicate variables) and that may be true or false
depending on the values of these variables. Since a predicate takes value true or false once
instantiated (that is, once its variables are taking values), we may alternatively say that a
predicate instantiated becomes a proposition.

For example, P (x) = "x is greater than x" is a predicate. It contains one predicate variable x. If
we choose x = 1, P (1) is "1 is greater than 1", which is a proposition (always false).

The domain of a predicate variable is the collection of all possible values that the variable may
take. For the predicate P (x) = "x is greater than x", the domain of x could be for example the set
Z of all integers. It could alternatively be the set R of real numbers. Whether instantiations of a
predicate are true or false may depend on the domain considered. When several predicate
variables are involved, they may or not have different domains. For example, consider the
predicate P (x, y) = "x > y", in two predicate variables. We have Z (the set of integers) as domain
for both of them.

3 of 18 Kotebe Metropolitan University - Department of Computer Science


Logic in Computer Science (CoSc3141)

✓ Take x = 4, y = 3, then P (4, 3) = "4 > 3", which is a proposition taking the value
true.
✓ Take x = 1, y = 2, then P (1,2) = "1 > 2", which is a proposition taking the value
false.
Note that in general P (x, y) ≠ P (y, x)!

3.3. Quantifiers

Quantifiers allow us to express properties of collections of objects instead of enumerating objects


by name. They are applied to sentence containing variable, and are used to describe "parts or
quantities" from a domain. The variable of predicates is quantified by quantifiers. Since a
predicate can combine with more than one variable, it is necessary to write the variable
immediately after the quantifier to indicate which variable the quantifier interacts with. There are
two types of quantifier in predicate logic: Universal and Existential Quantifier.

✓ Universal Quantifier

Universal quantifier states that the statements within its scope are true for every value of the
specific variable. The universal quantifier is symbolized by an upside down A, ∀, and is read
“for all,” “given any,” “for every,” “for each,” or “for any.”

Thus the sentence, “For every x, x >0” can be symbolized by (∀x)(x > 0).

A quantifier and its named variable are placed in parentheses. The second set of parentheses
shows that the quantifier acts on the enclosed expression, which in this case is “x >0.”

The phrase “x >0” describes a property of the variable x, that of being positive. A property is
also called a predicate; the notation P(x) is used to represent some unspecified predicate or
property that x may have. Thus, our original sentence is an example of the more general form

(∀x)P(x)

Example: "Man is mortal" can be transformed into the propositional form ∀x P(x) where P(x) is
the predicate which denotes x is mortal and the universe of discourse is all men.

The truth value of the expression (∀x)(x >0) depends on the domain of objects in which we are
“interpreting” this expression, that is, the collection of objects from which x may be chosen. This
collection of objects is called the domain of interpretation. We have already agreed that if the

4 of 18 Kotebe Metropolitan University - Department of Computer Science


Logic in Computer Science (CoSc3141)

domain of interpretation consists of the positive integers, the expression has the truth value true
because every possible value for x has the required property of being greater than zero. If the
domain of interpretation consists of all the integers, the expression has the truth value false,
because not every x has the required property. We impose the condition that the domain of
interpretation contain at least one object so that we are not talking about a trivial case.

An interpretation of the expression (∀x)P(x) would consist of not only the collection of objects
from which x could take its value but also the particular property that P(x) represents in this
domain. Thus an interpretation for (∀x)P(x) could be the following: The domain consists of all
the books in your university library, and P(x) is the property that x has a red cover. In this
interpretation, (∀x)P(x) says that every book in your university library has a red cover. The truth
value of this expression, in this interpretation, is undoubtedly false.

✓ Existential Quantifier

Existential quantifier states that the statements within its scope are true for some values of the
specific variable. The existential quantifier is symbolized by a backward E, ∃, and is read “there
exists one,” “for at least one,” or “for some.” Thus the expression

(∃x)(x >0)

is read “there exists an x such that x is greater than zero.”

Again, the truth value of this expression depends on the interpretation. If the domain of
interpretation contains a positive number, the expression has the value true; otherwise, it has the
value false. The truth value of (∃x) P(x), if the domain consists of all the books in your local
library and P(x) is the property that x has a red cover, is true if there is at least one book in the
library with a red cover.

∃x P(x) is read as for some values of x, P(x) is true.

Example: "Some people are dishonest" can be transformed into the propositional form (∃x) P(x)
where P(x) is the predicate which denotes x is dishonest and the universe of discourse is some
people.

5 of 18 Kotebe Metropolitan University - Department of Computer Science


Logic in Computer Science (CoSc3141)

The predicates we have seen so far, involving properties of a single variable, are unary
predicates. Predicates can be binary, involving properties of two variables, ternary, involving
properties of three variables, or, more generally, n-ary, involving properties of n variables.

✓ Negation of Quantification

Negation of a universal quantification becomes an existential quantification. For example,


consider the sentence “all computer science students study hard”.

Its’ negation can be “Not all computer science students study hard”. This sentence means that
(equivalent with) “There is at least one computer science student who does not study hard”.
Symbolically, it can be expressed like this.

¬ ((∀x) P(x)) ≡ (∃x) ¬P(x)

Negation of an existential quantification becomes a universal quantification.

Consider the sentence “It is not the case that some students in this class are from natural science
stream” is equivalent with “All students in this class are not from natural science stream”.
Symbolically, it looks like the following.

¬ ((∃x) P(x)) ≡ ( ∀x )¬P(x)

Negating statements with quantifiers, as in negating compound statements, requires care. The
negation of the statement, “Everything is beautiful,” is, “It is false that everything is beautiful,”
or, “Something is non beautiful.” Symbolically,

[(∀x)A(x)]′ is equivalent to (∃x)[A(x)]′

Note that, “Everything is non beautiful,” or (∀x)[A(x)]′, says something stronger than the
negation of the original statement.

The negation of, “Something is beautiful,” is, “Nothing is beautiful,” or, “Everything fails to be
beautiful.” Symbolically,

[(∃x)A(x)]′ is equivalent to (∀x)[A(x)]′

In English, the statement, “Everything is not beautiful,” would often be misinterpreted as, “Not
everything is beautiful,” or, “There is something non beautiful.” However, this misinterpretation,
symbolized by (∃x)[A(x)]′, is not as strong as the negation of the original statement.

6 of 18 Kotebe Metropolitan University - Department of Computer Science


Logic in Computer Science (CoSc3141)

✓ Order of quantifiers

A common logical mistake is to confuse the order of quantifiers - for example, to think that
(∀x)(∃y) means the same as (∃y )(∀x), which it does not. For example, if we informally interpret
loves(x, y) as “x loves y” then (∀x)(∃y ) loves(x, y) means “Everybody loves somebody,” that is,
for every individual x there is at least one individual y that x loves. On the other hand, (∃y)(∀x)
loves(x, y) means that there is some individual y who is loved by everyone - a very fortunate y, if
such a person exists.

Note that the parentheses around the quantifiers (∀x) and (∃x) are not used for grouping, and
should be regarded as part of the symbol indicating a quantifier. Also, remember that the
quantifiers and NOT are unary, prefix operators, and the only sensible way to group them is from
the right.

For example: Thus the expression (∀x) NOT (∃y)P(x, y ) is grouped

(∀x) (NOT ((∃y)P(x, y )))

and means “For all x there is no y such that P(x, y ) is true.” Put another way, there is no pair of
values for x and y that makes P(x, y) true.

3.4. Predicate logic as a formal language

The discussion of the preceding section was intended to give an impression of how we code up
sentences as formulas of predicate logic. In this section, we will be more precise about it, giving
syntactic rules for the formation of predicate logic formulas. Because of the power of predicate
logic, the language is much more complex than that of propositional logic. In mathematics and
computer science a formal language is a set of strings of symbols together with a set of rules
that are specific to it.

The first thing to note is that there are two sorts of things involved in a predicate logic formula.
The first sort denotes the objects that we are talking about: individuals such as a and p (referring
to Andy and Paul) are examples, as are variables such as x and v. Function symbols also allow us
to refer to objects: thus, m(a) and g(x, y) are also objects. Expressions in predicate logic which
denote objects are called terms.

7 of 18 Kotebe Metropolitan University - Department of Computer Science


Logic in Computer Science (CoSc3141)

The other sort of things in predicate logic denotes truth values; expressions of this kind are
formulas: Y(x, m(x)) is a formula, though x and m(x) are terms. A predicate vocabulary consists
of three sets: a set of predicate symbols p, a set of function symbols F and a set of constant
symbols C. Each predicate symbol and each function symbol comes with an arity, the number of
arguments it expects. In fact, constants can be thought of as functions which don’t take any
arguments (and we even drop the argument brackets). Constants are 0-arity, so-called nullary
functions.

A predicate can be:

One-place predicate such as: is happy, is boring

Two-place predicate such as: like, hate, love, hit

Three-place predicate such as: introduce, give

✓ Formulas

The set of formulas of the first-order predicate logic over predicate symbol p and function
symbol F is defined as follows.

✓ If P is an n-place predicate, and t1, t2, …, tn are terms, then P(t1, t2, …, tn) is a formula. For
example:

✓ John is happy: H(j) John loves Mary: L(j,m)

✓ If t1 and t2 are individual constants or variables, then t1 = t2 is a formula. For example:

John is Bill: j = b

✓ If φ is a formula, then ¬φ is a formula.

✓ If φ and ψ are formulas, then (φ ∧ ψ), (φ ∨ ψ), (φ → ψ), and (φ ↔ ψ) are formulas too.

✓ If φ is a formula and x is a variable, then ∀xφ, and ∃xφ are formulas too. For example:

Everyone is happy: ∀xH(x)


Someone loves John: ∃xL(x, j)
Everyone loves someone: ∀x∃yL(x, y), ∃y∀xL(x, y)
✓ Nothing else is a formula in predicate logic

The set of formulas of the predicate logic have the following syntax:

ϕ= P(t1, t2, …, tn) || (t1 = t2 ) || (¬ϕ)|| (ϕ∧ϕ)|| (ϕ∨ϕ)|| (ϕ→ϕ)|| (∀xϕ)|| (∃xϕ)

8 of 18 Kotebe Metropolitan University - Department of Computer Science


Logic in Computer Science (CoSc3141)

3.5. Translation

Many English language statements can be expressed as predicate wffs. For example, “Every
parrot is ugly,” is really saying, “For anything, if it is a parrot, then it is ugly.” Letting P(x)
denote “x is a parrot” and U(x) denote “x is ugly,” the statement can be symbolized as

(∀x)[P(x) → U(x)]

Other English language variations that take the same symbolic form are, “All parrots are ugly,”
and, “Each parrot is ugly.” Notice that the quantifier is the universal quantifier and the logical
connective is implication; ∀ and → almost always belong together.

The wff (∀x)[P(x) ∧U(x)] is an incorrect translation because it says that everything in the
domain, understood here to be the whole world, is an ugly parrot. This says something much
stronger than the original English statement. Similarly, “There is an ugly parrot,” is really
saying, “There exists something that is both a parrot and ugly.” In symbolic form,

(∃x)[P(x) ∧U(x)]

Variations are, “Some parrots are ugly,” and, “There are ugly parrots.” Here the quantifier is the
existential quantifier and the logical connective is conjunction; ∃ and ∧ almost always belong
together. The wff (∃x)[P(x) → U(x) ] is an incorrect translation. This wff is true as long as there
is anything, call it x, in the domain (the whole world) that is not a parrot, because then P(x) is
false and the implication is true. Indeed, this wff is true if there are no parrots in the world at all!
To translate an English statement into a wff, it may help to first write an intermediate English
language statement and then symbolize that statement. We did this with the parrot examples. The
word “only” seems particularly troublesome in translations because its placement in a sentence
can completely change the meaning. For example, the English statements

1. John loves only Mary.

2. Only John loves Mary.

3. John only loves Mary.

say three entirely different things. Using the predicate symbols J(x) for “x is John,” M(x) for “x is
Mary,” and L(x, y) for “x loves y,” they can be rewritten as

9 of 18 Kotebe Metropolitan University - Department of Computer Science


Logic in Computer Science (CoSc3141)

1. If John loves anything, then that thing is Mary.

or

1. For anything, if it is John then, if it loves anything, that thing is Mary.

(∀x)(J(x) → (∀y)(L(x, y) → M( y))

2. If anything loves Mary, then that thing is John.

or

2. For anything, if it is Mary then, if anything loves it, that thing is John.

(∀x)(M(x) → (∀y)(L( y, x) → J(y))

3. If John does anything to Mary, then that thing is love.

or

3. For anything, if it is John then, for any other thing, if that thing is Mary, then John loves it.

(∀x)(J(x) → (∀y)(M(y) → L(x, y))

In each case, the consequent of the implication is the word following “only” in the original
English statement.

Let us see another example. Given the predicate symbols

D(x) is “x is a dog”
R(x) is “x is a rabbit”
C(x, y) is “x chases y”

The following table shows examples of an English statement, an intermediate English statement,
and a wff translation. Note that in wff 2, the connective associated with ∃ is ∧ and the connective
associated with ∀ is →. In wff 3, the first version shows two implications associated with the two
∀ quantifiers. The second version is equivalent because of the tautology [A ∧ B → C ] ↔ [A →
(B → C )]. This version may appear to violate the rule that universal quantifiers should be used
with implication, not conjunction, but this tautology provides another way to write two
implications. The second version also shows more clearly that “dogs,” the word following
“only,” is the conclusion.

10 of 18 Kotebe Metropolitan University - Department of Computer Science


Logic in Computer Science (CoSc3141)

English Statement Intermediate Statement Wff

For anything, if it is a dog, then (∀x)[D(x) → (∀y)(R(y) → C(x, y))]


for any other thing, if that thing
1. All dogs chase is a rabbit, then the dog chases it.
all rabbits.

There is something that is a dog (∃x)[D(x) ∧ (∀y)(R(y) → C(x, y))]


and, for any other thing, if that
2. Some dogs chase thing is a rabbit, then the dog
all rabbits. chases it.

For anything, if it is a rabbit (∀y)[R(y) → (∀x)(C(x, y) → D(x))]


then, if anything chases it, that
3. Only dogs chase thing is a dog. (∀y)( ∀x)[R(y) ∧ C(x, y) → D(x)]
rabbits.
For any two things, if one is a
rabbit and the other chases it,
then the other is a dog.

Translation from an English statement into a predicate wff is a little harder than translation into a
propositional wff, partly because of the added expressiveness of the verbal form and partly
because there can be multiple correct predicate wffs. Here is a summary of translation tips:

Look for the key words that signify the type of quantifier:

for all, for every, for any, for each: use a universal quantifier

for some, there exists:use an existential quantifier.

✓ English sometimes uses “understood” universal quantifiers. For example,

“Dogs chase rabbits,” is understood to mean, “All dogs chase all rabbits.”

✓ If you use a universal quantifier, the connective that goes with it is almost always
implication.

✓ If you use an existential quantifier, the connective that goes with it is almost always
conjunction.

Whatever comes after the word “only” is the conclusion of an implication; that is, it comes after
“then” in an “if–then” statement.

✓ You are most right to arrive at a correct translation if you follow the order of the English
words.

11 of 18 Kotebe Metropolitan University - Department of Computer Science


Logic in Computer Science (CoSc3141)

Let’s do a couple of examples in great detail. The first is:

All giraffes are tall.

The property of being a giraffe and the property of being tall are unary predicates. We’ll use G(x)
for “x is a giraffe” and T(x) for “x is tall”. Following the sentence structure, we first see “All,”
which tells us that there’s a universal quantifier, so the wff begins with

(∀x) (…)

All what? All giraffes, so

(∀x) (G(x))

Because of the universal quantifier, we expect to use the implication connective, so now we have

(∀x) (G(x) →…)

Thinking of the implication as an “if–then,” we have “if a giraffe, then … .” Then what? Then it's
tall. The final wff is

(∀x) (G(x) → T(x))

The second example is:

Only giraffes are taller than elephants.

The property of being a giraffe and the property of being an elephant are unary predicates, and
we’ll use G(x) and E(x) to represent them. But “taller than” is a property that compares two
things, so it’s a binary predicate; T(x, y) will mean “x is taller than y”. There are no obvious
quantifier key words, so we understand that we are talking about all giraffes and all elephants
(universal quantifiers). The word “giraffes” follows the word “only,” so the property of being a
giraffe is going to be the conclusion of an implication and the overall form will be “if xxx, then a
giraffe.” Indeed, if something is taller than an elephant, then it’s a giraffe. Putting in the
universal quantifiers, “if anything is taller than any elephant, then that thing is a giraffe,” or
(even more tortured English), “for anything, if it is an elephant, then for any other thing, if it’s
taller than the elephant, then it’s a giraffe.” Now we can pretty much translate directly into a
wff. “For anything, if it is an elephant, then” becomes

(∀x) (E(x) → …)

12 of 18 Kotebe Metropolitan University - Department of Computer Science


Logic in Computer Science (CoSc3141)

and, “for any other thing, if it's taller than the elephant, then,” adds a second implication to the
wff:

(∀x) (E(x) → (∀y)(T(y, x) → …))

Notice that we introduced y here, a second variable, because we’ve already given x the elephant
property. Also, we’ve written T(y, x), not T(x, y), because we want this new thing to be taller than
the elephant, and our definition of the taller predicate was that the first variable was taller than
the second. We are ready for the final conclusion—this new thing is a giraffe.

(∀x) (E(x) → (∀y)(T(y, x) → G(y)))

As in previous table in example of dog and rabbit (3), a tautology allows us to also write this wff
as

(∀x) (∀y) (E(x) ∧T(y, x) → G(y))

“For any two things, if one is an elephant and the other is taller than the elephant, then the other
thing is a giraffe.”

Exercise!

Using the predicate symbols S(x) for “x is a student,” I(x) for “x is intelligent,” and M(x) for “x
likes music,” write wffs that express the following statements. (The domain is the collection of
all people.)

a) All students are intelligent.

b) Some intelligent students like music.

c) Everyone who likes music is a good student.

d) Only intelligent students like music.

3.6. Validity

The truth value of a propositional wff depends on the truth values assigned to the statement
letters. The truth value of a predicate wff depends on the interpretation. Choosing an
interpretation for a predicate wff is thus analogous to choosing truth values in a propositional
wff. However, there are an infinite number of possible interpretations for a predicate wff and
only 2n possible rows in the truth table for a propositional wff with n statement letters.

13 of 18 Kotebe Metropolitan University - Department of Computer Science


Logic in Computer Science (CoSc3141)

A tautology is a propositional wff that is true for all rows of the truth table. The analogue to
tautology for predicate wffs is validity - a predicate wff is valid if it is true in all possible
interpretations. The validity of a wff must be derived from the form of the wff itself, since
validity is independent of any particular interpretation; a valid wff is “intrinsically true.”

An algorithm exists to decide whether a propositional wff is a tautology-construct the truth table
and examine all possible truth assignments. How can we go about deciding validity for predicate
wffs? We clearly cannot look at all possible interpretations, because there are an infinite number
of them. As it turns out, no algorithm to decide validity for any wff exists. (This does not mean
simply that no algorithm has yet been found-it means that it has been proved that there is no such
algorithm.) We must simply use reasoning to determine whether the form of a particular wff
makes the wff true in all interpretations. Of course, if we can find a single interpretation in which
the wff has the truth value false or has no truth value at all, then the wff is not valid.

The following table compares propositional and predicate wffs.

Propositional Wffs Predicate Wffs

Truth values True or false, depending on truth True, false, or perhaps (if the wff
value assignments to statement has a free variable) neither,
letters depending on interpretation

“Intrinsic truth” Tautology—true for all truth Valid wff—true for all
value assignments interpretations

Methodology Algorithm (truth table) to No algorithm to determine


determine whether wff is a whether wff is valid
tautology

Now let’s try our hand at determining validity for specific wffs.For example:

a) The wff

(∀x)P(x) → (∃x)P(x)

is valid. In any interpretation, if every element of the domain has a certain property, then there
exists an element of the domain that has that property. Therefore, whenever the antecedent is
true, so is the consequent, and the implication is therefore true.

14 of 18 Kotebe Metropolitan University - Department of Computer Science


Logic in Computer Science (CoSc3141)

b) The wff

(∀x)P(x) → P(a)

is valid because in any interpretation, a is a particular member of the domain and therefore has
the property that is shared by all members of the domain.

c) The wff

(∃x)P(x) → (∀x)P(x)

is not valid. For example, in the interpretation where the domain consists of the integers and P(x)
means that x is even, it is true that there exists an integer that is even, but it is false that every
integer is even. The antecedent of the implication is true and the consequent is false, so the value
of the implication is false.

d) The wff

P(x) → [Q(x) → P(x)]

is valid. To see this, consider any interpretation, and let x be any member of the domain. Then x
either does or does not have property P. If x does not have property P, then P(x) is false; because
P(x) is the antecedent of the main implication, this implication is true. If x does have property P,
then P(x) is true; regardless of the truth value of Q(x), the implication Q (x) → P(x) is true, and
so the main implication is also true.

3.7. Derivation rules for Predicate Logic

The equivalence rules and inference rules of propositional logic are still part of predicate logic.
An argument of the form

P ∧(P → Q) → Q

is still valid by modus ponens, even if the wffs involved are predicate wffs. For example, use
predicate logic to prove the validity of the argument

(∀x)R(x) ∧[(∀x)R(x) → (∀x)S(x)] → (∀x)S(x)

A proof sequence is

1. (∀x)R(x) hyp

15 of 18 Kotebe Metropolitan University - Department of Computer Science


Logic in Computer Science (CoSc3141)

2. (∀x)R(x) → (∀x)S(x) hyp

3. (∀x)S(x) 1, 2, mp

However, there are many arguments with predicate wffs that are not tautologies but are still valid
because of their structure and the meaning of the universal and existential quantifiers. The
overall approach to proving these arguments is to strip off the quantifiers, manipulate the
unquantified wffs, and then put the quantifiers back in. The new rules of inference provide
mechanisms to strip off and insert quantifiers. Hence there are four new rules-one each to strip
off the universal and existential quantifier, respectively, and one each to insert the universal and
existential quantifier, respectively. The four rules are given in the following table; their details
will be explained shortly. In the table, the notation P(x) does not imply that P is a unary predicate
with x as its only variable; it simply means that x is one of the variables in the predicate P. Thus
P(x) might actually be something like (∃y)(∀z)Q(x, y, z).

Now let’s examine these rules more closely, particularly the necessity for their restrictions.

✓ Universal Instantiation (ui)

The universal instantiation rule says that from (∀x)P(x) we can derive P(x), P( y), P(z), P(a), and
so on, thus stripping off a universal quantifier. The justification is that if P is true for every
element of the domain, we can name such an element by an arbitrary variable name like x, y, or
z, or we can specify a particular constant in the domain, and P is still true for all of these things.

For example, given the following argument

(∀x)[H(x) → M(x)] ∧H(s) → M(s)

Its proof sequence will be the following.

1. (∀x)(H(x) → M(x)) hyp

2. H(s) hyp

3. H(s) → M(s) 1, ui

4. M(s) 2, 3, mp

In step 3, a constant symbol has been substituted for x throughout the scope of the universal
quantifier, as allowed by universal instantiation.

16 of 18 Kotebe Metropolitan University - Department of Computer Science


Logic in Computer Science (CoSc3141)

Without the restriction on universal instantiation, a hypothesis of the form (∀x)(∃y)P(x, y) could
lead to the wff (∃y)P( y, y); here y has been substituted for x within the scope of a quantifier on y.
This would be invalid. For example, in the domain of the integers, if P(x, y) means “y > x,” then
(∀x)(∃y)P(x, y) is true (for every integer there is a bigger integer) but (∃y)P( y, y) is false (no
integer has the property that it is bigger than itself).

✓ Existential Instantiation (ei)

The existential instantiation rule allows us to strip off an existential quantifier. It says that from
(∃x)P(x) we can derive P(a) or P(b) or P(c ) provided that these are new constant symbols. The
justification is that if P is true for some element of the domain, we can give that element a
specific name, but we cannot assume anything else about it.

For example, given the following argument

(∀x)[P(x) → Q(x)] ∧ (∃y)P(y) → Q(a)

The following expressions would be legitimate steps in a proof sequence:

1. (∀x)[P(x) → Q(x)] hyp

2. (∃y)P(y) hyp

3. P(a) 2, ei

4. P(a) → Q(a) 1, ui

5. Q(a) 3, 4, mp

In step 3, the specific element with property P was given the name a. In step 4, ui was then used
to say that an implication that is universally true in the domain is certainly true for this a. Steps 3
and 4 cannot be reversed. If ui is first used on hypothesis 1 to name a constant a, there is then no
reason to assume that this particular a is the one that is guaranteed by hypothesis 2 to have
property P.

The effect of the restriction on existential instantiation is that you should look at all your
hypotheses and, if you plan to use ei on any of them, do it first. (Use existential instantiation
early in the proof sequence.)

17 of 18 Kotebe Metropolitan University - Department of Computer Science


Logic in Computer Science (CoSc3141)

✓ Universal Generalization (ug)


Universal Generalization allows a universal quantifier to be inserted. This must be done pretty
carefully, however. If we know that P(x) is true and that the x is absolutely arbitrary, i.e., that x
could be any element of the domain, then we can conclude (∀x)P(x). But if x is supposed to
represent some specific element of the domain that has property P, then we can’t generalize that
every element of the domain has property P.

For example, use predicate logic to prove

(∀x)[P(x) → Q(x)] ∧ (∀x)P(x) → (∀x)Q(x)

Here is a proof sequence.

1. (∀x)[P(x) → Q(x)] hyp

2. (∀x)P(x) hyp

3. P(x) → Q(x) 1, ui

4. P(x) 2, ui Note that there is no restriction on ui about reusing a name.

5. Q(x) 3, 4, mp

6. (∀x)Q(x) 5, ug

✓ Existential Generalization

The last rule allows insertion of an existential quantifier. From P(x) or P(a) we can derive
(∃x)P(x); something has been named as having property P, so we can say that there exists
something that has property P.

For example, prove the argument (∀x)P(x) → (∃x)P(x).

Here is a proof sequence.

1. (∀x)P(x) hyp

2. P(x) 1, ui

3. (∃x)P(x) 2, eg

18 of 18 Kotebe Metropolitan University - Department of Computer Science

You might also like