| Prereq rules |
| The prerequisites for IC211 are that you have taken IC210 or you have taken SI204. If you don't satisfy the prerequisites, you cannot enroll in IC211. If you do satisfy the prerequisites, and you have not taken IC211, you may enroll in IC211. |
Given that MIDN Jones is enrolled in IC211 and he has not taken IC210, prove that he has taken SI204.
Follow-on problem: Consider the original and a new version (Version B below) of the rules:
| Prereq Rules Version A (original) | Prereq Rules Version B (new) |
| The prerequisites for IC211 are that you have taken IC210 or you have taken SI204. If you don't satisfy the prerequisites, you cannot enroll in IC211. If you do satisfy the prerequisites, and you have not taken IC211, you may enroll in IC211. | The prerequisites for IC211 are that you have taken IC210 or you have taken SI204. If you satisfy the prerequisites, you can enroll in IC211. If you don't satisfy the prerequisites, you cannot enroll in IC211. If you have already taken IC211, you may not enroll in IC211. |
Are these two rulesets (ignoring the MIDN Jones specific part of the original) the same? Or are there situations in which you get different results? How can we test this?
We can encode the two rulesets in propositional logic and use the prop. log. tool to generate a truth table. They are equivalent if the results column has all trues. Try it!
( # Version A (~(t210 | t204) => ~e211) # If you don't satisfy the prerequisites, you cannot enroll in IC211. & ((t210 | t204) & ~t211 => e211) # If you do satisfy the prerequisites, and you have not taken IC211, you may enroll in IC211. ) <=> ( # Version B ((t210|t204) => e211) # If you satisfy the prerequisites, you can enroll in IC211. & (~(t210 | t204) => ~e211) # If you don't satisfy the prerequisites, you cannot enroll in IC211. & (t211 => ~e211) # If you already taken IC211, you may not enroll in IC211. )If you construct a truth table for this formula, you'll see there are several false's in the results column (so these two versions of the rules are not equivalent!), for example in the row corresponding to the interpretation
t210=false, t204=true, e211=false, t211=trueThe Version A formula evaluates to true for this interpretation, so the original rules are satisfied. However, the Version B formula evaluates to false, so the interpretation violates those rules. Should this be OK? Which rule set is correct?
| A valid proof step | An invalid proof step | |
|---|---|---|
1: a ∧ (¬b ∨ c) ⊕ c [Given] 2: a ∧ (b => c) ⊕ c [Implication rewriting on #1]We can replace one subformula within a larger formula with another subformula, but only if the original subformula and the new subformula are equivalent. Our simplification/rewriting rules are based on an equivalence, so it's OK. The equivalnce in this case is the tautology: (x => y) <=> (¬x ∨ y)
|
1: a ∧ (¬b ∧ c) ⊕ c [Given] 2: a ∧ ( ¬b ) ⊕ c [And-elimination on #1]Deduction rules are based on implication (=>) rather than equivalence. For example, And-elimination is based on the tautology: x ∧ y => x. The left and right hand sides here are definitely not equivalent, so we change the meaning of the formula when we replace (¬b ∧ c) with (¬b).
|
equivalence-splitting: $(A \Leftrightarrow B) \Leftrightarrow (A\Rightarrow B) \wedge (B \Rightarrow A)$
We can view these as deduction rules instead
Example: Given a & b <=> c and c, prove b.
1: a & b <=> c [given] 2: c [given] 3: (a & b => c) & (c => a & b) [Equivalence splitting on 1] 4: c => a & b [And-elimination (with commutativity of ∧)] 5: a & b [Modus ponens on 4 and 2] 6: b [And-elimination on 5]Note: When we split an equivalence up into two implications, we almost always immediately apply and-elimination to deduce whichever of the two implications we really care about. Since we do it often, we will typlically collapse the two into one step. So in the above, we make 3 and 4 a single step that we justify with equivalence splitting with and-elimination.
We know that "if-then" usually indicates that there is an implication (=>) behind the scenes. Similarly, when you see "if-and-only-if", that means that we have an equivalence (<=>). For example, in mathematics we might write:
$x + y = x(1 + y/x)$ if and only if $x \neq 0$
If we let $a$ stand for "$x + y = x(1 + y/x)$" and $b$ stand for "$x \neq 0$", the above is stating $a \Leftrightarrow b$. And since we can deduce $b \Rightarrow a$ from $a \Leftrightarrow b$ (this is equivalence splitting), knowing $x \neq 0$ allows us to deduce $x + y = x(1 + y/x)$.Important: Definitions are always "if-and-only-if" statements!
For example, we have: "Definition: a square is a rectangle with all sides equal." Logically, this is $Square \Leftrightarrow Rectangle \wedge AllSidesEqual$. To give another example: "Definition: if $P$ has four sides and all interior angles are 90 degrees, then we call it a rectangle." Because this is defining "rectangle", it is logically the equivalence $Rectangle \Leftrightarrow FourSides \wedge AllAngles90$, despite being in "if-then" form.Important: Definitions can be introduced as given into proofs whenever you need them.
So let's look at a proof using these ideas. Given that $S$ is a square, prove that $S$ has four sides.
varibles: SQ = "S is a square"
SR = "S is a rectangle"
S4 = "S has four sides"
SE = "S has all sides equal"
S90 = "S has all interior angels 90 degrees"
given: SQ, prove S4
---------in propositional logic---------- ------------in English-------------------------------------
1 SQ [Given] }-- We are given that S is a square.
2 SQ <=> SR & SE [Definition of "square"] \
3 SQ => SR & SE [Equivalence splitting on 2] \_ Since S is a square, by definition it is a rectangle
4 SR & SE [Modus Ponens on 3 and 1] /
5 SR [And-elimination on 4] /
6 SR <=> S4 & S90 [Definition of "rectangle"] \
7 SR => S4 & S90 [Equivalence splitting on 6] \_ Since S is a rectangle, by definition it has four sides
8 S4 & S90 [Modus Ponens on 7 and 5] /
9 S4 [And-elimination on 8] /
Given: (x | y) => z, prove x => z 1: (x | y) => z [Given] A.1: x [New assumption] A.2: x | y [Or-introduction on A.1] A.3: z [Modus Ponens on 1 and A.2] 4: x => z [Closing assumption A.1 with A.3]Let's apply this to prove: if a shape is not a rectangle, then it is not a square. Note that the way I've written this, we're trying to prove an implication, and that means we should be thinking about using assumptions.
R : is a rectangle
S : is a square
E : all sides equal
Prove: ~R => ~S
1: S <=> R & E [Definition of square]
2: ~(R & E) => ~S [Equivalence splitting on 1 (with and-elimination)]
3: (~R | ~E) => ~S [De Morgan on 2]
A.1: ~R [Assumption]
A.2: ~R | ~E [Or-introduction]
A.3: ~S [Modus ponens 3 and A.2]
4: ~R => ~S [Closing assumption A.1 with A.3]
1: ~a => ~c [Given]
2: ~a [Given]
3: ~c [Modus Ponens on 1 and 2]
4: ~a|b [Or-introduction 2]
5: a => b [Rewriting 4 using the tautology (a => b) <=> (~a | b)]
6: (a => b) => c [Given]
7: c [Modus Ponens on 6 and 5]
Huh?!?! 3 says ~c is true, and 7 says c is true!!!
So what happend here? Every step of our proof was valid, so
given that (a => b) => c, ~a => ~c and ~a are all true, we
proved that both c and ~c are true. Since, c and ~c both true
is impossible, it must be that thee three "givens" all being
true for the same interpretation is also possible. More
concretely:
((a => b) => c) & (~a => ~c) & ~a is a contradiction! (You can
check with a truth table.)
This is a general idea:
Important: If using formulas $F_1, F_2, \ldots, F_k$ as givens you "prove" a contradiction (like $c \wedge \neg c$), then $F_1 \wedge F_2 \wedge \cdots F_k$ is a contradiction (i.e. evaluates to false for all interpretations).
Important: When you add assumption $X$ and deduce a contradiction from it, you can close the assumption with the deduction of $\neg X$.
For example:
Given: a=>c, d & ~b and ~a => b, prove c
1: ~a => b [Given]
2: d & ~b [Given]
3: ~b [And-elimination]
A.1: ~a [assumption]
A.2: b [M.P. on 1 and A.1]
4: a [Contradiction (3 and A.2) of assumption A.1]
5: a => c [Given]
6: c [Modus ponens 5 and 4]
Here's the justification for this deduction rule.
A contradiction occurs when you derive false.
In proof by contradiction, we make assumption $X$ and
derive false from it. Thus, in closing the assumption
we have derived $X \Rightarrow false$. But
$X \Rightarrow false$ is equivalent to $\neg X$ ... just check
the truth table.
Proof by contradiction makes some thing easier to prove. Here's an example:
Given x => z & y, and z => ~y, prove ~x.
1: x => z & y [Given] A.1: x [Assumption] A.2: z & y [Modus ponens 1 and A.1] A.3: z [And-elimination A.2] A.4: y [And-elimination A.2] A.5: z => ~y [Given] A.6: ~y [Modus ponens A.5 and A.3] 2: ~x [Contradiction (A.4 and A.6) of assupmtion A.1]Challenge: Prove this without proof by contradiction!