Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
5 views17 pages

1.2. Predicate Logic - Discrete Structures For Computing

Logic and truth tables

Uploaded by

manueleze88
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views17 pages

1.2. Predicate Logic - Discrete Structures For Computing

Logic and truth tables

Uploaded by

manueleze88
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

Predicate Logic

Contents
• 1.2.1. Predicates and Variables
• 1.2.2. Quantifiers
• 1.2.3. Nested Quantifiers
• 1.2.4. Possible Pitfalls
• 1.2.5. Exercises

It is often the case that propositional logic is insufficient to represent more complex logical
expressions. Enter predicate logic.

In propositional logic, the following cannot be represented.

 Propositional logic is insufficient

p := “All men are mortal” and q := “Socrates is a man”. Is Socrates a mortal? The answer
is yes, but this cannot be expressed in propositional logic.

We need a way to formalize objects, their properties, and relations between them.

Predicates and Variables


◦ Compound Expressions
Quantifiers
◦ Precedence of Quantifiers
◦ Negating Quantifiers
◦ Truth and Fallacy of Quantifiers
Nested Quantifiers
◦ Order of Quantifiers
◦ Translating between English and Logic
◦ Revisiting System Specifications
Possible Pitfalls
◦ Negating many Quantifiers
◦ Quantifiers and Connectives
Exercises
◦ Predicates and Variables
◦ Quantifiers
◦ Nested Quantifiers

1.2.1. Predicates and Variables


Predicate logic augments propositional logic with variables, predicates, and quantifiers. Variables
are simple. They are some symbol, for example x, y, or z, that stands in for some mathematical
object.

 Definition (predicate)

A symbol which represents a property or relation. Often, the statement or relation itself is
called a predicate.
Predicates are typically capital letters P , Q, R, S, …. Predicates are very much like propositional
variables in that they stand in for something. Predicates are more general in that they need not have
a truth value. Moreover, whereas propositions needed to be a declarative statement (i.e. an
independent clause in a sentence), predicates can be an incomplete phrase.

 A first few predicates

The following are all predicates.

• D := “is a dog”

• R := “has rowing as their favourite sport”

• P := “is a positive number”

• E := “is an even integer”

Notice from these examples that predicates typically lack subjects. Combining predicates with
variables allows us to form propositional functions.

 Definition (propositional function)

A function formed by a predicate and one or more variables. A proposition is obtained by


applying particular values to the variable(s) or by binding the variables by logical
quantifiers,

Propositional functions become propositions when their variables are replaced by a value in the
domain of discourse, often called simply domain. This domain specifies what are the possible values
for the variable. A domain is often denoted by U .

Without a domain, a propositional function makes little sense. If P (x) stands for “x passed
CS2214”, this only makes sense if the domain for x is “people who have taken CS2214”.

 Propositional function

Let P be “is greater than 0”. Then, P (x) is a propositional function denoting “x is greater
than 0”. If we let the domain be the integers, x may take the value of any integer.

• P (−3) is false.

• P (0) is false.

• P (2) is true.

• P (3.14159) is invalid because 3.14159 is not an integer.

When we replace (i.e. substitute) a particular value from the domain of discourse for a variable in a
propositional function, we say that the variable is bound. We call it a bound variable. In contrast, a
variable that is not bound is called a free variable.

Checkpoint Solution

 Bound variables, propositions, predicates

Let R(x, y, z) := x + y = z. Let Q(x, y, z) := x − y = z. Let U be the integers for x,


y, and z. What are the truth values of the following?

1. R(2, −1, 5)

2. R(3, 4, 7)

3. R(x, 3, z)

4. Q(2, −1, 3)

5. Q(3, 4, 7)

6. Q(x, 3, z)
Compound Expressions
All of the logical connectives of propositional logic also apply to predicate logic. Let’s see some
examples.

 Connecting predicates

Let P (x) := x can fly. Let Q(x) := x are blue. Let the domain of x be all species of
animals.

• P (penguins) ∨ P (geese) is true.

