References Propositions as Types [1] Chapter 6 of: Basic Simple Type - - PowerPoint PPT Presentation

references propositions as types
SMART_READER_LITE
LIVE PREVIEW

References Propositions as Types [1] Chapter 6 of: Basic Simple Type - - PowerPoint PPT Presentation

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], 479490.


slide-1
SLIDE 1

Propositions as Types

The Curry-Howard Correspondence Jim Royer

Types Seminar

January 28, 2014

Jim Royer (Types Seminar) Propositions as Types January 28, 2014 1 / 15

References

[1] Chapter 6 of: Basic Simple Type Theory, J. Roger Hindley, Cambridge, 1997. [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 [3] “From λ-calculus to cartesian closed categories,” J. Lambek (1980) in [4] 375–402. (See http://www.math.uchicago.edu/~may/VIGRE/VIGRE2010/ REUPapers/Berger.pdf.) [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 2 / 15

Intuitionistic implicational logic

This is also called minimal logic. Formulæ: F ::= X | F1 → F2 Rules: →E: σ → τ σ τ →I: [σ] . . . τ σ → τ

Each (→I) application discharges some, all, or none

  • f the occurrences of σ

above τ and has a discharge label that lists the locations/addresses of each of these occurrences. Discharged occurrences of σ at leaves must be marked by “[ ·]”.

Jim Royer (Types Seminar) Propositions as Types January 28, 2014 3 / 15

Sample proof

Proof of (a → a → c) → a → c: [a → a → c]

(0011)

[a]

(0012) (→E)

a → c

(001)

[a]

(002) (→E)

c

(00)

(→I)

a @ 0012,002

a → c

(0)

(→I)

a → a → c @ 0011

(a → a → c) → a → c

(ǫ)

(d1d2 · · · dk) = position in the proof ϕ @ d1d2 · · · dk = discharge label

Jim Royer (Types Seminar) Propositions as Types January 28, 2014 4 / 15

slide-2
SLIDE 2

Two proofs of (a → a → c) → a → a → c

[a → a → c]

(00011)

[a]

(00012) (→E)

a → c

(0001)

[a]

(0002) (→E)

c

(000)

(→I)

a @ 00012

a → c

(00)

(→I)

a @ 0002

a → a → c

(0)

(→I)

a → a → c @ 00011

(a → a → c) → a → a → c

(ǫ)

[a → a → c]

(00011)

[a]

(00012) (→E)

a → c

(0001)

[a]

(0002) (→E)

c

(000)

(→I)

a @ 00012,0002 ⇐

a → c

(00)

(→I)

a vacuously ⇐

a → a → c

(0)

(→I)

a → a → c @ 00011

(a → a → c) → a → a → c

(ǫ)

Jim Royer (Types Seminar) Propositions as Types January 28, 2014 5 / 15

The Curry-Howard lambda to logic translation

Suppose: ∆ is a TAλ deduction of Γ → M : τ. Then: the corresponding logic deduction ∆L is defined thusly. Case (i): Suppose: M ≡ x and ∆ is x : τ → x : τ. Then: ∆L is just τ. Case (ii): Suppose: M ≡ PQ, Γ = Γ1 ∪ Γ2, and the last step of ∆ is: (∆1) Γ1 → P : σ → τ (∆2) Γ2 → Q : σ Γ1 ∪ Γ2 → (PQ) : τ Then: ∆L is the result of applying (→E) to ∆1L and ∆2L. Case (iii): Suppose: M ≡ λx.P, τ = ρ → σ, Γ = Γ′ − x, and the last step

  • f ∆ is:

(∆′) Γ′ → P : σ Γ − x → λx.P : ρ → σ Then: ∆L is the result of applying (→I) to ∆′

L and discharging all occurrences of

ρ in ∆′

L with positions corresponding to

the free occurrences of x in P.

Jim Royer (Types Seminar) Propositions as Types January 28, 2014 6 / 15

The lambda-to-logic lemma

Lemma (6B2) Suppose x1, . . . , xn are distinct and ∆ is a TAλ-deduction of x1 : ρ1, . . . , xn : ρn → M : τ. Then ∆L is a natural deduction in minimal logic and yields ρ1, . . . , ρn ⊢ τ. Proof. An induction on the structure of M.

Jim Royer (Types Seminar) Propositions as Types January 28, 2014 7 / 15

The lambda-to-logic translation is not one-one

∆3: x : a → a → c → x : a → a → c y : a → y : a (→E) x : a → a → c, y : a → xy : a → c z : a → z : a (→E) x : a → a → c, y : a, z : a → xyz : c ∆4: 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) x : a → a → c, y : a → xyy : c (∆3)L = (∆4)L = a → a → c a (→E) a → c a (→E) c

Jim Royer (Types Seminar) Propositions as Types January 28, 2014 8 / 15

slide-3
SLIDE 3

A logic to lambda translation, 1

Suppose ∆ is a natural deduction in minimal logic. From ∆, we construction TAλ-deduction ∆λ as follows. Case (i): ∆ ≡ τ. Then: Pick some term-variable x and let ∆λ be x : τ → x : τ. Case (ii): The last step of ∆ is a (→E) applied to ∆′ and ∆′′. Suppose ∆′

λ has conclusion Γ′ → M : σ → τ,

∆′′

λ has conclusion Γ′′ → N : σ, and

  • ∆′′λ is the result of replacing all of the variables (free and bound) in

∆′′

λ with fresh ones (so that ∆′ λ and

∆′′λ have no variables in common). Then: let ∆λ is the result of applying (→E) to ∆′

λ and

∆′′λ.

Jim Royer (Types Seminar) Propositions as Types January 28, 2014 9 / 15

A logic to lambda translation, 2

Case (iii): The last step of ∆ is a (→I)

  • f the form:

[ρ] . . . σ      ρ → σ a deduction ∆′

  • disc. k ≥ 0 occur. of ρ

where Γ, v1 : ρ, . . . , vk : ρ → P : σ is the conclusion of ∆′ and where v1, . . . , vk are distinct and / ∈ Subjects(Γ), vi occurs free in P at the same position as the i-th occur. of ρ in ∆ (and this is the only

  • ccurrence in P).

Subcase k > 0: Pick a fresh variable x and let ∆′

λ = [x/v1, . . . , x/vk]∆′ and

P∗ = [x/v1, . . . , x/vk]P. So, the conclusion of ∆′

λ is Γ, x : ρ → P∗ : σ.

Let ∆λ be the result of applying (→I)main to ∆′

λ to deduce Γ → (λx.P∗) : ρ → σ.

Subcase k = 0: The conclusion of ∆′

λ must be Γ → P : σ. Pick a fresh x not in ∆′ λ.

Let ∆λ be the result of applying (→I)vac to ∆′

λ to deduce Γ → (λx.P) : ρ → σ.

Jim Royer (Types Seminar) Propositions as Types January 28, 2014 10 / 15

The logic to lambda lemma

Lemma (6B5) Suppose σ1, . . . , σn ⊢ τ is the conclusion of a logic deduction ∆, and for each i = 1, . . . , n, σi,1, . . . , σi,mi are exactly the undischarged

  • ccurrences of σi in ∆.

Then, ∆λ is well-defined and is a TAλ-deduction with conclusion of the form: x1,1 : σ1, . . . , x1,m1 : σ1, . . . . . . xn,1 : σn, . . . , xn,mn : σn → M : τ where each xi,j occurs exactly once in M (at the same position as σi,j in ∆) and M has no bound variable clashes. Also: (∆λ)L ≡ ∆. Proof. An induction on the structure of ∆.

Jim Royer (Types Seminar) Propositions as Types January 28, 2014 11 / 15

∆ vs. (∆L)λ

Lemma (6B6) Suppose ∆ is a TAλ-deduction of Γ → P : τ. Then (∆L)λ is a TAλ-deduction of Γ′ → M : τ where M has no bound-variable clashes, FV(M) = { x1, . . . , xn } and each xi occurs exactly once in M, for v1, . . . , vn (not necessarily distinct): P ≡α [v1/x1] . . . [vn/xn]M, ∆ ≡α [v1/x1] . . . [vn/xn](∆L)λ In particular, if Γ = ∅, then Γ′ = ∅ and P ≡α M.

Jim Royer (Types Seminar) Propositions as Types January 28, 2014 12 / 15

slide-4
SLIDE 4

The Curry-Howard theorem

Theorem (6B7) (i) The provable formulæ of minimal logic are exactly the types of the closed λ-terms. (ii) The relation σ1, . . . , σn ⊢ τ holds in minimal logic iff there are M and x1, . . . , xn (distinct) such that x1 : σ1, . . . , xn : σn ⊢λ M : τ (iii) The ∆-to-∆L mapping is a one-to-one correspondence between TAλ-proofs and natural deduction proofs in minimal logic, and the ∆-to-∆λ is its inverse (modulo ≡α). That is, for all TAλ-proofs ∆, (∆L)λ ≡

(N.B. ∆ has no open assumptions.)

∆ (modulo ≡α in subjects in (∆L)λ), and for all minimal logic proofs ∆, (∆λ)L ≡ ∆. 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

Proof of Curry-Howard continued

Theorem (6B7: (ii: only if)) Suppose σ1, . . . , σn ⊢ τ holds in minimal logic. Then there are M and x1, . . . , xn (distinct) ∋ x1 : σ1, . . . , xn : σn ⊢λ M : τ. Proof. Let ∆ be a minimal logic deduction yielding σ1, . . . , σn ⊢ τ. Apply (→I) n-times to ∆ to obtain a proof ∆∗ of σ1 → . . . σn → τ. Then by Lemma 6B5, the conclusion of (∆∗)λ is: → N : σ1 → . . . σn → τ Proof continued. where N is a closed λ-term (with no bound variable clashes). By the Subject Construction Theorem (Theorem 2B2, skipped last time) N = λx1 . . . xn.M where the xi’s are distinct and (∆∗)λ must contain the formula xi : σ1, . . . , xn : σn ⊢λ M : τ. Since N has no no bound variable clashes, neither does M. QED

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