from … to induction cs 270 math foundations of cs jeremy johnson
TRANSCRIPT
![Page 1: From … to Induction CS 270 Math Foundations of CS Jeremy Johnson](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bff11a28abf838cbb7b1/html5/thumbnails/1.jpg)
From … to Induction
CS 270 Math Foundations of CSJeremy Johnson
![Page 2: From … to Induction CS 270 Math Foundations of CS Jeremy Johnson](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bff11a28abf838cbb7b1/html5/thumbnails/2.jpg)
Objective
• To illustrate the shortcomings to the proof techniques seen so far and to introduce the principle of induction which allows the proof of infinitely many cases at once.
• With practice, students should be able to carry out simple inductive proofs following the lecture.
![Page 3: From … to Induction CS 270 Math Foundations of CS Jeremy Johnson](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bff11a28abf838cbb7b1/html5/thumbnails/3.jpg)
Outline
1. Motivating Example2. Induction Principle3. Inductive Proofs
1. Distributive Law2. DeMorgan’s Law3. Sums
4. Counting Clauses
![Page 4: From … to Induction CS 270 Math Foundations of CS Jeremy Johnson](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bff11a28abf838cbb7b1/html5/thumbnails/4.jpg)
Atmost One
• Recall the condition for at most one of the variables P1,…,Pt to be true
P1 (P2 Pt)
…Pt-2 (Pt-1 Pt)
Pt-1 Pt
• We see a pattern and fill in the dots
![Page 5: From … to Induction CS 270 Math Foundations of CS Jeremy Johnson](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bff11a28abf838cbb7b1/html5/thumbnails/5.jpg)
Atmost One
• When converting to CNF we used a generalized version of the distributive law
P1 (P2 Pt)
P1 (P2 Pt)
(P1 P2) (P1 Pt)
• Again we fill in the dots and assume the distributive law generalizes appropriately
![Page 6: From … to Induction CS 270 Math Foundations of CS Jeremy Johnson](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bff11a28abf838cbb7b1/html5/thumbnails/6.jpg)
Generalized Distributive Law
• A (B C) (A B) (A C)
• What about• A (B C D) (A B) (A C) (A D)
• What does this mean?• (B C D) and (A B) (A C) (A D)
![Page 7: From … to Induction CS 270 Math Foundations of CS Jeremy Johnson](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bff11a28abf838cbb7b1/html5/thumbnails/7.jpg)
Generalized Distributive Law
• A (B C D) º A ((B C) D) º (A (B C)) (A D) º ((A B) (A C)) (A D) º (A B) (A C) (A D)
![Page 8: From … to Induction CS 270 Math Foundations of CS Jeremy Johnson](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bff11a28abf838cbb7b1/html5/thumbnails/8.jpg)
Generalized Distributive Law
• A (B C D E) º A ((B C D) E) º (A (B C D)) (A E) º ((A B) (A C) (A D)) (A E) º (A B) (A C) (A D) (A E)
![Page 9: From … to Induction CS 270 Math Foundations of CS Jeremy Johnson](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bff11a28abf838cbb7b1/html5/thumbnails/9.jpg)
Generalized Distributive Law
• A (B C D E F) º A ((B C D E) F) º (A (B C D E)) (A F) º ((A B) (A C) (A D) (A D))
(A F) º (A B) (A C) (A D) (A E) (A F) • …
![Page 10: From … to Induction CS 270 Math Foundations of CS Jeremy Johnson](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bff11a28abf838cbb7b1/html5/thumbnails/10.jpg)
Generalized Distributive Law
• Define
![Page 11: From … to Induction CS 270 Math Foundations of CS Jeremy Johnson](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bff11a28abf838cbb7b1/html5/thumbnails/11.jpg)
Induction Principle
• Let S(n) be a statement paramterized by a non-negative integer n
• If S(0) is true and S(n) S(n+1) then S(n) holds for all non-negative integers.• S(0), S(0) S(1) S(1)• S(1), S(1) S(2) S(2)• S(2), S(2) S(3) S(3)• …
• This allows a proof of infinitely many cases
![Page 12: From … to Induction CS 270 Math Foundations of CS Jeremy Johnson](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bff11a28abf838cbb7b1/html5/thumbnails/12.jpg)
Inductive Proofs
• Let S(n) be a statement paramterized by n a nonnegative integer. To prove S(n) holds for all non-negative integers.
1. Prove S(0) [Base case]2. Assume S(n) [inductive hypothesis] and
prove S(n+1). This proves S(n) S(n+1)
• Can start with a positive integer k and show S(n) holds for all integers k.
![Page 13: From … to Induction CS 270 Math Foundations of CS Jeremy Johnson](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bff11a28abf838cbb7b1/html5/thumbnails/13.jpg)
Generalized Distributive Law
• Theorem. )
• Proof by induction on n.
• Base case ()• )
![Page 14: From … to Induction CS 270 Math Foundations of CS Jeremy Johnson](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bff11a28abf838cbb7b1/html5/thumbnails/14.jpg)
Generalized Distributive Law
• Theorem. )• Assume Inductive Hypothesis (IH)• )
º [by definition of ]º [by distrib. law]º ) [by IH]º ) [by definition of ]
![Page 15: From … to Induction CS 270 Math Foundations of CS Jeremy Johnson](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bff11a28abf838cbb7b1/html5/thumbnails/15.jpg)
Exercise Generalized DeMorgan’s Law
• Prove by induction on n that
• Base case.
• Inductive Hypothesis
![Page 16: From … to Induction CS 270 Math Foundations of CS Jeremy Johnson](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bff11a28abf838cbb7b1/html5/thumbnails/16.jpg)
Solution
• Prove by induction on n that
• Base case. ()
![Page 17: From … to Induction CS 270 Math Foundations of CS Jeremy Johnson](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bff11a28abf838cbb7b1/html5/thumbnails/17.jpg)
Solution
• Inductive Hypothesis• Assume and show that
• [by def ]º [by DeMorgan’s law]º ) [by IH]º [by def of ]
![Page 18: From … to Induction CS 270 Math Foundations of CS Jeremy Johnson](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bff11a28abf838cbb7b1/html5/thumbnails/18.jpg)
Counting Clauses
• We would like a formula for the number of clauses in the N-queens problem.
• Count the number of clauses for atmost_one, atleast_one and exactly_one
• Sum over all rows, columns and diagonals
![Page 19: From … to Induction CS 270 Math Foundations of CS Jeremy Johnson](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bff11a28abf838cbb7b1/html5/thumbnails/19.jpg)
Number of Clauses in atmost_one
• The number of clauses in atmost_one(P1,…,Pt) is equal to
•
P1 (P2 Pt)
…Pt-2 (Pt-1 Pt)
Pt-1 Pt
![Page 20: From … to Induction CS 270 Math Foundations of CS Jeremy Johnson](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bff11a28abf838cbb7b1/html5/thumbnails/20.jpg)
Summation Formula
• Theorem. • Proof by induction on n.• Base case (n=1). • Assume [IH] and show
![Page 21: From … to Induction CS 270 Math Foundations of CS Jeremy Johnson](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bff11a28abf838cbb7b1/html5/thumbnails/21.jpg)
Summation Formula
• Prove by induction on n that • Base Case• Inductive Hypothesis
![Page 22: From … to Induction CS 270 Math Foundations of CS Jeremy Johnson](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bff11a28abf838cbb7b1/html5/thumbnails/22.jpg)
Counting Clauses
• M(n) number of clauses for atmost_one• L(n) number of clauses for atleast_one• E(n) number of clauses for exactly_one
• M(n) = n(n-1)/2• L(n) = 1• E(n) = M(n)+E(n)
![Page 23: From … to Induction CS 270 Math Foundations of CS Jeremy Johnson](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bff11a28abf838cbb7b1/html5/thumbnails/23.jpg)
Clauses in N-Queens SAT Problem
Constraints Exactly one queen per row
N*E(N) = N(N(N-1)/2+1) = ½*N*(N2-N+2)
Exactly one queen per column N*E(N) = N(N(N-1)/2+1) = ½*N*(N2-N+2)
At most one queen on diagonal 2*(2 + M(N)) = 4*+2M(N) = 2+ N(N-1) = 2= 1/3N(N-1)(2N-1)
![Page 24: From … to Induction CS 270 Math Foundations of CS Jeremy Johnson](https://reader036.vdocument.in/reader036/viewer/2022062519/5697bff11a28abf838cbb7b1/html5/thumbnails/24.jpg)
Clauses in N-Queens SAT Problem
C(N) = R(N) + C(N) + D(N) =
C(3) = 34, C(4) = 84, C(100) = 1,646,900