• P (blue jays) ∧ Q(blue jays) is true.

• P (penguins) → Q(tigers) is true.

We can also use logical connectives to connect propositional functions. The result is another
propositional function with possibly more variables.

 Connecting propositional functions

Let P , Q be predicates. Let x, y be variables.

• P (2) ∨ Q(5) is a proposition since all variables are bound.

• P (3) ∧ P (x) is a propositional function with one variable.

• P (x) → P (y) is a propositional function with two variables.

• P (y) ∨ Q(x) is a propositional function with two variables.

1.2.2. Quantifiers
Quantifiers are used as modifiers to variables, giving rise to the logical formalization of the English
words “all”, “some”, “any”, “every”, etc. For example, “all men are mortal” or “some birds cannot fly”
cannot be expressed in propositional logic but can be represented in predicate logic using
quantifiers. The two main quantifiers are the universal quantifier and the existential quantifier.

 Definition (universal quantifier)

“For all”, “For any”, “Given any”. A universal quantifier asserts that a predicate is true for
any and every value in the domain. It is denoted ∀.

 Definition (existential quantifier)

“There exists”, “For some”, “There is a”, “There is at least one”. An existential quantifier
asserts that a predicate is true for at least one value in the domain. It is denoted ∃.

Just as substituting a variable for a value from the domain binds the variable, a quantifier also binds
a variable. Let P be a predicate and U be the domain. ∀xP (x) says that P (x) is true for every
choice of x from the domain. ∃xP (x) says that P (x) is true for some x in the domain.

∀ x P (x) can be read as “For all x, P (x)”.


 Universal quantifier

• Let P (x) := x > 0. If U is all integers, ∀xP (x) is false.

• Let P (x) := 2x is even. If U is all integers, ∀xP (x) is true.

• Let P (x) := x has feathers. If U is all animals, ∀xP (x) is false.

• Let P (x) := x has feathers. If U is all birds, ∀xP (x) is true.

∃ x P (x) can be read as “There exists an x such that P (x)”.

 Existential quantifier

• Let P (x) := x > 0. If U is all integers, ∃xP (x) is true.

• Let P (x) := 2x is odd. If U is all integers, ∃xP (x) is false.

• Let P (x) := x has feathers. If U is all animals, ∃xP (x) is true.

• Let P (x) := x has feathers. If U is all birds, ∃xP (x) is true.

Notice that the truth value of a propositional function whose variable is bound by a quantifier
depends on the particular domain of discourse.

 Important

Without specifying a domain of discourse, a quantifier applied to a propositional function


cannot give us a truth value. The predicate, the domain, and choice of quantifier together
give a truth value.

Checkpoint Solution

 Quantifiers and domains

Let P (x) := x < 2.

1. If U is the positive integers, what is the truth value of ∀ x P (x)? What is the truth value of
∃ x P (x)?
2. If U is the negative integers, what is the truth value of ∀ x P (x)? What is the truth value of
∃ x P (x)?
3. If U is the numbers 3, 4, and 5, what is the truth value of ∀ x P (x)? What is the truth
value of ∃ x P (x)?

These examples suggest implications between existential and universal quantifiers.

 Tip

Let P (x) be a propositional function with a universe U .

• If ∀ x P (x) is true, then ∃ x P (x) must be true.

• If ∃ x P (x) is false, then ∀ x P (x) must be false.

That is, ∀ x P (x) → ∃ x P (x) and ¬(∃ x P (x)) → ¬(∀ x P (x)).

For some domains of discourse, it is possible to “expand” a quantified expression into an equivalent
compound expression with no variables. In particular, when domains are finite.
 Finite domains, conjunctions, disjunctions

Let P be a predicate and U be the integers 1, 2, and 3.

∀ x P (x) ≡ P (1) ∧ P (2) ∧ P (3)

∃ x P (x) ≡ P (1) ∨ P (2) ∨ P (3)

Precedence of Quantifiers
Quantifiers have a higher precedence than all other logical connectives.

