From … to Induction CS 270 Math Foundations of CS Jeremy Johnson 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. Outline 1. Motivating Example 2. Induction Principle 3. Inductive Proofs 1. Distributive Law 2. DeMorgan’s Law 3. Sums 4. Counting Clauses 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 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 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) 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) 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) 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) • … • Generalized Distributive Law • Define • 𝑛 𝑖=1 𝐴𝑖 𝐴1 ∧ ⋯ ∧ 𝐴𝑛 = = 𝑛−1 𝑖=1 𝐴𝑖 𝐴1 𝑛 𝑖=1 𝐴𝑖 ∧ 𝐴𝑛 𝑛>1 𝑛=1 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(2) S(2), S(2) S(3) … S(1) S(2) S(3) • This allows a proof of infinitely many cases 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. Generalized Distributive Law • Theorem. 𝐴 ∨ 𝑛 𝑖=1 𝐵𝑖 ≡ 𝑛 𝑖=1(𝐴 ∨ 𝐵𝑖 ) • Proof by induction on n. • Base case (𝑛 = 1) • 𝐴∨ 1 𝑖=1 𝐵𝑖 ≡ (𝐴 ∨ 𝐵1 ) ≡ 1 𝑖=1(𝐴 ∨ 𝐵𝑖 ) Generalized Distributive Law • Theorem. 𝐴 ∨ 𝑛𝑖=1 𝐵𝑖 ≡ 𝑛𝑖=1(𝐴 ∨ 𝐵𝑖 ) • Assume Inductive Hypothesis (IH) • 𝐴∨ ≡ 𝑛−1 𝑖=1 (𝐴 ∨ 𝐵𝑖 ) 𝑛 𝑖=1 𝐵𝑖 𝐴 ∨ (( 𝑛−1 ] 𝑖=1 𝐵𝑖 ) ∧ 𝐵𝑛 ) [by definition of (𝐴 ∨ ( 𝑛−1 𝑖=1 𝐵𝑖 ) ∧ (𝐴 ∨ 𝐵𝑛 ) [by distrib. law] 𝑛−1 𝑖=1 (𝐴 ∨ 𝐵𝑖 ) ∧ (𝐴 ∨ 𝐵𝑛 ) [by IH] 𝑛 ] 𝑖=1(𝐴 ∨ 𝐵𝑖 ) [by definition of • 𝐴∨ 𝑛−1 𝑖=1 𝐵𝑖 Exercise Generalized DeMorgan’s Law • Prove by induction on n that 𝑛 𝑛 ¬ 𝑖=1 𝐴𝑖 ≡ ⋁𝑖=1 ¬𝐴𝑖 • Base case. • Inductive Hypothesis Solution • Prove by induction on n that 𝑛 𝑛 ¬ 𝑖=1 𝐴𝑖 ≡ ⋁𝑖=1 ¬𝐴𝑖 • Base case. (𝑛 = 1) • ¬ 1 𝑖=1 𝐴𝑖 = ¬𝐴1 • ⋁1𝑖=1 ¬𝐴𝑖 = ¬𝐴1 Solution • Inductive Hypothesis 𝑛−1 • Assume ¬ 𝑛−1 𝐴 ≡ ⋁ 𝑖=1 𝑖 𝑖=1 ¬𝐴𝑖 and show 𝑛 𝑛 that ¬ 𝑖=1 𝐴𝑖 ≡ ⋁𝑖=1 ¬𝐴𝑖 • ¬ 𝑛 𝑖=1 𝐴𝑖 ≡¬ 𝑛−1 𝑖=1 𝐴𝑖 ∧ 𝐴𝑛 [by def 𝑛 𝑖=1 𝐴𝑖 ] ¬ 𝑛−1 𝑖=1 𝐴𝑖 ∨ ¬𝐴𝑛 [by DeMorgan’s (⋁𝑛−1 𝑖=1 ¬𝐴𝑖 ) ∨ ¬𝐴𝑛 [by IH] 𝑛 𝑛 ⋁𝑖=1 ¬𝐴𝑖 [by def of ⋁𝑖=1 ] law] 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 Number of Clauses in atmost_one • The number of clauses in atmost_one(P1,…,Pt) is equal to • 𝑡−1 𝑖=1 𝑖 = 𝑡(𝑡−1) 2 P1 (P2 Pt) … Pt-2 (Pt-1 Pt) Pt-1 Pt Summation Formula 𝑛 𝑖=1 𝑖 • Theorem. = 𝑛(𝑛+1) 2 • Proof by induction on n. 1 𝑖=1 𝑖 • Base case (n=1). • Assume • • 𝑛 𝑖=1 𝑖 = 𝑛+1 𝑖=1 𝑖 𝑛 𝑖=1 𝑖 𝑛(𝑛+1) 2 2(𝑛+1) 2 = 𝑛+1 = + =1= 𝑛(𝑛+1) 2 [IH] and show + 𝑛+1 = = 1(1+1) 2 𝑛+1 (𝑛+2) 2 𝑛(𝑛+1) + 2 Summation Formula • Prove by induction on n that 𝑛(𝑛+1)(2𝑛+1) 6 • Base Case • Inductive Hypothesis 𝑛 2 𝑖 𝑖=1 = 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) 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 𝑁−1 𝑁−1 𝑑=1 𝑀(𝑑) + M(N)) = 4* 𝑑=1 𝑀(𝑑)+2M(N) = 2 𝑁−1 𝑑=1 𝑑 𝑑 − 1 + N(N-1) = 2 − 2 𝑁−1 𝑑 + 𝑁(𝑁 − 1)= 1/3N(N-1)(2N-1) 2 𝑁−1 𝑑 𝑑=1 𝑑=1 2*(2 Clauses in N-Queens SAT Problem C(N) = R(N) + C(N) + D(N) = 5𝑁3 −6𝑁2 +7 3 C(3) = 34, C(4) = 84, C(100) = 1,646,900
© Copyright 2026 Paperzz