You are on page 1of 3

CSE 20 Homework 1: Solutions

1. Identify all of the following statements that are a proposition.

Answer: (a), (c), (d), (e), (f) are all propositions because they are all statements which can be either true or false.

(b) is not a proposition because self-reference makes it impossible to assign a truth value to the statement.

2. Which of the following are syntactically legal statements of propositional logic?

Answer: All are syntactically illegal.

(a) is illegal because ← is not a legal operator.

(b) and (c) are illegal because they have double implication without parentheses.

(d) is illegal because ¬ → is not a valid expression.

3. Write each statement as a Boolean expression and then for each one write their truth table.

Answer:
(a) Let p = “it’s a weekend”, q = “the weather is good”, and r= “we go running.” In propositional logic:

(p ∧ q) → r

Truth table:
p q r p∧q p∧q →r
F F F F T
F F T F T
F T F F T
F T T F T
T F F F T
T F T F T
T T F T F
T T T T T

(b) Let p = “you work hard” and q = “you will get a good grade in CSE 20.” In propositional logic:

p→q

Truth table:
p q p→q
F F T
F T T
T F F
T T T

(c) Let p = “you can fly”, q = “you can run”, r = “you can walk”, s = “you can crawl.” In propositional logic:

(¬p → q) ∧ (¬q → r) ∧ (¬r → s)

Truth table:

1
p q r s ¬p → q ¬q → r ¬r → s (¬p → q) ∧ (¬q → r) ∧ (¬r → s)
F F F F F F F F
F F F T F F T F
F F T F F T T F
F F T T F T T F
F T F F T T F F
F T F T T T T T
F T T F T T T T
F T T T T T T T
T F F F T F F F
T F F T T F T F
T F T F T T T T
T F T T T T T T
T T F F T T F F
T T F T T T T T
T T T F T T T T
T T T T T T T T

4. Write down the truth tables for the following expressions.

(a) (p ∨ r) ∧ (p ∨ ¬q)

p q r p∨r p ∨ ¬q (p ∨ r) ∧ (p ∨ ¬q)
F F F F T F
F F T T T T
F T F F F F
F T T T F F
T F F T T T
T F T T T T
T T F T T T
T T T T T T

(b) (s → q) ∧ (s ⊕ q)

q s s→q s⊕q (s → q) ∧ (s ⊕ q)
F F T F F
F T T T T
T F F T F
T T T F F

(c) (p → q) → ((¬p → q) → (q → p))

p q p→q ¬p → q q→p (¬p → q) → (q → p) (p → q) → ((¬p → q) → (q → p))


F F T F T T T
F T T T F F F
T F F T T T T
T T T T T T T

(d) ¬(q ∨ s) → ¬((r → s) ∨ (p ∧ q))

2
p q r s ¬(q ∨ s) r→s p∧q ¬((r → s) ∨ (p ∧ q)) ¬(q ∨ s) → ¬((r → s) ∨ (p ∧ q))
F F F F T T F F F
F F F T F T F F T
F F T F T F F T T
F F T T F T F F T
F T F F F T F F T
F T F T F T F F T
F T T F F F F T T
F T T T F T F F T
T F F F T T F F F
T F F T F T F F T
T F T F T F F T T
T F T T F T F F T
T T F F F T T F T
T T F T F T T F T
T T T F F F T F T
T T T T F T T F T

5. For the following pairs of expressions, decide whether or not they are equivalent. If they are, show so using their
truth tables.If not,give an assignment to the variables (e.g. p=T, q=F) for which the two expressions evaluate to different
values.

Answer:

(a) Not equivalent. Consider p = F and q = T , then

p → q = T but q → p = F.
(b) Equivalent.

p q p→q p q ¬q ¬p ¬q → ¬p
F F T F F T T T
F T T F T F T T
T F F T F T F F
T T T T T F F T

(c) Not equivalent. Let p = T , q = F , and r = F . Then

p ∧ q → r = T but p ∧ ¬r → q = F

6. Using exactly k variables, how many Boolean expressions could one make that are not equivalent to each other?
k
Answer: 22 . This answer has two parts.
k
Part 1: There are 22 distinct truth tables using exactly k variables. To see this, note that two truth tables are different
if they differ in any row of their last column. With k variables, a truth table has 2k rows. Since there are two possible
values that can fill in each row of the last column (T or F), the number of ways we can fill in the last column of the truth
table is
2k times
z }| { k
2 · 2 · · · · 2 = 22 .

Part 2: For any truth table, there is a corresponding Boolean expression. In class we saw that we can convert any truth
table into a Boolean expression (either as a DNF or a CNF) and vice versa. Thus, because two Boolean expressions are
equivalent iff they have the same truth table, then the number of non-equivalent Boolean expressions over k variables is
k
equal to the number of distinct truth tables over k variables. From part 1, we can conclude that there are 22 non-equivalent
Boolean formulas.

You might also like