∀ x P (x) ∨ Q(x) ≡ ( ∀ x P (x) ) ∨ Q(x)

∃ x P (x) ∧ Q(x) ≡ ( ∃ x P (x) ) ∧ Q(x)

∀ x P (x) → Q(x) ≡ ( ∀ x P (x) ) → Q(x)

P (x) → ∃ x Q(x) ≡ P (x) → ( ∃ x Q(x) )

If we want a quantifier to apply to multiple predicates, we must use parentheses. ∀ x P (x) ∧ Q(x)
is not the same as ∀ x (P (x) ∧ Q(x)).

 Quantified compounds

Let P (x) := “x has a son”. Let Q(x) := “x is a parent”. Let U be all people.

∀ x P (x) → Q(x) translates to “if every person has a son, then x is a parent”. That is,
we have not bound the variable in the predicate Q(x).

∀ x (P (x) → Q(x)) translates to “For all people, if a person has a son then that person
is a parent”.

Negating Quantifiers
When we are negating expressions with quantifiers, special care must be taken. Consider first some
English language examples.

 Negating English

1. “Every student in this class knows Python”


◦ “It is not the case that every student in this class knows Python”, or

◦ “Not every student in this class knows Python”, or

◦ “At least one student in this class does not know Python”

2. “Someone thinks football is the best sport”


◦ “It is not that case that someone thinks football is the best sport”,

◦ “No one thinks football is the best sport”, or

◦ “Everyone thinks football is not the best sport”

Already, we can see that there are two ways to express negation with quantifiers. We can negate
the quantifier itself, or we can negate the inner predicate. Formally, this is similar to De Morgan’s law
for propositional logic. Negating a universal or existential quantifier “flips” it to become the other one.

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

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


 Negating Quantifiers

Let P := “knows Python” with U being all students in this class.

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

“There exists a student in this class who does not know Python”.

Let S := “thinks football is the best sport” with U being all people.

¬(∃ x S(x)) ≡ ∀ x ¬S(x)

“Everyone does not think football is the best sport”.

Truth and Fallacy of Quantifiers

Quantified Equivalent
Expression Expression When True? When False?

∀ x P (x) When P (x) is true When P (x) is false


for every possible x for at least one
possible x

∃ x P (x) When P (x) is true When P (x) is false


for at least one for every possible x
possible x

¬∀ x P (x) ∃ x ¬P (x) When P (x) is false When P (x) is true


for at least one for every possible x
possible x

¬∃ x P (x) ∀ x ¬P (x) When P (x) is false When P (x) is true


for every possible x for at least one
possible x

Table 1.6 Quantifiers and truth values

You should really internalize these subtle differences in each case. You will really need this
throughout the course and in the future! Re-read the table and try the do the following checkpoint.

Checkpoint Solution

 The true and false of quantifiers

Translate the following sentences to predicate logic, using quantifiers as appropriate. Can
you discern a truth value from the resulting expression?

1. “Some student in this class has visited Brazil.”

2. “Every student in this class has visited Canada or Brazil.”

3. “An animal that can fly is an animal with wings.”

1.2.3. Nested Quantifiers


Nested quantifiers are necessary for some English sentence with several clauses and variables. It
has natural extensions to math and computer science.
 A first nested quantifier

“Every real number has a multiplicative inverse.”

Letting U be the real numbers:

∀ x ∃ y (x × y = 1)

One way of thinking of nested quantifiers is through nested propositional functions. From the
previous example, let P (x, y) := (x × y = 1) and Q(x) := ∃ y P (x, y). P (x, y) is saying that
x and y are multiplicative inverses, meanwhile Q(x) is saying x has a multiplicative inverse.

Then, “every real number has a multiplicative inverse” can be written as:

∀ x Q(x) ≡ ∀ x (∃ y P (x, y))


≡ ∀ x (∃ y (x × y = 1))
≡ ∀ x ∃ y (x × y = 1)

Order of Quantifiers
The order of quantifiers is very important. Consider again multiplicative inverses.

