Doktorsavhandling, 2018

Martin Löf Type Theory, having put computation at the center of logical

reasoning, has been shown to be an effective foundation for proof assistants,

with applications both in computer science and constructive mathematics. One

ambition though is for MLTT to also double as a practical general purpose

programming language. Datatypes in type theory come with an induction or

coinduction principle which gives a precise and concise specification of their

interface. However, such principles can interfere with how we would like to

express our programs. In this thesis, we investigate more flexible alternatives

to direct uses of the (co)induction principles.

As a first contribution, we consider the n-truncation of a type in Homo-

topy Type Theory. We derive in HoTT an eliminator into (n+1)-truncated

types instead of n-truncated ones, assuming extra conditions on the underlying

function.

As a second contribution, we improve on type-based criteria for termination

and productivity. By augmenting the types with well-foundedness information,

such criteria allow function definitions in a style closer to general recursion.

We consider two criteria: guarded types, and sized types.

Guarded types introduce a modality ”later” to guard the availability of

recursive calls provided by a general fixed-point combinator. In Guarded Cu-

bical Type Theory we equip the fixed-point combinator with a propositional

equality to its one-step unfolding, instead of a definitional equality that would

break normalization. The notion of path from Cubical Type Theory allows us

to do so without losing canonicity or decidability of conversion.

Sized types, on the other hand, explicitly index datatypes with size bounds

on the height or depth of their elements. The sizes however can get in the

way of the reasoning principles we expect. Our approach is to introduce new

quantifiers for ”irrelevant” size quantification. We present a type theory with

parametric quantifiers where irrelevance arises as a “free theorem”. We also

develop a conversion checking algorithm for a more specific theory where the

new quantifiers are restricted to sizes.

Finally, our third contribution is about the operational semantics of type

theory. For the extensions above we would like to devise a practical conversion

checking algorithm suitable for integration into a proof assistant. We formal-

ized the correctness of such an algorithm for a small but challenging core

calculus, proving that conversion is decidable. We expect this development to

form a good basis to verify more complex theories.

The ideas discussed in this thesis are already influencing the development

of Agda, a proof assistant based on type theory.

reasoning, has been shown to be an effective foundation for proof assistants,

with applications both in computer science and constructive mathematics. One

ambition though is for MLTT to also double as a practical general purpose

programming language. Datatypes in type theory come with an induction or

coinduction principle which gives a precise and concise specification of their

interface. However, such principles can interfere with how we would like to

express our programs. In this thesis, we investigate more flexible alternatives

to direct uses of the (co)induction principles.

As a first contribution, we consider the n-truncation of a type in Homo-

topy Type Theory. We derive in HoTT an eliminator into (n+1)-truncated

types instead of n-truncated ones, assuming extra conditions on the underlying

function.

As a second contribution, we improve on type-based criteria for termination

and productivity. By augmenting the types with well-foundedness information,

such criteria allow function definitions in a style closer to general recursion.

We consider two criteria: guarded types, and sized types.

Guarded types introduce a modality ”later” to guard the availability of

recursive calls provided by a general fixed-point combinator. In Guarded Cu-

bical Type Theory we equip the fixed-point combinator with a propositional

equality to its one-step unfolding, instead of a definitional equality that would

break normalization. The notion of path from Cubical Type Theory allows us

to do so without losing canonicity or decidability of conversion.

Sized types, on the other hand, explicitly index datatypes with size bounds

on the height or depth of their elements. The sizes however can get in the

way of the reasoning principles we expect. Our approach is to introduce new

quantifiers for ”irrelevant” size quantification. We present a type theory with

parametric quantifiers where irrelevance arises as a “free theorem”. We also

develop a conversion checking algorithm for a more specific theory where the

new quantifiers are restricted to sizes.

Finally, our third contribution is about the operational semantics of type

theory. For the extensions above we would like to devise a practical conversion

checking algorithm suitable for integration into a proof assistant. We formal-

ized the correctness of such an algorithm for a small but challenging core

calculus, proving that conversion is decidable. We expect this development to

form a good basis to verify more complex theories.

The ideas discussed in this thesis are already influencing the development

of Agda, a proof assistant based on type theory.

Conversion

Parametricity

Higher Inductive Types

Sized Types

Dependent Types

Type Theory

Guarded Types

Chalmers, Data- och informationsteknik, Datavetenskap

Proceedings of the ACM on Programming Languages,; Vol. 2(2018)p. 23:1-23:29

**Artikel i vetenskaplig tidskrift**

Proceedings of the ACM on Programming Languages,; Vol. 1(2017)p. 32:1--32:29-

**Paper i proceeding**

Proceedings of the ACM on Programming Languages,; Vol. 1(2017)p. 33:1--33:3-

**Paper i proceeding**

25th EACSL Annual Conference on Computer Science Logic (CSL 2016),; Vol. 62(2016)p. 23:1-23:17

**Paper i proceeding**

24th EACSL Annual Conference on Computer Science Logic (CSL 2015),; Vol. 41(2015)p. 359-373

**Paper i proceeding**

Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics),; Vol. 8858(2014)p. 140-158

**Paper i proceeding**

thought of not as a list of instructions for a machine to perform but

rather as something closer to mathematical functions. In this paradigm

new programming idioms emerged from the ability to manipulate

functions, and hence programs, as any other kind of data.

Martin Löf Type Theory (MLTT) goes one step further in this connection

to mathematical functions by requiring that programs always give a

result and never throw an error or get stuck in a loop; such functions

are called total. Therefore any total function that returns sufficient

evidence that some property is true can then be considered a formal

proof of that property. Tools based on MLTT have made use of this

ability to express proofs as total programs to formally establish

results in mathematics and computer science.

To only allow programs that are total such tools have to be

conservative and unfortunately end up rejecting even valid ones. Among

the wrongly rejected programs are often those relying on the idioms of

functional programming, because they tend to require a more extensive

analysis than others to determine whether they will eventually produce

a result.

In this thesis we explore ways to guarantee totality that offer more

flexibility by using the expressivity of MLTT and its extensions to

more closely characterize the behavior of programs so that even hard

to analyze ones can be accepted as total.

Algebra och logik

Datavetenskap (datalogi)

Grundläggande vetenskaper

978-91-7597-772-0

Doktorsavhandlingar vid Chalmers tekniska högskola. Ny serie: 4453

Chalmers tekniska högskola

ED lecture hall, EDIT building, Hörsalsvägen 11, Chalmers

Opponent: Prof. Rasmus Ejlers Møgelberg, Computer Science Department, IT University of Copenhagen, Denmark