Final touch-up on report and acknowledgments

This commit is contained in:
Frederik Hanghøj Iversen 2018-05-29 15:09:38 +02:00
parent b992d5a7f2
commit 37a675a84f
5 changed files with 715 additions and 676 deletions

1
doc/acknowledgement.tex Normal file
View File

@ -0,0 +1 @@
\chapter*{Acknowledgements}

View File

@ -1,53 +1,53 @@
\chapter{Conclusion} \chapter{Conclusion}
This thesis highlighted some issues with the standard inductive This thesis highlighted some issues with the standard inductive
definition of propositional equality used in Agda. Functional definition of propositional equality used in Agda. Functional
extensionality and univalence are examples of two propositions not extensionality and univalence are examples of two propositions not
admissible in Intensional Type Theory (ITT). This has a big impact on admissible in Intensional Type Theory (ITT). This has a big impact on
what is provable and the reusability of proofs. This issue is overcome what is provable and the reusability of proofs. This issue is
with an extension to Agda's type system called Cubical Agda. With overcome with an extension to Agda's type system called Cubical Agda.
Cubical Agda both functional extensionality and univalence are With Cubical Agda both functional extensionality and univalence are
admissible. Cubical Agda is more expressive, but there are certain admissible. Cubical Agda is more expressive, but there are certain
issues that arise that are not present in standard Agda. For one thing issues that arise that are not present in standard Agda. For one
Agda enjoys Uniqueness of Identity Proofs (UIP) though a flag exists thing Agda enjoys Uniqueness of Identity Proofs (UIP) though a flag
to turn this off, which is the case in Cubical Agda. In stead exists to turn this off. This feature is not present in Cubical Agda.
there exists a hierarchy of types with increasing \nomen{homotopical Rather than having unique identity proofs cubical Agda gives rise to a
hierarchy of types with increasing \nomen{homotopical
structure}{homotopy levels}. It turns out to be useful to built the structure}{homotopy levels}. It turns out to be useful to built the
formalization with this hierarchy in mind as it can simplify proofs formalization with this hierarchy in mind as it can simplify proofs
considerably. Another issue one must overcome in Cubical Agda is when considerably. Another issue one must overcome in Cubical Agda is when
a type has a field whose type depends on a previous field. In this a type has a field whose type depends on a previous field. In this
case paths between such types will be heterogeneous paths. This case paths between such types will be heterogeneous paths. In
problem is related to Cubical Agda not having the K-rule. In practice practice it turns out to be considerably more difficult to work with
it turns out to be considerably more difficult to work heterogeneous heterogeneous paths than with homogeneous paths. The thesis
paths than with homogeneous paths. The thesis demonstrated some demonstrated the application of some techniques to overcome these
techniques to overcome these difficulties, such as based difficulties, such as based path induction.
path-induction.
This thesis formalized some of the core concepts from category theory This thesis formalizes some of the core concepts from category theory
including; categories, functors, products, exponentials, Cartesian including; categories, functors, products, exponentials, Cartesian
closed categories, natural transformations, the yoneda embedding, closed categories, natural transformations, the yoneda embedding,
monads and more. Category theory is an interesting case-study for the monads and more. Category theory is an interesting case study for the
application of Cubical Agda for two reasons in particular: Because application of cubical Agda for two reasons in particular: Because
category theory is the study of abstract algebra of functions, meaning category theory is the study of abstract algebra of functions, meaning
that functional extensionality is particularly relevant. Another that functional extensionality is particularly relevant. Another
reason is that in category theory it is commonplace to identify reason is that in category theory it is commonplace to identify
isomorphic structures and univalence allows for making this notion isomorphic structures. Univalence allows for making this notion
precise. This thesis also demonstrated another technique that is precise. This thesis also demonstrated another technique that is
common in category theory; namely to define categories to prove common in category theory; namely to define categories to prove
properties of other structures. Specifically a category was defined properties of other structures. Specifically a category was defined
to demonstrate that any two product objects in a category are to demonstrate that any two product objects in a category are
isomorphic. Furthermore the thesis showed two formulations of monads isomorphic. Furthermore the thesis showed two formulations of monads
and proved that they indeed are equivalent: Namely monads in the and proved that they indeed are equivalent: Namely monads in the
monoidal- and Kleisli- form. The monoidal formulation is more typical monoidal- and Kleisli- form. The monoidal formulation is more typical
to category theoretic formulations and the Kleisli formulation will be to category theoretic formulations and the Kleisli formulation will be
more familiar to functional programmers. It would have been very more familiar to functional programmers. It would have been very
difficult to make a similar proof with setoids. In the formulation we difficult to make a similar proof with setoids and the proof would be
also saw how paths can be used to extract functions. A path between very difficult to read. In the formulation we also saw how paths can
two types induce an isomorphism between the two types. This be used to extract functions. A path between two types induce an
e.g. permits developers to write a monad instance for a given type isomorphism between the two types. This e.g.\ permits developers to
using the Kleisli formulation. By transporting along the path between write a monad instance for a given type using the Kleisli formulation.
the monoidal- and Kleisli- formulation one can reuse all the By transporting along the path between the monoidal- and Kleisli-
operations and results shown for monoidal- monads in the context of formulation one can reuse all the operations and results shown for
kleisli monads. monoidal- monads in the context of kleisli monads.
%% %%
%% problem with inductive type %% problem with inductive type
%% overcome with cubical %% overcome with cubical

