Professional Documents
Culture Documents
Assignment 1: Due: 8:00pm, Thursday, May 16, 2019
Assignment 1: Due: 8:00pm, Thursday, May 16, 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) ≡
5
CPSC 121, Section V01 Summer, 2019
(b) ≡
6
CPSC 121, Section V01 Summer, 2019
(c) ≡
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
10