------------------------------- Week 1, cos 441, fall 2008 ------------------------------- -- Continue examples not covered from Lecture 1 -- Go over exercise 1 Rule Induction -------------- -- the given inference rules are an *exhaustive* source of information about the valid judgments. -- no judgment is valid unless you can derive a proof for it using some finite number of the given inference rules -- this leads to a proof principal (Rule Induction): * to show every derivable judgment has some property P, show for every rule in the deductive system: J1 ... Jn --------- name J if J1 ... Jn have property P then J has property P -- examples: 1. Given a property P, we know that P is true for all natural numbers, if we can prove: * P holds unconditionally for Z. Corresponds to rule: ----------- Z |- Z nat * Assuming P holds for n then P holds for (S n). Corresponds to rule: |- n nat ------------- S |- S n nat -- also called "induction on the structure of natural numbers" or more generally "structural induction" when the objects are numbers, but other things like trees or programming language expressions. Theorem: If |- even2 n then |- even n. Proof: By induction on the derivation |- even2 n. case: ---------- even2Z |- even2 Z |- even Z (by evenZ) case: |- even2 n ----------------- even2S |- even2 (S (S n)) |- even n (by IH) |- odd (S n) (by oddS) |- even (S (S n)) (by evenS) QED Theorem: If |- n nat then either |- even n or |- odd n. Proof: By induction on the derivation of |- n nat. (Or "by induction on the structure of naturals n") Case: -------- |- Z nat |- even Z (by rule evenZ) case: |- n nat ------------- |- S n nat (1) |- even n or (2) |- odd n (by IH) Assuming (1): |- odd S n (by (1) and oddS) Assuming (2): |- even S n (by (2) and evenS) QED Theorem: For all n1, n2, there exists n3 such that |- add n1 n2 n3. Proof: By induction on the structure of n1. case: -------- |- Z nat |- add Z n2 n2 (by addZ) case: |- n nat ------------- succ |- S n nat |- add n n2 n3' (by IH) |- add (S n) n2 (S n3') (by addS) QED