arXiv:2609.08578cs.PLSep 2026

Manuscript Offprint

arXiv:2609.08578

Erased Postulates, Identity Types and Quotients

Nils Anders Danielsson

NILS ANDERS DANIELSSON, University of Gothenburg and Chalmers University of Technology, Sweden

This text is concerned with the question of whether, in type theory with erasure annotations, one can postulate that some type is inhabited and still have a guarantee that a program will not get stuck. Previous work has provided such guarantees for consistent erased postulates, i.e. postulates that are restricted to be used in erased contexts. Here those guarantees are extended to type theory with identity types.

Similar ideas provide a simple way to support quotient types: it is shown that one can let things like “the equivalence classes for two related values are equal” be erased postulates and have an eliminator that only computes for the equivalence class constructor, and still get a guarantee that programs will compute correctly.

Another question is whether programs compute correctly if one is allowed to transport (cast) using erased identity proofs. It is shown that this is safe in the absence of quotients and postulates, and in the presence of quotients and erased postulates that can be implemented using equality reflection. However, unrestricted transports of this kind are not compatible with erased, postulated univalence. For that reason the text includes a study of the function []-cong, which encapsulates a limited form of transport for erased identity proofs.

The text is accompanied by machine-checked Agda proofs.

1 Introduction

Dependent type theories/programming languages like Agda [59], Idris [14], Lean [60] and Rocq [61] support identity types. A key feature of identity types is the ability to substitute equals for equals, as witnessed by the following Agda function:

subst:(P:A→Typep)→IdAxy→Px→PysubstPreflp=p\begin{aligned}&subst:(P:A\to Type p)\to Id A x y\to P x\to P y\\&subst P refl p=p\\ \end{aligned}

In any context expressible as a function PP from some type AA to the universe TypepType p (the type of types with universe level pp) one can replace xx with yy, given that the identity type IdAxyId A x y is inhabited. Note that subst is implemented by matching on the constructor refl : IdAxxId A x x.

A potential drawback of identity types in plain, intensional Martin-Löf type theory is that one cannot prove certain properties, like function extensionality – extensionally equal functions are equal [6] – or univalence – which implies that types that are in bijective correspondence are equal [62]. A workaround is to postulate the properties that one needs (assuming that they are consistent). However, if the type theory is used as a programming language, then a postulate could lead to programs becoming stuck during execution.

This problem was addressed by Abel et al. [1], who study a family of type theories with support for erasure inspired by the work of McBride [43] and Atkey [9], and similar to the support for erasure in Agda and Idris 2. The idea is basically that erased data will be removed by compilers, and that the type system ensures that no run-time decision is made based on erased data. Abel et al. [1, Theorem 8.3] show that, for a program tt of type N\mathbb{N} that only uses postulates in erased contexts, if the postulates are mutually consistent, then tt will reduce to a numeral, and the corresponding compiled program will reduce to the same numeral.

Abel et al. did not support identity types. One contribution of this work is to add support for identity types (see Theorem 10.1), thus establishing that a postulate like the following one is “safe”:

Author's Contact Information: Nils Anders Danielsson, Department of Computer Science and Engineering, University of Gothenburg and Chalmers University of Technology, Gothenburg, Sweden, nad@cse.gu.se.

Figure

This work is licensed under a Creative Commons Attribution 4.0 International License.

postulate @0 funext:(∀x→Id(Px)(fx)(gx))→Id((x:A)→Px)fg\mathbf{p o s t u l a t e}\ @0\ f u n e x t:\left(\forall x\to I d\left(P x\right)\left(f x\right)\left(g x\right)\right)\to I d\left(\left(x:A\right)\to P x\right)f g

This code uses Agda notation: the annotation @0 means that the postulate is erased, and may only be used in erased contexts, for instance in erased function arguments.

This work also goes further:

  • It is shown how erased postulates make it easy to implement a form of quotient types ( §3§ 3). As an aside, the associated proofs of normalisation, canonicity, consistency, etc. are possibly the first mechanised proofs of that kind for type theory with quotients ( §9§ 9).

  • It is shown that in some cases erased postulates can be supported even in the presence of erased matches [1], in particular variants of subst that take erased identity proofs ( §4§ 4).

  • Some forms of erased matches are incompatible with univalence, and for that reason this text includes a study of the function []-cong, which provides a restricted form of erased match for identity proofs ( §5§ 5).

  • This work provides a first step towards Computational Book HoTT: a variant of Book HoTT [62] with erased univalence, higher inductive types with erased higher constructors, and a guarantee that programs will compute properly ( §6§ 6).

  • The technique of fording [18, 51] – encoding inductive families using regular inductive types and identity proofs – is adapted for use with erased identity proofs. (The text only treats the case of vectors.) The technique uses erased matches for identity types ( §7§ 7).

Formalisation. All results have been formalised in Agda, and the code has been made available to download [25]. The results in §§ 8-12 have been proved in the context of a formalisation of graded type theory [1, 2], while those in §§ 3-7 and §§ 13-16 are proved for Agda. Note that there are minor differences between the code and the presentation in the text.

The graded type theory formalisation of Abel et al. [1] builds on earlier work for non-graded type theory by Abel et al. [4], extended by Oskar Eriksson, Gaëtan Gilbert and Wojciech Nawrocki. The graded type theory formalisation has in turn been extended with a weak unit type (Eriksson), top-level, possibly opaque definitions [27], and universe polymorphism [26].

References (47)