Chap 1 Exercise
Chap 1 Exercise
Exercise 1-1
1. Which of these sentences are propositions? What are the truth values of those that are propositions?
a) Boston is the capital of Massachusetts.
b) Miami is the capital of Florida.
c) 2 + 3 =5
d) 5 + 7 = 10
e) x + 2 =11
f) Answer this question
Ans: a) Yes, T b) Yes, F (Tallahassee) c) Yes, T d) Yes, F e) No f) No
5. Let p and q be the propositions “Swimming at the New Jersey shore is allowed” and “Sharks
have been spotted near the shore,” respectively. Express each of these compound propositions as an
English sentence.
a) ¬q b) p ^ q c) ¬pˇq d) p → ¬q
Ans:
a) Sharks have not been spotted near the shore.
b) Swimming at the New Jersey shore is allowed, and sharks have been spotted near the shore.
c) Swimming at the New Jersey shore is not allowed, or sharks have been spotted near the shore.
d) If swimming at the New Jersey is allowed, then sharks have not been spotted near the shore.
37. Find the bitwise OR, AND, XOR of each of these pairs of bit strings.
a) 1011110, 0100001 b) 11110000, 10101010
Ans: a) OR: 1111111, AND: 0000000, XOR: 1111111
b) OR: 11111010, AND: 10100000, XOR:01011010
2
Exercise 1-2
5. Use a truth table to verify the distributive law
p ^ (qˇr) ≣ (p ^ q) ˇ (p ^ r)
Ans:
3
Exercise 1-3
1. Let P(x) denote the statement “x≦4” What are the truth values?
a) P(0) b) P(4) c)P(6)
Ans: a) T b) T c) F
11. Let P(x) be the statement “x = x2.” If the domain consists of the integers, what are the truth
values?
a) P(0) b) P(1) c) P(2) d) P(-1) e) xP(x) f) xP(x )
Ans: a) T b) T c) F d) F e) T f) F
17. Suppose that the domain of the propositional function P(x) consists of integers 0, 1, 2, 3, and 4.
Write out each of these propositions using disjunctions, conjunctions, and negations.
a) xP(x) b) xP(x ) c) xP(x ) d) xP(x ) e) xP(x ) f) xP(x)
Ans: a)存在一個 x,使得 P(x)成立之解。所以,其解包含: P(0) P(1) P(2) P(3) P(4)
b) 對所有 x,P(x) 都成立,其解為: P(0) P(1) P(2) P(3) P(4)
c) P(0) P(1) P(2) P(3) P(4)
d) P(0) P(1) P(2) P(3) P(4)
e) ( P(0) P(1) P(2) P(3) P(4))
f) ( P(0) P(1) P(2) P(3) P(4))
31. Suppose that the domain of Q(x, y, z) consists of triples x, y, z, where x=0, 1, or 2, y=0 or 1, and
z=0 or 1. Write out these propositions using disjunctions and conjunctions.
a) yQ(0, y ,0) b) xQ(x,1,1) c) zQ (0,0, z ) d) xQ(x,0,1)
Ans: a) Q(0, 0, 0) Q(0, 1, 0) b) Q(0,1,1) Q(1,1,1) Q(2,1,1) c) Q(0, 0, 0) Q(0, 0, 1)
d) Q(0, 0, 1) Q(1, 0, 1) Q(2, 0, 1)
43. Determine whether x( P( x) Q(x) ) and xP( x ) x Q(x) are logically equivalent. Justify
your answer.
Ans: Not logically equivalent.例如:P(x) 整數 x,x2 > x;Q(x) 整數 x,x2 < x;所以,
P(x)有些成立,有些不成立;Q(x)則永遠 false,所以,
x( P( x) Q(x) ) 為假 (有些成立,有些不成立,所以,對所有 x 而言,則不一定成立);
xP( x ) x Q(x) 中,前件 F,後件 F,所以,整個 proposition 為 T
4
Exercise 1-4
27. Determine the truth value of each of these statements if the domain for all variables consists of all
integers.
a) nm(n 2 m) b) nm(n m 2 ) c) nm(n m 0) d) nm(n m m)
e) nm(n 2 m 2 5) f) nm(n 2 m 2 6) g) nm(n m 4 n m 1)
h) nm(n m 4 n m 2) i) nmp( p (n m) / 2)
Ans: a)T b) T c) T d)T e)T f)F g)F h)T i) F
31. Express the negations of each these statements so that all negation symbols immediately precede
predicates.
a) xyzT ( x, y , z ) b) xyP( x, y ) xyQ( x, y ) c) xy ( P( x, y ) zR ( x, y , z ))
d) xy ( P( x, y ) Q ( x, y ))
Ans: a) (xyzT ( x, y , z )) xyzT ( x, y , z )
b) xyP( x, y ) xyQ( x, y )
c) xy (P( x, y ) zR( x, y , z ))
d) xy ( P( x, y ) Q( x, y ))
33. Rewrite each of these statements so that negations appear only within predicates.
a) xyP( x, y ) b) yxP( x, y ) c) yx( P( x, y ) Q( x, y ))
d) (xyP( x, y ) xyQ ( x, y ))
e) x(yz( P( x, y, z ) zyP( x, y, z))
Ans: a) xyP( x, y ) b) yxP( x, y ) c) yx (P( x, y ) Q( x, y ))
d) (xyP( x, y ) xyQ( x, y )) e) x (yz (P( x, y, z ) zyP( x, y, z ))
5
Exercise 1-5
15. For each of these arguments determine whether the argument is correct or incorrect and explain
why.
a) All students in this class understand logic. Xavier is a student in this class. Therefore, Xavier
understands logic.
b) Every computer science major takes discrete mathematics. Nana is taking discrete mathematics.
Therefore, Nana is a computer science major.
c) All parrots(鸚鵡) like fruit. My pet bird is not a parrot. Therefore, my pet bird does not like fruit.
d) Everyone who eat granola(燕麥) every day is healthy. Linda is not healthy. Therefore, Linda does
not eat granola every day.
Ans: a) C b) I c)I d) C
23. Identify the error or errors in this argument that supposedly shows that if xP(x) xQ( x) is
true then x (P(x) Q ( x)) is true.
1. xP(x) xQ( x) Premise
2. xP(x) Simplification from (1)
3. P(c) Existential instantiation from (2)
4. xQ(x) Simplification from (1)
5. Q(c) Existential instantiation from (4)
6. P(c) Q(c ) Conjunction from (3) & (5)
7. x (P(x) Q ( x)) Existential generalization
Ans: Error. Step 5 is incorrect for using the parameter c (the same as step 3).
29. Use rules of inference to show that if x(P(x) Q( x )), x (Q(x) S ( x)),
x (R(x) S ( x)), and xP(x), are true, then xR(x), is true.
Ans: 解題技巧:以 GPS 方式找起點與終點的中間解,再繼續找中間解,直到連接起起點
與終點。
終點: xR(x),
起點:四個已知條件
中間:S(x)
再找中間:Q(x)
此時,可與已知連結:
1. xP(x), ??
2. P(c), ??
3. x(P(x) Q( x )), ??
4. P(c) Q (c),
5. Q(c)
6. x (Q(x) S ( x)),
7. Q(c) S (c), from (5)
6
8. S(c)
9. x (R(x) S ( x)), ??
10. R(c) S (c ),
11. R(c),
12. xR(x), is true.
7
Exercise 1-6
(證明常用方式:直接證法、反向證法( q p )、矛盾證法)
1. Use a direct proof to show that the sum of two odd integers is even.
Ans: Let n= 2K+1, m=2h+1 be odd integers. Then n + m = 2(k+h) + 2 = 2(k+h+1) is even. (直接證
法)
9. Use a proof by contradiction to prove that the sum of an irrational number and a rational number is
irrational.
Ans: Suppose that r is rational and i is irrational and s = r + i is rational. Then, s – r = i is rational
(contradiction). So, the sum of an irrational number and a rational number is irrational.
21. Let P(n) be the proposition “If a and b are positive real numbers, then (a+b)n ≥an + bn.” Prove
that P(1) is true. What kind of proof did you use?
Ans: P(1): (a + b)1 = a + b ≥a1 + b1. (direct proof)
27. Prove that if n is a positive integer, then n is odd if and only if 5n + 6 is odd.
Ans: (i) if n is odd, then 5n + 6 is odd
Let n = 2k+1, then 5n + 6 = 5(2k+1) + 6 = 2(5k+5) + 1 is odd.
(ii) if 5n + 6 is odd, then n is odd
(反向證法): If n is even, n = 2k. Then 5n + 6 = 5(2k) + 6 = 2(5k+3) is even. It implies “if 5n + 6
is odd, then n is odd.”
33. Show that these statements about the real number x are equivalent: (i) x is irrational, (ii) 3x+2 is
irrational, (iii) x/2 is irrational.
Ans: (i) -> (ii)
(反向證法) Suppose 3x+2 is rational, then (3x+2) = p/q (q≠0). Then, x =p/3q – 2/3 is
rational.
(ii) -> (i)
同上,Suppose x is rational, then x = p/q (q≠0). 3x+2 = 3p/q + 2 is rational.
(i) -> (iii)
類似 (i) -> (ii)
(iii) -> (i)
類似 (ii) -> (i)
(ii) -> (iii) 與(ii) -> (i) 證明相同, (iii)->(ii) 與 (i) -> (ii) 證明相同
8
Exercise 1-7
3. Prove that if x and y are real numbers, then max(x, y)+min(x, y) = x + y.
Ans: Two cases:
1: If x≦y, then max(x, y)+min(x, y) = y + x = x+ y
2. If x> y, then max(x, y)+min(x, y) = x+ y
13. Show that each pf these statements can be used to express the fact that there is a unique element x
such that P(x) is true. (即 ! xP( x ) )
a) xy ( P( y ) x y )
b) xP( x) xy ( P( x ) P( y ) x y )
c) x ( P( x ) y ( P( y ) x y ))
Ans:
a) 說明存在一個 x,使得 P(y) is true, then y=x. 且 x=y, P(y) is true (即 P(x) is true).所以,P(y)
除了 y=x 時,P(x) 才為真,否則皆為假。
b) 第一句:存在一個 x,使 P(x) is ture. 第二句:對所有 x, y,要 P(x)^ P(y)為真,則 x=y.
所以,只有存在一個 x = y 時,整個才為真。
c) 第一句:存在一個 x,使 P(x) is ture. 而且,當所有其他數值 y,使得 P(y)為真,則 x=y.
所以,只有存在一個 x = y 時,整個才為真。
27. Prove that there is no positive integer n such that n2+n3 =100.
Ans: 所有正整數 n3 > 100, 當 n>4. 所以,只要考慮 n=1, n=2, n=3, n=4 帶入均不符, 所以,
There is no positive integer n such that n2+n3 =100.