Propositions and Proofs¶
Problem 1¶
Using the following definitions, convert English sentences into predicate logic,
X is the set of people
S(x) ::= x has been a student of 6.042
A(x) ::= x got an A on 6.042
T(x) ::= x is a TA on 6.042
E(x,y) ::= x and y are the same person
There are people who have taken 6.042 and have gotten A’s in 6.042
All people who are 6.042 TA’s and have taken 6.042 got A’s in 6.042
There are no people who are 6.042 TA’s who did not get A’s in 6.042
There are at least three people who are TA’s in 6.042 and have not taken 6.042
Problem 2¶
Use a truth table to prove or disprove the following statements:
\(\lnot (P \lor (Q \land R)) = (\lnot P) \land (\lnot Q \lor \lnot R)\)
P |
Q |
R |
\(\lnot (P \lor (Q \land R))\) |
\(\lnot (P) \land (\lnot Q \lor \lnot R)\) |
---|---|---|---|---|
F |
F |
F |
T |
T |
F |
F |
T |
T |
T |
F |
T |
F |
T |
T |
F |
T |
T |
F |
F |
T |
F |
F |
F |
F |
T |
F |
T |
F |
F |
T |
T |
F |
F |
F |
T |
T |
T |
F |
F |
They’re all the same, so they are equal. For fun I ran this in python to verify.
from itertools import product
X = product([True, False], repeat=3)
result = 'Proved'
for P, Q, R in X:
if not (P or (Q and R)) != (not P) and (not Q or not R):
print((P, Q, R))
result = 'Disproved'
print(result)
# >>> Proved
\(\lnot (P \land (Q \lor R)) = \lnot P \lor (\lnot Q \lor \lnot R)\)
P |
Q |
R |
\(\lnot (P \land (Q \lor R))\) |
\(\lnot P \lor (\lnot Q \lor \lnot R)\) |
---|---|---|---|---|
F |
F |
F |
T |
T |
F |
F |
T |
T |
T |
F |
T |
F |
T |
T |
F |
T |
T |
T |
T |
T |
F |
F |
T |
T |
T |
F |
T |
F |
T |
T |
T |
F |
F |
T |
T |
T |
T |
F |
F |
Two discrepancies at TFT and TTF. I ran it through python again, to check my answers.
from itertools import product
X = product([True, False], repeat=3)
result = 'Proved'
for P, Q, R in X:
if not (P and (Q or R)) != (not P or (not Q or not R)):
print((P, Q, R))
result = 'Disproved'
print(result)
# >>> (True, True, False)
# >>> (True, False, True)
# >>> Disproved
Problem 3¶
Find equivalent expressions using only \(\barwedge\) (nand) and \(\lnot\) (not).
\(A \land B\)
\(A \lor B\)
\(A \Rightarrow B\)
Find an equivalent expression for ( \(\lnot\) A) using only nand and grouping parentheses
The constants true and false themselves may be expressed using only nand.
Construct an expression using an arbitrary statement A and nand that evaluates to true regardless of whether A is true or false
Construct a second expression that always evaluates to false
Problem 4¶
12 coins and a balance scale, one coin is fake. All real coins weigh the same, but the fake coin weighs less than the rest. In at most 3 weighings, give a strategy that detects the fake coin.
Reliable Strategy¶
(guaranteed to find fake in exactly 3 weighings)
6 on each side of the scale, discard the heavier side
3 on each side of scale, discard the heavier side
1 on each side, if balanced, the third coin is fake, else the lighter side is the fake
High Risk - High Reward Strategy¶
(could find fake on first try, might not find it at all)
Randomly pick two coins and place on each side of scale. If unbalanced, the lighter side is the fake else discard both coins.
Repeat until fake is found or 3 weighings
Best Strategy¶
(could find fake in 2 weighings, definitely in 3)
4 on each side, with 4 remainder. If balanced, discard both, as fake is in remainder else discard heavier side and remainder.
1 on each side, 2 remainder. If unbalanced, the lighter side is the fake, else discard both.
(if necessary) 1 on each side the lighter side is the fake.
Problem 5¶
Prove the following statement by proving its contrapositive: if r is irrational, then \(r^{1/5}\) is irrational.
We define the following to write out our theorem:
P(r) ::= r is irrational
\(r^{1/5}\) is irrational
Theorem: \(\forall r \in \Bbb R. P(r) \Rightarrow Q(r)\)
Proof: we prove by contrapositive if \(r^{1/5}\) is rational, then r is rational. Assuming \(r^{1/5}\) is rational, we can assume the following
lemma 1: rational numbers are equal to a ratio of two integers
lemma 2: the nth root of non-integers are irrational
If r is rational, then a / b must be an integer. From lemma 1, a and b are coprime with gcd(a, b) = 1. This means for \({a \over b}\) to be an integer, b must equal 1.
Since a is an integer, \(a^5\) is also an integer, because integers are closed under multiplication. It therefore follows that r is also an integer, i.e. rational. \(\blacksquare\)
Problem 6¶
Suppose that \(w^2 + x^2 + y^2 = z^2\) , where w x y and z are positive integers. Prove the proposition z is even if and only if w, x and y are even.
First, we define the following:
The domain of discourse is all positive integers (\(\Bbb Z^+\))
E(n) ::= n is even
Theorem: \(\forall w,x,y \exists z. ((w^2 + x^2 + y^2 = z^2) \Rightarrow E(z)) \Leftrightarrow E(w) \land E(x) \land E(y)\)
That is, given the formula \(w^2 + x^2 + y^2 = z^2\), where w, x, y and z are positive integers, z is even if and only if w, x and y are all even.
Proof: We shall prove by cases
Lemma 1: All odd integers can be rewritten as \(2i + 1\) where i is an integer.
All even integers can be rewritten as \(2j\) where j is an integer.
Using lemma 1, in each case, w,x,y and z will be rewritten as multiple of integers a, b, c and d respectively.
Case 1: All three of \(\{x,y,z\}\) are odd, i.e.
We can then rewrite the formula as follows,
a, b, c and d are integers, meaning their squares are also integers. Integers added together result in an integer, so we get,
Adding 0.75 to any integer cannot result in an integer. This is a contradiction, so w, x and y cannot all be odd.
Case 2: One of \(\{x,y,z\}\) is even, the others are odd e.g.
We can then rewrite the formula as follows,
Following the same reasoning as case 1, we end up with,
Adding 0.5 to any integer cannot result in an integer. This is a contradiction, so one of \(\{w,x,y\}\) cannot be even.
Case 3: Two out of \(\{w,x,y\}\) are even, the other is odd e.g.
We can then rewrite the formula as follows,
Again, we end up with,
Adding 0.25 to any integer cannot result in an integer. This is a contradiction, so two of \(\{w,x,y\}\) cannot be even.
Case 4: They’re all even i.e.
We can then rewrite the formula as follows,
As before, this gives us,
Which is true, so the theorem holds true in this case.
Case 4 is the only case where the theorem can be true, thus proving the if and only if relationship. \(\blacksquare\)