Download SOLUTIONS FOR MATH 55, HOMEWORK #1 Contact. If you see

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Law of thought wikipedia , lookup

Boolean satisfiability problem wikipedia , lookup

Truth-bearer wikipedia , lookup

Laws of Form wikipedia , lookup

Transcript
SOLUTIONS FOR MATH 55, HOMEWORK #1
Contact. If you see any errors in this solution set, or if you have any questions, feel
free to email the GSI at [email protected].
Note about problem set 1. Because this is the first problem set and because it’s
the introduction to formal logic, many questions on this set are of the form “write
down an x equivalent to y.” There’s no intermediate work in such a problem—one
simply writes the answer down and moves on. This is generally not the case for
this course; most problems will ask you to present an argument. On such problems
a bare, unsupported assertion of an answer won’t suffice.
Problem 1.1.8. Let p, q, and r be the propositions
p : You have the flu.
q : You miss the final examination.
r : You pass the course.
Write these propositions using p and q and logical connectives.
(a) p → q
(b) ¬q ⇐⇒ r
(c) q → ¬r
(d) p ∨ q ∨ r
(e) (p → ¬r) ∨ (q → ¬r)
(f ) (p ∧ q) ∨ (¬q ∧ r)
Solution. Because this is part of the chapter 1.1, we don’t have logical equivalences yet. That’s a shame—many of these solutions could be made to sound more
“natural” by first altering the form of the logic a bit.
(a) If you have the flu, you miss the final examination.
(b) You pass the course if and only if you take the final exam.
(c) If you miss the final examination, you will not pass the course.
(d) You either have the flu, miss the final examination, or pass the course (or
any combination).
(e) If you have the flu, you will fail the course, or if you miss the final exam,
you will fail the course. (Note that if we had chapter 1.2 at this point, we could
simplify the statement first:
(p → ¬r) ∨ (q → ¬r) ⇐⇒ (¬p ∨ ¬r) ∨ (¬q ∨ ¬r)
⇐⇒ (¬p ∨ ¬q) ∨ ¬r
⇐⇒ ¬(p ∧ q) ∨ ¬r
⇐⇒ (p ∧ q) → ¬r
Typeset by AMS-TEX
1
2
SOLUTIONS FOR MATH 55, HOMEWORK #1
write the more natural sentence “you will fail the course if you have a flu and miss
the final examination.”
(f) Either you have the flu and miss the final exam, or you don’t miss the final
exam and pass the course.
Problem 1.1.10. Let p, q, and r be the propositions
p : You get an A on the final exam.
q : You do every exercise in the book.
r : You get an A in this course.
Write these propositions using p, q, and r and logical connectives.
(a) You get an A in this class, but you do not do every exercise in this book.
(b) You get an A on the final, you do every exercise in this book, and you get an
A in this class.
(c) To get an A in this class, it is necessary for you to get an A on the final.
(d) You get an A on the final, but you don’t do every exercise in this book;
nevertheless, you get an A in this class.
(e) Getting an A on the final and doing every exercise in the book is sufficient
for getting an A in this class.
(f ) You will get an A in this class if and only if you either do every exercise in
this book or you get an A on the final.
Solution.
(a) r ∧ ¬q
(b) p ∧ q ∧ r
(c) r → p
(d) p ∧ ¬q ∧ r
(e) (p ∧ q) → r
(f) r ⇐⇒ (p ∨ q)
Problem 1.1.22. State the converse, contrapositive, and inverse of each of these
implications.
(a) If it snows tonight, then I will stay at home.
(b) I go to the beach whenever it is a sunny summer day.
(c) When I stay up late, it is necessary that I sleep until noon.
Solution. (a) Converse: If I stay at home, it will have snowed tonight.
Contrapositve: If I don’t stay home tonight, it didn’t snow.
Inverse: If it doesn’t snow tonight, then I won’t stay home.
(b) Converse: It is a sunny summer day whenever I go to the beach.
Contrapositive: It isn’t a sunny summer day whenever I don’t go to the beach.
Inverse: I don’t go to the beach whenever it isn’t a sunny summer day.
(c) Converse: When I sleep until noon, it is necessary that I stay up late.
Contrapositive: When I don’t sleep until noon, it is necessary that I not stay up
late.
Inverse: When I don’t stay up late, it is necessary that I not sleep until noon.
SOLUTIONS FOR MATH 55, HOMEWORK #1
3
Problem 1.1.26. Construct a truth table for each of these compound propositions:
(a) p ⊕ p
(b) p ⊕ ¬p
(c) p ⊕ ¬q
(d) ¬p ⊕ ¬q
(e) (p ⊕ q) ∨ (p ⊕ ¬q)
(f ) (p ⊕ q) ∧ (p ⊕ ¬q)
Solution.
(a)
p
F
T
p⊕p
F
F
(b)
p ¬p
F T
T F
p ⊕ ¬p
T
T
(c)
p
F
F
T
T
q ¬q
F T
T F
F T
T F
p ⊕ ¬q
T
F
F
T
(d)
p
F
F
T
T
q ¬p
F T
T T
F F
T F
¬q
T
F
T
F
¬p ⊕ ¬q
F
T
T
F
(e) Reusing our work from (c) above,
p
F
F
T
T
q p⊕q
F
F
T
T
F
T
T
F
p ⊕ ¬q
T
F
F
T
(p ⊕ q) ∨ (p ⊕ ¬q)
T
T
T
T
p
F
F
T
T
q p⊕q
F
F
T
T
F
T
T
F
p ⊕ ¬q
T
F
F
T
(p ⊕ q) ∧ (p ⊕ ¬q)
F
F
F
F
(f)
4
SOLUTIONS FOR MATH 55, HOMEWORK #1
Problem 1.1.42. An explorer is captured by a group of cannibals. There are two
types of cannibals—those who always tell the truth and those who always lie. The
cannibals will barbecue the explorer unless he can determine whether a particular
cannibal always lies or always tells the truth. He is allowed to ask the cannibal
exactly one question.
(a) Explain why the question “Are you a liar?” does not work.
(b) Find a question that the explorer can use to determine whether the cannibal
always lies or tells the truth.
Solution.
(a) The problem is that every native will respond “no” to this question–truth
tellers will respond “no” honestly; liars will lie and say “no.”
(b) “Am I an explorer?” would do the trick, as would any question about objective reality. (“Is that the sun?” “Is the grass green?”, and so forth.)
Problem 1.2.4. Use truth tables to verify the associative laws
(a) (p ∨ q) ∨ r = p ∨ (q ∨ r)
(b) (p ∧ q) ∧ r = p ∧ (q ∧ r)
Solution.
p
F
F
F
F
T
T
T
T
q r p∨q
F F
F
F T
F
T F
T
T T
T
F F
T
F T
T
T F
T
T T
T
q∨r
F
T
T
T
F
T
T
T
(p ∨ q) ∨ r
F
T
T
T
T
T
T
T
p ∨ (q ∨ r)
F
T
T
T
T
T
T
T
p
F
F
F
F
T
T
T
T
q r p∧q
F F
F
F T
F
T F
F
T T
F
F F
F
F T
F
T F
T
T T
T
q∧r
F
F
F
T
F
F
F
T
(p ∧ q) ∧ r
F
F
F
F
F
F
F
T
p ∧ (q ∧ r)
F
F
F
F
F
F
F
T
So yes, both associative laws work.
Problem 1.2.12. Determine whether (¬p ∧ (p → q)) → ¬q is a tautology.
Three Solutions for the Price of One..
The Boring Solution
p
F
F
T
T
q ¬p
F T
T T
F F
T F
p→q
T
T
F
T
¬p ∧ (p → q) ¬q
T
T
T
F
F
T
F
F
so the statement is not a tautology
(¬q ∧ (p → q)) → ¬q
T
F
T
T
SOLUTIONS FOR MATH 55, HOMEWORK #1
5
Another Boring Solution
(¬p ∧ (p → q)) → ¬q ⇐⇒ ¬(¬p ∧ (p → q)) ∨ ¬q
⇐⇒ (p ∨ ¬(p → q)) ∨ ¬q
⇐⇒ (p ∨ (p ∧ ¬q)) ∨ ¬q
⇐⇒ p ∨ ¬q
This isn’t a tautology—it’s false if p is false and q is true. A Slightly More
Interesting Solution Suppose p were false and q true. Then p → q is certainly
true, as is ¬p, so the left side of the main implication would be true, yet ¬q would be
false. This would make the overall implication false, so it cannot be a tautology. 1.2.34. Find a compound proposition involving propositions p, q, and r that is true
when p and q and r is false, but false otherwise.
Solution. If we want p and q and not r, we can just literally write that!
p ∧ q ∧ (¬r)
Since ∧ is associative, there’s no need for extra parenthesis to establish precedence.
1.3.10. Let C(x) be the statement “x has a cat,” D(x) be the statement “x has a
dog,” and F (x) be the statement “x has a ferret. Express each of these statements
in terms of C(x), D(x), and F (x) quantifiers, and logical connectives. Let the
universe of discourse consist of all the students in your course.
(a) A student in your class has a cat, a dog, and a ferret.
(b) All students in your class have a cat, a dog, or a ferret.
(c) Some student in your class has a cat and a ferret, but not a dog.
(d) No student in your class has a cat, a dog, and a ferret.
(e) For each of the three animals, cats, dogs, and ferrets, there is a student in
your class who as one of these animals as a pet.
Solution. (a) ∃x(C(x) ∧ D(x) ∧ F (x))
(b) ∀x(C(x) ∨ D(x) ∨ F (x))
(c) ∃x((C(x) ∧ F (x)) ∧ ¬D(x))
(d) ¬∃x(C(x) ∧ D(x) ∧ F (x))
(e) (∃x(C(x))) ∧ (∃x(D(x))) ∧ (∃x(F (x)))
1.3.12. Let Q(x) be the statement “x+1 > 2x.” If the universe of discourse consists
of all integers, what are these truth values.
(a) Q(0)
(b) Q(−1)
(c) Q(1)
(d) ∃xQ(x)
(e) ∀xQ(x)
(f ) ∃x¬Q(x)
(g) ∀x¬Q(x)
Solution. First, note that Q(x) is equivalent to x < 1.
(a) claims that 0 < 1. This is clearly true. (b) claims that −1 < 1, which is also
true. (c) claims 1 < 1, which is false.
6
SOLUTIONS FOR MATH 55, HOMEWORK #1
(d) claims that there exists an integer less than 1, which is true. (e), by contrast,
claims that all integers are less than 1, which is false. (f ) claims that there exists
an integer not less than one, which is clearly true. (g) claims that all integers aren’t
less than one, which is nonsense.
Proclaim 1.3.24. Translate each of these statements into logical expressions in
three different ways by varying the universe of discourse and by using predicates
with one or two variables.
(a) Someone in your school has visited Uzbekistan
(b) Everyone in your class has studied calculus and C++.
(c) No one in your school owns both a bicycle and a motorcycle.
(d) There is a person in your school who is not happy.
(e) Everyone in your school was born in the twentieth century.
Solution.
(a) if we take the universe of discourse to be “students at Berkeley,” and let
U (x) be “x has visited Uzbekistan”, then we could express this as ∃x(U (x)). If
we instead take the universe of discourse to be all people, and B(x) to be x is a
Berkeley student, then we’d have ∃x(U (x) ∧ B(x)). Finally, if we let x vary over
all people and y vary over all nations, and define V (x, y) as “x has visited y”, then
we have ∃x(V (x, Uzbekistan)).
(b) Suppose we let the universe of discourse be “students in your class.” If we
let C(x) be “x has studied Calculus” and CP P (x) be “x has studied C++,” then
the statement is ∀x(C(x) ∧ CP P (x)). If we let x vary over all students at Berkeley
and define Y C(x) to be “x is a student in your class,” then we have ¬∃x(Y C(x) ∧
¬(C(x) ∧ (CP P (x)))). Finally, if we let x vary over all students at Berkeley and y
range over all subjects of study, we could define S(x, y) to mean “x has studied y.”
We would then have ¬∃x(Y C(x) ∧ ¬(S(x, Calculus) ∧ S(x, C + +))).
(c) First, let x vary over all people at Berkeley. Let B(x) mean x owns a
bicycle, and M (x) mean that x owns a motorcycle. Then the claim is ¬∃x(B(x) ∧
M (x)). We could instead let x we let x vary over all people, and let U CB(x) mean
“x is a student at UC Berkeley. ” We would then have ¬∃x(U CB(x) ∧ B(x) ∧
M (x)). Finally, if we let x vary over students at Berkeley, and let y vary over all
vehicles. Define V (x, y) to be “x has vehicle y”. We then have ¬∃x(V (x, bicycle) ∧
V (x, motorcycle)
(d) Let x range over students at Berkeley, and let H(x) be “x is happy.” We
then have ∃x(¬H(x)). If we let y range over all emotions and let F (x, y) mean “x
is feeling y,” then we have ∃x(¬F (x, happy). If we let x range over all people, and
import U CB from the previous problem, then we have ∃x(U CB(x)∧¬F (x, happy).
(e) Let x vary over UC Berkeley students, and let T mean “was born in the 20th
century. We then have ∀xT (x). We could let y be an integer and let B(x, y) mean
that x was born in century y, upon which we have ∀xB(x, 20). By extending x
to range over all people and again importing U CB, we could have ∀x(U CB(x) →
B(x, 20)).
Proclaim 1.3.40. Express each of these system specifications using predicates,
quantifiers, and logical connectives.
(a) Every user has access to an electronic mailbox.
(b) The system mailbox can be accessed by everyone in the group if the file system
is locked.
SOLUTIONS FOR MATH 55, HOMEWORK #1
7
(c) The firewall is in a diagnostic state only if the proxy server is in a diagnostic
state.
(d) At least one router is functioning normally if the throughput is between
100kbps and 500kbps and the proxy server is not in a diagnostic state.
Solution.
(a) Let u run over all users, and let M (u) mean “u” has an electronic mailbox.
This spec says
∀uM (u).
(b) Let G(u) mean “u is in the group, let SM (u) mean “u can access the system
mailbox,” and let l be the propostion “the file system is locked.” We now have
∀u((l ∧ G(u)) → SM (u))
(c) Let s run over all servers, and let DS(s) mean “s is in a diagnostic state.”
We now have
DS(firewall) → DS(proxy server).
(d) Let r run over all routers, and let x run over all possible throughputs. Let
T (x) mean “throughput is faster than x”. Let N (r) mean “r is functioning normally.
We now have
(¬DS(proxy server) ∧ T (100kbps) ∧ (¬T (500kbps))) → ∃rN (r).
Problem 1.3.58. Let P (x), Q(x), R(x), and S(x) be the statements “x is a duck,”
“x is one of my poultry,” “x is an officer,” and “x is willing to waltz,” respectively. Express each of these statements using quantifiers; logical connectives, and
P (x), Q(x), R(x), and S(x).
(a) No ducks are willing to waltz.
(b) No officers ever decline to waltz.
(c) All my poultry are ducks.
(d) My poultry are not officers.
(e) Does (d) follow from (a), (b), and (c)? If not, is there a correct conclusion?
Solutions. (a) could be rephrased as “for all x, if x is a duck then x is unwilling to
waltz,” or ∀x(P (x) → ¬S(x).
(b) could be rephrased as “for all x, if x is an officer then x is willing to waltz,”
or ∀x(R(x) → S(x)).
(c) could be rephrased as “for all x, if x is my poultry then x is a duck,” or
∀x(Q(x) → P (x))
(d) could be rephrased as “for all x, if x is my poultry then x is not an officer,”
or ∀x(Q(x) → ¬R(x).
(e) (d) does follow at once from (a) − (c): For all x, we have Q(x) → P (x) from
(c), P (x) → ¬S(x) from (a), and ¬S(x) → ¬R(x) from the contrapositive of (b).
Following the chain of implications, we arrive at (d).
8
SOLUTIONS FOR MATH 55, HOMEWORK #1
Problem 1.4.6. Let C(x, y) mean that student x is enrolled in class y, where the
universe of discourse for x consists of all students in your school and the universe
of discourse for y is the set of all classes being given at your school. Express each
of these statements by a simple English sentence.
(a) C(Randy Goldberg, CS252)
(b) ∃xC(x,Math 695)
(c) ∃yC(Carol Sitea, y)
(d) ∃x(C(x, Math 222) ∧ C(x, CS 252))
(e) ∃x∃y∀z((x 6= y) ∧ (C(x, z) → C(y, z)))
(f ) ∃x∃y∀z((x 6= y) ∧ (C(x, z) ↔ C(y, z))
Solution.
(a) Randy Goldberg is enrolled in CS252.
(b) At least one student is enrolled in Math 695.
(c) Carol Sitea is enrolled in at least one course.
(d) At least one student is enrolled in both Math 222 and CS 252.
(e) There exists a pair of distinct students x and y such that y is enrolled in
every class x is enrolled in.
(f) There exists a pair of distinct students enrolled in precisely the same courses.
Problem 1.4.12. Let I(x) be the statement “x has an Internet connection” and
C(x, y) be the statement “x and y have chatted over the Internet,” where the universe of discourse for the variables x and y consists of all the students in your class.
Use quantifiers to express each of these statements.
(a) Jerry does not have an Internet connection.
(b) Rachel has not chatted over the Internet with Chelsea.
(c) Jan and Sharon have never chatted over the Internet.
(d) No one in the class has chatted with Bob.
(e) Sanjay has chatted with everyone except Joseph.
(f ) Someone in your class does not have an Internet connection.
(g) Not everyone in your class has an Internet connection.
(h) Exactly one student in your class has an Internet connection.
(i) Everyone except one student in your class has an Internet connection.
(j) Everyone in your class with an Internet connection has chatted over the
Internet with at least one other student in your class.
(k) Someone in your class has an Internet connection but has not chatted with
anyone else in your class.
(l) There are two students in your class who have not chatted with each other
over the Internet.
(m) There is a student in your class who has chatted with everyone in your class
over the Internet.
(n) There are at least two students in your class who have not chatted with the
same person in your class.
(o) There are two students in your class who between them have chatted with
everyone else in the class.
Solution.
(a) ¬I(Jerry)
(b) ¬C(Rachel, Chelsea)
SOLUTIONS FOR MATH 55, HOMEWORK #1
9
(c) Here we run into a problem with the vagaries of the English language. If
we mean Jan has never chatted with Sharon, this is just ¬C(Jan, Sharon). If we
mean that Jan and Sharon have never chatted over the Internet at all, then we
can’t render the statement, as it requires referring to people outside our universe
of discourse (all the other people they haven’t chatted with not in the class). The
closest that we can come is to claim that Jan and Sharon haven’t chatted with
anyone else in the class: f orallx(¬C(Jan, x) ∧ ¬C(Sharon, x))
(d) ¬∃x(C(Bob, x))
(e) ∀x(C(Sanjay, x) ∨ (x = Joseph) ∨ (x = Sanjay))
(f) ∃x(¬I(x))
(g) ¬∀x(I(x)). (Yes, this is the same as (f ), by DeMorgan’s laws).
(i) ∀x∀y((¬I(x) ∧ ¬I(y)) → (x = y))
(j) ∀x∃y((y 6= x) ∧ (I(x) → C(x, y))
(k) ∃x∀y((x = y) ∨ (I(x) ∧ ¬C(x, y))).
(l) ∃x∃y((x 6= y) ∧ ¬C(x, y))
(m) ∃x∀yC(x, y). (Including himself or herself, apparently!)
(n) ∃x∃y∀z(C(x, z) ⇐⇒ ¬C(y, z)).
(o) ∃x∃y∀z((x 6= y) ∧ (C(x, z) ∨ C(y, z))).
Problem 1.4.26. Let Q(x, y) be the statement x + y = x − y. If the universe of
discourse for both variables consists of all integers, what are the truth values?
(a) Q(1, 1)
(b) Q(2, 0)
(c) ∀yQ(1, y)
(d) ∃xQ(x, 2)
(e) ∃x∃yQ(x, y)
(f ) ∀x∃yQ(x, y)
(g) ∃y∀xQ(x, y)
(h) ∀y∃xQ(x, y)
(i) ∀x∀yQ(x, y)
Solution. Q can be simplified by solving and noting that x + y = x − y is equivalent
to y = 0. Thus (a) is false and (b) is true. (c) isn’t true—(a) is a counterexample.
(d) also isn’t true—x is irrelevant to the truth value of Q(x, y). (e) is true at once,
given (b). (f ) is true—Q(x, 0) is always true. (g) is therefore true as well. (h)
is not true—there’s no x such that Q(x, 1) is true, for example.(i) certainly isn’t
true—again, (a) is a counterexample.
Problem 1.5.6. What rules of inference are used in this argument? “No man is
an island. Manhattan is an island. Therefore, Manhattan is not a man.”
Solution. Let’s work it through symbolically. Let M (x) be the proposition that x
is a man, and I(x) be the proposition that x is an island. We have ∀x(M (x) →
¬I(x)) and I(Manhattan). We start with universal instatiation: M (Manhattan) →
¬I(Manhattan). We then use a standard modus tollens argument to argue
¬M (Manhattan)
, which is the conclusion.
10
SOLUTIONS FOR MATH 55, HOMEWORK #1
Problem 1.5.12. For each of these arguments, determine whether the argument
is correct or incorrect and explain why.
(a) Everyone enrolled in the university has lived in a dormitory. Mia has never
lived in a dormitory. Therefore Mia is not enrolled in a university.
(b) A convertible car is fun to drive. Issac’s car is not a convertible. Therefore,
Issac’s car is not fun to drive.
(c) Quincy likes all action movies. Quincy likes the movie Eight Men Out.
Therefore, Eight Men Out is an action movie.
(d) All lobstermen set at least a dozen traps. Hamilton is a lobsterman. Therefore, Hamilton sets at least a dozen traps.
Solution. (a) is a correct argument—it’s the same universal instantiaton/modus
tollens argument that we saw in 1.5.6.
(b) is incorrect—it uses the fallacy of denying the hypothesis.
(c) is incorrect—it uses the fallacy of affirming the conclusion.
(d) is correct—it’s just universal instantiation followed by modus ponens.
.
Problem 1.5.20. Prove that the square of an even number is an even number
using
(a) a direct proof
(b) an indirect proof
(c) a proof by contradiction
Proof. (a) Let m be an even number. Since 2 divides m, 2 also divides m2 . Thus m2
is even. Thus the square of every even number is even. (Universal generalization)
(b) Let n be an integer. Suppose n2 is odd. Then 2 does not divide n2 . Since 2
is prime, 2 does not divide n either.
(c) Let n be even. Suppose n2 were odd. So, 2 divides n. But then 2 divides
n2 (a divisor of n divides any multiple of n). Thus n2 is even. Contradicton! Thus
our assumption must be wrong, and n2 must be even.
Problem 1.5.70. the Logic Problem, taken from WFF’N PROOF, The Game of
Logic, has these two assumptions.
1. “Logic is difficult or not many students like logic.”
2. “If mathematics is easy, then logic is not difficult”
By translating these assumptions into statements involving propositional variables and logical connectives, determine whether each of the following are valid
conclusions of these assumptions.
(a) That mathematics is not easy, if many students like logic.
(b) That not many students like logic, if mathematics is not easy.
(c) That mathematics is not easy or logic is difficult.
(d) That logic is not difficult or mathematics is not easy.
(e) That if not many students like logic, then either mathematics is not easy or
logic is not difficult.
Solution. Let l be logic and m be mathematics. Let D(x) mean “x is difficult,”
and S(x) mean “many students like x.”
Our assumptions are D(l)∨¬S(l) and (¬D(m)) → (¬D(l)). The former could be
rewritten S(l) → D(l), while the latter (taking the contrapositive) is D(l) → D(m).
SOLUTIONS FOR MATH 55, HOMEWORK #1
11
By hypothetical syllogism, we have S(l) → D(m), which is (a). (a) thus follows
from the conditions.
(b) doesn’t follow from the assumptions—D(m) doesn’t lead anywhere, and the
contrapositive, S(l) →6 D(m), directly contradicts (a).
(c) is equivalent to D(m) → D(l), and as in (b) D(m) doesn’t lead anywhere.
¬D(l) leads to ¬S(l), but that doesn’t get us anywhere either.
(d) is equivalent to D(l) → D(m), which is precisely the second assumption.
(e) Our second assumption is (¬D(m)) → (¬D(l)). We can rewrite that as
D(m) ∨ ¬D(I), which is the consequence of the implication of (e). Since a true
proposition is implied by any proposition, (e) follows from the assumptions.