You are on page 1of 4

University of Alberta CMPUT 272 Practice Term Test 1 Sample Partial Solutions

Question 1 The symbol ⊕ denotes exclusive or, meaning that for any two statements p and q,
p ⊕ q is true if and only if exactly one of p and q is true.

a) Draw the truth table for ⊕;


Solution: The column for p ⊕ q is F T T F

b) Write down an equivalent expression of p ⊕ q using only connectives ∼, ∧, ∨.


Solution: p ⊕ q ≡ (∼ p ∧ q) ∨ (p∧ ∼ q) (there are other correct answers)

c) Prove the equivalence between p ⊕ q and your proposed expression in b).


Solution: Use truth tables

d) Is (p ⊕ q) ⊕ r ≡ p ⊕ (q ⊕ r)? Justify your answer.


Solution: Yes, use truth tables to justify

e) Is (p ⊕ q) ∧ r ≡ (p ∧ r) ⊕ (q ∧ r)? Justify your answer without using truth tables.


Solution: Yes, use the logical equivalences from the textbook and the equivalence from part
(b) of this question to transform the RHS to the LHS

Question 2 Given a statement p: “If compound X is boiling, then its temperature must be at
least 150o ”

a) State the contrapositive.


Solution: If the temperature of compound X is less than 150o then it is not boiling.

b) Assuming p is true, is “If compound X is not boiling, then its temperature is less than 150o ”
true?
Solution: No (this is the inverse of p)

c) Assuming p is true, is “compound X’s temperature is at least 150o ” a sufficient condition for
compound X to boil?
Solution: No (this is the converse of p)

Question 3
Prove that the following argument is valid:

(1) ∼p∨q →r
(2) s∨ ∼ q
(3) ∼t
(4) p→t
(5) ∼ p ∧ r →∼ s
∴ ∼q

At each step of reasoning you need to provide the rule and line numbers that you use.

1
Solution:

(6) ∼p 3,4, Modus Tollens


(7) ∼p∨q 6, Generalization
(8) r 1, 7, Modus Ponens
(9) ∼p∧r 6, 8, Conjunction
(10) ∼s 5, 9, Modus Ponens
∴ ∼q 2, 10, Elimination

Question 4
Write a negation of the following statement:

If x is a solution to x10 + 100x9 − 3x − 300 = 0, then x is an integer.

Prove or disprove the correctness of the above statement.


Solution:
The negation is: x is a solution to x10 + 100x9 − 3x − 300 = 0 and x is not an integer.
Disprove the original statement by factoring the expression:
x10 + 100x9 − 3x − 300 = x9 (x + 100) − 3(x + 100) = (x9 − 3)(x + 100) √
and then observing that the expression equals zero if x9 = 3, that is, when x = 9 3, which is not
an integer.

Question 5 Simplify the following statements as much as you can using the logical equivalences
studied in class.
a) ∼ [(∼ p →∼ (q →∼ r)) → (p ∨ r)]
Solution:

≡ (∼ p → (q∧ ∼∼ r))∧ ∼ (p ∨ r) implication and De Morgan combined, twice


≡ (∼∼ p ∨ (q ∧ r))∧ ∼ (p ∨ r) Double negation and implication law
≡ (p ∨ (q ∧ r))∧ ∼ (p ∨ r) double negation
≡ (p ∨ q) ∧ (p ∨ r)∧ ∼ (p ∨ r) distributive law
≡ (p ∨ q) ∧ c Negation law
≡ c Universal bound

b) [(p → q) ∧ (q → r)] → (p → r)

2
Solution:

≡ ∼ [(∼ p ∨ q) ∧ (∼ q ∨ r)] ∨ (∼ p ∨ r) implication law three times