Let P (x, y) := x × y = 1. Are ∀x ∃y P (x, y) and ∃y ∀x P (x, y) the same?

No! The first says “every real number has a multiplicative inverse”. The second says “there exists a
real number which, when multiplied by any real number, equals 1”.

Let’s try another example.

 Ordering quantifiers

Let P (x, y) := x + y = 0 and the domain of x and y be the real numbers. The truth
value of the following expressions are:

∀x ∀y P (x, y) False

∀y ∀x P (x, y) False

∃x ∀y P (x, y) False

∀y ∃x P (x, y) True

∃x ∃y P (x, y) True

This previous exemplifies that the order of two universal quantifiers (or existential quantifiers)
applied to a single propositional function does not change the truth value. However, the order
between a universal quantifier and an existential quantifier does matter.

 Tip

One way to think about nested quantifiers is that variables are bound or “fixed” left to right.
In ∃x ∀y P (x, y), x is bound first, regardless of what happens to y. Then y is bound.

Yet another way of thinking about nested quantifiers is as nested loops. Consider the below loop
and the following quantified expressions.

for i in range(n) :
for j in range(m) :
P(i, j)
Expression When is it true?

∀i ∀j P (i, j) This expression is only true if all iterations of


both loops are true.

∀i ∃j P (i, j) This expression is true when, for every


iteration of the outer loop, at least one iteration
of the inner loop is true.

∃i ∀j P (i, j) This expression is true when, for at least one


iteration of the outer loop, every iteration of
the inner loop is true.

∃i ∃j P (i, j) This expression is true if at least one iteration


of the inner loop is true, for any iteration of the
outer loop.

Of course, when the domains of discourse are infinite, we cannot actually loop through all of the
possible elements. However, it is a useful way to think about quantifiers.

Translating between English and Logic


We have seen a several example of translating English to predicates. But what about the opposite?

 Quantifiers to English

Let C(x) := x has a computer, F (x, y) := x and y are friends, where U is all students
at Western.

∀x (C(x) ∨ ∃y (C(y) ∧ F (x, y)))

In English, this says “every student at Western has a computer or has a friend with a
computer”.

Before we start thinking about translating more interesting mathematical statements, let’s check in
and make sure we understand nested quantifiers and their ordering.

Checkpoint Solution

 Translating predicates to English

Let C(x) := x has a computer, F (x, y) := x and y are friends, where U is all students
at Western.

Express the following expression in English.

∃x ∀y ∀z ( (F (x, y) ∧ F (x, z) ∧ (y ≠ z)) → ¬F (y, z) )

Once we conclude this chapter on logic and proofs, the rest of the course will be much more
mathematical. We will use the language of logic to formally state many mathematical properties,
theorems, and facts. Let’s see a taste of that before returning to “fun” English statements.

Unfortunately, a large part of being able to understand, and translate, mathematical statements
comes with practice. But, there is a general methodology we can use to convert mathematical
statements to logic.

1. First re-write the statement to be more verbose. Replace phrases like “q whenever p” with “if p
then q” to bring the statement closer to a “direct translation”.
2. Explicitly introduce variables. Replace phrases like “a number greater than two” with “a
number x such that x > 2”.
3. Finally, translate that sentence to a logical expression using quantifiers, predicates, and logical
connectives.

 Translating mathematical statements

Write “the sum of two positive integers is always positive” as a logical expression.

1. Re-write the sentence to be more verbose: “for any two integers, if they are both positive,
then their sum is positive.”

2. Use variables explicitly: “for any two integers x and y, if x and y are both positive, then
their sum is positive”.

3. Translate to a logical expression:

∀x ∀y ( (x > 0) ∧ (y > 0) → (x + y > 0) ),

where U is all integers.

Revisiting System Specifications


Predicate logic is exceptionally useful for system specifications (recall Formal Specifications). This
application requires special care with nested quantifiers and precedence between quantifiers and
logical connectives. Let’s take an example.

 System specifications with predicates

