|
|
||
|
|
Start of topic | Skip to actions
Today we wish to answer the question: How can a type system be used as a proof system?
In logic systems, we have a number of propositions and then connectives. For example A::= True | A->A | A \/ A | A /\ AThen, we define a number of rules where we can take formulas and derive more formulas |-A |-B -------- (And-Intro) |-A /\ B |-A /\ B --------- (And-Elim1) |-A |-A /\ B --------- (And-Elim2) |-B |-A --------- (Or-Intro1) |-A\/B |-B --------- (Or-Intro2) |-A\/B [A] ... |- B ---------- (Impl-Intro) |- A->B |- A->B |-A ----------- (Impl-Elim) |- B [A] ------------ (Assumption) Aand so on... For example, [A->(A->B)] (Assumption) [A] (Assumption) ---------- (Elimination) A->B ---------- (Elimination) B ---------- (Impl-Intro) A->BThere's a one to one correspondence between systems like this and lambda calculus. Our lambda terms are going to be textual representations of these proof trees. Our types will correspond to our set of primitives t::=() | t->t | t+t | t*tThis corresponds to true, implication, or, and and respectively. We also have expressions e::=lam x:t.e|e e|x|()|inl e|inr e|(case e of | inl x->e | inr x->e)| (e,e)|fst e|snd eThis gives us typing rules Gamma |- e:t1 -------------- Gamma|- inl e:t1+t2 Gamma |- e:t2 -------------- Gamma|- inl e:t1+t2 Gamma|-e:t1+t2 Gamma,x:t1|-e1:t3 Gamma,x:t2|-e2:t3 ---------------------------------------------------- Gamma|-(case e of |inl x-> e1 |inr x -> e2): t3etc... For example, A->(B->A/\B) Assump1: AIf we can prove (B->A/\B), then we can prove A->(B->A/\B). Thus, Assump2: BIf we can prove (A/\B), then we can prove (B->A/\B). But, we have (A/\B) by using the and-intro rule combined with our two assumptions. Then, the rest of the proof follows. Thus, 1. Assump1 A 2. Assump2 B 3. B from 2 by assumption 4. A from 1 by assumption 5. A/\B by and intro from 3 and 4 6. B->A/\B by impl-intro 7. A->(B->A/\B) by impl-introCurry-Howard correspondence allows us to represent these proof trees with lambda terms. Using our example, x:A,y:B|-x:A x:A,y:B|-y:B ---------------------------------- x:A,y:B|-(x,y):A*B ----------------------------------- x:A|-lam y:B.(x,y):B->(A*B) ----------------------------------- |-lam x:A.lam y:B.(x,y):A->B->(A*B)which is the exact same thing. Each type corresponds to a formula. The typing judgment corresponds to the proof derivation. The lambda terms essentially compress the proofs and give us a nice representation. Type checking our programs correspond to checking the proof. Normally, we could also prove A->(B->A/\B) using a truth table. But, we don't have this luxury in these constructive systems or intuitional logic.
Topic Actions: Edit | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r2 < r1 | More topic actions
Webs: Main | TWiki | Africa | EmbeddedSystems | Gpce | Houston | International | K12 | MetaOCaml | MulticoreOCR | ProgrammingLanguages | RAP | RIDL | Sandbox | SpeechClub | Teaching | Texbot | WG211 Web Actions: |
|
This work is licensed under a Creative Commons Attribution 2.5 License. Please follow our citation guidelines.