# 15-819 Computational Higher Type Theory

## Course Information

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

Room: | 4102 GHC |

Instructor: | Robert Harper |

## 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 Type Theory (CTT), 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 CTT, 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 NuPRL system is
based on a proof theory, called *refinement logic*, that supports interactive proof
development and extraction of programs from proofs.

We will then investigate a recent advance in computational type theory, called
*Cubical Computational Type Theory (CCTT)*, which enriches CTT 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 CTT, proof theories for CCTT are chosen according to convenience so as to support deriving true equations between types and their elements at all dimensions. The RedTT system is new proof interactive proof checker for CCTT. It uses a novel proof theory to support the convenient development of proofs/programs in computational cubical type theory.

## 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.
- Arnon Avron. Simple Consequence Relations .
- 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. Tarski's Theorem on Power Sets. Lecture note, January, 2019.
- 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.
- Martin Hofmann and Thomas Streicher, The Groupoid Interpretation of Type Theory, Twenty-five Years of Constructive Type Theory (Venice, 1995), Oxford Logic Guides vol 36, Oxford University Press, New York, 1998, pp. 83-111.
- Gérard Huet, Confluent Reductions: Abstract Properties and Applications to Term Rewriting Systems, Journal of the ACM, Vol. 27, No. 4, October 1980, pp. 797-821.
- 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.
- M. Okada and P. J. Scott. A Note on Rewriting Theory for Uniqueness of Iteration. Theory and Applications of Categories, vol. 6, no. 4, pp. 47-64, 1999.
- Søren Stenlund, Combinators, λ-Terms, and Proof Theory, D. Reidel, 1972.
- Univalent Mathematics Project. Homotopy Type Theory: Univalent Foundations of Mathematics, Institute for Advanced Study, 2013.

The notes from last year's instance are included as a convenient reference, but be warned that they are not perfectly synchronized in content or development as this year's instance.

- Collected Lecture notes by Ryan Kavanagh (2018).
- Week 1: Balzer and Gratzer
- Week 2: Balzer and Niu
- Week 3: Kavanagh and Coblenz
- Week 4: Niu and Yuan
- Week 5: Derakshan and Wang
- Week 6: Derakshan and Wang
- Week 7: Evan Cavallo
- Week 8: Yue Niu and Jonathan Laurent
- Week 10: Travis Hance and Paul Goelz
- week 11: Di Wang
- Week 12: Kavananagh, Sterling, Laurent
- Week 16: Goelz

## Requirements

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

No letter grades will be assigned for this class.

## Schedule

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

Jan | 15 | (No Class: PoPL) | ||

Jan | 17 | (No Class: PoPL) | ||

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

24 | Formal Type Theory and its Computational Interpretation | Stenlund | Tait's Method for Termination | |

29 | Semantic Type Theory | Martin-Löf CMCP | ||

31 | (Class Cancelled due to weather) | |||

Feb | 5 | Equality for Formal and Semantic Type Theory | Martin-Löf CMCP; Stenlund | |

7 | Decidability of Formal Equality | Stenlund; Angiuli STLC | ||

12 | Normalization | Angiuli STLC | ||

14 | Computational Interpretation of Girard's F | Girard's Method for Termination | ||

19 | Girard's F; Computational Dependent Types | Martin-Löf ITT, CMCP; Constable et al. NuPRL | ||

21 | Computational Dependent Types | Martin-Löf CMCP; Constable, et al NuPRL | ||

26 | Constructing a Type System | Martin-Löf CMCP; Constable, et al.: NuPRL | Proving Symmetry | |

28 | Constructing a Type System | Martin-Löf ITT; Constable et al.: NuPRL | ||

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

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

12 | (Spring Break) | |||

14 | (Spring Break) | |||

19 | Identity and Equality | HoTT Book | ||

21 | The Univalence Principle | Martin-Löf ITT; HoTT Book | ||

26 | Universes | Martin-Löf CMCP; Constable, et al. | ||

28 | Computational Cubical Type Theory | Angiuli, et al. Part III; Angiuli et al. PoPL | ||

Apr | 2 | Cubical Pre-Types | Angiuli, et al. Part III; Angiuli et al. PoPL | |

4 | Computational Kan Conditions | Angiuli, et al. Part III; Angiuli et al. PoPL | ||

9 | Kan Conditions for Simple Types | |||

11 | (No Classes) | |||

16 | Kan Conditions for Dependent Types | |||

18 | Path and Identity Types | |||

23 | Path Induction | |||

25 | Univalence | |||

30 | Univalence | |||

May | 2 | XTT Formalism |