HW1A
HW1A
Section 1.1
8.
Let p and q be the propositions p : I bought a lottery ticket this week. q : I
won the million dollar jackpot. Express each of these propositions as an English
sentence.
a)¬p
b)p ∨ q
c)p → q
d)p ∧ q
e)p ↔ q
f )¬p → ¬q
g)¬p ∨ ¬q
h)¬p ∨ (p ∧ q)
1
9.
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
e)¬q → p
f )¬p → ¬q
g)p ↔ ¬q
h)¬p ∧ (p ∨ ¬q)
2
11.
Let p and q be the propositions
p : It is below freezing.
q : It is snowing.
Write these propositions using p and q and logical connectives (including nega-
tions).
a) It is below freezing and snowing.
b) It is below freezing but not snowing.
c) It is not below freezing and it is not snowing.
d) It is either snowing or below freezing (or both).
e) If it is below freezing, it is also snowing.
f ) Either it is below freezing or it is snowing, but it is not snowing if it is below
freezing.
g) That it is below freezing is necessary and sufficientfor it to be snowing.
Proof. a) p ∧ q
b) p ∧ ¬q
c) ¬p ∧ ¬q
d) p ∨ q
e) p → q
f) (p ∨ q) ∧ (p → ¬q)
g) p ↔ q
3
12.
Let p, q, and r be the propositions
p : You have the flu.
q : You miss the final examination.
r : You pass the course.
Express each of these propositions as an English sentence.
a)p → q
b)¬q ↔ r
c) q → ¬r
d)p ∨ q ∨ r
e) (p → ¬r)¬(q → ¬r)
f ) (p ∧ q) ∨ (¬q ∧ r)
Proof. a) p → q: If you have the flu, then you miss the final examination.
b) ¬q ↔ r: You do not miss the final examination if and only if you pass
the course.
c) q → ¬r : If you miss the final examination, then you do not pass the
course.
d) p ∨ q ∨ r: You have the flu, or you miss the final examination, or you pass
the course.
e) (p → ¬r)¬(q → ¬r): If you have the flu, then you do not pass the course,
and it is not the case that if you miss the final examination then you do not
pass the course.
f) (p ∧ q) ∨ (¬q ∧ r): Either you have the flu and miss the final examination,
or you do not miss the final examination and pass the course.
4
15.
Let p, q, and r be the propositions
p : Grizzly bears have been seen in the area.
q : Hiking is safe on the trail.
r : Berries are ripe along the trail.
Write these propositions using p, q, and r and logical connectives (including
negations).
a) Berries are ripe along the trail, but grizzly bears have not been seen in the
area.
b) Grizzly bears have not been seen in the area and hiking on the trail is safe,
but berries are ripe along the trail.
c) If berries are ripe along the trail, hiking is safe if and only if grizzly bears
have not been seen in the area.
d) It is not safe to hike on the trail, but grizzly bears have not been seen in the
area and the berries along the trail are ripe.
e) For hiking on the trail to be safe, it is necessary but not sufficient that berries
not be ripe along the trail and for grizzly bears not to have been seen in the
area.
f ) Hiking is not safe on the trail whenever grizzly bears have been seen in the
area and berries are ripe along the trail.
Proof. a)r ∧ ¬p
b)¬p ∧ q ∧ r
c)r → (q ↔ ¬p)
d)¬q ∧ ¬p ∧ r
e)q ↔ ((¬r ∧ ¬p) ∧ ¬(r ∧ p))
f)(p ∧ r) → ¬q
5
16.
Determine whether these biconditionals are true or false.
a) 2 + 2 = 4 if and only if 1 + 1 = 2.
b) 1 + 1 = 2 if and only if 2 + 3 = 4.
c) 1 + 1 = 3 if and only if monkeys can fly.
d) 0 > 1 if and only if 2 > 1.
d) 0 > 1 if and only if 2 > 1: This statement is false because 0 > 1 is false,
but 2 > 1 is true.
17.
Determine whether each of these conditional statements is true or false.
a) If 1 + 1 = 2, then 2 + 2 = 5.
b) If 1 + 1 = 3, then 2 + 2 = 4.
c) If 1 + 1 = 3, then 2 + 2 = 5.
d) If monkeys can fly, then 1 + 1 = 3
6
36.
. Construct a truth table for each of these compound propositions.
a) (p ∨ q) ∨ r
b) (p ∨ q) ∧ r
c) (p ∧ q) ∨ r
d)(p ∧ q) ∧ r
e) (p ∨ q) ∧ ¬r
f )(p ∧ q) ∨ ¬r
Proof. a) (p ∨ q) ∨ r
p q r (p ∨ q) ∨ r
T T T T
T T F T
T F T T
T F F T
F T T T
F T F T
F F T T
F F F F
Proof. b) (p ∨ q) ∧ r
p q r (p ∨ q) ∧ r
T T T T
T T F F
T F T T
T F F F
F T T T
F T F F
F F T F
F F F F
Proof. c) (p ∧ q) ∨ r
p q r (p ∧ q) ∨ r
T T T T
T T F T
T F T T
T F F F
F T T T
F T F F
F F T T
F F F F
7
Proof. d) (p ∧ q) ∧ r
p q r (p ∧ q) ∧ r
T T T T
T T F F
T F T F
T F F F
F T T F
F T F F
F F T F
F F F F
Proof. e)(p ∨ q) ∧ ¬r
p q r (p ∨ q) ∧ ¬r
T T T T
T T F F
T F T F
T F F F
F T T F
F T F F
F F T F
F F F F
Proof. f )(p ∧ q) ∨ ¬r
p q r (p ∧ q) ∨ ¬r
T T T T
T T F T
T F T F
T F F T
F T T F
F T F T
F F T F
F F F T
8
37.
Construct a truth table for each of these compound propositions.
a) p → (¬q ∨ r)
b) ¬p → (q → r)
c) (p → q) ∨ (¬p → r)
d) (p → q) ∧ (¬p → r)
e) (p ↔ q) ∨ (¬q ↔ r)
f ) (¬p ↔ ¬q) ↔ (q ↔ r)
Proof. a) p → (¬q ∨ r)
p q r p → (¬q ∨ r)
T T T T
T T F F
T F T T
T F F T
F T T T
F T F T
F F T F
F F F T
Proof. b) ¬p → (q → r)
p q r ¬p → (q → r)
T T T T
T T F T
T F T T
T F F T
F T T T
F T F F
F F T T
F F F T
Proof. c) (p → q) ∨ (¬p → r)
p q r (p → q) ∨ (¬p → r)
T T T T
T T F T
T F T T
T F F F
F T T T
F T F T
F F T F
F F F T
9
Proof. d) (p → q) ∧ (¬p → r)
p q r (p → q) ∧ (¬p → r)
T T T T
T T F F
T F T F
T F F F
F T T T
F T F T
F F T T
F F F T
Proof. e) (p ↔ q) ∨ (¬q ↔ r)
p q r (p ↔ q) ∨ (¬q ↔ r)
T T T T
T T F T
T F T T
T F F F
F T T T
F T F T
F F T T
F F F T
10
44.
Evaluate each of these expressions.
a) 11000 ∧ (01011 ∨ 11011)
b) (01111 ∧ 10101) ∨ 01000
c) (01010 ⊕ 11011) ⊕ 01000
d) (11011 ∨ 01010) ∧ (10001 ∨ 11011)
11
45.
Fuzzy logic is used in artificial intelligence. In fuzzy logic, aproposition has a
truth value that is a number between 0 and 1,inclusive.A proposition with a
truth value of 0 is false and one with a truth value of 1 is true. Truth values
that are between 0 and 1 indicate varying degrees of truth. For instance, the
truth value 0.8 can be assigned to the statement “Fred is happy,”because Fred is
happy most of the time, and the truth value 0.4 can be assigned to the statement
“John is happy,” because John is happy slightly less than half the time. Use
these truth values to solve Exercises 45–47.
45. The truth value of the negation of a proposition in fuzzy logic is 1 minus
the truth value of the proposition. What are the truth values of the statements
“Fred is not happy” and “John is not happy?”
Proof. In fuzzy logic, the truth value of the negation of a proposition is calcu-
lated as 1 minus the truth value of the proposition.
Given that the truth value for the statement “Fred is happy” is 0.8, the truth
value for the statement “Fred is not happy” would be 1 − 0.8 = 0.2
. Similarly, given that the truth value for the statement “John is happy” is 0.4,
the truth value for the statement “John is not happy” would be 1 − 0.4 = 0.6
. So, the truth values of the statements “Fred is not happy” and “John is not
happy” are 0.2 and 0.6 respectively.
Section 1.2
6.
You can upgrade your operating system only if you have a 32-bit processor
running at 1 GHz or faster, at least 1 GB RAM, and 16 GB free hard disk
space, or a 64-bit processor running at 2 GHz or faster, at least 2 GB RAM,
and at least 32 GB free hard disk space. Express you answer in terms of u:
“You can upgrade your operating system,” b32: “You have a 32-bit processor,”
b64:“You have a 64-bit processor,” g1: “Your processor runs at 1 GHz or faster,”
g2: “Your processor runs at 2 GHz or faster,” r1: “Your processor has at least
1 GB RAM,” r2: “Your processor has at least 2 GB RAM,” h16: “You have at
least 16 GB free hard disk space,” and h32: “You have at least 32 GB free hard
disk space.”
Proof. u = (b32 ∧ g1 ∧ r1 ∧ h16) ∨ (b64 ∧ g2 ∧ r2 ∧ h32)
12
7.
Express these system specifications using the propositions p “The message is
scanned for viruses” and q “The message was sent from an unknown system”
together with logical connectives (including negations).
a) “The message is scanned for viruses whenever the message was sent from an
unknown system.”
b) “The message was sent from an unknown system but it was not scanned for
viruses.”
c) “It is necessary to scan the message for viruses whenever it was sent from an
unknown system.”
d) “When a message is not sent from an unknown system it is not scanned for
viruses.”
Proof. a)q → p
b)p ∧ q
c)q ↔ p
d)¬q ↔ ¬p
19.
Exercises 19–23 relate to inhabitants of the island of knights and knaves created
by Smullyan, where knights always tell the truth and knaves always lie. You
encounter two people, A and B. Determine, if possible, what A and B are if
they address you in the ways described. If you cannot determine what these
two people are, can you draw any conclusions?
19. A says “At least one of us is a knave” and B says nothing.
13
36
36.Four friends have been identified as suspects for an unauthorized access into
a computer system. They have made statements to the investigating authori-
ties. Alice said “Carlos did it.” John said “I did not do it.” Carlos said “Diana
did it.” Diana said “Carlos lied when he said that I did it.”
a) If the authorities also know that exactly one of the four suspects is telling
the truth, who did it? Explain your reasoning.
b) If the authorities also know that exactly one is lying, who did it? Explain
your reasoning.
Proof. a) Only one person is telling the truth: If Alice is telling the truth (Carlos
did it), then Carlos’s statement (Diana did it) would be a lie, which contradicts
the assumption that only one person is telling the truth.
If John is telling the truth (John didn’t do it), then Diana’s statement (Carlos
lied) would be a lie, which contradicts the assumption that only one person is
telling the truth.
If Carlos is telling the truth (Diana did it), then Alice’s statement (Carlos did
it) would be a lie, which contradicts the assumption that only one person is
telling the truth.
Therefore, Diana must be the only one telling the truth. So, Carlos lied when
he said Diana did it, and John did it.
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, 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, and
in one of them there is a tiger.” Suppose that you know that one of these signs
is true and the other is false. Behind which door is the lady?
Proof. The sign on the first door says: “In this room there is a lady, and in the
other one there is a tiger.”
The sign on the second door says: “In one of these rooms, there is a lady, and
in one of them there is a tiger.”
14
If the first sign is true (there is a lady in the first room and a tiger in the second),
then the second sign would also be true, which contradicts the information that
one sign is false.
Therefore, the first sign must be false. This means there is a tiger in the
first room and a lady in the second room. So, the lady is behind the second
door. The second sign is indeed true: there is a lady in one room (the second)
and a tiger in one room (the first).
38.
Solve this famous logic puzzle, attributed to Albert Einstein, and known as the
zebra puzzle. Five men with different nationalities and with different jobs live
in consecutive houses on a street. These houses are painted different colors. The
men have different pets and have different favorite drinks. Determine who owns
a zebra and a whose favorite drink is mineral water (which is one of the favorite
drinks) given these clues: The Englishman lives in the red house. The Spaniard
owns a dog. The Japanese man is a painter. The Italian drinks tea. The Nor-
wegian lives in the first house on the left. The green house is immediately to
the right of the white one. The photographer breeds snails. The diplomat lives
in the yellow house. Milk is drunk in the middle house. The owner of the green
house drinks coffee. The Norwegian’s house is next to the blue one. The violin-
ist drinks orange juice. The fox is in a house next to that of the physician. The
horse is in a house next to that of the diplomat. [Hint: Make a table where the
rows represent the men and columns represent the color of their houses, their
jobs, their pets, and their favorite drinks and use logical reasoning to determine
the correct entries in the table.]
First, let’s list out the five houses in order, and fill in the information we know
for sure:
The Spaniard owns a dog: Since the only pet we know of so far is the dog,
we can say that the Spaniard lives in house 2, 3, or 4. But since the Japanese
man is a painter and the Italian drinks tea, the Spaniard must live in house 2.
15
The Japanese man is a painter: Since the only job we know of so far is the
painter, we can say that the Japanese man lives in house 3 or 4. But since the
Italian drinks tea, the Japanese man must live in house 3.
The Italian drinks tea: Since the only drink we know of so far is tea, we can
say that the Italian lives in house 4.
The diplomat lives in the yellow house: Since the only job we know of so far
is the diplomat, we can say that the diplomat lives in house 1 or 2. But since
the Norwegian lives in the first house, the diplomat must live in house 2.
The green house is immediately to the right of the white one: Since the green
house is not at the leftmost position, the first house must be yellow. So, the
houses’ colors from 1 to 5 are Yellow, Blue, White, Green, and Red respectively.
The photographer breeds snails: Since the only job left is the photographer
and the only pet left is the snails, we can say that the photographer lives in
house 1 and breeds snails.
The violinist drinks orange juice: Since the only job left is the violinist and
the only drink left is orange juice, we can say that the violinist lives in house 2
and drinks orange juice.
The fox is in a house next to that of the physician: Since the only pet left
is the fox and the only job left is the physician, we can say that the fox lives in
house 3 and the physician lives in house 2.
The horse is in a house next to that of the diplomat: Since the only pet left
is the horse and the only job left is the diplomat, we can say that the horse lives
in house 2 and the diplomat lives in house 1.
39.
Freedonia has fifty senators. Each senator is either honest or corrupt. Suppose
you know that at least one of the Freedonian senators is honest and that, given
any two Freedonian senators, at least one is corrupt. Based on these facts, can
16
you determine how many Freedonian senators are honest and how many are
corrupt? If so, what is the answer?
Proof. Based on the given facts, we can determine the number of honest and
corrupt senators.
The key information is that “given any two Freedonian senators, at least
one is corrupt.” This means that in any pair of senators, there cannot be a pair
that consists of two honest senators. Therefore, there can be at most one honest
senator.
Since we also know that “at least one of the Freedonian senators is honest,”
we can conclude that exactly one senator is honest.
Therefore, out of the 50 senators, 1 is honest and the remaining 49 are
corrupt.
17
40.
Find the output of each of these combinatorial circuits.
41.
Find the output of each of these combinatorial circuits.
42.
Construct a combinatorial circuit using inverters, OR gates, and AND gates
that produces the output (p ∧ ¬r) ∨ (¬q ∧ r) from input bits p, q, and r.
Proof.
18
Section 1.3
43.
Show that ¬, ∧, and∨ form a functionally complete collection of logical opera-
tors.
Proof. NOT (¬): This operator allows us to negate a proposition. It’s the only
unary operator in our set.
47.
47. Show that p|q(NAND) is logically equivalent to ¬(p ∧ q).
p q p|q p∧q ¬(p ∧ q)
T T F T F
Proof. We can use truth table: T F T F T
F T T F T
F F T F T
49
49. Show that p ↓ q(NOR) is logically equivalent to ¬(p ∨ q)
p q p↓q p∨q ¬(p ∨ q)
T T F T F
Proof. We can use truth table: T F F T F
F T F T F
F F T F T
54.
Show that p|(q|r) and (p|q)|r are not equivalent, so that the logical operator |
is not associative.
19
p q r q NAND r p NAND (q NAND r) p NAND q (p NAND q) NAND r
T T T F F F T
T T F T F F T
T F T T F T T
Proof. T F F T F T T
F T T F T T T
F T F T T T T
F F T T T T T
F F F T T T T
59
How many of the disjunctions p ∨ ¬q ∨ s, ¬p ∨ ¬r ∨ s, ¬p ∨ ¬r ∨ ¬s, ¬p ∨ q ∨
¬s, q ∨ r ∨ ¬s, q ∨ ¬r ∨ ¬s, ¬p ∨ ¬q ∨ ¬s, p ∨ r ∨ s, andp ∨ r ∨ ¬s can be made
simultaneously true by an assignment of truth values to p, q, r, and s?
Proof. Let’s number these disjunctions as follows:
1.(p ∨ ¬q ∨ s)
2.(¬p ∨ ¬r ∨ s)
3.(¬p ∨ ¬r ∨ ¬s)
4.(¬p ∨ q ∨ ¬s)
5.(q ∨ r ∨ ¬s)
6.(q ∨ ¬r ∨ ¬s)
7.(¬p ∨ ¬q ∨ ¬s)
8.(p ∨ r ∨ s)
9.(p ∨ r ∨ ¬s)
Now, when (p) is True, each of the disjunctions in 1., 8., and 9. will be True.
When (r) is False, each of the disjunctions in 2., 3., and 6. will be true. And,
when (s) is False, each of the disjunctions in 4., 5., and 7. will be true.
Thus each of our nine disjunctions can be made simultaneously true by the
assignment (T, F, F) to (p, r, s), respectively, independently of the truth value
assigned to (q). Of course there are other options too such as when (p) is False
and each of (q, r, s) is True, for instance. So, all nine disjunctions can be made
simultaneously true by an assignment of truth values to (p, q, r, s).
20
61
Determine whether each of these compound propositions is satisfiable.
a) (p ∨ ¬q) ∧ (¬p ∨ q) ∧ (¬p ∨ ¬q)
b)(p → q) ∧ (p → ¬q) ∧ (¬p → q) ∧ (¬p → ¬q)
c)(p ↔ q) ∧ (¬p ↔ q)
Proof. A compound proposition is satisfiable if there exists at least one truth
value assignment to the variables that makes the proposition true. Here are the
explanations and results for each proposition:
a) (p ∨ ¬q) ∧ (¬p ∨ q) ∧ (¬p ∨ ¬q)
For this proposition, if we choose p = False and q = False, then the propo-
sition becomes True. Therefore, this proposition is satisfiable.
b) (p → q) ∧ (p → q) ∧ (¬p → q) ∧ (¬p ↔ ¬q)
This proposition is not satisfiable because there are no values of p and q
that make all four parts of the proposition true at the same time.
c) (p ↔ q) ∧ (¬p ↔ q)
This proposition is also not satisfiable because there are no values of p and
q that make both parts of the proposition true at the same time.
So, only proposition a) is satisfiable. Propositions b) and c) are not satisfi-
able.
21
upon further examination, contains some kernel of truth or reason7. For exam-
ple, the statement “This is the beginning of the end” is a paradox.
Counterexample: A counterexample is an example that refutes or disproves a
proposition or theory. For example, finding a bird that cannot fly serves as a
counterexample to the claim “All birds can fly”. Premise, Assumption, Pre-
sumption, Axiom, Hypothesis, Conjecture:
22
Inference: An inference is a process of deriving logical conclusions from
premises known or assumed to be true15. For example, from the premise “All
men are mortal” and “Socrates is a man”, one can infer that “Socrates is mor-
tal”.
Argument: An argument in logic is a set of statements, one of which is the
conclusion and the others are the premises, intended to demonstrate that the
conclusion follows logically from the premises16. For example, “All men are
mortal. Socrates is a man. Therefore, Socrates is mortal” is an argument.
Reasoning: Reasoning is the process of thinking about things in a logical, ra-
tional way, and drawing conclusions based on evidence or the application of
logic16. For example, if you see dark clouds in the sky, you might reason that
it is likely to rain soon.
Variable, Argument, Arity:
23