≡ ∼ (∼ p ∨ q)∨ ∼ (∼ q ∨ r) ∨ (∼ p ∨ r) De Morgan’s law
≡ (∼∼ p∧ ∼ q) ∨ (∼∼ q∧ ∼ r) ∨ (∼ p ∨ r) Demorgan’s law
≡ (p∧ ∼ q) ∨ (q∧ ∼ r) ∨ (∼ p ∨ r) Double Negation
≡ (p∧ ∼ q)∨ ∼ p ∨ (q∧ ∼ r) ∨ r commutative law
≡ [(p∨ ∼ p) ∧ (∼ q∨ ∼ p)] ∨ [(q ∨ r) ∧ (∼ r ∨ r)]) distributive law twice
≡ [t ∧ (∼ q∨ ∼ p)] ∨ [(q ∨ r) ∧ t] negation law
≡ ∼ q∨ ∼ p ∨ q ∨ r identity law
≡ ∼ q ∨ q∨ ∼ p ∨ r commutative law
≡ t∨ ∼ p ∨ r Negation law
≡ t Universal bound law

Question 6 Suppose that P and Q are predicates with the same domain. For each statement
below, indicate whether it is true or false. Justify your answers.
a) ∃xP (x) ∧ ∃x ∼ P (x) ≡ ∃x(P (x)∧ ∼ P (x))
Solution: This is false. For example, let domain of x be set of all integers and P (x) be x is even.
Then clearly the LHS is true (as there are both even and odd integers) but no integer is both even
and odd.
b) ∃x(P (x) →∼ Q(x)) ≡∼ ∀x(P (x) ∧ Q(x))
Solution: This is true:
∃x(P (x) →∼ Q(x)) ≡ ∃x(∼ P (x)∨ ∼ Q(x)) ≡ ∃x ∼ (P (x) ∧ Q(x)) ≡∼ ∀x(P (x) ∧ Q(x))

Question 7 Below are some English statements and some statements in formal logical notation.
The domain is the set of natural numbers, N = {0, 1, 2, . . .}. The predicates are defined as follows:
G(x, y) means x > y.
B(x, y, z) means x is between y and z, that is, either y < x < z or z < x < y.
Match each English statement with the statement in formal logic that most closely translates it.

E1 There is a natural number that is greater than all natural numbers.

E2 There are three (not necessarily distinct) natural numbers such that one is between the other
two.

E3 Every natural number other than zero is between two natural numbers.

E4 Every natural number is greater than some natural number.

E5 Every natural number is between two natural numbers.

E6 There is a natural number such that every other natural number is greater than it.

E7 There is a natural number that is greater than any natural number except itself.

3
E8 For every natural number, there is a natural number that is greater than it.

L1 ∀x ∃y G(y, x)

L2 ∀x ∃y G(x, y)

L3 ∃y ∀x G(y, x)

L4 ∃y ∀x (y 6= x → G(y, x))

L5 ∃x ∀y (y 6= x → G(y, x))

L6 ∀x ∃y ∃z B(x, y, z)

L7 ∀x (x 6= 0 → (∃ y, z such thatB(x, y, z)))

L8 ∃x, y, z such that B(x, y, z)

Solution:

E1 E2 E3 E4 E5 E6 E7 E8
L3 L8 L7 L2 L6 L5 L4 L1

Question 8 For each statement below, state whether it is true or false. Prove the statement
directly from the definitions if it is true, and give a counterexample if it is false.

a) The sum of any three consecutive integers is divisible by 3.


Solution: T
Proof: Let n be an integer. The sum of the three consecutive integers beginning at n is
n + (n + 1) + (n + 2) = 3n + 3 = 3(n + 1).
Since n + 1 is an integer, 3|3(n + 1) by the definition of divides, and the proposition holds. 

b) For all even integers a and b, 4|ab.


Solution: T
Proof: Let a and b be even integers. By the definition of even,
a = 2r and b = 2s for some integers r and s.
Then
ab = 2r · 2s = 4rs.
Therefore, since rs is an integer, 4|ab by the definition of divides and the proposition holds. 

c) For all integers a, b, and c, if a|b and a|c then a|(2b − 3c).
Solution: T, use the definition of divides to prove it (similar to part (a))

d) For all integers a, b, and c, if ab|c then a|c and b|c.


Solution: T, use the definition of divides to prove it (similar to part (a))

e) For all integers a, b, and c, if a|(b + c) then (a|b or a|c).


Solution: F: Let a = 2, b = 1, c = 1

You might also like