# 15-819 Computational Higher Type Theory

## Course Information

Time: | Tue-Thu 10:30-11:50 |

Room: | 4303 GHC |

Instructor: | Robert Harper |

Slack: | Slack |

## Synopsis

Computational type theory has its origins in Martin-Löf's Constructive Mathematics and Computer Programming. That paper provided the foundation for the NuPRL type theory and implementation, which has been under continual development at Cornell since the early 1980's. Unlike formal type theory, computational type theory begins with the notion of program, and defines types as specifications of program behavior. This leads to a very rich type theory that encompasses the usual logically-motivated types and extends it with many concepts motivated directly by computation. With types being defined semantically, the role of proof theory is entirely pragmatic, supporting implementation, rather than definitional or conceptual.

The subject of this course is Computational Dependent Type Theory (CDTT), a theory of
constructive mathematics based on computation. We will begin by developing the origins of
computational type theory, and its relation to formal type theory. The semantic method used
to define CDTT, called a *meaning explanation*, is related to the main method used to
analyze formal type theories, the theory of *logical relations*. But, rather than
being a metamathematical device, the relational interpretation of types defines the semantics
of types. An important technical distinction, however, is in the semantics of variables. In
computational type theory variables behave as they do in informal mathematics, ranging over
the values of a type, whereas in formal type theory variables behave more like indeterminates
in algebra. The emphasis in computational type theory is on execution of closed programs,
whereas the emphasis in formal type theory is on calculation with open terms. Moreover, the
concept of judgmental equality differs markedly in the two settings.

We will build up a full treatment of dependent type theory in the computational setting. The computational approach starts with a programming language given by a deterministic transition system and the notion of a value, or canonical form. The meaning explanation defines types as programs whose values index, or name, specifications of program behavior. The elements of a type are those programs that behave according to the specification given by its type. Philosophically, the meaning explanation is meant to be self-standing, meaningful on its own terms and not in need of further explanation or justification. Mathematically, it can be helpful to examine these principles by a rigorous construction, along the lines considered by Allen and Crary.

Computational type theory is implemented by a proof theory that is sound according to the
meaning explanations to be convenient to use. Proof theory is viewed as a means to access the
truth; it *describes*, rather than *defines*, the subject matter. A practical
proof theory need not (and does not) correspond to any extant system of formal logic, nor need
it satisfy any meta-theoretic properties other than being sound for the semantics. But it
does need to be practical! For example, the RedPRL system is
based on a proof theory, called *refinement logic*, that supports interactive proof
development and extraction of programs from proofs. It is inspired by the NuPRL system, which has been under development at Cornell for the
last thirty years.

We will then investigate a recent advance in computational type theory, called
*Computational Cubical Dependent Type Theory (CCDTT)*, which enriches CDTT with
*identifications*, or *paths*, of all finite dimensions. The ordinary elements
of a type are called its *points*, and are of dimension *0*. Its elements at
dimension *n+1* are paths that connect two elements of dimension *n*, and serve
as a witness of the interchangeability of those elements in all contexts. From a programming
viewpoint, the higher-dimensional structure provides a general theory of (symmetric) coercions
between types. From a mathematical viewpoint, it makes connections to algebraic topology and
higher category theory. In either case a central concept is Voevodsky's univalence axiom,
which asserts that equivalent (loosely speaking, isomorphic) types are identified
(interchangeable).

There are many ways to organize the higher structure of types. We will use a
*cubical* structure in which types and terms are stratified into dimensions, with
dimension zero corresponding to conventional computational type theory, and with the objects
at dimension *n+1* being *n+1*-dimensional cubes, which may be considered as
lines between *n*-cubes in *n* different ways, corresponding to the pairs of
opposing faces in each dimension. Thus, a 1-cube is a line connecting two points, a 2-cube is
a square connecting two lines by connecting their end points, a 3-cube is, well, a cube
connecting three pairs of squares in three ways, and so on through all dimensions. In the
computational setting a cube is a program whose evaluation sensitive to the bindings of
dimension variables that, when specialized to 0 or 1, induce the computation of the end points
of a line parameterized by that variable. A cube may also execute in response to the
substitution of one variable for another, forming the diagonal of a square.