Consider a mail server with limited bandwidth. The designer specifies three requirements:

1. “Every message larger than 1 megabyte must be compressed.”

2. “Messages larger than 10 megabytes cannot be sent.”

We leave the domains implicit since they are obvious.

Let L(m, y) := “message m is larger than x megabytes”. Let C(m) := “message m is


compressed”. Let S(u, m) := user u can send message m.

1. ∀ m (L(m, 1) → C(m))

2. ∀ m (L(m, 10) → ∀u¬S(u, m)) ≡ ∀ m (L(m, 10) → ¬∃uS(u, m)).

1.2.4. Possible Pitfalls


We have seen that ordering or quantifiers is very important. Predicates, quantifiers, and logical
connectives have a strict order of precedence that can drastically change their interpretation. When
in doubt, use parentheses!

Negating many Quantifiers


Let’s revisit that idea with the negation of a predicates. We know from Negating Quantifiers that
negation “flips” a universal quantifier or existential quantifier to become the other. But what happens
when we have nested quantifiers? Simply use parentheses and proceed one at a time.

¬∀x ∃y ∀z P (x, y, z) ≡ ¬ (∀x (∃y (∀z P (x, y, z))))


≡ (∃x ¬ (∃y (∀z P (x, y, z))))
≡ (∃x (∀y ¬ (∀z P (x, y, z))))
≡ (∃x (∀y (∃z ¬P (x, y, z))))

Quantifiers and Connectives


Recall from Precedence of Quantifiers that quantifiers have a higher precedence than logical
connectives. We had to use parenthesis to apply a quantifier to a compound expression.

Now, you may be wondering, is it possible to “distribute” a quantifier into a compound expression as
we did with negation? The answer is sometimes.

The following are valid.

∀x (P (x) ∧ Q(x)) ≡ ∀x P (x) ∧ ∀x Q(x)

∃x (P (x) ∨ Q(x)) ≡ ∃x P (x) ∨ ∃x Q(x)

To see why, let the domain of x be a, b, c.

∀x (P (x) ∧ Q(x)) ≡ (P (a) ∧ Q(a)) ∧ (P (b) ∧ Q(b)) ∧ (P (c) ∧ Q(c))


≡ P (a) ∧ P (b) ∧ P (c) ∧ Q(a) ∧ Q(b) ∧ Q(c)
≡ ∀x P (x) ∧ ∀x Q(x)

∃x (P (x) ∨ Q(x)) ≡ P (a) ∨ P (b) ∨ P (c) ∨ Q(a) ∨ Q(b) ∨ Q(c)


≡ P (a) ∨ P (b) ∨ P (c) ∨ Q(a) ∨ Q(b) ∨ Q(c)
≡ ∃x P (x) ∨ ∃x Q(x)

However, in more cases, quantifiers do not distribute. Here are some counterexamples.

∃x (P (x) ∧ Q(x)) ≢ ∃x P (x) ∧ ∃x Q(x)

∀x (P (x) ∨ Q(x)) ≢ ∀x P (x) ∨ ∀x Q(x)

∃x (P (x) → Q(x)) ≢ ∃x P (x) → ∃x Q(x)

∀x (P (x) → Q(x)) ≢ ∀x P (x) → ∀x Q(x)

A key reason why existential quantifiers do not distribute is because the two quantifiers bind the
variable in different ways. ∃x P (x) ∧ ∃x Q(x) means “there exists some x such that P (x) AND
there exists some x such that Q(x)”. The x in the first clause is not the same x in the second
clause; x was quantified twice in different contexts.

This is very different from saying ∃x(P (x) ∧ Q(x)), which says “there exists some x such that
P (x) and Q(x) are true”. In the latter, the same object x is being applied simultaneously to P and
Q.

Can you reason about the other expressions?

1.2.5. Exercises
Predicates and Variables

 Exercise 1.17

Rewrite the following statements, as appropriate, using the quantifiers “for all” and “there
exists”.

1. “Not all continuous functions are differentiable.”

2. “There is no largest real number.”

