References Propositions as Types [1] Chapter 6 of: Basic Simple Type Theory , J. Roger Hindley, Cambridge, 1997. The Curry-Howard Correspondence [2] “The formulae-as-types notion of construction,” Howard, William A. (1980) in [4], 479–490. (Original paper manuscript from 1969.) http://www.cs.cmu.edu/~crary/819-f09/Howard80.pdf Jim Royer [3] “From λ -calculus to cartesian closed categories,” J. Lambek (1980) in [4] Types Seminar 375–402. (See http://www.math.uchicago.edu/~may/VIGRE/VIGRE2010/ REUPapers/Berger.pdf .) January 28, 2014 [4] To H.B. Curry: Essays on Combinatory Logic, Lambda Calculus and Formalism , Seldin, Jonathan P. and Hindley, J. Roger (Editors), Academic Press, 1980 Jim Royer (Types Seminar) Propositions as Types January 28, 2014 1 / 15 Jim Royer (Types Seminar) Propositions as Types January 28, 2014 2 / 15 Intuitionistic implicational logic Sample proof This is also called minimal logic . Proof of ( a → a → c ) → a → c: Formulæ: F :: = X | F 1 → F 2 Each ( → I) application [ a → a → c ] [ a ] (0012) ( → E) (0011) Rules: discharges some, all, or none a → c [ a ] (001) (002) ( → E) of the occurrences of σ c (00) → E: σ → τ σ ( → I) a @ 0012,002 above τ and a → c (0) ( → I) has a discharge label that lists a → a → c @ 0011 τ ( a → a → c ) → a → c ( ǫ ) the locations/addresses of each of these occurrences. [ σ ] . ( d 1 d 2 · · · d k ) = position in the proof . . Discharged occurrences of σ at ϕ @ d 1 d 2 · · · d k = discharge label τ leaves must be marked by “[ · ]”. → I: σ → τ Jim Royer (Types Seminar) Propositions as Types January 28, 2014 3 / 15 Jim Royer (Types Seminar) Propositions as Types January 28, 2014 4 / 15
Two proofs of ( a → a → c ) → a → a → c The Curry-Howard lambda to logic translation Suppose: ∆ is a TA λ deduction of Γ �→ M : τ . Then: the corresponding logic deduction ∆ L is defined thusly. [ a → a → c ] [ a ] (00012) ( → E) (00011) a → c [ a ] (0001) (0002) ( → E) Case (i): Suppose: M ≡ x and ∆ is x : τ �→ x : τ . Then: ∆ L is just τ . c (000) ( → I) a @ 00012 a → c (00) ( → I) a @ 0002 Case (iii): Suppose: M ≡ λ x . P , Case (ii): Suppose: M ≡ PQ , a → a → c (0) τ = ρ → σ , Γ = Γ ′ − x , and the last step ( → I) a → a → c @ 00011 Γ = Γ 1 ∪ Γ 2 , and the last step of ∆ is: ( a → a → c ) → a → a → c ( ǫ ) of ∆ is: ( ∆ 1 ) ( ∆ 2 ) ( ∆ ′ ) Γ 1 �→ P : σ → τ Γ 2 �→ Q : σ Γ ′ �→ P : σ [ a → a → c ] [ a ] (00012) ( → E) (00011) Γ 1 ∪ Γ 2 �→ ( PQ ) : τ Γ − x �→ λ x . P : ρ → σ a → c [ a ] (0001) (0002) ( → E) c (000) Then: ∆ L is the result of applying ( → I) ⇐ Then: ∆ L is the result of applying ( → I) a @ 00012,0002 a → c (00) ( → E) to ∆ 1 L and ∆ 2 L . to ∆ ′ ( → I) L and discharging all occurrences of a vacuously ⇐ a → a → c (0) ρ in ∆ ′ L with positions corresponding to ( → I) a → a → c @ 00011 ( a → a → c ) → a → a → c ( ǫ ) the free occurrences of x in P . Jim Royer (Types Seminar) Propositions as Types January 28, 2014 5 / 15 Jim Royer (Types Seminar) Propositions as Types January 28, 2014 6 / 15 The lambda-to-logic lemma The lambda-to-logic translation is not one-one ∆ 3 : Lemma (6B2) x : a → a → c �→ x : a → a → c y : a �→ y : a ( → E) Suppose x 1 , . . . , x n are distinct and ∆ is a TA λ -deduction of x : a → a → c , y : a �→ xy : a → c z : a �→ z : a ( → E) x : a → a → c , y : a , z : a �→ xyz : c x 1 : ρ 1 , . . . , x n : ρ n �→ M : τ . ∆ 4 : Then ∆ L is a natural deduction in minimal logic and yields x : a → a → c �→ x : a → a → c y : a �→ y : a ( → E) x : a → a → c , y : a �→ xy : a → c y : a �→ y : a ( → E) ρ 1 , . . . , ρ n ⊢ τ . x : a → a → c , y : a �→ xyy : c Proof. a → a → c a ( → E) An induction on the structure of M . ( ∆ 3 ) L = ( ∆ 4 ) L = a → c a ( → E) c Jim Royer (Types Seminar) Propositions as Types January 28, 2014 7 / 15 Jim Royer (Types Seminar) Propositions as Types January 28, 2014 8 / 15
A logic to lambda translation, 1 A logic to lambda translation, 2 Case (iii): The last step of ∆ is a ( → I) where Γ , v 1 : ρ , . . . , v k : ρ �→ P : σ is the conclusion of ∆ ′ and where Suppose ∆ is a natural deduction in minimal logic. of the form: From ∆ , we construction TA λ -deduction ∆ λ as follows. v 1 , . . . , v k are distinct and [ ρ ] . / ∈ Subjects ( Γ ) , Case (i): ∆ ≡ τ . . . a deduction ∆ ′ Then: Pick some term-variable x and let ∆ λ be x : τ �→ x : τ . v i occurs free in P at the same σ disc. k ≥ 0 occur. of ρ position as the i -th occur. of ρ in ρ → σ ∆ (and this is the only Case (ii): The last step of ∆ is a ( → E) applied to ∆ ′ and ∆ ′′ . Suppose occurrence in P ). λ has conclusion Γ ′ �→ M : σ → τ , ∆ ′ λ has conclusion Γ ′′ �→ N : σ , and ∆ ′′ Subcase k > 0 : Pick a fresh variable x and let � λ = [ x / v 1 , . . . , x / v k ] ∆ ′ and ∆ ′ P ∗ = [ x / v 1 , . . . , x / v k ] P . So, the conclusion of � λ is Γ , x : ρ �→ P ∗ : σ . � ∆ ′ ∆ ′′ λ is the result of replacing all of the variables (free and bound) in λ and � Let ∆ λ be the result of applying ( → I) main to � ∆ ′′ λ with fresh ones (so that ∆ ′ ∆ ′ λ to deduce Γ �→ ( λ x . P ∗ ) : ρ → σ . ∆ ′′ λ have no variables in common). λ and � Subcase k = 0 : The conclusion of ∆ ′ λ must be Γ �→ P : σ . Pick a fresh x not in ∆ ′ Then: let ∆ λ is the result of applying ( → E) to ∆ ′ ∆ ′′ λ . λ . Let ∆ λ be the result of applying ( → I) vac to ∆ ′ λ to deduce Γ �→ ( λ x . P ) : ρ → σ . Jim Royer (Types Seminar) Propositions as Types January 28, 2014 9 / 15 Jim Royer (Types Seminar) Propositions as Types January 28, 2014 10 / 15 ∆ vs. ( ∆ L ) λ The logic to lambda lemma Lemma (6B5) Lemma (6B6) Suppose Suppose ∆ is a TA λ -deduction of Γ �→ P : τ . σ 1 , . . . , σ n ⊢ τ is the conclusion of a logic deduction ∆ , and Then ( ∆ L ) λ is a TA λ -deduction of Γ ′ �→ M : τ where for each i = 1, . . . , n, σ i ,1 , . . . , σ i , m i are exactly the undischarged M has no bound-variable clashes, occurrences of σ i in ∆ . FV ( M ) = { x 1 , . . . , x n } and each x i occurs exactly once in M, Then, ∆ λ is well-defined and is a TA λ -deduction with conclusion of the form: for v 1 , . . . , v n (not necessarily distinct): . . . x n ,1 : σ n , . . . , x n , m n : σ n �→ M : τ x 1,1 : σ 1 , . . . , x 1, m 1 : σ 1 , . . . P ≡ α [ v 1 / x 1 ] . . . [ v n / x n ] M , where each x i , j occurs exactly once in M (at the same position as σ i , j in ∆ ) and ∆ ≡ α [ v 1 / x 1 ] . . . [ v n / x n ]( ∆ L ) λ M has no bound variable clashes. Also: ( ∆ λ ) L ≡ ∆ . In particular, if Γ = ∅ , then Γ ′ = ∅ and P ≡ α M. Proof. An induction on the structure of ∆ . Jim Royer (Types Seminar) Propositions as Types January 28, 2014 11 / 15 Jim Royer (Types Seminar) Propositions as Types January 28, 2014 12 / 15
The Curry-Howard theorem Proof of Curry-Howard continued Theorem (6B7) Theorem (6B7: (ii: only if)) Proof continued. where N is a closed λ -term (with (i) The provable formulæ of minimal logic are exactly the types of the closed λ -terms. Suppose σ 1 , . . . , σ n ⊢ τ holds in minimal logic. no bound variable clashes). Then there are M and x 1 , . . . , x n (distinct) ∋ (ii) The relation σ 1 , . . . , σ n ⊢ τ holds in minimal logic iff there are M and x 1 , . . . , x n x 1 : σ 1 , . . . , x n : σ n ⊢ λ M : τ . (distinct) such that By the Subject Construction x 1 : σ 1 , . . . , x n : σ n ⊢ λ M : τ Proof. Theorem (Theorem 2B2, skipped Let ∆ be a minimal logic deduction last time) (iii) The ∆ -to- ∆ L mapping is a one-to-one correspondence between TA λ -proofs and yielding σ 1 , . . . , σ n ⊢ τ . natural deduction proofs in minimal logic, and the ∆ -to- ∆ λ is its inverse N = λ x 1 . . . x n . M Apply ( → I) n -times to ∆ to obtain a proof (modulo ≡ α ). That is, for all TA λ -proofs ∆ , ∆ ∗ of σ 1 → . . . σ n → τ . where the x i ’s are distinct and Then by Lemma 6B5, the conclusion of ( ∆ L ) λ ≡ ( ∆ ∗ ) λ must contain the formula ∆ ( N.B. ∆ has no open assumptions.) ( ∆ ∗ ) λ is: (modulo ≡ α in subjects in ( ∆ L ) λ ), and for all minimal logic proofs ∆ , x i : σ 1 , . . . , x n : σ n ⊢ λ M : τ . �→ N : σ 1 → . . . σ n → τ ( ∆ λ ) L ≡ ∆ . Since N has no no bound variable clashes, neither does M . QED Proof: (i) by Lemma 6B2, (iii) by Lemma 6B6, & (ii: if) by Lemma 6B2. Jim Royer (Types Seminar) Propositions as Types January 28, 2014 13 / 15 Jim Royer (Types Seminar) Propositions as Types January 28, 2014 14 / 15 What next? http://en.wikipedia.org/wiki/Curry-Howard_correspondence Jim Royer (Types Seminar) Propositions as Types January 28, 2014 15 / 15
Recommend
More recommend