The higher-dimensional structure applies to types as well as their members. At dimension
zero there is no room for variation, so that types and members are as in ordinary
computational type theory. At higher dimension a line of types classifies a line of elements
in such a way that the end points of the element line inhabit the corresponding end points of
the type line. Moreover, a line of types induces a coercion between its end points that, in
general, computes in a non-trivial way to express the computational meaning of that line. For
a line of terms to inhabit a line of types, coercion along the type line must take the left
end point of the element line from the left end point of the type line to the right end point
of the type line, wherein they are identified. (And, conversely, the right end point must be
coerced to the left end of the type wherein it is identified with the left end point.)
Well-typed computations are required to be *coherent* in that the order of
specialization of dimensions does not matter---the upper point of the left edge of a square
must coincide with the left point of its upper edge. Finally, there must be enough lines to
ensure that, for example, two lines with the same intermediate end point may be concatenated
to form another line, and there must be higher-dimensional lines witnessing the associativity
of concatenation. The general condition is called the *Kan condition*, which amounts
to demanding that a class of equational constraint satisfaction problems have
solutions---which, in the computational setting, means to require that the solutions be
computable from the problem specification in a uniform manner.

Just as in ordinary CDTT, proof theories for CCDTT are chosen according to convenience so as to support deriving true equations between types and their elements at all dimensions. The RedPRL system implements CCDTT using a higher-dimensional form of refinement logic that specifies the extraction of programs from proofs and provides a means of executing them. Thus, the propositions-as-types correspondence extends to the higher-dimensional case.

## References

- Stuart Allen, A Non-Type Theoretic Definition of Martin-Löf's Types. April, 1987.
- Carlo Angiuli. Contractibility + Transport ⟺ J, December, 2014.
- Carlo Angiuli. How to prove that STLC is normalizing. Unpublished manuscript, May, 2015.
- Carlo Angiuli and Robert Harper and Todd Wilson. Computational Higher Dimensional Type Theory. POPL, Paris, January 2017.
- Carlo Angiuli, Robert Harper, and Todd Wilson. Computational Higher Type Theory I: Abstract Cubical Realizability. April, 2016.
- Carlo Angiuli and Robert Harper. Computational Higher Type Theory II: Dependent Cubical Realizability. April, 2017 (revised).
- Carlo Angiuli, Kuen-Bang Hou (Favonia), and Robert Harper. Computational Higher Type Theory III: Univalence and Universes. December, 2017.
- Carlo Angiuli and Robert Harper, Meaning Explanations at Higher Dimension. Idagationes Mathematicae vol. 29 issue 1, February, 2018.
- Carlo Angiuli and Kuen-Bang Hou (Favonia) and Robert Harper. Cartesian Cubical Computational Type Theory: A Constructive Formulation of Two-Level Type Theory. January 2018.
- Bruno Bentzen. A Cubical Approach to Informal Type Theory. Unpublished manuscript, March, 2017.
- Marc Bezem, Thierry Coquand, and Simon Huber. A Model of Type Theory in Cubical Sets. 19th International Conference on Types for Proofs and Programs (TYPES 2013), 2014.
- Evan Cavallo and Robert Harper. Computational Higher Type Theory IV: Inductive Types. February, 2018.
- Cyril Cohen, Thierry Coquand, Simon Huber, and Anders Mörtberg. Cubical Type Theory: A Constructive Interpretation of the Univalence Axiom. 21st International Conference on Types for Proofs and Programs (TYPES 2015), 2018.
- Peter Dybjer. Program testing and the meaning explanations of intuitionistic type theory. In Peter volume 27 of Logic, Epistemology, and the Unity of Science, pages 215–241. Springer, 2012.
- Robert L. Constable. The NuPRL Project.
- Robert L. Constable,
*et al.*. Implementing Mathematics with the Nuprl Proof Development System, Prentice-Hall, 2012. - Martín Hötzel Escardó. A self-contained, brief and complete formulation of Voevodsky's Univalence Axiom. March 7, 2018.
- Jean-Yves Girard, Proofs and Types. Cambridge University Press, 1989. (Available online as linked.)
- Daniel R. Grayson. An Introduction to Univalent Foundations for Mathematicians, Bulletin of the American Mathematical Society, March, 2018.
- Robert Harper and Carlo Angiuli. Computational (Higher) Type Theory. ACM POPL Tutorial Session, January 2018.
- J. Van Heijenoort, From Frege to Gödel: A Source Book in Mathematical Logic, 1879-1931, Harvard University Press, 1967.
- Martin Hofmann, Syntax and Semantics of Dependent Types, Unpublished manuscript, ca 1995.
- Dan Licata, Yet another proof that univalence implies function extensionality.
- Per Martin-Löf, The collected works of Martin-Löf.
- Per Martin-Löf, Truth of a Proposition, Evidence of a Judgment, Validity of a Proof.
- Per Martin-Löf, Analytic and Synthetic Judgments in Type Theory.
- Per Martin-Löf, Constructive Mathematics and Computer Programming. Proc. of the Sixth International Congress on Logic, Methodology, and Philosophy of Science VI, 1979.
- Per Martin-Löf.
*Intuitionistic Type Theory.*Notes by Giovanni Sambin. Bibliopolis,1984. Online edition - Bengt Nordström, Kent Petersson, and Jan Smith. Programming in Martin-Löf's Type Theory, Oxford University Press, 1990.
- Søren Stenlund, Combinators, λ-Terms, and Proof Theory, D. Reidel, 1972.
- Jon M. Sterling. Type theory and its meaning explanations.
- Dimitrios Tsementzis. A Meaning Explanation for HoTT, draft manuscript, March, 2018.
- Univalent Mathematics Project. Homotopy Type Theory: Univalent Foundations of Mathematics, Institute for Advanced Study, 2013.