3. “Every positive integer is the product of some collection of primes.”


 Solution to Exercise 1.17

1. “There exists a continuous function which is not differentiable.”

2. “For every real number y, there exists a real number x such that x > y.”

3. “For every positive integer x, there exists prime numbers p1, … , pk such that
x = p1p2 ⋯ pk.”

 Exercise 1.18

Rewrite the following statements, as appropriate, using the quantifiers “for all” and “there
exists”. You don’t have to translate to predicate logic, just re-write in English being more
verbose and including the phrases “for all” and “there exists” as appropriate.

1. A polynomial with integer coefficients may have integer roots.

2. A polygon may not be both convex and concave.

3. Trigonometric functions are periodic.

 Solution to Exercise 1.18

1. There exists a polynomial with integer coefficients which has integer roots.

2. For all polygons p, p cannot be both convex and concave.

3. For all trigonometic functions f , f is periodic.

Quantifiers

 Exercise 1.19

• Let F (x) := “x is a fish”

• Let H(x) := “x is a whale”

• Let W (x) := “x inhabits the water”

• Let S(x) := “x has scales”

If the domain of x is all animals, what is the truth value of the following?

1. ∀x (F (x) → W (x))

2. ∃x (S(x) → ¬W (x))

3. ∃x (F (x) ∧ ¬S(x) ∧ W (x))

4. ∀x S(x) → ∀x W (x)

 Solution to Exercise 1.19

1. True. If the animal is a fish, then it lives in the water. If the animal is not a fish, falsity
implies anything.

2. True. There exists many animals with scales that live on land. Butterflies, chameleons,
pangolins.

3. True. There exists a scale-less fish that lives in the water.

4. True. Quantifiers have precedence over implication. Therefore, the left-hand side and
right-hand side are independently false and we have F → F ≡ T .
 Exercise 1.20

• Let B(x) := “x is a bird”

• Let E(x) := “x lays eggs”

• Let M(x) := “x is a mammal”

• Let P (x) := “x is a plant”

• Let W (x) := “x inhabits the water”

If the domain of x is all plants and animals, translate each of these quantified statements
to a natural language statement. What is the truth value of each of them?

1. ∀x (B(x) → E(x))

2. ∀x (E(x) → B(x))

3. ∃x (W (x) ∧ P (x))

4. ∃x (W (x) ∧ E(x))

5. ∀x (P (x) ∨ M(x) ∨ B(x))

6. ∀x (W (x) → ¬M(x))

 Solution to Exercise 1.20

1. True. All birds lay eggs.

2. False. Not all eye-layers are birds. Reptiles, for example.

3. True. There are water plants. For example, seaweed.

4. True. Egg-laying water dwellers? Puffins, Penguins, for example.

5. False. There are organisms which are neither plants, mammals or birds. Reptiles,
amphibians, etc.

6. False. There are water-inhabiting organisms which are mammals. Whales!

 Exercise 1.21

Write the following English statements in predicate logic. Do this in two steps. First, re-
write the statement so that any implicit quantifiers or logical connectives are explicit.
Second, convert that statement to predicate logic, quantified as necessary.

1. “Of the positive integers, there is a smallest.”

2. “Some polynomials do not have real roots.”

3. “Two sets may have no elements in common.”

 Solution to Exercise 1.21

1. “There exists a positive integer that is smaller than every other positive integer.” Let
P (x, y) := x < y. Letting the domain of x and y be positive integers, we have:
∃x ∀y P (x, y)

2. “There exists a polynomial that has a non-real (i.e. complex) root.” Let P (f) := “f has a
non-real root.” Letting the domain of f be all polynomials, we have:
∃fP (f)

3. “There exists sets A and B such that A and B have no common elements.” Let
P (A, B) := “A and B have no common elements.” Letting the domain of A and B be all
possible sets, we have:
∃A ∃B P (A, B)
 Exercise 1.22

Let U be the set of imaginary creatures consisting of drackles, klabs, and grebbits.

• D(x) := x is a drackle.

