Lecture18StrongInduction

Lecture18StrongInduction - CS2603 Applied Logic for...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS2603 Applied Logic for Hardware and Software Rex Page – University of Oklahoma 1 Lecture 18 — CS 2603 Applied Logic for Hardware and Software Strong Induction Induction at a Discount or Bringing in the Cavalry to Prove P(n) Anything missing? ¡ Examples ¢ deal [1, 2, 3, 4, 5, 6] = ( [1, 3, 5], [2, 4, 6] ) ¢ deal [1, 2, 3, 4, 5, 6, 7] = ( [1, 3, 5, 7], [2, 4, 6] ) ¡ Informal specification ¢ deal :: [a] −> ( [a], [a] ) ¢ deal [x 1 , x 2 , … x 2n ] = ( [x 1 , x 3 , … x 2n-1 ], [x 2 , x 4 , … x 2n ] ) ¢ deal [x 1 , x 2 , … x 2n+1 ] = ( [x 1 , x 3 , … x 2n+1 ], [x 2 , x 4 , … x 2n ] ) ¡ Axioms ( x1: ys , x2: zs ) deal (x1: (x2: xs)) = deal [ ] = ( [ ], [ ] ) deal — a way to split a sequence in half deal [x] = ( [x], [ ] ) where (ys, zs) = deal xs ( x1: ys , x2: zs ) ( x1: ys , x2: zs ) ( x1: ys, x2: zs ) What equation changes if we want the extra element (if there is one) to go into the list in the second component? CS2603 Applied Logic for Hardware and Software Rex Page – University of Oklahoma 2 CS2603 Applied Logic for Hardware and Software Rex Page – University of Oklahoma 3 Termination Is deal a Finite Computation? ¡ Axioms for deal deal (x1: (x2: xs)) = ( x1: ys, x2: zs )--deal:: where (ys, zs) = deal xs deal [x] = ( [x], [ ] )--deal[x] deal [ ] = ( [ ], [ ] )--deal[ ] ¡ Question of termination ¢ Given: a computer system that can interpret the deal equations ¢ Question: What conditions imply termination? 9 Given a sequence xs::[a], under what conditions will the computer system be able to deliver, in a finite amount of time, a value of the form (ys, zs) = deal xs ¡ Answer ¢ When xs has a finite number of elements, (deal xs) terminates ¢ Proof … need to know a few things about basic operations CS2603 Applied Logic for Hardware and Software Rex Page – University of Oklahoma 4 Basic Operations deal (x1: (x2: xs)) = ( x1: ys, x2: zs )--deal:: where (ys, zs) = deal xs deal [x] = ( [x], [ ] )--deal[x] deal [ ] = ( [ ], [ ] )--deal[ ] ¡ Matching ¢ For any sequence xs::[a], computer system can determine, in a finite amount of time, which axiom for deal matches xs ¡ Pairing ¢ For any sequences xs, ys::[a], computer system can build, in a finite amount of time, the pair (xs, ys) ¡ Insertion ¢ For any sequence xs::[a] and any value x::a, computer system can build, in a finite amount of time, the sequence (x: xs) ¡ Empty ¢ System can build, in a finite amount of time, the sequence [ ] CS2603 Applied Logic for Hardware and Software Rex Page – University of Oklahoma 5 Induction with a Twist ¡ Basic Principle of Induction ¢ Prove P(0) is true ¢ Prove P(n+1) is true, n ∈ N arbitrary 9 Proof of P(n+1) may assume P(n) is true ¢ Conclude ∀ n ∈ N . P(n) Pretty good deal, eh?...
View Full Document

This note was uploaded on 04/08/2008 for the course CS 2603 taught by Professor Rexpage during the Spring '08 term at The University of Oklahoma.

Page1 / 27

Lecture18StrongInduction - CS2603 Applied Logic for...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online