Rosen7eExtraExamples0105 PDF
Rosen7eExtraExamples0105 PDF
Rosen7eExtraExamples0105 PDF
Solution:
(a) The predicate states that if y is a store, then Margaret shops there. That is, Margaret shops in every
store.
(b) The predicate states that there is a person x with the property that x shops in every store y. That is,
There is a person who shops in every store. [Note that part (a) is obtained from part (b) by taking a
particular value, Margaret, for the variable x. If we do this, we do not need to quantify x.]
Solution:
The solution depends on what we take for the universe for the variable. If we take all Juniors in this class
as the universe, we can write the proposition as
x S(x)
where S(x) is the predicate x scored above 90 on the rst exam.
However, if we take all students in this class as the universe, then we can write the proposition as
x (J(x) S(x))
where J(x) is the predicate x is a Junior.
We can extend the universe still further. Suppose we take all students as the universe. Then we need to
introduce a third predicate C(x) to mean x is in this class. In this case, the proposition becomes
x ((C(x) J(x)) S(x)).
If we also wish to distinguish among possible scores on the rst exam, we can use nested quantiers,
discussed later in this section of the book. We can replace S(x) by S(x, y) where S(x, y) means x received
a score of y on the rst exam and the universe for y is the set of all possible exam scores. In this case the
proposition becomes
1
Solution:
The statement y x (T (x) S(x, y)) says that there is a store y with a certain property, namely, if x is
any student whatever, then x does not shop in y. We have There is a store in which no student shops.
Solution:
The statement y x (T (x) S(x, y)) asserts that for every store y that can be chosen, there is a person x
who is a student and who shops in y. Therefore: Every store has at least one student who shops in it.
Solution:
The statement S(x1 , y) (x1 = x2 S(x2 , y)) tells us two things: person x1 shops in store y, and if x2
is any other person then x2 does not shop in y. Therefore, we have There is a store in which exactly one
person shops.
2
Solution:
The statement x y (C(x) M (y) T (x, y)) asserts that for every student x there is a course y such that
if x is a major in Computer Science then x is taking y and y is a math course. Therefore, Every Computer
Science major is taking at least one math course.
Solution:
The statement y x (C(x) T (x, y)) says that for every course y there is a student x such that x is not a
Computer Science major and x is taking y. That is, Every course has a student in it who is not a Computer
Science major.
Solution:
First examine part of the statement, y (M (y) T (x, y)). This says that if y is a math course, then x
is taking y, or, equivalently, x is taking every math course. The given statement says that there is no
3
student with this property: F (x) y (M (y) T (x, y)); that is, there is no student who is both a freshman
and who is taking every math course. Therefore, we have No Freshman is taking every math course.
Solution:
Using Will for x and Als Record Shoppe for y, we have
S(Will, Als Record Shoppe).
No quantiers are needed.
Solution:
We can begin by stating that It is false that there exists a store y with the property that no students shop
in y. Saying that no students shop in y is saying x (T (x) S(x, y)). Completely written in symbols,
we have
y x (T (x) S(x, y)).
Solution:
The given statement asserts that There is at least one store, y, such that only students shop there. Saying
4
that only students shop in y means that x (S(x, y) T (x)). Putting these together gives
y x (S(x, y) T (x)).
Solution:
(a) True. We need to consider three cases: y = 1, y = 2, y = 3.
If y = 1, we can take x = 2, obtaining the true statement 2 = 1 P (2, 1).
If y = 2, we can take x = 3, obtaining the true statement 3 = 2 P (3, 2).
If y = 3, we can take x = 1, obtaining the true statement 1 = 3 P (1, 3).
Therefore, the statement x (x=y P (x, y)) is true for all possible choices of y. Hence, yx (x=y P (x, y))
is true.
(b) False. Take x = 3. The statements P (3, 1), P (3, 2), and P (3, 3) are true; that is, the statements P (3, 1),
P (3, 2), and P (3, 3) are false. Therefore, there is no value y such that 3=y P (3, y) is true.
(c) False. Take y = 1. We need to consider x = 1, x = 2, and x = 3. The conjunctions 1=1 P (1, 1),
2=1 P (2, 1), and 3=1 P (3, 1) are all false.
Solution:
(a) False. If we take y = 1, not all four statements P (x, 1) are true. (Take x = 1 for example.) If we take
y = 2, not all four statements P (x, 2) are true. (Take x = 1 for example.) If we take y = 3, not all four
statements P (x, 3) are true. (Take x = 1 for example.) If we take y = 4, not all four statements P (x, 4) is
true. (Take y = 2.)
(b) False. P (1, 1) is false.
(c) True. For every x we can nd a value y = x such that P (x, y) is true: P (1, 4), P (2, 1), P (3, 4), and
P (4, 1).
5
Solution:
(a) The sentence has the form If it is a time of peace, then . . . , and, if it is a time of war, then . . . . Written
in full, the sentence is If it is a time of peace, then no soldier shall be quartered in any house without the
consent of the owner, and, if it is a time of war, then no soldier shall be quartered in any house except in a
manner to be prescribed by law.
(b) The statement is a conjunction; it has the form (if P (t), then . . .) (if P (t), then . . .).
Let us examine the case when it is a time of peace. The statement says that if the owner of a house does
not give consent, then no soldier shall be quartered in that house. That is, if person x owns house h and
does not consent to quarter soldier y in h, then x is not required to quarter y in h. In symbols, we have
((O(x, h) S(y) C(x, y, h) Q(x, y, h).
Similarly, in the case when it is not a time of peace, we have
((O(x, h) S(y) A(y, h) Q(x, y, h) .
Completely written in symbols we have
t x y h P (t) (O(x, h) S(y) C(x, y, h) Q(x, y, h)
.
P (t) (O(x, h) S(y) A(y, h) Q(x, y, h)
where x and y are integers and z is a Boolean variable (with values True and False).
(b) Use the laws of propositional logic to simplify the statement by expressing it in a simpler form.
(c) Translate the answer in part (b) back into C++.
See Solution
Solution:
(a) First we insert the predicates into the code, obtaining
if (!(!E(x) && L(x, y)) || E(x))
A(True)
else
A(False).
Next change to the usual logical connective symbols, keeping in mind that C++ code of the form if p then q
else r is really a statement of the form (p q) (p r):
[ ( E(x) L(x, y)) E(x)]
A(True)
[ ( E(x) L(x, y)) E(x)] A(True) [ ( E(x) L(x, y)) E(x)] A(False) .
(b) Using one of De Morgans laws on the negation of the conjunction, the statement becomes
x y [(E(x) L(x, y)) E(x)] A(True) [(E(x) L(x, y)) E(x)] A(False) ,
which can be simplied to give
x y (E(x) L(x, y)) A(True) (E(x) L(x, y)) A(False) .
(c) Translating the statement in (b) into C++ yields
if (x==0 || y/x >= 1)
cout << True
else
cout << False.
See Solution
(a) This statement asserts that there are numbers x and y such that xy = 2. This is true because we can
take x = 2 and y = 1, for example.
(b) This statement asserts that there is a number x such that when we multiply this particular x by every
possible number y we obtain xy = 2. There is no such number x. (If there were such a number x, then
xy = 2 for all y. If we take y = 0, the product xy cannot equal 2.) Therefore the statement is false.
(c) This statement asserts that for every number x we choose, we can nd a number y such that the xy = 2.
This is almost always the case, except if we choose x = 0. If we take x = 0, there is no number y such
that xy = 2. Therefore the statement is false. (Note that the statement would be true if the universe for x
consisted of all nonzero real numbers.)
(d) This statement claims that no matter what numbers x and y we choose, we obtain xy = 2. Clearly, this
is false, because we could choose x = y = 1.
Solution:
(a) The sentence states that there is a store y such that every person x shops there. Thus, There is a store
in which everyone shops.
(b) The sentence states that for every person x there is a store y in which x shops. Therefore, we have
Everyone shops somewhere.
Solution:
(a) True. We can take x = 1. Because there is no y such that y < 1, the hypothesis of the implication
y < x P (x, y) is false, making the implication true.
(b) True. We need to consider the cases y = 1, y = 2, and y = 3.
If y = 1, then the statement x (y < x P (x, y)) is true for x = 2 (because 1 < 2).
If y = 2, then the statement x (y < x P (x, y)) is true for x = 3 (because 2 < 3).
If y = 3, then the statement x (y < x P (x, y)) is true for x = 1 (because P (1, 3) is true).
(c) True. Take x = y = 2, for example.
8
(d) True. We need to consider the cases y = 1, y = 2, and y = 3. This means that we must examine the
three statements
x (P (x, 1) P (1, x)) ( true for x = 2 because P (2, 1) P (1, 2) is true )
x (P (x, 2) P (2, x)) ( true for x = 1 because P (1, 2) P (2, 1) is true )
x (P (x, 3) P (3, x)) ( true for x = 2 because P (2, 3) P (3, 2) is true ).
Solution:
(a) True. For every value of x (x = 1 and x = 2) there are y and z such that P (x, y, z) is true. In both cases
we can choose both y = z = 2.
(b) True. For each choice of values for x and y, we can nd z such that P (x, y, z) is true. We need to
consider four cases.
(1) x = y = 1: we take z = 1,
(2) x = 1 and y = 2: we can take z to be 1 or 2,
(3) x = 2, y = 1: we take z = 1,
(4) x = y = 2: we take z = 2.
(c) False. If we take y = 1 and z = 2, there is no value of x such that P (x, 1, 2) is true.
(d) False. Take x = 2. There is no value of y such that z P (2, y, z) is true.
Solution:
(a) False. If we take x = 1, we do not have P (1, y, z) true for all possible values of y and z P (1, 1, 2) is
false. If we take x = 2, we do not have P (2, y, z) true for all possible values of y and z P (2, 1, 2) and
P (2, 2, 1) are both false.
(b) False. Take x = 2. Then z y P (2, y, z) is false. To see this, suppose we try z = 1; then P (2, y, 1) is
false for y = 1. If we try z = 2, P (2, y, 2) is false for y = 1.
(c) True. We must consider the cases where y = 1 and y = 2. If we take y = 1. Then x z P (x, 1, z) is
true if x = z = 2, that is, P (2, 1, 2) is true. If we take y = 2. Then x z P (x, 2, z) is true if x = 2 and
9
Solution:
(a) True. For every value of x taken from the universe, there is a value y such that P (x, y) is true: P (1, 4),
P (2, 1), P (3, 4), and P (4, 1) are all true.
(b) False. If y = 3, there is no value of x such that P (x, 3) is true.
(c) False. If we take x = 1, not all four statements P (1, y) are true. (Take y = 1 for example.) If we take
x = 2, not all four statements P (2, y) are true. (Take y = 3 for example.) If we take x = 3, not all four
statements P (3, y) are true. (Take y = 1 for example.) If we take x = 4, not all four statements P (4, y) is
true. (Take y = 2 for example.)
Solution:
The statement says that For every number x we choose, there is a number y such that y > x. That is,
x y (y > x)
where the universe for x and y consists of all numbers.
Solution:
Using the universe consisting of all real numbers for x and y, we are saying that If x and y are greater than
zero, then xy is greater than zero. That is,
x y [(x > 0 y > 0) (xy > 0)].
10
If we use all positive real numbers as the universe for x and y, we can write the statement more simply:
x y (xy > 0).
N (x): x is negative.
Solution:
(a) We are saying that it is not possible to have a perfect square that is negative. That is, x (S(x)N (x)).
Equivalently, we could say that if x is a perfect square, then x is not negative. That is,
x (S(x) N (x)).
We could rewrite this as its contrapositive: If x is negative, then x is not a perfect square. That is,
x (N (x) S(x)).
(b) This statement is equivalent to (a). This statement says that it is not possible to have a negative number
that is a perfect square. That is,
x (N (x) S(x)).
You should use the various laws of logic to show that x (N (x) S(x)) is indeed equivalent to x (S(x)
N (x))
P (x): x is positive
Solution:
Note that for all is implied. When we say Perfect squares are positive we are really saying that For all
integers x we choose, if x is a perfect square, then x is positive. In symbols we have
x (S(x) P (x)).
11
Solution:
We are making a two-part statement:
Solution:
(a) We are asserting that there is an integer x that has two properties: (1) it is positive, (2) it ends in the
digit 5. That is, x (P (x) F (x)).
(b) This statement begins with the statement for (a) and then asserts that there is a dierent positive integer
that does not end in the digit 5. That is,
x (P (x) F (x)) y ((y = x) P (x) F (x)).
Equivalently, we could write
x y [(x = y) P (x) P (y) F (x) F (y)].
Solution:
12
Using all positive real numbers as the universe for x and y, we are saying that For every number x we can
choose, there is a number y that is smaller than x. In symbols,
x y (y < x).
If we use all real numbers as the universe for x and y, we are saying that For every positive real number x
we can choose, there is a real number y that is positive and smaller than x. In symbols,
x (x > 0 y (0 < y < x)).
a+b
lies between a and b.
2
See Solution
Solution:
Note that it is understood that the predicate applies to all a and b chosen from some universe. Using all real
numbers as the universe for a and b, we have
a+b
a b a < b a <
<b .
2
a+b
lies between a and b.
2
See Solution
Solution:
a+b
Note that we cannot write ab a <
< b because we do not know that a < b. (It may be the case
2
that a = b or that a > b.) We can write
a+b
a+b
a b a
b b
a .
2
2
Solution:
We take the negation and then move the negation sign inside:
(x y (xy = 0)) x (y (xy = 0)) x y (xy = 0) x y (xy = 0).
The original statement says that There is a number with the property that no matter what number we
multiply it by, we obtain 0. (The statement is true because the number 0 is such a number x.) The negation
13
states that No matter what number is chosen, there is a number such that the product is nonzero. (As
expected, the negation is false because it is the negation of a true statement. To see that the negation is
false, take x to be 0. Then no matter what value we take for y, the product xy = 0.)
Solution:
Taking the universe for x and y to consist of all real numbers, we are stating that there is a number x such
that, no matter what number y is chosen, we have x y. Therefore.
x y (x y).
Its negation can be formed using these steps:
(x y (x y)) x y (x y) x y (x < y).
(This says that there is no largest number.)
14