Docsity

Logic Practice Quiz Answers and Proofs, Quizzes of Computer Science

Toggle sidebar
bg1
CS1050B - Practice Quiz Answer Keys
Practice Quiz 1a
1. Use a truth table to prove or disprove that (p ⊕ q) ⇔ p ↔ q
p q p ⊕ q p ↔ q
T T F T
T F T F
F T T F
F F F T
The two statements are not logically equivalent, because they do not have the same
truth table values.
2. Without using truth tables, prove that ¬(p → q) → ¬q is a tautology.
¬(p → q) → ¬q
⇔ ¬(¬(¬p ∨ q)) ∨ ¬q Implication Equivalence
⇔ (¬p ∨ q) ∨ ¬q Double Negation
⇔ ¬p ∨ (q ∨ ¬q) Associative
⇔ ¬p ∨ T Or Tautology
⇔ T Domination
3. Without using truth tables, prove that [p ∧ (p → q)] ⇔ (p ∧ q).
[p ∧ (p → q)] ⇔ (p ∧ q)
[p ∧ (¬p ∨ q)] ⇔ (p ∧ q) Implication Equivalence
(p ∧ ¬p) ∨ (p ∧ q) ⇔ (p ∧ q) Distributive
F ∨ (p ∧ q) ⇔ (p ∧ q) And Contradiction
(p ∧ q) ∨ F ⇔ (p ∧ q) Commutative
(p ∧ q) ⇔ (p ∧ q) Identity
4. Let P(m,n) be the statement “m + n > mn”, where the universe of discourse for
both variables is the set of positive integers. State whether each of the following
propositions is true or false by writing either T or F beside the proposition.
a. P (4,7) = F
b. P (1,8) = T
c. ∀m∀n P(m,n) = F
d. ∃m∀n P(m,n) = T
e. ∃n∀m P(m,n) = T
f. ∀m∃n P(m,n) = T
g. ∀n P(1,n) = T
h. ∃n ¬P(1,n) = F
pf3
pf4

Partial preview of the text

Download Logic Practice Quiz Answers and Proofs and more Quizzes Computer Science in PDF only on Docsity!

CS1050B - Practice Quiz Answer Keys

Practice Quiz 1a

1. Use a truth table to prove or disprove that (p ⊕ q) ⇔ p ↔ q

p q (^) p ⊕ q p ↔ q T T F T T F T F F T T F F F F T

The two statements are not logically equivalent, because they do not have the same truth table values.

2. Without using truth tables, prove that ¬(p → q) → ¬q is a tautology.

¬(p → q) → ¬q ⇔ ¬(¬(¬p ∨ q)) ∨ ¬q Implication Equivalence ⇔ (¬p ∨ q) ∨ ¬q Double Negation ⇔ ¬p ∨ (q ∨ ¬q) Associative ⇔ ¬p ∨ T Or Tautology ⇔ T Domination

3. Without using truth tables, prove that [p ∧ (p → q)] ⇔ (p ∧ q). [p ∧ (p → q)] ⇔ (p ∧ q) [p ∧ (¬p ∨ q)] ⇔ (p ∧ q) Implication Equivalence (p ∧ ¬p) ∨ (p ∧ q) ⇔ (p ∧ q) Distributive F ∨ (p ∧ q) ⇔ (p ∧ q) And Contradiction (p ∧ q) ∨ F ⇔ (p ∧ q) Commutative (p ∧ q) ⇔ (p ∧ q) Identity 4. Let P(m,n) be the statement “m + n > mn”, where the universe of discourse for both variables is the set of positive integers. State whether each of the following propositions is true or false by writing either T or F beside the proposition. a. P (4,7) = F b. P (1,8) = T c. ∀m∀n P(m,n) = F d. ∃m∀n P(m,n) = T e. ∃n∀m P(m,n) = T f. ∀m∃n P(m,n) = T g. ∀n P(1,n) = T h. ∃n ¬P(1,n) = F

5. Prove that the sum of an even integer and an odd integer is always an odd integer. Let a be an even integer and b be an odd integer. Then ∃ j,k ∈ Z such that a = 2j and b = 2k + 1. Then a + b = 2j + (2k + 1) = (2j + 2k) + 1 = 2(j + k) + 1. Which is odd because (j + k) must be an integer. 6. Prove that if n is a positive integer, then n is even if and only if 7n + 4 is even. a. Prove that if n is even, then 7n + 4 is even. Since n is even, ∃j ∈ Z such that n = 2j. Then 7n + 4 = 7(2j) + 4 = 14j + 4 = 2(7j + 2). Which is even because 7j + 2 must be an integer.

b. Prove that if 7n + 4 is even, then n is even. From the contrapositive, this is equivalent to if n is odd then 7n + 4 is odd. Assume n is odd. Then ∃j ∈ Z such that n = 2j + 1. Then 7n + 4 = 7(2j + 1) + 4 = 14j + 7 + 4 = 14j + 10 + 1 = 2(7j + 5) + 1. Which is odd because 7j + 5 must be an integer.

Practice Quiz 1b

1. Use a truth table to prove or disprove that ¬ (p ⊕ q) ⇔ p ↔ q

p q (^) ¬(p ⊕ q) p ↔ q T T T T T F F F F T F F F F T T

The two statements are logically equivalent, because they have the same truth table values.

2. Without using truth tables, prove that (¬q ∧ (p → q)) → ¬p is a tautology.

(¬q ∧ (p → q)) → ¬p ⇔ ¬(¬q ∧ (¬p ∨ q)) ∨ ¬p Implication Equivalence ⇔ (¬(¬q) ∨ ¬(¬p ∨ q)) ∨ ¬p DeMorgan ⇔ (q ∨ (p ∧ ¬q)) ∨ ¬p Demorgan/Double Negation ⇔ ((p ∧ ¬q) ∨ q) ∨ ¬p Commutative ⇔ (p ∧ ¬q) ∨ (q ∨ ¬p) Associative ⇔ (p ∧ ¬q) ∨ (¬p ∨ q) Commutative ⇔ (p ∧ ¬q) ∨ (¬p ∨ ¬(¬q)) Double Negation ⇔ (p ∧ ¬q) ∨ ¬(p ∧ ¬q) DeMorgan ⇔ T Or Tautology

7. Prove that the product of a nonzero rational number and an irrational number is irrational. Let r be a nonzero rational number and i be an irrational number. Since r is a nonzero rational, then r = m/n where m,n ∈ Z and m,n are both ≠0. Assume that their product is rational. Then ri = a where a = j/k with j,k ∈ Z and k≠0. Therefore ri = (m/n)i = j/k. This gives i = jn/km. But since jn is an integer and km is a nonzero integer then jn/km is rational. We have that an irrational number i is equal to a rational number jn/km. This is a contradiction so ir must be irrational.