cs156 the calculus of
play

CS156: The Calculus of Complete induction (for T PA , T cons ) - PowerPoint PPT Presentation

Induction Stepwise induction (for T PA , T cons ) CS156: The Calculus of Complete induction (for T PA , T cons ) Computation Theoretically equivalent in power to stepwise induction, Zohar Manna but sometimes produces more concise proof


  1. Induction ◮ Stepwise induction (for T PA , T cons ) CS156: The Calculus of ◮ Complete induction (for T PA , T cons ) Computation Theoretically equivalent in power to stepwise induction, Zohar Manna but sometimes produces more concise proof Winter 2010 ◮ Well-founded induction Generalized complete induction ◮ Structural induction Over logical formulae Chapter 4: Induction Page 1 of 37 Page 2 of 37 Stepwise Induction (Peano Arithmetic T PA ) Example Axiom schema (induction) Prove: F [ n ] : 1 + 2 + · · · + n = n ( n + 1) F [0] ∧ . . . base case 2 ( ∀ n . F [ n ] → F [ n + 1]) . . . inductive step for all n ∈ N . → ∀ x . F [ x ] . . . conclusion ◮ Base case : F [0] : 0 = 0 · 1 2 for Σ PA -formulae F [ x ] with one free variable x . ◮ Inductive step : Assume F [ n ] : 1 + 2 + · · · + n = n ( n +1) , (IH) 2 show To prove ∀ x . F [ x ], the conclusion, i.e., F [ n + 1] : 1 + 2 + · · · + n + ( n + 1) F [ x ] is T PA -valid for all x ∈ N , n ( n + 1) it suffices to show = + ( n + 1) by ( IH ) ◮ base case: prove F [0] is T PA -valid. 2 n ( n + 1) + 2( n + 1) ◮ inductive step: For arbitrary n ∈ N , = 2 assume inductive hypothesis, i.e., ( n + 1)( n + 2) F [ n ] is T PA -valid, = 2 then prove Therefore, F [ n + 1] is T PA -valid. ∀ n ∈ N . 1 + 2 + . . . + n = n ( n + 1) 2 Page 3 of 37 Page 4 of 37

  2. Example: First attempt: ∀ y [ ∀ x . exp 3 ( x , y , 1) = x y ] Theory T + PA obtained from T PA by adding the axioms: � �� � ◮ ∀ x . x 0 = 1 F [ y ] (E0) ◮ ∀ x , y . x y +1 = x y · x We chose induction on y . Why? (E1) ◮ ∀ x , z . exp 3 ( x , 0 , z ) = z (P0) Base case: ◮ ∀ x , y , z . exp 3 ( x , y + 1 , z ) = exp 3 ( x , y , x · z ) (P1) F [0] : ∀ x . exp 3 ( x , 0 , 1) = x 0 For arbitrary x ∈ N , exp 3 ( x , 0 , 1) = 1 (P0) and x 0 = 1 (E0). ( exp 3 ( x , y , z ) stands for x y . z ) Prove that Inductive step: Failure. For arbitrary n ∈ N , we cannot deduce ∀ x , y . exp 3 ( x , y , 1) = x y F [ n + 1] : ∀ x . exp 3 ( x , n + 1 , 1) = x n +1 from the inductive hypothesis is T + PA -valid. F [ n ] : ∀ x . exp 3 ( x , n , 1) = x n Page 5 of 37 Page 6 of 37 Second attempt: Strengthening Inductive step: For arbitrary n ∈ N Assume inductive hypothesis Strengthened property F [ n ] : ∀ x , z . exp 3 ( x , n , z ) = x n · z (IH) prove ∀ x , y , z . exp 3 ( x , y , z ) = x y · z F [ n + 1] : ∀ x ′ , z ′ . exp 3 ( x ′ , n + 1 , z ′ ) = x ′ n +1 · z ′ ↑ note Implies the desired property (choose z = 1) ∀ x , y . exp 3 ( x , y , 1) = x y Consider arbitrary x ′ , z ′ ∈ N : Proof of strengthened property: exp 3 ( x ′ , n + 1 , z ′ ) = exp 3 ( x ′ , n , x ′ · z ′ ) (P1) = x ′ n · ( x ′ · z ′ ) IH F [ n ]; x �→ x ′ , z �→ x ′ · z ′ Again, induction on y = x ′ n +1 · z ′ ∀ y [ ∀ x , z . exp 3 ( x , y , z ) = x y · z (E1) ] � �� � F [ y ] Base case: F [0] : ∀ x , z . exp 3 ( x , 0 , z ) = x 0 · z For arbitrary x , z ∈ N , exp 3 ( x , 0 , z ) = z (P0) and x 0 = 1 (E0). Page 7 of 37 Page 8 of 37

  3. Example: Theory T + Stepwise Induction (Lists T cons ) cons I Axiom schema (induction) T cons with axioms ( ∀ atom u . F [ u ]) ∧ . . . base case Concatenating two lists ( ∀ u , v . F [ v ] → F [cons( u , v )]) . . . inductive step ◮ ∀ atom u . ∀ v . concat ( u , v ) = cons ( u , v ) (C0) → ∀ x . F [ x ] . . . conclusion ◮ ∀ u , v , x . concat (cons( u , v ) , x ) = cons( u , concat ( v , x )) (C1) for Σ cons -formulae F [ x ] with one free variable x . Note: ∀ atom u . F [ u ] stands for ∀ u . (atom( u ) → F [ u ]). To prove ∀ x . F [ x ], i.e., F [ x ] is T cons -valid for all lists x , it suffices to show ◮ base case: prove F [ u ] is T cons -valid for arbitrary atom u . ◮ inductive step: For arbitrary lists u , v , assume inductive hypothesis, i.e., F [ v ] is T cons -valid, then prove F [cons( u , v )] is T cons -valid. Page 9 of 37 Page 10 of 37 Example: Theory T + Example: Theory T + cons II cons III Example: for atoms a , b , c , d , Reversing a list ◮ ∀ atom u . rvs ( u ) = u (R0) concat (cons( a , cons( b , c )) , d ) ◮ ∀ x , y . rvs ( concat ( x , y )) = concat ( rvs ( y ) , rvs ( x )) (R1) = cons( a , concat (cons( b , c ) , d )) ( C 1) = cons( a , cons( b , concat ( c , d ))) ( C 1) Example: for atoms a , b , c , = cons( a , cons( b , cons( c , d ))) ( C 0) rvs (cons( a , cons( b , c )) = rvs ( concat ( a , concat ( b , c ))) ( C 0) concat (cons(cons( a , b ) , c ) , d ) = concat ( rvs ( concat ( b , c )) , rvs ( a )) ( R 1) = cons(cons( a , b ) , concat ( c , d )) ( C 1) = concat ( concat ( rvs ( c ) , rvs ( b )) , rvs ( a )) ( R 1) = cons(cons( a , b ) , cons( c , d )) ( C 0) = concat ( concat ( c , b ) , a ) ( R 0) = concat (cons( c , b ) , a ) ( C 0) = cons( c , concat ( b , a )) ( C 1) = cons( c , cons( b , a )) ( C 0) Page 11 of 37 Page 12 of 37

  4. Example: Theory T + cons IV Prove ∀ x . flat ( x ) → rvs ( rvs ( x )) = x Deciding if a list is flat; � �� � F [ x ] i.e., flat ( x ) is true iff every element of list x is an atom. is T + ◮ ∀ atom u . flat ( u ) cons -valid. (F0) ◮ ∀ u , v . flat (cons( u , v )) ↔ atom( u ) ∧ flat ( v ) (F1) Base case: For arbitrary atom u , Example: for atoms a , b , c , F [ u ] : flat ( u ) → rvs ( rvs ( u )) = u flat (cons( a , cons( b , c ))) = true by F 0 and R0. flat (cons(cons( a , b ) , c )) = false Inductive step: For arbitrary lists u , v , assume the inductive hypothesis F [ v ] : flat ( v ) → rvs ( rvs ( v )) = v (IH) Page 13 of 37 Page 14 of 37 and prove Missing steps: F [cons( u , v )] : flat (cons( u , v )) → rvs ( rvs (cons( u , v ))) rvs ( rvs (cons( u , v ))) = cons( u , v ) ( ∗ ) = rvs ( rvs ( concat ( u , v ))) (C0) = rvs ( concat ( rvs ( v ) , rvs ( u ))) (R1) Case ¬ atom( u ) = concat ( rvs ( rvs ( u )) , rvs ( rvs ( v ))) (R1) = concat ( u , rvs ( rvs ( v ))) (R0) flat (cons( u , v )) ⇔ atom( u ) ∧ flat ( v ) ⇔ ⊥ = concat ( u , v ) (IH), since flat ( v ) by (F1). ( ∗ ) holds since its antecedent is ⊥ . = cons( u , v ) (C0) Case atom( u ) flat (cons( u , v )) ⇔ atom( u ) ∧ flat ( v ) ⇔ flat ( v ) by (F1). Now, show rvs ( rvs (cons( u , v ))) = · · · = cons( u , v ) . Page 15 of 37 Page 16 of 37

  5. Complete Induction (Peano Arithmetic T PA ) Is base case missing? No. Base case is implicit in the structure of complete induction. Axiom schema (complete induction) Note: ( ∀ n . ( ∀ n ′ . n ′ < n → F [ n ′ ] ) → F [ n ]) . . . inductive step ◮ Complete induction is theoretically equivalent in power to � �� � IH stepwise induction. → ∀ x . F [ x ] . . . conclusion ◮ Complete induction sometimes yields more concise proofs. for Σ PA -formulae F [ x ] with one free variable x . Example: Integer division quot (5 , 3) = 1 and rem (5 , 3) = 2 To prove ∀ x . F [ x ], the conclusion i.e., Theory T ∗ PA obtained from T PA by adding the axioms: F [ x ] is T PA -valid for all x ∈ N , ◮ ∀ x , y . x < y → quot ( x , y ) = 0 (Q0) it suffices to show ◮ ∀ x , y . y > 0 → quot ( x + y , y ) = quot ( x , y ) + 1 (Q1) ◮ inductive step: For arbitrary n ∈ N , ◮ ∀ x , y . x < y → rem ( x , y ) = x (R0) assume inductive hypothesis, i.e., F [ n ′ ] is T PA -valid for every n ′ ∈ N such that n ′ < n , ◮ ∀ x , y . y > 0 → rem ( x + y , y ) = rem ( x , y ) (R1) then prove Prove F [ n ] is T PA -valid. (1) ∀ x , y . y > 0 → rem ( x , y ) < y (2) ∀ x , y . y > 0 → x = y · quot ( x , y ) + rem ( x , y ) Best proved by complete induction. Page 17 of 37 Page 18 of 37 Case ¬ ( x < y ): Proof of (1) Then there is natural number n , n < x s.t. x = n + y ∀ x . ∀ y . y > 0 → rem ( x , y ) < y � �� � rem ( x , y ) = rem ( n + y , y ) x = n + y F [ x ] = rem ( n , y ) (R1) Consider an arbitrary natural number x . IH ( x ′ �→ n , y ′ �→ y ) y < Assume the inductive hypothesis since n < x and y > 0 ∀ x ′ . x ′ < x → ∀ y ′ . y ′ > 0 → rem ( x ′ , y ′ ) < y ′ (IH) � �� � F [ x ′ ] Prove F [ x ] : ∀ y . y > 0 → rem ( x , y ) < y . Let y be an arbitrary positive integer Case x < y : rem ( x , y ) = by (R0) x y case < Page 19 of 37 Page 20 of 37

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend