CS109A Notes for Lecture 1/12/96
The Essence of Proof
Mathematical proof is essentially persuasive prose.
Like an essay, it is e ective if it convinces the
listener.
Also like an essay, we can learn certain rhetorical tricks, e.g. \proof by induction" or \use
of the contrapositive."
Two Parts of a Proof
Some parts of a proof involve logical manipulation,
regardless of what our statements mean.
Example: Modus Ponens is the rule that says \if
you know p and you know p ! q, then you may
conclude q.
This rule does not depend on what p and q
\mean."
Other parts of a proof depend on the meaning of
propositional variables or predicates.
Example:
(8X ) greenElephant(X ) ! wearsBoxers(X )
is true (vacuously!) because we can argue that
there are no green elephants.
The general statement (8X ) p(X ) ! q(X )
is not a theorem.
Succinct Notation
replaced by concatenation (no operator,
like multiplication).
OR replaced by +.
NOT replaced by :.
TRUE and FALSE replaced by 0 and 1.
AND
Truth Tables
The truth table for an expression has one row for
each combination of truth-values for its variables,
i.e., 2n rows if there are n variables.
Assignment of TRUE or FALSE to each variable
of the expression is a truth assignment.
The value in each row is the value of the expression
for that truth assignment.
Often, we evaluate an expression \bottomup," with a column for each subexpression.
Apply an operator to two columns by applying the operator row-wise.
Example: (p ! q) (:q ! :p).
The contrapositive law.
p q
0
0
1
1
0
1
0
1
p!q
1
1
0
1
:p :q :
1
1
0
0
1
0
1
0
q ! : p whole
1
1
0
1
1
1
1
1
Algebraic Laws (Tautologies)
1. Commutative laws : (p + q) (q + p) and
pq qp.
2. Associative laws : (p + q)+ r p +(q + r) and
(pq)r p(qr).
3. Distributive laws : p(q + r) pq + pr and
p + qr (p + q)(p + r).
That last one is a surprise; the other laws
so far make AND and OR look just like
times and plus.
4. Idempotence laws : pp p and p + p p.
5. DeMorgan's laws : :(pq)
:p + :q and
:(p + q ) (:p)(:q ).
2
Generalizes to any number of variables:
the negation of any product is the sum
of the negations, and the negation of any
sum is the product of the negations.
Also generalizes to the \in nite case"
involving quanti ers: : (8X )e(X )
(9X ) :e(X ) and : (9X )e(X )
(8X ) :e(X ) .
Example: :(pq + r) :(pq) (:r) (:p + :q)(:r).
6. Double negation : :(:p) p.
Laws Useful in Designing Proofs
7. Contrapositive law : (p ! q) (:q ! :p).
To prove an implication, prove the reverse implication of the negations.
Example: Consider \if X is not divisible by 4,
then either X is odd or X = 2Y and Y is odd."
Use propositions:
p: \X is divisible by 4."
q: \X is odd."
r: \X is twice an odd number."
Statement is: :p ! q + r.
Contrapositive: (:q)(:r) ! p.
Argument:
:q says \X is even," i.e., X = 2A for
some A.
:r says X is not twice any odd number.
Since X is twice A, A is not odd. Thus,
A = 2B for some B.
Thus, X = 4B, which is statement p: \X
is divisible by 4."
8. Proof by contradiction : p (:p) ! 0.
3
Prove a statement by showing that its
negation implies FALSE, i.e., a contradiction such as q(:q).
9. Modus ponens : p(p ! q) ! q.
One way to prove a statement q is to
prove some statement p and also show
that p implies q.
10. Transitivity of implication : (p ! q)(q ! r) ! (p ! r).
To prove p implies r, nd some intermediate q; show p ! q and q ! r.
Likewise : (p q)(q r) ! (p r)
11. Replacing implications : (p ! q) (:p + q).
Because we can often manipulate AND
and OR by the familiar rules for times and
plus, it is often easier to replace implications this way.
Similarly, (p q) pq + (:p)(:q) .
12. Case analysis : (p ! q)(:p ! q) ! q.
If q follows from both p and :p, then q
must be true.
More generally, if q follows from each of
p1 ; p2; : : : ; pn, and at least one of the pi 's
must be true, then we may conclude q.
Example: Consider
p: \X is divisible by 4."
q: \X is odd."
r: \X is twice an odd number."
We want to prove :p ! q +r, or equivalently using
(11): p + q + r.
Consider 4 cases, depending on whether the
remainder of X=4 is 0, 1, 2, or 3.
Surely at least one (in fact, exactly one)
of these cases is true for any integer X .
4
0: Then p is true. Since p ! p + q + r is a tautology, we may use modus ponens to conclude
from that and p that p + q + r.
1: Then q is true. Since q ! p + q + r is also a
tautology, we can conclude p + q + r by modus
ponens.
2: Then X=2 is odd, so r is true. r ! p + q + r
is a tautology, so we conclude p + q + r by
modus ponens.
3: Like case 1.
Substitution Principle
You may substitute for any or all propositional
variables in a tautology.
Even expressions involving predicate
logic may be substituted.
Example: p + :p is a tautology. Substitute
s(X; Y ) + s(Y; X ) for p. It follows that
s(X; Y ) + s(Y; X ) +
s(X; Y ) + s(Y; X )
is a tautology.
Substitution of Equals for Equals
Take any expression E , nd some subexpression
F , substitute for F an equivalent expression, and
the resulting expression will be equivalent to E .
Example: A substituted instance of DeMorgan's law says : s(X; Y ) + s(Y; X )
:s(X; Y )) :s(Y; X ) . Substitute the right
side for the left in previous example to conclude
s(X; Y )+ s(Y; X )+ :s(X; Y ))(:s(Y; X ) is a tautology.