View File

@ -1,113 +1,113 @@
\chapter{Perspectives} \chapter{Perspectives}
\section{Discussion} \section{Discussion}
In the previous chapter the practical aspects of proving things in In the previous chapter the practical aspects of proving things in
Cubical Agda were highlighted. I also demonstrated the usefulness of Cubical Agda were highlighted. I also demonstrated the usefulness of
separating ``laws'' from ``data''. One of the reasons for this is that separating ``laws'' from ``data''. One of the reasons for this is that
dependencies within types can lead to very complicated goals. One dependencies within types can lead to very complicated goals. One
technique for alleviating this was to prove that certain types are technique for alleviating this was to prove that certain types are
mere propositions. mere propositions.
\subsection{Computational properties} \subsection{Computational properties}
The new contribution of cubical Agda is that it has a constructive The new contribution of cubical Agda is that it has a constructive
proof of functional extensionality\index{functional extensionality} proof of functional extensionality\index{functional extensionality}
and univalence\index{univalence}. This means that in particular that and univalence\index{univalence}. This means that in particular that
the type checker can reduce terms defined with these theorems. So one the type checker can reduce terms defined with these theorems. So one
interesting result of this development is how much this influenced the interesting result of this development is how much this influenced the
development. In particular having a functional extensionality that development. In particular having a functional extensionality that
``computes'' should simplify some proofs. ``computes'' should simplify some proofs.
I have tested this theory by using a feature of Agda where one can I have tested this by using a feature of Agda where one can mark
mark certain bindings as being \emph{abstract}. This means that the certain bindings as being \emph{abstract}. This means that the
type-checker will not try to reduce that term further when type-checker will not try to reduce that term further during type
type-checking is performed. I tried making univalence and functional checking. I tried making univalence and functional extensionality
extensionality abstract. It turns out that the conversion behaviour of abstract. It turns out that the conversion behaviour of univalence is
univalence is not used anywhere. For functional extensionality there not used anywhere. For functional extensionality there are two places
are two places in the whole solution where the reduction behaviour is in the whole solution where the reduction behaviour is used to
used to simplify some proofs. This is in showing that the maps between simplify some proofs. This is in showing that the maps between the
the two formulations of monads are inverses. See the notes in this two formulations of monads are inverses. See the notes in this
module: module:
% %
\begin{center} \begin{center}
\sourcelink{Cat.Category.Monad.Voevodsky} \sourcelink{Cat.Category.Monad.Voevodsky}
\end{center} \end{center}
% %
I've also put this in a source listing in \ref{app:abstract-funext}. I
will not reproduce it in full here as the type is quite involved. The
method used to find in what places the computational behaviour of
these proofs are needed has the caveat of only working for places that
directly or transitively uses these two proofs. Fortunately though the
code is structured in such a way that this should be the case.
Nonetheless it is quite surprising that this computational behaviours
is not used more widely in the formalization.
Barring this, however, the computational behaviour of paths can still I will not reproduce it in full here as the type is quite involved. In
be useful. E.g. if a programmer want's to reuse functions that operate stead I have put this in a source listing in \ref{app:abstract-funext}.
on a monoidal monads to work with a monad in the Kleisli form that The method used to find in what places the computational behaviour of
this programmer has specified. To make this idea concrete, say we are these proofs are needed has the caveat of only working for places that
directly or transitively uses these two proofs. Fortunately though
the code is structured in such a way that this is the case. So in
conclusion the way I have structured these proofs means that the
computational behaviour of functional extensionality and univalence
has not been so relevant.
Barring this the computational behaviour of paths can still be useful.
E.g.\ if a programmer wants to reuse functions that operate on a
monoidal monads to work with a monad in the Kleisli form that the
programmer has specified. To make this idea concrete, say we are
given some function $f \tp \Kleisli \to T$ having a path between $p given some function $f \tp \Kleisli \to T$ having a path between $p
\tp \Monoidal \equiv \Kleisli$ induces a map $\coe\ p \tp \Monoidal \tp \Monoidal \equiv \Kleisli$ induces a map $\coe\ p \tp \Monoidal
\to \Kleisli$. We can compose $f$ with this map to get $f \comp \to \Kleisli$. We can compose $f$ with this map to get $f \comp
\coe\ p \tp \Monoidal \to T$. Of course, since that map was \coe\ p \tp \Monoidal \to T$. Of course, since that map was
constructed with an isomorphism these maps already exist and could be constructed with an isomorphism these maps already exist and could be
used directly. So this is arguably only interesting when one wants to used directly. So this is arguably only interesting when one also
prove properties of such functions. wants to prove properties of applying such functions.
\subsection{Reusability of proofs} \subsection{Reusability of proofs}
The previous example illustrate how univalence unifies two otherwise The previous example illustrate how univalence unifies two otherwise
disparate areas: The category-theoretic study of monads; and monads as disparate areas: The category-theoretic study of monads; and monads as
in functional programming. Univalence thus allows one to reuse proofs. in functional programming. Univalence thus allows one to reuse proofs.
You could say that univalence gives the developer two proofs for the You could say that univalence gives the developer two proofs for the
price of one. As an illustration of this I proved that monads are price of one. As an illustration of this I proved that monads are
groupoids. I initially proved this for the Kleisli groupoids. I initially proved this for the Kleisli
formulation\footnote{Actually doing this directly turned out to be formulation\footnote{Actually doing this directly turned out to be
tricky as well, so I defined an equivalent formulation which was not tricky as well, so I defined an equivalent formulation which was not
formulated with a record, but purely with $\sum$-types.}. Since the formulated with a record, but purely with $\sum$-types.}. Since the
two formulations are equal under univalence, substitution directly two formulations are equal under univalence, substitution directly
gives us that this also holds for the monoidal formulation. This of gives us that this also holds for the monoidal formulation. This of
course generalizes to any family $P \tp 𝒰𝒰$ where $P$ is inhabited course generalizes to any family $P \tp 𝒰𝒰$ where $P$ is inhabited
at either formulation (i.e.\ either $P\ \Monoidal$ or $P\ \Kleisli$ at either formulation (i.e.\ either $P\ \Monoidal$ or $P\ \Kleisli$
holds). holds).
The introduction (section \S\ref{sec:context}) mentioned an often The introduction (section \S\ref{sec:context}) mentioned that a
employed-technique for enabling extensional equalities is to use the typical way of getting access to functional extensionality is to work
setoid-interpretation. Nowhere in this formalization has this been with setoids. Nowhere in this formalization has this been necessary,
necessary, $\Path$ has been used globally in the project as $\Path$ has been used globally in the project for propositional
propositional equality. One interesting place where this becomes equality. One interesting place where this becomes apparent is in
apparent is in interfacing with the Agda standard library. Multiple interfacing with the Agda standard library. Multiple definitions in
definitions in the Agda standard library have been designed with the the Agda standard library have been designed with the
setoid-interpretation in mind. E.g. the notion of ``unique setoid-interpretation in mind. E.g.\ the notion of \emph{unique
existential'' is indexed by a relation that should play the role of existential} is indexed by a relation that should play the role of
propositional equality. Likewise for equivalence relations, they are propositional equality. Equivalence relations are likewise indexed,
indexed, not only by the actual equivalence relation, but also by not only by the actual equivalence relation but also by another
another relation that serve as propositional equality. relation that serve as propositional equality.
%% Unfortunately we cannot use the definition of equivalences found in %% Unfortunately we cannot use the definition of equivalences found in
%% the standard library to do equational reasoning directly. The %% the standard library to do equational reasoning directly. The
%% reason for this is that the equivalence relation defined there must %% reason for this is that the equivalence relation defined there must
%% be a homogenous relation, but paths are heterogeneous relations. %% be a homogenous relation, but paths are heterogeneous relations.
In the formalization at present a significant amount of energy has In the formalization at present a significant amount of energy has
been put towards proving things that would not have been needed in been put towards proving things that would not have been needed in
classical Agda. The proofs that some given type is a proposition were classical Agda. The proofs that some given type is a proposition were
provided as a strategy to simplify some otherwise very complicated provided as a strategy to simplify some otherwise very complicated
proofs (e.g. \ref{eq:proof-prop-IsPreCategory} proofs (e.g.\ \ref{eq:proof-prop-IsPreCategory}
and \ref{eq:productPath}). Often these proofs would not be this and \ref{eq:productPath}). Often these proofs would not be this
complicated. If the J-rule holds definitionally the proof-assistant complicated. If the J-rule holds definitionally the proof-assistant
can help simplify these goals considerably. The lack of the J-rule has can help simplify these goals considerably. The lack of the J-rule has
a significant impact on the complexity of these kinds of proofs. a significant impact on the complexity of these kinds of proofs.
\TODO{Universe levels.}
\subsection{Motifs} \subsection{Motifs}
An oft-used technique in this development is using based path An oft-used technique in this development is using based path
induction to prove certain properties. One particular challenge that induction to prove certain properties. One particular challenge that
arises when doing so is that Agda is not able to automatically infer arises when doing so is that Agda is not able to automatically infer
the family that one wants to do induction over. For instance in the the family that one wants to do induction over. For instance in the
proof $\var{sym}\ (\var{sym}\ p) ≡ p$ from \ref{eq:sym-invol} the proof $\var{sym}\ (\var{sym}\ p) ≡ p$ from \ref{eq:sym-invol} the
family that we chose to do induction over was $D\ b'\ p' \defeq family that we chose to do induction over was $D\ b'\ p' \defeq
\var{sym}\ (\var{sym}\ p') ≡ p'$. However, if one interactively tries \var{sym}\ (\var{sym}\ p') ≡ p'$. However, if one interactively tries
to give this hole, all the information that Agda can provide is that to give this hole, all the information that Agda can provide is that
one must provide an element of $𝒰$. Agda could be more helpful in this one must provide an element of $𝒰$. Agda could be more helpful in this
context, perhaps even infer this family in some situations. In this context, perhaps even infer this family in some situations. In this
very simple example this is of course not a big problem, but there are very simple example this is of course not a big problem, but there are
examples in the source code where this gets more involved. examples in the source code where this gets more involved.
@ -115,26 +115,25 @@ examples in the source code where this gets more involved.
\subsection{Compiling Cubical Agda} \subsection{Compiling Cubical Agda}
\label{sec:compiling-cubical-agda} \label{sec:compiling-cubical-agda}
Compilation of program written in Cubical Agda is currently not Compilation of program written in Cubical Agda is currently not
supported. One issue here is that the backends does not provide an supported. One issue here is that the backends does not provide an
implementation for the cubical primitives (such as the path-type). implementation for the cubical primitives (such as the path-type).
This means that even though the path-type gives us a computational This means that even though the path-type gives us a computational
interpretation of functional extensionality, univalence, transport, interpretation of functional extensionality, univalence, transport,
etc., we do not have a way of actually using this to compile our etc., we do not have a way of actually using this to compile our
programs that use these primitives. It would be interesting to see programs that use these primitives. It would be interesting to see
practical applications of this. The path between monads that this practical applications of this.
library exposes could provide one particularly interesting case-study.
\subsection{Higher inductive types}
This library has not explored the usefulness of higher inductive types
in the context of Category Theory.
\subsection{Initiality conjecture}
A fellow student here at Chalmers, Andreas Källberg, is currently
working on proving the initiality conjecture\TODO{Citation}. He will
be using this library to do so.
\subsection{Proving laws of programs} \subsection{Proving laws of programs}
Another interesting thing would be to use the Kleisli formulation of Another interesting thing would be to use the Kleisli formulation of
monads to prove properties of functional programs. The existence of monads to prove properties of functional programs. The existence of
univalence will make it possible to re-use proofs stated in terms of univalence will make it possible to re-use proofs stated in terms of
the monoidal formulation in this setting. the monoidal formulation in this setting.
%% \subsection{Higher inductive types}
%% This library has not explored the usefulness of higher inductive types
%% in the context of Category Theory.
\subsection{Initiality conjecture}
A fellow student at Chalmers, Andreas Källberg, is currently working
on proving the initiality conjecture. He will be using this library
to do so.

File diff suppressed because it is too large Load Diff

View File

@ -207,13 +207,13 @@ with \nomenindex{extensional sets} $(X, \sim)$. That is a type $X \tp
\MCU$ and an equivalence relation $\sim\ \tp X \to X \to \MCU$ on that \MCU$ and an equivalence relation $\sim\ \tp X \to X \to \MCU$ on that
type. Under the setoid interpretation the equivalence relation serve type. Under the setoid interpretation the equivalence relation serve
as a sort of ``local'' propositional equality. Since the developer as a sort of ``local'' propositional equality. Since the developer
gets to pick this relation it is not a\~priori a congruence gets to pick this relation it is not a~priori a congruence
relation. So this must be verified manually by the developer. relation. So this must be verified manually by the developer.
Furthermore, functions between different setoids must be shown to be Furthermore, functions between different setoids must be shown to be
setoid homomorphism, that is; they preserve the relation. setoid homomorphism, that is; they preserve the relation.
This approach has other drawbacks; it does not satisfy all This approach has other drawbacks; it does not satisfy all
propositional equalities of type theory a priori. That is, the propositional equalities of type theory a\~priori. That is, the
developer must manually show that e.g.\ the relation is a congruence. developer must manually show that e.g.\ the relation is a congruence.
Equational proofs $a \sim_{X} b$ are in some sense `local' to the Equational proofs $a \sim_{X} b$ are in some sense `local' to the
extensional set $(X , \sim)$. To e.g.\ prove that $x y → f\ x extensional set $(X , \sim)$. To e.g.\ prove that $x y → f\ x