Section 1-2
Section 1-2
p p ∨ ¬r
r
¬r (p ∨ ¬r) ∧ (¬p ∨ (q ∨ ¬r))
¬p
p
q ¬p ∨ (q ∨ ¬r)
r q ∨ ¬r
¬r
Exercises
In Exercises 1–6, translate the given statement into proposi- “You have a 64-bit processor,” g1 : “Your processor runs
tional logic using the propositions provided. at 1 GHz or faster,” g2 : “Your processor runs at 2 GHz or
1. You cannot edit a protected Wikipedia entry unless you faster,” r1 : “Your processor has at least 1 GB RAM,” r2 :
are an administrator. Express your answer in terms of e: “Your processor has at least 2 GB RAM,” h16 : “You have
“You can edit a protected Wikipedia entry” and a: “You at least 16 GB free hard disk space,” and h32 : “You have
are an administrator.” at least 32 GB free hard disk space.”
2. You can see the movie only if you are over 18 years old 7. Express these system specifications using the proposi-
or you have the permission of a parent. Express your an- tions p “The message is scanned for viruses” and q “The
swer in terms of m: “You can see the movie,” e: “You are message was sent from an unknown system” together
over 18 years old,” and p: “You have the permission of a with logical connectives (including negations).
parent.” a) “The message is scanned for viruses whenever the
3. You can graduate only if you have completed the require- message was sent from an unknown system.”
ments of your major and you do not owe money to the
b) “The message was sent from an unknown system but
university and you do not have an overdue library book.
it was not scanned for viruses.”
Express your answer in terms of g: “You can graduate,”
m: “You owe money to the university,” r: “You have com- c) “It is necessary to scan the message for viruses when-
pleted the requirements of your major,” and b: “You have ever it was sent from an unknown system.”
an overdue library book.” d) “When a message is not sent from an unknown system
4. To use the wireless network in the airport you must pay it is not scanned for viruses.”
the daily fee unless you are a subscriber to the service. 8. Express these system specifications using the proposi-
Express your answer in terms of w: “You can use the wire- tions p “The user enters a valid password,” q “Access is
less network in the airport,” d: “You pay the daily fee,” granted,” and r “The user has paid the subscription fee”
and s: “You are a subscriber to the service.” and logical connectives (including negations).
5. You are eligible to be President of the U.S.A. only if you a) “The user has paid the subscription fee, but does not
are at least 35 years old, were born in the U.S.A, or at the enter a valid password.”
time of your birth both of your parents were citizens, and b) “Access is granted whenever the user has paid the
you have lived at least 14 years in the country. Express subscription fee and enters a valid password.”
your answer in terms of e: “You are eligible to be Pres-
ident of the U.S.A.,” a: “You are at least 35 years old,” c) “Access is denied if the user has not paid the subscrip-
b: “You were born in the U.S.A,” p: “At the time of your tion fee.”
birth, both of your parents where citizens,” and r: “You d) “If the user has not entered a valid password but has
have lived at least 14 years in the U.S.A.” paid the subscription fee, then access is granted.”
6. You can upgrade your operating system only if you have 9. Are these system specifications consistent? “The system
a 32-bit processor running at 1 GHz or faster, at least is in multiuser state if and only if it is operating normally.
1 GB RAM, and 16 GB free hard disk space, or a 64- If the system is operating normally, the kernel is func-
bit processor running at 2 GHz or faster, at least 2 GB tioning. The kernel is not functioning or the system is
RAM, and at least 32 GB free hard disk space. Express in interrupt mode. If the system is not in multiuser state,
you answer in terms of u: “You can upgrade your oper- then it is in interrupt mode. The system is not in interrupt
ating system,” b32 : “You have a 32-bit processor,” b64 : mode.”
P1: 1/1 P2: 1/2 QC: 1/1 T1: 2
CH01-7T Rosen-2311T MHIA017-Rosen-v5.cls May 13, 2011 15:27
10. Are these system specifications consistent? “Whenever become unhappy if Samir is there, Samir will attend only
the system software is being upgraded, users cannot ac- if Kanti will be there, and Kanti will not attend unless Jas-
cess the file system. If users can access the file system, mine also does. Which combinations of these three friends
then they can save new files. If users cannot save new can you invite so as not to make someone unhappy?
files, then the system software is not being upgraded.” Exercises 19–23 relate to inhabitants of the island of knights
11. Are these system specifications consistent? “The router and knaves created by Smullyan, where knights always tell
can send packets to the edge system only if it supports the the truth and knaves always lie. You encounter two people,
new address space. For the router to support the new ad- A and B. Determine, if possible, what A and B are if they
dress space it is necessary that the latest software release address you in the ways described. If you cannot determine
be installed. The router can send packets to the edge sys- what these two people are, can you draw any conclusions?
tem if the latest software release is installed, The router 19. A says “At least one of us is a knave” and B says nothing.
does not support the new address space.”
20. A says “The two of us are both knights” and B says “A
12. Are these system specifications consistent? “If the file
is a knave.”
system is not locked, then new messages will be queued.
If the file system is not locked, then the system is func- 21. A says “I am a knave or B is a knight” and B says nothing.
tioning normally, and conversely. If new messages are not 22. Both A and B say “I am a knight.”
queued, then they will be sent to the message buffer. If
the file system is not locked, then new messages will be 23. A says “We are both knaves” and B says nothing.
sent to the message buffer. New messages will not be sent Exercises 24–31 relate to inhabitants of an island on which
to the message buffer.” there are three kinds of people: knights who always tell the
13. What Boolean search would you use to look for Web truth, knaves who always lie, and spies (called normals by
pages about beaches in New Jersey? What if you wanted Smullyan [Sm78]) who can either lie or tell the truth. You
to find Web pages about beaches on the isle of Jersey (in encounter three people, A, B, and C. You know one of these
the English Channel)? people is a knight, one is a knave, and one is a spy. Each of the
three people knows the type of person each of other two is. For
14. What Boolean search would you use to look for Web each of these situations, if possible, determine whether there
pages about hiking in West Virginia? What if you wanted is a unique solution and determine who the knave, knight, and
to find Web pages about hiking in Virginia, but not in West spy are. When there is no unique solution, list all possible
Virginia? solutions or state that there are no solutions.
∗ 15. Each inhabitant of a remote village always tells the truth
or always lies. A villager will give only a “Yes” or a “No” 24. A says “C is the knave,” B says, “A is the knight,” and C
response to a question a tourist asks. Suppose you are a says “I am the spy.”
tourist visiting this area and come to a fork in the road. 25. A says “I am the knight,” B says “I am the knave,” and
One branch leads to the ruins you want to visit; the other C says “B is the knight.”
branch leads deep into the jungle. A villager is standing 26. A says “I am the knave,” B says “I am the knave,” and C
at the fork in the road. What one question can you ask the says “I am the knave.”
villager to determine which branch to take?
27. A says “I am the knight,” B says “A is telling the truth,”
16. An explorer is captured by a group of cannibals. There are
and C says “I am the spy.”
two types of cannibals—those who always tell the truth
and those who always lie. The cannibals will barbecue 28. A says “I am the knight,” B says, “A is not the knave,”
the explorer unless he can determine whether a particu- and C says “B is not the knave.”
lar cannibal always lies or always tells the truth. He is 29. A says “I am the knight,” B says “I am the knight,” and
allowed to ask the cannibal exactly one question. C says “I am the knight.”
a) Explain why the question “Are you a liar?” does not
30. A says “I am not the spy,” B says “I am not the spy,” and
work.
C says “A is the spy.”
b) Find a question that the explorer can use to determine
whether the cannibal always lies or always tells the 31. A says “I am not the spy,” B says “I am not the spy,” and
truth. C says “I am not the spy.”
17. When three professors are seated in a restaurant, the host- Exercises 32–38 are puzzles that can be solved by translating
ess asks them: “Does everyone want coffee?” The first statements into logical expressions and reasoning from these
professor says: “I do not know.” The second professor expressions using truth tables.
then says: “I do not know.” Finally, the third professor 32. The police have three suspects for the murder of Mr.
says: “No, not everyone wants coffee.” The hostess comes Cooper: Mr. Smith, Mr. Jones, and Mr. Williams. Smith,
back and gives coffee to the professors who want it. How Jones, and Williams each declare that they did not kill
did she figure out who wanted coffee? Cooper. Smith also states that Cooper was a friend of
18. When planning a party you want to know whom to in- Jones and that Williams disliked him. Jones also states
vite. Among the people you would like to invite are three that he did not know Cooper and that he was out of town
touchy friends. You know that if Jasmine attends, she will the day Cooper was killed. Williams also states that he
P1: 1/1 P2: 1/2 QC: 1/1 T1: 2
CH01-7T Rosen-2311T MHIA017-Rosen-v5.cls May 13, 2011 15:27
saw both Smith and Jones with Cooper the day of the whose favorite drink is mineral water (which is one of the
killing and that either Smith or Jones must have killed favorite drinks) given these clues: The Englishman lives
him. Can you determine who the murderer was if in the red house. The Spaniard owns a dog. The Japanese
a) one of the three men is guilty, the two innocent men man is a painter. The Italian drinks tea. The Norwegian
are telling the truth, but the statements of the guilty lives in the first house on the left. The green house is
man may or may not be true? immediately to the right of the white one. The photogra-
b) innocent men do not lie? pher breeds snails. The diplomat lives in the yellow house.
33. Steve would like to determine the relative salaries of three Milk is drunk in the middle house. The owner of the green
coworkers using two facts. First, he knows that if Fred house drinks coffee. The Norwegian’s house is next to the
is not the highest paid of the three, then Janice is. Sec- blue one. The violinist drinks orange juice. The fox is in
ond, he knows that if Janice is not the lowest paid, then a house next to that of the physician. The horse is in a
Maggie is paid the most. Is it possible to determine the house next to that of the diplomat. [Hint: Make a table
relative salaries of Fred, Maggie, and Janice from what where the rows represent the men and columns represent
Steve knows? If so, who is paid the most and who the the color of their houses, their jobs, their pets, and their
least? Explain your reasoning. favorite drinks and use logical reasoning to determine the
34. Five friends have access to a chat room. Is it possible to correct entries in the table.]
determine who is chatting if the following information is 39. Freedonia has fifty senators. Each senator is either honest
known? Either Kevin or Heather, or both, are chatting. or corrupt. Suppose you know that at least one of the Free-
Either Randy or Vijay, but not both, are chatting. If Abby donian senators is honest and that, given any two Free-
is chatting, so is Randy. Vijay and Kevin are either both donian senators, at least one is corrupt. Based on these
chatting or neither is. If Heather is chatting, then so are facts, can you determine how many Freedonian senators
Abby and Kevin. Explain your reasoning. are honest and how many are corrupt? If so, what is the
35. A detective has interviewed four witnesses to a crime. answer?
From the stories of the witnesses the detective has con- 40. Find the output of each of these combinatorial circuits.
cluded that if the butler is telling the truth then so is the
cook; the cook and the gardener cannot both be telling the a) p
truth; the gardener and the handyman are not both lying;
and if the handyman is telling the truth then the cook is
lying. For each of the four witnesses, can the detective de- q
termine whether that person is telling the truth or lying?
Explain your reasoning. b) p
36. Four friends have been identified as suspects for an unau- p
thorized access into a computer system. They have made q
statements to the investigating authorities. Alice said
“Carlos did it.” John said “I did not do it.” Carlos said 41. Find the output of each of these combinatorial circuits.
“Diana did it.” Diana said “Carlos lied when he said that
I did it.” a) p
a) If the authorities also know that exactly one of the q
four suspects is telling the truth, who did it? Explain r
your reasoning.
b) If the authorities also know that exactly one is lying,
who did it? Explain your reasoning. b) p
37. Suppose there are signs on the doors to two rooms. The
sign on the first door reads “In this room there is a lady, q
and in the other one there is a tiger”; and the sign on the
second door reads “In one of these rooms, there is a lady, p
and in one of them there is a tiger.” Suppose that you r
know that one of these signs is true and the other is false.
Behind which door is the lady? 42. Construct a combinatorial circuit using inverters,
∗ 38. Solve this famous logic puzzle, attributed to Albert Ein- OR gates, and AND gates that produces the output
stein, and known as the zebra puzzle. Five men with (p ∧ ¬r) ∨ (¬q ∧ r) from input bits p, q, and r.
different nationalities and with different jobs live in con- 43. Construct a combinatorial circuit using inverters,
secutive houses on a street. These houses are painted dif- OR gates, and AND gates that produces the output
ferent colors. The men have different pets and have dif- ((¬p ∨ ¬r) ∧ ¬q) ∨ (¬p ∧ (q ∨ r)) from input bits p,
ferent favorite drinks. Determine who owns a zebra and q, and r.