170 lines
7.6 KiB
TeX
170 lines
7.6 KiB
TeX
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.
|
|
|
|
Furthermore an extension has been implemented for the proof assistant Agda
|
|
(\cite{agda}, \cite{cubical-agda}) that allows us to work in such a ``cubical
|
|
setting''. This thesis will explore the usefulness of this extension in the
|
|
context of category theory.
|
|
%
|
|
\section{Motivating examples}
|
|
%
|
|
In the following two sections I present two examples that illustrate some
|
|
limitations inherent in ITT and -- by extension -- Agda.
|
|
%
|
|
\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}
|
|
%
|
|
$n + 0$ is \nomen{definitionally} equal to $n$ which we write as $n + 0 = n$.
|
|
This is also called \nomen{judgmental} equality. We call it definitional
|
|
equality because the \emph{equality} arises from the \emph{definition} of $+$
|
|
which is:
|
|
%
|
|
\newcommand{\suc}[1]{\mathit{suc}\ #1}
|
|
\begin{align*}
|
|
+ & : \bN \to \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
|
|
expression. We \emph{do}, however, have that they are \nomen{propositionally}
|
|
equal which we write as $n + 0 \equiv n$. 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$.
|
|
|
|
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
|
|
\nomen{pointwise equality}, where the \emph{points} of a function refers
|
|
to it's arguments.
|
|
|
|
In the context of category theory functional extensionality is e.g. needed to
|
|
show 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 goal.
|
|
%
|
|
\subsection{Equality of isomorphic types}
|
|
%
|
|
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.
|
|
|
|
More specifically; what we are interested in is a way of identifying
|
|
\nomen{equivalent} types. I will return to the definition of equivalence later,
|
|
but for now, it is sufficient to think of an equivalence as a one-to-one
|
|
correspondence. We write $A \simeq B$ to assert that $A$ and $B$ are equivalent
|
|
types. The principle of univalence says that:
|
|
%
|
|
$$\mathit{univalence} \tp (A \simeq B) \simeq (A \equiv B)$$
|
|
%
|
|
In particular this allows us to construct an equality from an equivalence
|
|
($\mathit{ua} \tp (A \simeq B) \to (A \equiv B)$) and vice-versa.
|
|
|
|
\section{Formalizing Category Theory}
|
|
%
|
|
The above examples serve to illustrate the limitation of Agda. One case where
|
|
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
|
|
functional extensionality is particularly useful for formulating Category
|
|
Theory. In Category theory it is also common to identify isomorphic structures
|
|
and this is exactly what we get from univalence. In fact we can formulate this
|
|
requirement within our formulation of categories by requiring the
|
|
\emph{categories} themselves to be univalent as we shall see.
|
|
|
|
\section{Context}
|
|
%
|
|
\begin{verbatim}
|
|
Inspiration:
|
|
* Awodey - formulation of categories
|
|
* HoTT - sketch of homotopy proofs
|
|
\end{verbatim}
|
|
The idea of formalizing Category Theory in proof assistants is not new. There
|
|
are a multitude of these available online. Just as first reference see this
|
|
question on Math Overflow: \cite{mo-formalizations}. Notably these
|
|
implementations of category theory in Agda:
|
|
\begin{itemize}
|
|
\item
|
|
\url{https://github.com/copumpkin/categories} -- setoid interpretation
|
|
\item
|
|
\url{https://github.com/pcapriotti/agda-categories} -- homotopic setting with postulates
|
|
\item
|
|
\url{https://github.com/pcapriotti/agda-categories} -- homotopic setting in coq
|
|
\item
|
|
\url{https://github.com/mortberg/cubicaltt} -- homotopic setting in \texttt{cubicaltt}
|
|
\end{itemize}
|
|
|
|
The 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-typed
|
|
term evaluates to a \emph{canonical} form. For example for a closed term $e :
|
|
\bN$ it will be the case that $e$ reduces to $n$ applications of $\mathit{suc}$
|
|
to $0$ for some $n$; $e = \mathit{suc}^n\ 0$. Without canonicity terms in the
|
|
language can get ``stuck'' -- meaning that they do not reduce to a canonical
|
|
form.
|
|
|
|
Another approach is to use the \emph{setoid interpretation} of type theory
|
|
(\cite{hofmann-1995,huber-2016}). With this approach one works with
|
|
\nomen{extensionals sets} $(X, \sim)$, that is a type $X \tp \MCU$ and an
|
|
equivalence relation $\sim$.
|
|
|
|
Types should additionally `carry around' an equivalence relation that serve as
|
|
propositional equality. This approach has other drawbacks; it does not satisfy
|
|
all judgemental equalites of type theory, is cumbersome to work with in practice
|
|
(\cite[p. 4]{huber-2016}) and makes equational proofs less reusable since
|
|
equational proofs $a \sim_{X} b$ are inherently `local' to the extensional set
|
|
$(X , \sim)$.
|
|
%
|
|
\section{The equality type}
|
|
The usual definition of equality in Agda is an inductive data-type with a single
|
|
constructor:
|
|
%
|
|
%% \VerbatimInput{../libs/main.tex}
|
|
% \def\verbatim@font{xits}
|
|
\begin{verbatim}
|
|
data _≡_ {a} {A : Set a} (x : A) : A → Set a where
|
|
instance refl : x ≡ x
|
|
\end{verbatim}
|
|
%
|
|
I shall refer to this as the (usual) inductive equality type.
|