You are on page 1of 10

CPSC 121, Section V01 Summer, 2019

Assignment 1
Due: 8:00pm, Thursday, May 16, 2019

CS ID 1:

CS ID 2:

Instructions:
1. Export the completed assignment as a PDF file for upload to Gradescope.
2. On Gradescope, you must join a group with your partner (if you have one) and
upload only one submission per partnership.
Academic Conduct: I certify that my assignment follows the academic conduct
rules for of CPSC 121 as outlined on the course website. As part of those rules, when
collaborating with anyone outside my group, (1) I and my collaborators took no record
but names away, and (2) after a suitable break, my group created the assignment I am
submitting without help from anyone other than the course staff.

1
CPSC 121, Section V01 Summer, 2019

1. (9 marks) The truth table below defines the truth value of s for each combination
of truth values of p, q and r.
p q r s
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 F

(a) Find a logic formula for s that uses each variable at most twice. Then verify
the correctness of your formula by drawing a truth table corresponding to this
formula, including the truth values of all relevant sub-formulas. Enter your
response in the table below. We have provided at least as many columns as
you’ll need. Be sure to fill in the column headings!
p q r
T T T
T T F
T F T
T F F
F T T
F T F
F F T
F F F
(b) Create a circuit with inputs p, q and r, whose output is the value s described by
the truth table. We recommend that you create your circuit in Logisim, take a
screenshot and insert it into this document using the insertgraphics command,
or draw it by hand, take a photo, and insert it into this document using the
insertgraphics command.

2
CPSC 121, Section V01 Summer, 2019

2. (6 marks) The “XNOR” operator is the opposite of XOR. That is, p XNOR q ≡ ¬(p⊕
q). Show using logical equivalences (not truth tables!) that p XNOR q ≡ (p ↔ q).
(Recall that p ⊕ q ≡ (p ∨ q) ∧ ¬(p ∧ q).)
Complete this table with your solution.
p XNOR q
≡ ¬(p ⊕ q) given above

3
CPSC 121, Section V01 Summer, 2019

3. (16 marks) Here is a list of five propositional forms and three circuits. This list
contains four pairs of logically equivalent entries (we will say a circuit is equivalent
to a propositional form if the propositional form describes the value of the circuit’s
output for all possible combinations of input values). For instance, maybe A ≡ B,
C ≡ D, E ≡ F and G ≡ H). First determine the four pairs, and then prove for
each pair that one element of the pair is logically equivalent to the other one.
(A) (a ∧ b ∧ c) =⇒ d.
(B) a =⇒ (b =⇒ (c =⇒ d)).
(C) (¬a ∧ b ∧ ¬c ∧ ¬d).
(D) (a ∨ b) ↔ (d ∧ c).
(E) (a ∧ b ∧ c ∧ d) ∨ ¬(a ∨ b ∨ c ∨ d).

(F)

(G)

(H)

You are allowed to use truth tables to figure out the equivalences; however at least
three of your proofs must use a sequence of known logical equivalences (see Epp-4
table 2.1.1, Epp-3 table 1.1.1, Rosen-6 table 6 in section 1.2, Rosen-7 table 6 in
section 1.3, or Dave’s excellent formula sheet; you can also assume that x =⇒ y ≡
¬x ∨ y and that x ⊕ y ≡ (x ∨ y) ∧ ∼ (x ∧ y) ≡ (¬x ∧ y) ∨ (x ∧ ¬y). The fourth proof
can use either a sequence of known logical equivalences, or a truth table.
Hint: you might want to translate the circuits into formulas that mirror exactly as
the circuit is implemented, before using any logical equivalence rules.

4
CPSC 121, Section V01 Summer, 2019

(a) ≡

expression 1 expression 2 reason











5
CPSC 121, Section V01 Summer, 2019

(b) ≡

expression 1 expression 2 reason





















6
CPSC 121, Section V01 Summer, 2019

(c) ≡

expression 1 expression 2 reason





















7
CPSC 121, Section V01 Summer, 2019

(d) ≡

8
CPSC 121, Section V01 Summer, 2019

4. (9 marks) Design a circuit that takes four inputs x1, x2, x3, x4 and outputs true if
(and only if) all of the false inputs are consecutive. For instance, your circuit should
output true in the following four cases:
• x1 = true, x2 = true, x3 = true, x4 = true.
• x1 = false, x2 = true, x3 = true, x4 = true.
• x1 = true, x2 = false, x3 = false, x4 = true.
• x1 = false, x2 = false, x3 = false, x4 = false.
but it should output false in these cases:
• x1 = false, x2 = true, x3 = true, x4 = false.
• x1 = true, x2 = false, x3 = true, x4 = false.
Prove that your answer is correct.

9
CPSC 121, Section V01 Summer, 2019

5. (9 marks) There is an island on which everyone is a dragon or a troll. Dragons,


being noble, always tell the truth. Trolls, being tricky, always lie. Olivia, Zucheng,
and Hyeon, all inhabitants of the island, make the following statements.

• Olivia: ”I’m a dragon"


• Zucheng: ”Olivia is a dragon"
• Hyeon: ”Olivia is a troll"
(a) Is it possible that Olivia is a dragon? In one sentence, justify your answer.
(b) Is it possible that Olivia is a troll? In one sentence, justify your answer.
(c) Is it possible that Zucheng is a dragon? In one sentence, justify your answer.
(d) Is it possible that Zucheng is a troll? In one sentence, justify your answer.
(e) Is it possible that Hyeon is a dragon? In one sentence, justify your answer.
(f) Is it possible that Hyeon is a troll? In one sentence, justify your answer.
(g) There are eight possible assignments of dragon or troll to Olivia, Zucheng, and
Hyeon. An assignment is a label of dragon or troll to each of Olivia, Zucheng,
and Hyeon, regardless of whether it is correct or incorrect. For example, ”Olivia
is a dragon, Zucheng is a dragon, and Hyeon is a troll" is one of the eight possible
assignments, regardless of whether that assignment is correct or not.
Are all of the eight possible assignments potentially correct, based on what
Olivia, Zucheng, and Hyeon said? Justify your answer. Your answer will be
judged on the brevity and preciseness of justifying why either yes or no is correct.

10

You might also like