TD2 Logic
TD2 Logic
Exercise 1 Let p, q and r be propositions. Write the truth table of the following compound
propositions:
1. (p ∧ q) ∨ ¬(p → q)
2. (p ∧ q) ∧ (p ↔ r) ∧ (q → r).
Exercise 3 Let p, q and r be propositions. Without using truth table, prove that the following
compound propositions are tautologies:
1. [¬p ∧ (p ∨ q)] → q
2. [(p ∧ q) ∨ (p ∧ ¬q)] ↔ p
3. [p ∧ (p → q)] → q
5. [p → (q → r)] ↔ [(p ∧ q) → r]
Exercise 4 Let p(x) = “x ≤ 5”, q(x) = “x + 1 is odd” and r(x) = “x > 0” be three statements
defined on Z.
• q(2) ⊕ ¬(r(−5))
• ¬[p(−4) ∨ q(−3)]
• q(3) ∨ [p(3) ∨ ¬(r(3))]
• p(2) → [q(2) → r(2)]
• [p(2) ∧ q(2)] → r(2)
• p(0) → [¬(q(−1)) ↔ r(1)]
2. Determine the values of x for which the statement [p(x) ∧ q(x)] ∧ r(x) is True.
• ∃ x ∈ Z; [p(x) ∧ r(x)]
• ∀ x ∈ Z, [p(x) ∨ q(x)]
• ∃ x ∈ Z; ¬[p(x) ∨ r(x)]
3. There exists a natural number whose product with every real number is zero.
Exercise 6 Give the truth value of the following propositions. Justify your answer. Then, write
their negation.
1. ∀ x ∈ R, (x + 1)2 > 0.
2. (∃ x ∈ R; x + 1 = 0) and (∃ x ∈ R; x + 2 = 0).
4. (∀ x ∈ R, x2 > 0) or (∀ x ∈ R, x ≤ 0).
Exercise 8 Suppose that the universal set U = {5, 6, 7, 8, 9, 10, 12, 19, 21, 33, 90}.
1. What bit string represents the subset A of all prime numbers? Call it “a”.
2. What bit string represents the subset B of all odd integers? Call it “b”.
4. Deduce A and B.
5. Find the bitwise AND, the bitwise OR and the bitwise XOR of strings “a” and “b”.
6. Deduce A ∪ B, A ⊕ B and A ∩ B.