2017-11-26 13:59:05 +00:00
|
|
|
\documentclass{article}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
\usepackage[utf8]{inputenc}
|
|
|
|
|
|
|
|
\usepackage{natbib}
|
2017-12-02 00:34:33 +00:00
|
|
|
\usepackage[hidelinks]{hyperref}
|
2017-11-26 13:59:05 +00:00
|
|
|
|
|
|
|
\usepackage{graphicx}
|
|
|
|
|
|
|
|
\usepackage{parskip}
|
2017-12-02 00:34:33 +00:00
|
|
|
\usepackage{multicol}
|
|
|
|
\usepackage{amsmath,amssymb}
|
2018-01-30 12:00:09 +00:00
|
|
|
\usepackage[toc,page]{appendix}
|
2017-12-02 00:34:33 +00:00
|
|
|
% \setlength{\parskip}{10pt}
|
|
|
|
|
|
|
|
% \usepackage{tikz}
|
|
|
|
% \usetikzlibrary{arrows, decorations.markings}
|
|
|
|
|
|
|
|
% \usepackage{chngcntr}
|
|
|
|
% \counterwithout{figure}{section}
|
|
|
|
|
|
|
|
\usepackage{chalmerstitle}
|
|
|
|
\input{macros.tex}
|
|
|
|
|
|
|
|
\title{Category Theory and Cubical Type Theory}
|
|
|
|
\author{Frederik Hanghøj Iversen}
|
|
|
|
\authoremail{hanghj@student.chalmers.se}
|
|
|
|
\supervisor{Thierry Coquand}
|
|
|
|
\supervisoremail{coquand@chalmers.se}
|
|
|
|
\cosupervisor{Andrea Vezzosi}
|
|
|
|
\cosupervisoremail{vezzosi@chalmers.se}
|
|
|
|
\institution{Chalmers University of Technology}
|
2017-11-26 13:59:05 +00:00
|
|
|
|
|
|
|
\begin{document}
|
|
|
|
|
2017-12-02 00:34:33 +00:00
|
|
|
\maketitle
|
|
|
|
%
|
2017-11-26 13:59:05 +00:00
|
|
|
\section{Introduction}
|
2017-12-02 00:34:33 +00:00
|
|
|
%
|
|
|
|
Functional extensionality and univalence is not expressible in
|
|
|
|
\nomen{Intensional Martin Löf Type Theory} (ITT). This poses a severe limitation
|
|
|
|
on both 1) what is \emph{provable} and 2) the \emph{reusability} of proofs.
|
|
|
|
Recent developments have, however, resulted in \nomen{Cubical Type Theory} (CTT)
|
|
|
|
which permits a constructive proof of these two important notions.
|
|
|
|
|
2017-12-12 14:45:20 +00:00
|
|
|
Furthermore an extension has been implemented for the proof assistant Agda
|
|
|
|
(\cite{agda}) that allows us to work in such a ``cubical setting''. This project
|
|
|
|
will be concerned with exploring the usefulness of this extension. As a
|
|
|
|
case-study I will consider \nomen{category theory}. This will serve a dual
|
|
|
|
purpose: First off category theory is a field where the notion of functional
|
|
|
|
extensionality and univalence wil be particularly useful. Secondly, Category
|
|
|
|
Theory gives rise to a \nomen{model} for CTT.
|
2017-12-02 00:34:33 +00:00
|
|
|
|
|
|
|
The project will consist of two parts: The first part will be concerned with
|
|
|
|
formalizing concepts from category theory. The focus will be on formalizing
|
|
|
|
parts that will be useful in the second part of the project: Showing that
|
2017-12-12 14:45:20 +00:00
|
|
|
\nomen{Cubical Sets} give rise to a model of CTT.
|
2017-12-02 00:34:33 +00:00
|
|
|
%
|
2017-11-26 13:59:29 +00:00
|
|
|
\section{Problem}
|
2017-12-02 00:34:33 +00:00
|
|
|
%
|
|
|
|
In the following two subsections I present two examples that illustrate the
|
2018-01-15 15:20:14 +00:00
|
|
|
limitation inherent in ITT and by extension to the expressiveness of Agda.
|
2017-12-02 00:34:33 +00:00
|
|
|
%
|
|
|
|
\subsection{Functional extensionality}
|
|
|
|
Consider the functions:
|
|
|
|
%
|
|
|
|
\begin{multicols}{2}
|
|
|
|
$f \defeq (n : \bN) \mapsto (0 + n : \bN)$
|
|
|
|
|
|
|
|
$g \defeq (n : \bN) \mapsto (n + 0 : \bN)$
|
|
|
|
\end{multicols}
|
|
|
|
%
|
2018-01-15 15:20:14 +00:00
|
|
|
$n + 0$ is definitionally equal to $n$. We call this \nomen{definitional
|
2017-12-12 14:45:20 +00:00
|
|
|
equality} and write $n + 0 = n$ to assert this fact. We call it definitional
|
2017-12-02 00:34:33 +00:00
|
|
|
equality because the \emph{equality} arises from the \emph{definition} of $+$
|
|
|
|
which is:
|
|
|
|
%
|
|
|
|
\newcommand{\suc}[1]{\mathit{suc}\ #1}
|
|
|
|
\begin{align*}
|
|
|
|
+ & : \bN \to \bN \\
|
|
|
|
n + 0 & \defeq n \\
|
|
|
|
n + (\suc{m}) & \defeq \suc{(n + m)}
|
|
|
|
\end{align*}
|
|
|
|
%
|
|
|
|
Note that $0 + n$ is \emph{not} definitionally equal to $n$. $0 + n$ is in
|
|
|
|
normal form. I.e.; there is no rule for $+$ whose left-hand-side matches this
|
2017-12-12 14:45:20 +00:00
|
|
|
expression. We \emph{do}, however, have that they are \nomen{propositionally}
|
|
|
|
equal. We write $n + 0 \equiv n$ to assert this fact. Propositional equality
|
|
|
|
means that there is a proof that exhibits this relation. Since equality is a
|
|
|
|
transitive relation we have that $n + 0 \equiv 0 + n$.
|
2017-12-02 00:34:33 +00:00
|
|
|
|
|
|
|
Unfortunately we don't have $f \equiv g$.\footnote{Actually showing this is
|
|
|
|
outside the scope of this text. Essentially it would involve giving a model
|
|
|
|
for our type theory that validates all our axioms but where $f \equiv g$ is
|
|
|
|
not true.} There is no way to construct a proof asserting the obvious
|
|
|
|
equivalence of $f$ and $g$ -- even though we can prove them equal for all
|
|
|
|
points. This is exactly the notion of equality of functions that we are
|
|
|
|
interested in; that they are equal for all inputs. We call this
|
2018-01-15 15:20:14 +00:00
|
|
|
\nomen{pointwise equality}, where the \emph{points} of a function refers
|
2017-12-02 00:34:33 +00:00
|
|
|
to it's arguments.
|
2018-01-15 16:56:08 +00:00
|
|
|
|
|
|
|
In the context of category theory the principle of functional extensionality is
|
|
|
|
for instance useful in the context of showing that representable functors are
|
|
|
|
indeed functors. The representable functor for a category $\bC$ and a fixed
|
|
|
|
object in $A \in \bC$ is defined to be:
|
|
|
|
%
|
|
|
|
\begin{align*}
|
|
|
|
\fmap \defeq X \mapsto \Hom_{\bC}(A, X)
|
|
|
|
\end{align*}
|
|
|
|
%
|
|
|
|
The proof obligation that this satisfies the identity law of functors
|
|
|
|
($\fmap\ \idFun \equiv \idFun$) becomes:
|
|
|
|
%
|
|
|
|
\begin{align*}
|
|
|
|
\Hom(A, \idFun_{\bX}) = (g \mapsto \idFun \comp g) \equiv \idFun_{\Sets}
|
|
|
|
\end{align*}
|
|
|
|
%
|
|
|
|
One needs functional extensionality to ``go under'' the function arrow and apply
|
|
|
|
the (left) identity law of the underlying category to proove $\idFun \comp g
|
|
|
|
\equiv g$ and thus closing the above proof.
|
2017-12-02 00:34:33 +00:00
|
|
|
%
|
|
|
|
\iffalse
|
|
|
|
I also want to talk about:
|
|
|
|
\begin{itemize}
|
|
|
|
\item
|
|
|
|
Foundational systems
|
|
|
|
\item
|
|
|
|
Theory vs. metatheory
|
|
|
|
\item
|
|
|
|
Internal type theory
|
|
|
|
\end{itemize}
|
|
|
|
\fi
|
|
|
|
\subsection{Equality of isomorphic types}
|
|
|
|
%
|
2017-12-12 14:45:20 +00:00
|
|
|
Let $\top$ denote the unit type -- a type with a single constructor. In the
|
|
|
|
propositions-as-types interpretation of type theory $\top$ is the proposition
|
|
|
|
that is always true. The type $A \x \top$ and $A$ has an element for each $a :
|
|
|
|
A$. So in a sense they are the same. The second element of the pair does not add
|
|
|
|
any ``interesting information''. It can be useful to identify such types. In
|
|
|
|
fact, it is quite commonplace in mathematics. Say we look at a set $\{x \mid
|
|
|
|
\phi\ x \land \psi\ x\}$ and somehow conclude that $\psi\ x \equiv \top$ for all
|
|
|
|
$x$. A mathematician would immediately conclude $\{x \mid \phi\ x \land
|
|
|
|
\psi\ x\} \equiv \{x \mid \phi\ x\}$ without thinking twice. Unfortunately such
|
|
|
|
an identification can not be performed in ITT.
|
2017-12-02 00:34:33 +00:00
|
|
|
|
|
|
|
More specifically; what we are interested in is a way of identifying types that
|
|
|
|
are in a one-to-one correspondence. We say that such types are
|
|
|
|
\nomen{isomorphic} and write $A \cong B$ to assert this.
|
|
|
|
|
2017-12-12 14:45:20 +00:00
|
|
|
To prove two types isomorphic is to give an \nomen{isomorphism} between them.
|
|
|
|
That is, a function $f : A \to B$ with an inverse $f^{-1} : B \to A$, i.e.:
|
|
|
|
$f^{-1} \comp f \equiv id_A$. If such a function exist we say that $A$ and $B$
|
|
|
|
are isomorphic and write $A \cong B$.
|
2017-12-02 00:34:33 +00:00
|
|
|
|
2017-12-12 14:45:20 +00:00
|
|
|
Furthermore we want to \emph{identify} such isomorphic types. This, we get from
|
|
|
|
the principle of univalence:\footnote{It's often referred to as the univalence
|
|
|
|
axiom, but since it is not an axiom in this setting but rather a theorem I
|
|
|
|
refer to this just as a `principle'.}
|
2017-12-02 00:34:33 +00:00
|
|
|
%
|
|
|
|
$$(A \cong B) \cong (A \equiv B)$$
|
|
|
|
%
|
2017-12-12 14:45:20 +00:00
|
|
|
\subsection{Formalizing Category Theory}
|
2017-12-02 00:34:33 +00:00
|
|
|
%
|
2018-01-15 15:20:14 +00:00
|
|
|
The above examples serve to illustrate the limitation of Agda. One case where
|
2017-12-12 14:45:20 +00:00
|
|
|
these limitations are particularly prohibitive is in the study of Category
|
|
|
|
Theory. At a glance category theory can be described as ``the mathematical study
|
|
|
|
of (abstract) algebras of functions'' (\cite{awodey-2006}). So by that token
|
2017-12-02 00:34:33 +00:00
|
|
|
functional extensionality is particularly useful for formulating Category
|
2017-12-12 14:45:20 +00:00
|
|
|
Theory. In Category theory it is also common to identify isomorphic structures
|
|
|
|
and this is exactly what we get from univalence.
|
2017-12-02 00:34:33 +00:00
|
|
|
|
2017-12-12 14:45:20 +00:00
|
|
|
\subsection{Cubical model for Cubical Type Theory}
|
2017-12-02 00:34:33 +00:00
|
|
|
%
|
2017-12-12 14:45:20 +00:00
|
|
|
A model is a way of giving meaning to a formal system in a \emph{meta-theory}. A
|
|
|
|
typical example of a model is that of sets as models for predicate logic. Thus
|
|
|
|
set-theory becomes the meta-theory of the formal language of predicate logic.
|
|
|
|
|
|
|
|
In the context of a given type theory and restricting ourselves to
|
2018-01-15 15:20:14 +00:00
|
|
|
\emph{categorical} models a model will consist of mapping `things' from the
|
2017-12-12 14:45:20 +00:00
|
|
|
type-theory (types, terms, contexts, context morphisms) to `things' in the
|
|
|
|
meta-theory (objects, morphisms) in such a way that the axioms of the
|
|
|
|
type-theory (typing-rules) are validated in the meta-theory. In
|
|
|
|
\cite{dybjer-1995} the author describes a way of constructing such models for
|
|
|
|
dependent type theory called \emph{Categories with Families} (CwFs).
|
|
|
|
|
2018-01-15 15:20:14 +00:00
|
|
|
In \cite{bezem-2014} the authors devise a CwF for Cubical Type Theory. This
|
2017-12-12 14:45:20 +00:00
|
|
|
project will study and formalize this model. Note that I will \emph{not} aim to
|
|
|
|
formalize CTT itself and therefore also not give the formal translation between
|
2018-01-15 15:20:14 +00:00
|
|
|
the type theory and the meta-theory. Instead the translation will be accounted
|
2017-12-12 14:45:20 +00:00
|
|
|
for informally.
|
2018-01-15 16:56:08 +00:00
|
|
|
|
|
|
|
The project will formalize CwF's. It will also define what pieces of data are
|
|
|
|
needed for a model of CTT (without explicitly showing that it does in fact model
|
|
|
|
CTT). It will then show that a CwF gives rise to such a model. Furthermore I
|
|
|
|
will show that cubical sets are presheaf categories and that any presheaf
|
|
|
|
category is itself a CwF. This is the precise way by which the project aims to
|
|
|
|
provide a model of CTT. Note that this formalization specifcally does not
|
|
|
|
mention the language of CTT itself. Only be referencing this previous work do we
|
|
|
|
arrive at a model of CTT.
|
2017-12-02 00:34:33 +00:00
|
|
|
%
|
2017-11-26 13:59:05 +00:00
|
|
|
\section{Context}
|
2017-12-02 00:34:33 +00:00
|
|
|
%
|
2017-12-12 14:45:20 +00:00
|
|
|
In \cite{bezem-2014} a categorical model for cubical type theory is presented.
|
|
|
|
In \cite{cohen-2016} a type-theory where univalence is expressible is presented.
|
|
|
|
The categorical model in the previous reference serve as a model of this type
|
|
|
|
theory. So these two ideas are closely related. Cubical type theory arose out of
|
|
|
|
\nomen{Homotopy Type Theory} (\cite{hott-2013}) and is also of interest as a
|
|
|
|
foundation of mathematics (\cite{voevodsky-2011}).
|
2017-12-02 00:34:33 +00:00
|
|
|
|
|
|
|
An implementation of cubical type theory can be found as an extension to Agda.
|
|
|
|
This is due to \citeauthor{cubical-agda}. This, of course, will be central to
|
2017-12-12 14:45:20 +00:00
|
|
|
this thesis.
|
|
|
|
|
|
|
|
The idea of formalizing Category Theory in proof assistants is not a new
|
|
|
|
idea\footnote{There are a multitude of these available online. Just as first
|
2018-01-08 21:16:11 +00:00
|
|
|
reference see this question on Math Overflow: \cite{mo-formalizations}}. The
|
2017-12-12 14:45:20 +00:00
|
|
|
contribution of this thesis is to explore how working in a cubical setting will
|
|
|
|
make it possible to prove more things and to reuse proofs.
|
|
|
|
|
|
|
|
There are alternative approaches to working in a cubical setting where one can
|
|
|
|
still have univalence and functional extensionality. One option is to postulate
|
|
|
|
these as axioms. This approach, however, has other shortcomings, e.g.; you lose
|
|
|
|
\nomen{canonicity} (\cite{huber-2016}). Canonicity means that any well-type
|
|
|
|
term will (under evaluation) reduce to a \emph{canonical} form. For example for
|
|
|
|
an integer $e : \bN$ it will be the case that $e$ is definitionally equal to $n$
|
2018-01-15 15:20:14 +00:00
|
|
|
applications of $\mathit{suc}$ to $0$ for some $n$; $e = \mathit{suc}^n\ 0$.
|
2017-12-12 14:45:20 +00:00
|
|
|
Without canonicity terms in the language can get ``stuck'' when they are
|
|
|
|
evaluated.
|
|
|
|
|
|
|
|
Another approach is to use the \emph{setoid interpretation} of type theory
|
|
|
|
(\cite{hofmann-1995,huber-2016}). Types should additionally `carry around' an
|
|
|
|
equivalence relation that should serve as propositional equality. This approach
|
|
|
|
has other drawbacks; it does not satisfy all judgemental equalites of type
|
|
|
|
theory and is cumbersome to work with in practice (\cite[p. 4]{huber-2016}).
|
2017-12-02 00:34:33 +00:00
|
|
|
%
|
2017-11-26 13:59:05 +00:00
|
|
|
\section{Goals and Challenges}
|
2017-12-02 00:34:33 +00:00
|
|
|
%
|
|
|
|
In summary, the aim of the project is to:
|
|
|
|
%
|
|
|
|
\begin{itemize}
|
|
|
|
\item
|
|
|
|
Formalize Category Theory in Cubical Agda
|
|
|
|
\item
|
|
|
|
Formalize Cubical Sets in Agda
|
|
|
|
% \item
|
|
|
|
% Formalize Cubical Type Theory in Agda
|
|
|
|
\item
|
|
|
|
Show that Cubical Sets are a model for Cubical Type Theory
|
|
|
|
\end{itemize}
|
|
|
|
%
|
|
|
|
The formalization of category theory will focus on extracting the elements from
|
|
|
|
Category Theory that we need in the latter part of the project. In doing so I'll
|
|
|
|
be gaining experience with working with Cubical Agda. Equality proofs using
|
|
|
|
cubical Agda can be tricky, so working with that will be a challenge in itself.
|
2017-12-12 14:45:20 +00:00
|
|
|
Most of the proofs in the context of cubical models I will formalize are based
|
|
|
|
on previous work. Those proofs, however, are not formalized in a proof
|
|
|
|
assistant.
|
|
|
|
|
|
|
|
One particular challenge in this context is that in a cubical setting there can
|
|
|
|
be multiple distinct terms that inhabit a given equality proof.\footnote{This is
|
2018-01-15 16:56:08 +00:00
|
|
|
in contrast with ITT where one \emph{can} have \nomen{Uniqueness of identity proofs}
|
2017-12-12 14:45:20 +00:00
|
|
|
(\cite[p. 4]{huber-2016}).} This means that the choice for a given equality
|
|
|
|
proof can influence later proofs that refer back to said proof. This is new and
|
|
|
|
relatively unexplored territory.
|
|
|
|
|
|
|
|
Another challenge is that Category Theory is something that I only know the
|
|
|
|
basics of. So learning the necessary concepts from Category Theory will also be
|
|
|
|
a goal and a challenge in itself.
|
2017-12-02 00:34:33 +00:00
|
|
|
|
|
|
|
After this has been implemented it would also be possible to formalize Cubical
|
2018-01-15 16:56:08 +00:00
|
|
|
Type Theory and formally show that Cubical Sets are a model of this. I do not
|
|
|
|
intend to formally implement the language of dependent type theory in this
|
|
|
|
project.
|
2017-12-02 00:34:33 +00:00
|
|
|
|
2017-12-12 14:45:20 +00:00
|
|
|
The thesis shall conclude with a discussion about the benefits of Cubical Agda.
|
2017-12-02 00:34:33 +00:00
|
|
|
%
|
|
|
|
\bibliographystyle{plainnat}
|
2017-12-12 14:45:20 +00:00
|
|
|
\nocite{cubical-demo}
|
|
|
|
\nocite{coquand-2013}
|
|
|
|
\bibliography{refs}
|
2018-01-30 12:00:09 +00:00
|
|
|
\begin{appendices}
|
|
|
|
\input{planning.tex}
|
|
|
|
\end{appendices}
|
2017-11-26 13:59:05 +00:00
|
|
|
\end{document}
|