



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Exercise 1
We study : A = [¬(p ∨ q) ∧ ¬(q ∨ p) ↔ (p ∧ q)]
p q p ∨ q ¬(p ∨ q) p ∧ q A T T T F T F T F T F F T F T T F F T F F F T F F
From column 6, we get that A is not a tautology nor a contradiction.
Exercise 2
A and B are inhabitants of Smullyan islands, and A says ”If I am a knight, then B is a knave”, while B says ”If I am a knave, then A is a knight”. The answer is: The two propositions are contradictory: there is no answer. We proceed as follows:
We have therefore reached a contradiction, and the problem has no answer.
Exercise 3
We want to prove that : (((p ∨ q) → r) ∧ (r → s)) → (¬s → ¬p) is a tautology:
p q r s p ∨ q a = (p ∨ q) → r r → s b = a ∧ (r → s) c = ¬s → ¬p b → c T T T T T T T T T T T T T F T T F F F T T T F T T F T F T T T T F F T F T F T T T F T T T T T T T T T F T F T T F F F T T F F T T F T F T T T F F F T F T F T T F T T T T T T T T T F T T F T T F F F T F T F T T F T F T T F T F F T F T F T T F F T T F T T T T T F F T F F T F F F T F F F T F T T T T T F F F F F T T T T T
From column 6, we get that the proposition is indeed a tautology.
Exercise 1
n and m are integers. We want to show that if nm is even, then one of n or m is even. We use a proof by contradiction. let p be the proposition nm is even, and let q be the proposition ”n or m is even”. The proposition p → q is false when p is true and q is false, i.e. nm is even and ”n is odd and m is odd”. If n is odd, there exists an integer k such that n = 2k + 1. Similarly, if m is odd, there exists an integer l such that m = 2l + 1. Then, nm = (2k + 1)(2l + 1) = 4kl + 2k + 2l + 1 = 2(kl + k + l) + 1 i.e. nm is odd. But this is in contradiction with nm is even, and therefore the proposition ”if nm is even, then one of n or m is even” is true.
Exercise 2
Let n = 4^25650925 − 1. Notice that 4 = 2^2 and 9 = 3^2. We can rewrite n as: n = 2^50650350 − 1 = 36^50 − 1 = (36^25 )^2 − 1 = (36^25 − 1)(36^25 + 1). Since both 36^25 − 1 and 36^25 + 1 are not equal to 1, we can conclude that n is composite.
Exercise 3
Let A = {p | p is a prime number }, let B = {(k^2 − 1) | k ∈ Z}, and let C = { 3 }. We want to show that A ∩ B = C. We show this by proving that A ∩ B ⊂ C and C ⊂ A ∩ B.
Let us suppose that A ∩ B = A. Based on De Morgan’s law, B ∩ A¯ = B¯∪ A¯. We also know that A¯ = A. Therefore, B∩B ∩ A¯ = B ∩ ( B¯ ∪ A). Using distributivity, we get: B ∩ B ∩ A¯ = (B ∩ B¯) ∪ (B ∩ A). We know that B ∩ B¯ = ∅; then B ∩B ∩ A¯ = B ∩A = A, based on the premise. The proposition is therefore true.
Exercise 2
We want to prove or disprove that for four sets A, B, C and D, (A − B) − (C − D) = (A − C) − (B − D). The proposition is probably false. We have two ways to show this:
a) Find a counter example. Notice that if an element x is in A, C and D, but not in B, then: x ∈ A − B but x /∈ C − D, and therefore x ∈ (A − B) − (C − D) x /∈ A − C, therefore x /∈ (A − C) − (B − D). We have therefore a counterexample! For instance: A = { 1 , 2 , 3 , 4 , 5 }, B = { 2 , 3 }, C = { 1 , 3 , 4 } and D = { 1 , 4 , 5 }. Then: A − B = { 1 , 4 , 5 }, C − D = { 3 } and (A − B) − (C − D) = { 1 , 4 , 5 }. A − C = { 2 , 5 }, B − D = { 2 , 3 } and (A − C) − (B − D) = { 5 }. b) We can use a membership table:
A B C D A − B C − D (A − B) − (C − D) A − C (B − D) (A − C) − (B − D) 1 1 1 1 0 0 0 0 0 0 1 1 1 0 0 1 0 0 1 0 1 1 0 1 0 0 0 1 0 1 1 1 0 0 0 0 0 1 1 0 1 0 1 1 1 0 1 0 0 0 1 0 1 0 1 1 0 0 0 0 1 0 0 1 1 0 1 1 0 1 1 0 0 0 1 0 1 1 0 1 0 1 1 1 0 0 0 0 0 0 0 1 1 0 0 1 0 0 1 0 0 1 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 1 1 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Since column 7 and 10 are not equal, (A − B) − (C − D) 6 = (A − C) − (B − D)
We want to design an algorithm that replaces a number in a sequence by the sum of the numbers that precede follow that number in the sequence. We first notice that if the sequence is defined as ai, for i ∈ [1, n], and if we define S as the sum of the numbers in the sequences, then the operation we need to perform is simply:
For all i, replace ai with S − ai !! This is easily done as follows:
Procedure Replace Input: a 1 , a 2 ,... , an Output: b 1 , b 2 ,... , bn Real a 1 , a 2 ,... , an Real b 1 , b 2 ,... , bn Real S Integer i
S ← 0 for { i = 1; i=n; STEP=1} { S ← S + ai } for { i = 1; i=n; STEP=1} { bi ← S − ai }
return We need n additions to compute S, and then n substitutions to find the sequence b. The procedure is of order n.