• K(x) := x is a klab.

• G(x) := x is a grebbit.

Translate the following into predicate logic statements.

1. Everything is a drackle.

2. Nothing is a klab.

3. All drackles are klabs.

4. Some drackles are grebbits.

5. No klab is a grebbit.

 Solution to Exercise 1.22

1. ∀ x D(x)

2. ¬∃ x K(x) ≡ ∀ x ¬K(x)

3. ∀ x (D(x) → K(x))

4. ∃ x (D(x) ∧ G(x))

5. ¬∃ x (K(x) ∧ G(x)) ≡ ∀ x (¬K(x) ∨ ¬G(x))

 Exercise 1.23

In some Far Far Away Kingdom, the Queens’s court is composed of a number of members
and ranks. Let U be the set of all such ranks.

• K(x) := x is a Knight.

• B(x) := x is a Bard.

• R(x) := x is royalty.

• T (x) := x is a Thane.

Translate the following into predicate logic statements.

1. Some people are both Knights and Bards.

2. There are no Bards which are royal.

3. A Thane must be a Knight.

4. A royal may not be a Thane nor a Bard.

5. A person who is both Knight and Bard is a Thane.

 Solution to Exercise 1.23

1. ∃ x (K(x) ∧ B(x))

2. ¬∃ x (R(x) ∧ B(x)) ≡ ∀ x (¬R(x) ∨ ¬B(c))

3. ∀ x (T (x) → K(x))

4. ∀ x (R(x) → ¬(T (x) ∨ B(x)))

5. ∀ x (K(x) ∧ B(x) → T (x))


 Exercise 1.24

Consider the following set of requirements.

1. “If a user is active, then they are connected to the server”

2. “Only users connected to the server can receive messages”

3. “A user that requests encryption must receive encrypted messages”

Let the domain of u be all users of the system and the domain of e be “encrypted” or
“unencrypted”. Let:

• A(u) := u is an active user,

• C(u) := u is connected to the server,

• R(u, e) := u can receive messages of type e,

• E(u) := u has requested encryption.

Translate these requirements to quantified predicates. Is that set of propositions


consistent? If so, give a satisfying truth assignment. If not, what can you add to one of
these requirements (using the already supplied predicates) to make the requirements
consistent?

 Solution to Exercise 1.24

1. ∀ u ( A(u) → C(u) )

2. ∀ u ∃ e ( C(u) ↔ R(u, e) )

3. ∀ u (E(u) → R(u, encrypted) ∧ ¬R(u, unencrypted)))

These are not consistent. If A(u), C(u) are false and E(u) is true, then the third
requirement implies that u can receive messages, contradicting (2).

Modify the third requirement:


∃ u (E(u) ∧ C(u) → R(u, encrypted) ∧ ¬R(u, unencrypted))

Nested Quantifiers

 Exercise 1.25

Let U be the positive real numbers. Let P (x, y) := xy = 1.

What is the truth value of the following expressions?

1. ∀x ∀y P (x, y)

2. ∀x ∃y P (x, y)

3. ∃x ∀y P (x, y)

4. ∃x ∃y P (x, y)

5. ∀x P (x, x)

 Solution to Exercise 1.25

1. False

2. True

3. False

4. True

5. True
 Exercise 1.26

Let T (x, y) be the predicate “x is taking y” where the domain of x is all students and the
domain of y is all courses.

Translate the following English statements into quantified predicate statements.

1. “Every course is being taken by at least one student”

2. “Some student is taking every course”

3. “No student is taking all courses”

4. “There is a course that all students are taking”

5. “Every student is taking at least one course”

6. “There is a course that no students are taking”

7. “Some students are taking no courses”

8. “No course is being taken by all students”

9. “Some courses are being taken by no students”

10. “No student is taking any course”

 Solution to Exercise 1.26

1. ∀C ∃S T (S, C)

2. ∃S ∀C T (S, C)

3. ∀S ∃C ¬T (S, C)

4. ∃C ∀S T (S, C)

