----------------- Deductive Systems ----------------- -- a deductive system has 2 parts: 1. definition of judgment form or collection of judgment forms * judgment = assertion, fact that may or may not be true * a valid or true judgment 2. collection of rules * axioms * inference rules J1 ... Jn --------- name J -- rules include some number of premises above the line and a conclusion below the line. We often put a name beside the rule to allow us to refer to it easily. -- rules often contain "metavariables" -- stand for classes of objects and may be instantiated by any object in the class. -- a judgment is valid if: 1. it is the conclusion of an axiom 2. it is the conclusion of a rule where all premises are valid judgements -- a derivation is a proof a judgement is valid. Hence a derivation is 1. either an axiom, or 2. a rule plus derivations for all of the premises of the rule. -- examples: 1. |- N nat "N is a natural number" |- N : nat ----------- Z --------------- S |- Z : nat |- S N : nat Note: N is a "meta-variable". There are many instances of rule S. A derivation proving that S (S (S Z)) is a natural number: --------- Z |- Z nat ------------------ S |- S Z nat ------------------ S |- S (S Z) nat ------------------ S |- S (S (S Z)) nat 2. |- add N1 N2 = N3 "N1 plus N2 equals N3" |- add N1 N2 = N3 ------------------- addZ --------------------------- addS |- add Z N = N |- add (S N1) N2 = S N3 3. |- even N "N is an even number" |- odd N "N is an odd number" ---------- evenZ |- even Z |- odd N |- even N ------------- evenS ------------- oddS |- even (S N) |- odd (S N) Alternative definition: ---------- even2Z |- even2 Z |- even2 N ----------------- even2S |- even2 (S (S N)) ---------- odd2Z |- odd2 (S Z) |- odd2 N ----------------- odd2S |- odd2 (S (S N)) ----------------- 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: For all natural numbers N, one of the following judgements is derivable |- 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. ie: add is a total relation. 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 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