Module 1 - Logic and Proofs Part 2 Student
Module 1 - Logic and Proofs Part 2 Student
Quantifiers
Logic using propositions are incapable of
describing most of the statements in
mathematics and computer science
such as the use of variables
Quantification
• Predicate – relationship between objects
Examples:
x<3 x>y x + y < 25
Note:
P(x,y,z), Q(x1,x2), M(x,y), and E(x,y)
are atomic formulas
Quantifiers
• Definition:
Let P(x) be a statement (predicate) involving x
and let D be a set.
• xy P(x, y)
– “For all x, there exists a y such that P(x,y)”
• xy P(x,y)
– There exists an x such that for all y P(x,y) is true”
Negation and Quantification
• Consider:
~ (x (P(x) ) )
- means, there does not exist even one x in
the universal set that makes P(x) true.
Thus, ~ ( x (P(x) ) ) x ( ~P(x) )
~ (x (P(x) ) )
- means P(x) is not true for all x in the
universal set.
Thus, ~ (x (P(x) ) ) x (~P(x) )
Negation Examples
1. ~(x(y (P(x,y) ) )
x ~(y (P(x,y) ) )
x y ~(P(x,y) )
2. ~(x(y (P(x,y) ) )
x y ~(P(x,y) )
Exercise #1: Find the negation
1. ~(x N (x is prime → x2 + 1 is even)
x N ~(x is prime → x2 + 1 is even)
since: (p →q ) ~p q
x N ~(x is not prime (x2 + 1) is even)
since: ~(p q ) ~p ~q
x N (x is prime x2 + 1 is odd)
Exercises: Find the negation
2. ~(x Q (x > 0 x3 = 2) )
x Q ~(x > 0 x3 = 2) )
x Q (x 0 x3 2) )
Your turn..
3. ~(x (y (xy = y) ) )
PROOFS
Mathematical Induction
Theorem
• A proposition that has been proven to be
true.
Example:
1. If the two sides of a triangle are equal, then
the angles opposite them are equal.
2. If the diagonals of quadrilateral bisect each
other then the quadrilateral is a
parallelogram.
Proof
• An argument that establishes the truth of a
theorem.
• Proof Derivation:
– Equivalence rules – describe logical equivalences
p ~ (~p) Negation
p → q ~p q Implication
~(p q) ~p ~q De Morgan’s laws
~(p q) ~p ~q
pqqp Commutative
pqqp
p ( q r) (p q) r Associative
p ( q r) (p q) r
Inference
• To prove the theorem means to show that the
implication is a tautology.
• Example:
( p (p → q) ) → q
• Examples:
a. q b. ~r
q ~ r
Basic Rules of Inference
• Conjuction (And) p
q
______
pq
• Disjunction (Or) p
If p is true, then p q ________
will ALWAYS be true pq
Modus tollens
(p q) → p or (p q) → q And Elimination
(q p) → q or (q p) → p (Simplification)
p → (p q) Disjunction (Or)
q → (q p) (Addition)
Inference Rules for Propositions
Inference Name
Hypothetical
syllogism
Disjunctive
syllogism
(Or Elimination)
Inference Example
• Use truth table to prove the following:
p
p→q q (also known as Modus ponens)
• Solution:
p→q (given)
Modus
ponens: ~q → ~p (Contrapositive)
~q (given)
p→q
~p (Modus ponens)
p
q
Exercises
1.1 Prove that pq
r
r → ~q
p
• Solution:
pq
p
r
~q
r → ~q
Exercises (cont.)
2. Prove that
Hypo Syllogism:
p→q
q→r
Solution:
p→r
p
q
p→q s
q→r
q→s
r→s
Exercises (cont.)
3. Prove that
Solution:
p→r
r→s p →s
~p
x ~s
~s
u ~x
~x
~u
Your Turn…
4. Prove that
2. pq
~p q
Exercises:
• Write a proof sequence for the assertion:
3. p → q ~q → ~p
4. p 5. p → (q r)
qr pr p
~p ~q s → ~r
s
q → ~p
p .
F
Exercises:
• Write a proof sequence for the assertion:
6. [p→(q r)] (~q ~r) →~p
7. {~p q [q → (p r)] } → r
Modus Badus
• Fallacy of affirming the conclusion
• Consider the following: q q
p→q q → p
p p
• Is this true?
p q p→q q(p→q)) (q(p→q)) → p
T T T T T
T F F F T Not a
F T T T F valid
rule!
F F T F T
Modus Badus
• Consider the following: ~p
p→q
~ q
• Is this true?
Mathematical Induction
Mathematical Induction
• Method of proving a formula
• Principles:
– Step 1: Basic Step S(1) is true
– Step 2: Inductive Step if S(1) is true for all i< n+1,
then S(n+1) is true
Example #1
1. Show that 1+2+3+…+ n = n(n+1)
2
Solution:
Step 1: S(1) or let n = 1
n = n (n + 1)
2
1 = 1 (1 + 1)
2
1 = 2/2 = 1 TRUE
Example #1 (cont.)
1. Show that 1+2+3+…+ n = n(n+1)
2
Solution:
Step 2: S(n+1) or let n = n + 1 to show:
= (n+1) (n+1+1)
2
= (n+1) (n+2)
2
Example #1 (cont.)
1 + 2 + 3 +…+ n = n(n+1) Show that:
2 (n+1) (n+2)
2
Since the last term on the left side is + n then add
both sides with (n+1):
1 + 2 + 3 +…+ n + (n+1) = n(n+1) + (n+1)
2
= n(n+1) + 2(n+1)
2
= (n+1)(n+ 2)
2
Example #2
2. Show that if r 1, then
a + ar1 + ar2 + … + arn = a(rn+1 -1)
r-1
Step 1: Since r 1 then let n=0
Step 2: Let n = n + 1
5n+ 1 – 1 = 5 * 5n – 1
= (4 + 1) * 5n – 1
= 4 * 5n + 5n – 1
Note: (5n – 1) is divisible by 4
4 * 5n is divisible by 4
Exercises:
• Using induction, verify each equation for every
positive integer n.
1. 1 + 3 + 5 + … + (2n -1) = n2
2. 1•2 + 2•3 + 3•4+ …+ n(n+1) = n(n+1) (n+2)
3
3. 1(1!) + 2(2!) + … + n(n!) = (n+1)! -1
4. 12 + 22 + 32 +… + n2 = n(n+1)(2n+1)
6
5. 12 - 22 + 32 -… + (-1)n+1n2 = (-1)n+1n(n+1)
2
Exercises:
6. 13 + 23+ 33 + … + n3 = n(n +1) 2
2
7. 1 + 1 + 1 + … + 1 = n
1• 3 3 • 5 5 • 7 (2n-1) (2n+1) 2n+1
End of Presentation