Lecture 4: Simply typed λ-calculus as CCC

Teacher: Paul-André Melliès

Reminders

An adjoint pair is a pair of functors

ALRB

equipped with a family of bijections:

ϕa,b:B(La,b)A(a,Rb)

natural in a and b.

This operation defines functors:

B(L,):Aop×BSetA(,R):A×BopSet

NB: in Homotopy Type Theory, we don’t currently know how to deal with these opposite categories.

Naturality here amounts to every commutative square

LAgLhABhBLAfB

being turned into a commutative square:

AϕA,B(g)hARBRhBAϕA,B(f)RB

Mac Lane’s Parameter theorem

In a cartesian category, we already know that the cartesian product defines a bifunctor.

Similarly, in a CCC: (Mac Lane’s Parameter theorem) the family of cartesian exponentiations

(A)A𝒞:𝒞𝒞

defines a unique bifunctor:

A,BAB:𝒞op×𝒞𝒞

such that the bijections ϕA,B,C are natural in A,B,C.

Every CCC is enriched over itself

In a cartesian closed category, the functor Hom functors as:

𝒞op×𝒞𝒞𝒞(1,)Set

NB: the terminal object 1 exists, as 𝒞 is cartesian (in the category of types, 1 is the empty context: closed terms: 1tA)

NB: the converse is not true: a category may be enriched over itself but not cartesian closed.

Example: Topological spaces: not cartesian closed. But a sub-category thereof is:

the category of compactly generated topological spaces (in which every set is closed iff its intersection with every compact is closed) and continuous functios is a CCC.

Simply typed λ-calculus as CCC

Inference rules/typing judgement:

Logical rules

x:Ax:A(variable)Γ,x:AP:BΓλx.P:AB(abstraction)ΓP:ABΔQ:AΓ,ΔPQ:B(abstraction)

Structural rules

ΓP:BΓ,x:AP:B(weakening)Γ,x:A,y:AP:BΓ,z:AP[xz,yz]:B(contraction)Γ,x:A,y:B,ΔP:CΓ,y:B,x:A,ΔP:C(exchange)
x1:A1,,xk:AkP:B

will be interpreted as

A1××AkPB

For every type variable α, we’re given an object ξ(α)

Interpretation of a type A: A

Then, by structural induction, we define for every type.

Every sequent x1:A1,,xk:AkP:B is translated into A1×AkB

by induction on the derivation tree:

  • Variable: AidAA

  • Lambda/Curryfication: A×ΓfB becomes, by adjunction: ΓϕA,Γ,B(f)AB

  • Application: ΓfA and ΔgAB

    Γ×Δf×gA×(AB)evalA,BB
  • Contraction Γ×A×AfB becomes Γ×AΓ×δAΓ×A×AfB

  • Weakening Γ×Aπ1ΓfB

    which is isomorphic to

    Γ×AΓ×wkΓ×1ΓfB
  • Exchange: analogous

Soundness theorem

In every CCC 𝒞, the interpretation is an invariant modulo β,η.

If Γ(λx.M):AB and ΔN:A:

Γ,Δ(λx.M)N:B=Γ,ΔM[x:=N]:B

If ΓM:AB:

Γ,Δ(λx.Mx):AB=ΓM:AB

Proof: Similar to the one of subject reduction (preservation of type by β-reduction and η-expansion): by induction on the typing judgment.

Linear Logic: an intermediate notion

Leave a comment