[Paper Review] Cocon: Computation in Contextual Type Theory
Cocon introduces a Martin-Löf-style dependent type theory that unifies intensional higher-order abstract syntax (HOAS) with extensional computation via contextual modal types, enabling inductive reasoning over syntax and metaprogramming. Its key contribution is a Kripke-style model proving normalization, from which subject reduction and consistency follow, thus bridging logical frameworks and constructive type theory.
We describe a Martin-Löf style dependent type theory, called Cocon, that allows us to mix the intensional function space that is used to represent higher-order abstract syntax (HOAS) trees with the extensional function space that describes (recursive) computations. We mediate between HOAS representations and computations using contextual modal types. Our type theory also supports an infinite hierarchy of universes and hence supports type-level computation -- thereby providing metaprogramming and (small-scale) reflection. Our main contribution is the development of a Kripke-style model for Cocon that allows us to prove normalization. From the normalization proof, we derive subject reduction and consistency. Our work lays the foundation to incorporate the methodology of logical frameworks into systems such as Agda and bridges the longstanding gap between these two worlds.
Motivation & Objective
- To unify intensional HOAS representations with extensional computational functions in a single type theory.
- To enable inductive reasoning and recursion over HOAS syntax while preserving consistency.
- To support type-level computation and metaprogramming via an infinite hierarchy of universes.
- To provide a formal foundation for integrating LF-style encodings into Martin-Löf type theory.
- To close the longstanding gap between logical frameworks (like LF) and constructive type theories (like Agda/Coq).
Proposed method
- Introduces contextual modal types to mediate between intensional HOAS function spaces and extensional computational functions.
- Employs a Kripke-style model with worlds and accessibility relations to formalize semantic typing and equality.
- Defines a semantic equality relation based on world-indexed typing and substitution, ensuring well-behaved type equivalence.
- Uses a hierarchy of universes to support type-level computation and reflection, enabling metaprogramming.
- Establishes normalization via a logical relation that tracks term behavior across worlds and contexts.
- Proves subject reduction and type uniqueness through mutual induction on typing derivations.
Experimental results
Research questions
- RQ1How can intensional HOAS representations and extensional computational functions be coherently combined in a dependent type theory?
- RQ2Can a Kripke-style model be constructed to prove normalization in a system mixing HOAS and computation?
- RQ3How can type-level computation and metaprogramming be supported within a consistent dependent type system?
- RQ4What conditions ensure that HOAS encodings remain adequate and free of exotic terms?
- RQ5Can a logical framework like LF be integrated into Martin-Löf type theory without sacrificing consistency or decidability?
Key findings
- Cocon achieves normalization via a Kripke-style logical relation, ensuring all well-typed terms reduce to normal forms.
- Subject reduction is proven, guaranteeing that typing is preserved under reduction.
- Type uniqueness holds: if a term has two types, they are definitionally equal.
- Consistency is established by showing that no term can inhabit a type like x : u0 ⊢ t : x, avoiding paradoxes.
- The system supports an infinite hierarchy of universes, enabling type-level computation and reflection.
- Type constructor discrimination is proven, ensuring that neutral types like sorts, function types, and contextual objects are semantically distinct.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.