## Requirements

The class is open to any PhD student, and to undergraduate or other graduate students with permission of the instructor.

All students are required to participate by preparing typeset lecture notes.

No letter grades will be assigned for this class. It should not be taken to fulfill a course requirement or for degree credit.

## Schedule

Date | Topic | Reading | Notes | |
---|---|---|---|---|

Jan | 16 | Computational and Formal Type Theory | Constable, et al. NuPRL; Martin-Löf ITT, CMCP | Balzer and Gratzer |

18 | Semantic Interpretation of Function Types | Angiuli STLC; Martin-Löf CMCP; Stenlund | ||

23 | Formal Interpretation of Function Types | Angiuli STLC; Martin-Löf CMCP; Stenlund | Balzer and Niu | |

25 | Kripke Logical Relations | Martin-Löf CMCP; Stenlund | ||

30 | Interpretations of Positive Types | Martin-Löf CMCP; Stenlund | Kavanagh and Coblenz | |

Feb | 1 | Interpretations of Positive Types | Martin-Löf CMCP; Stenlund | |

6 | Computational Interpretation of Polymorphism | Girard PandT | Niu and Yuan | |

8 | Structural and Behavioral Equality | Martin-Löf ITT, CMCP, Truth, Analytic; Constable, et al NuPRL | ||

13 | (Class cancelled) | |||

15 | Structural and Behavioral Equality | Martin-Löf ITT, CMCP, Truth, Analytic; Constable, et al NuPRL | Derakshan and Wang | |

20 | Propositions-as-Types | Van Heijenoort; Sterling Meaning Explanations | Derakshan and Wang | |

22 | Formal Dependent Type Theory | Martin-Löf ITT; Hofmann SSDT | ||

27 | Identity Type in Formal Type Theory | Martin-Löf ITT; HoTT Book | Evan Cavallo | |

Mar | 1 | Computational Dependent Type Theory | Martin-Löf CMCP; Sterling Meaning; Constable, et al. | |

6 | Computational Dependent Type Theory | Martin-Löf CMCP; Constable, et al. | Yue Niu and Jonathan Laurent | |

8 | Mathematical Semantics of CDTT | Martin-Löf CMCP; Constable, et al.; Allen | ||

13 | (Spring Break) | |||

15 | (Spring Break) | |||

20 | Mathemetical Semantics of CDTT | Martin-Löf CMCP; Sterling Meaning; Constable, et al. | Travis Hance and Paul Goelz | |

22 | Homotopy Type Theory: Enriching ITT | HoTT Book; Grayson; Tsementzis | ||

27 | Homotopy Type Theory: Univalence | HoTT Book; Escardo; Angiuli J; Licata FunExt | Di Wang | |

29 | Homotopy Type Theory: Higher Inductive Types | HoTT Book | ||

Apr | 3 | Computational Cubical Dependent Type Theory (CCDTT) | AHW PoPL; AH Meaning; AFH III | Kavananagh, Sterling, Laurent |

5 | Meanings of Judgments | AH Meaning; AFH III | ||

10 | Cartesian Cubical Type Theory | AH Meaning; AFH III | ||

12 | Cubical Pre-Types | AFH III | ||

17 | Kan Conditions: Coercion | AFH III | ||

19 | (No Class) | |||

24 | Kan Conditions: Coercion | AFH III | ||

26 | Kan Conditions: Composition | AFH III | ||

May | 1 | Universes and Univalence | AFH III | Goelz |

3 | Higher Inductive Types | CH IV |