5. ∀S ∃C T (S, C)

6. ∃C ∀S ¬T (S, C)

7. ∃S ∀C ¬T (S, C)

8. ∀C ∃S ¬T (S, C)

9. ∃C ∀S ¬T (S, C)

10. ∀S ∀C ¬T (S, C)

 Exercise 1.27

Express the following English sentences in predicate logic. First define a predicate and
then write the English sentence as a quantified predicate statement.

1. “Brothers are siblings.”

2. “Siblinghood is symmetric.”

3. “Everybody loves someone.”

4. “There is someone who is loved by everyone.”

5. “There is someone who loves someone.”


 Solution to Exercise 1.27

• Let B(x, y) := “y is the brother of x”

• Let S(x, y) := “y is the sibling of x”

• Let L(x, y) := “x loves y”

1. ∀x ∀y (B(x, y) → S(x, y))

2. ∀x ∀y (S(x, y) → S(y, x))

3. ∀x ∃y L(x, y)

4. ∃y ∀x L(x, y)

5. ∃x ∃y L(x, y)

 Exercise 1.28

Let E(m, p) := “man m has eaten pizza p” and T (p, i) := “pizza p has ingredient i as a
topping”. Let the domains of m be all men, i be all toppings available at Pizza Hut, and p
be all pizzas made at Pizza Hut.

What are the English equivalents of the following logical expressions?

1. ∃m ∀i ∃p (T (p, i) ∧ E(m, p))

2. ∃m ∃p ∀i (T (p, i) ∧ E(m, p))

 Solution to Exercise 1.28

1. “A man has, for all toppings, eaten a pizza with that topping.”

2. “A man has eaten a pizza with every topping.”

 Exercise 1.29

Negate each of the logical expressions in Exercise 1.28. Ensure to distribute the negation
inside of any quantifiers.

 Solution to Exercise 1.29

1. ∀m ∃i ∀p(¬T (p, i) ∨ ¬E(m, p))

2. ∀m ∀p ∃i(¬T (p, i) ∨ ¬E(m, p))

 Exercise 1.30

Use quantifiers and predicates to express the statement “there is a woman who has taken
a flight on every airline in the world”.

 Solution to Exercise 1.30

• Let P (w, f) := w has taken flight f .

• Let Q(f, a) := f is a flight on airline a.

• The domain of w is all women, the domain of f is all flights, and the domain of a is all
airlines.

∃w ∀a ∃f (P (w, f) ∧ Q(f, a))


 Exercise 1.31

Use quantifiers and predicates to express the statement “there is a person that has visited
every country or that country no longer exists”.

Then, negate the quantified expression. What is a natural language interpretation of the
negated statement?

 Solution to Exercise 1.31

• Let V (p, c) := p has visited country c.

• Let E(c) := c is an extant country.

• The domain of p is all people, the domain of c is all countries, past or present.

∃p ∀c (V (p, c) ∨ ¬E(c))

Negation: ∀p ∃c (¬V (p, c) ∧ E(c))

Its interpretation: “There is a extant country which not every person in the world has
visited. “

 Exercise 1.32

Use quantifiers to express the statement “there does not exist a woman who has taken a
flight on every airline in the world.” That is, negate the solution to Exercise 1.30. Distribute
the negation so that there is no negation applied to a quantifier.

Finally, translate that modified expression back to English.

 Solution to Exercise 1.32

¬∃w ∀a ∃f (P (w, f) ∧ Q(f, a)) ≡ ∀w ¬∀a ∃f (P (w, f) ∧ Q(f, a))


≡ ∀w ∃a ¬∃f (P (w, f) ∧ Q(f, a))
≡ ∀w ∃a ∀f ¬(P (w, f) ∧ Q(f, a))
≡ ∀w ∃a ∀f (¬P (w, f) ∨ ¬Q(f, a))

“For every woman, there is an airline such that for all flights, this woman has not taken that
flight or that flight is not on this airline.”

By Alexander Brandt
© Copyright 2022.

You might also like