Abstract 1 Introduction 2 Metatheory and formalisation 3 Variants of the syntax and the set interpretation 4 𝛂-normalisation for the groupoid-syntax 5 Reaping the fruits 6 Conclusions References Appendix A More diagrams

The Groupoid-Syntax of Type Theory Is a Set

Thorsten Altenkirch ORCID University of Nottingham, UK Ambrus Kaposi ORCID Eötvös Loránd University (ELTE), Budapest, Hungary Szumi Xie ORCID Eötvös Loránd University (ELTE), Budapest, Hungary
Abstract

Categories with families (CwFs) have been used to define the semantics of type theory in type theory. In the setting of Homotopy Type Theory (HoTT), one of the limitations of the traditional notion of CwFs is the requirement to set-truncate types, which excludes models based on univalent categories, such as the standard set model. To address this limitation, we introduce the concept of a Groupoid Category with Families (GCwF). This framework truncates types at the groupoid level and incorporates coherence equations, providing a natural extension of the CwF framework when starting from a 1-category.

We demonstrate that the initial GCwF for a type theory with a base family of sets and Π-types (groupoid-syntax) is set-truncated. Consequently, this allows us to utilize the conventional intrinsic syntax of type theory while enabling interpretations in semantically richer and more natural models. All constructions in this paper were formalised in Cubical Agda.

Keywords and phrases:
Categorical models of type theory, category with families, groupoids, coherence, homotopy type theory
Copyright and License:
[Uncaptioned image] © Thorsten Altenkirch, Ambrus Kaposi, and Szumi Xie; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Theory of computation Type theory
Related Version:
Preprint: https://arxiv.org/abs/2509.14988
Supplementary Material:
Software  (Source Code): https://bitbucket.org/akaposi/cohtt
  archived at Software Heritage Logo swh:1:dir:13849af00ff393300c0ae6cdd47ba6ddfa0d1cd8
Acknowledgements:
We thank the reviewers for their helpful comments and suggestions. We thank Niels van der Weide for explaining us the relationship to comprehension categories.
Funding:
The first author was supported by project no. TKP2021-NVA-29 which has been implemented with the support provided by the Ministry of Culture and Innovation of Hungary from the National Research, Development and Innovation Fund, financed under the TKP2021-NVA funding scheme. The second and third authors were funded by the European Union (ERC, HOTT, 101170308). Views and opinions expressed are however those of the author(s) only and do not necessarily reflect those of the European Union or the European Research Council. Neither the European Union nor the granting authority can be held responsible for them.
Editors:
Stefano Guerrini and Barbara König

1 Introduction

In [5], an intrinsically typed syntax for basic type theory using a Quotient-Inductive-Inductive Type (QIIT) was introduced. By intrinsically typed, we mean that the syntax directly enforces typing constraints, eliminating the need for separate untyped preterms needed in extrinsic presentations. The equational theory is integrated naturally using path constructors from Homotopy Type Theory (HoTT), while set-truncation ensures that types behave as sets.

QIITs are a special case of Higher Inductive-Inductive Types (HIITs) where all types are truncated to sets by adding a higher path constructor. The term inductive-inductive signals that constructors can reference other constructors in their types. In essence, [5] defined the syntax of type theory as the initial111Initiality is equivalent to induction for any QIIT [26], this been generalised to HIITs by Sattler [33]. In this paper, we use the terms initial model and syntax interchangeably. Category with Families (CwF) with Π-types and an uninterpreted base family. This allowed the syntax to be interpreted in any CwF with the necessary structure and served as the foundation for a proof of normalisation using Normalisation by Evaluation (NbE) [6].

However, this approach had a significant limitation: the syntax could not be interpreted in the intended model where types are sets. This issue arose due to the use of set truncation, which enforced types to be sets but precluded a univalent semantics, such as 𝖲𝖾𝗍. To work around this, inductive-recursive universes were used. While effective, this approach was unsatisfactory as it excluded univalent models, which are natural semantics for type theory.

Simply omitting set truncation is not a solution. Without truncation: (i) we cannot prove necessary equations in the syntax; (ii) the syntax itself is no longer a set, which e.g. makes equality in the syntax undecidable. A fully principled solution would require adding all higher coherences. However, this is both technically complex and generally believed to require a 2-level type theory rather than plain HoTT [29].

In this paper, we propose a middle ground: we lift the truncation level to groupoids and add a minimal set of coherence equations. This enables interpreting the syntax into the set model and other univalent category-based models. This compromise aligns naturally with the structure of categories in HoTT [36], where objects are groupoids with no truncation restriction, while hom-sets remain sets, as their name implies. Actually, if we only restrict types to be groupoids, then we can prove that contexts in the syntax also form a groupoid.

At first glance, this raises a new concern: does lifting to groupoids and adding coherence equations require redefining the syntax? Do we lose decidability of equality? Our main result resolves this concern:

The groupoid-syntax of type theory with 𝚷-types and a base family has types and contexts that are sets.

In essence, we retain the set-truncated syntax of type theory while enabling evaluation in groupoid-level models. This allows us to interpret the set-truncated syntax into univalent models, such as 𝖲𝖾𝗍 or the container model [7]. However, we note that univalence for types cannot be assumed as a principle at the judgmental level – doing so would mean that types are not a set anymore.

Contributions.

The main contributions of this paper are as follows:

  • We introduce the notion of a Groupoid Category with Families (GCwF) with Π-types and a base family (Definition 20).

  • We show that the initial GCwF with Π-types and a base family is set-truncated.

  • We establish the above proof using an α-normalisation construction.

  • As a result, we enable the definition of the univalent set model and other univalent category-based models for the set-truncated syntax.

All results are formalised in Cubical Agda.

Structure of the paper.

After listing related work, we describe our metatheory and notation in Section 2. In Section 3, we define various syntaxes as HIITs and describe the problem of interpreting the set-truncated syntax in sets. In Section 4 we show that the groupoid-syntax is a set. We use this fact in Section 5 to fix the above problem. We conclude in Section 6.

Related work.

This paper is a continuation of the series of papers internalising the intrinsic syntax of type theory in type theory [19, 15] and in homotopy type theory [34, 5]. Intrinsic syntax means that there are only well-formed, well-scoped, well-typed terms which are quotiented by conversion. This is in contrast with extrinsic style formalisations [1, 2]. We use a variant of Dybjer’s CwFs [21] introduced by Ehrhard [22, 17].

Infinite-dimensional versions of our 1-dimensional notion of model are given by Kraus and Uemura. Kraus defines a notion of -CwF [29] inside an extension of type theory with a strict equality (two-level type theory, [3, 9, 10]). He conjectures that the set-level (0-level) syntax is initial for his -model. Uemura [35] proves normalisation for an -dimensional presentation of type theory, however his work is not formalised in intensional type theory.

Our theorem that the initial GCwF with certain type formers is set-truncated can be seen as a simple coherence theorem analogous to that of monoidal categories. Coherence for monoidal categories says that in the free monoidal category over a set of objects, morphisms form a set. Our coherence theorem is for types rather than morphisms (substitutions), and we generate the types from a set-valued family using Π and instantiation. Coherence for monoidal groupoids was proven in HoTT by Piceghello [32], where he also used groupoid-truncated HITs to define the free monoidal groupoid.

In HoTT, the ideal solution for coherence problems is to find finite descriptions which imply all the infinitely many coherences. For example, usability of integers defined as set-quotients is limited, but there is a way to define their -version without truncation [8]. Free groups can defined without truncation [30], however originally groupoid-truncation was needed to prove that the free group over a set is a set. The general case was resolved by Wärn [40]. The Symmetry book [11] contains several similar examples.

There are notions of model of type theory weaker than CwFs where e.g. substitution is only functorial up to isomorphism [23, 31, 12]. These are further away from implementations of type theory, but they admit the standard model in the setting of HoTT [37], even without going 2-categorical. 2-categories are used to formulate the equivalence of weaker and stricter notions of model. Dybjer and Clairambault [16] proved the 2-equivalence of locally cartesian closed categories and CwFs with appropriate structure. Van der Weide [37] formalised this result in a univalent setting, for univalent comprehension categories instead of CwFs, and extended it to new type formers.

Higher inductive-inductive types (HIITs) have been used before to describe free algebraic structures such as real numbers [36], the partiality monad [4], or hybrid semantics [20], but all of these are set-truncated HIITs, unlike our groupoid-syntax. Cubical type theory supports HITs [18, 14], and there is a scheme for describing HIITs [25] which covers our usages.

2 Metatheory and formalisation

Everything in this paper is formalised in Cubical Agda [38], the formalisation is available as supplementary material. Next to definitions/theorems/etc., icons point to the corresponding part in the HTML version of the source code. In the paper text, we use informal cubical type theory: this means that we do not refer to the interval and instead of using 3-dimensional cubes, we only compose and fill larger 2-dimensional shapes.

We write for equations holding definitionally, : denotes definitions. Dependent function space is written (x:A)B or x.B, we also use implicit quantifications. We write dependent pairs as (x:A)×B, the empty type as , the unit type as . The universe of types is 𝖳𝗒𝗉𝖾, we also use the universe of h-sets 𝖲𝖾𝗍 and h-groupoids 𝖦𝗋𝗈𝗎𝗉𝗈𝗂𝖽. We have a predicative universe hierarchy, but we do not write levels for readability. The identity (path, equality) type is written a=Ab for a,b:A, where the subscript A is usually ommitted. The dependent path type (PathP, heterogeneous equality) is written b0=Beb1 for e:a0=a1 and bi:Bai, sometimes the subscript B is ommitted. We overload functions and their congruence (ap operator), e.g. fe:fa=fb where e:a=b, and we omit symmetries as well. Transport is written eb0:Ba1 for e:a0=a1 and b0:Ba0, we tend to give a separate name for operations using transport (e.g. []𝖴 is a transported version of []). The obvious element of the heterogeneous equality b0=Beeb0 is called transportFiller. The composition operator of cubical type theory is the generalisation of transitivity as depicted below, it also comes with a filler operation.

For the composite equality e, we denote the filler by fillerOfe. Some of these composition and filling operations are primitive in cubical type theory, but they are also definable via the eliminator of the identity type (J). In this paper we abstract over these differences.

We write compositions with equational reasoning by a0=e1a1=e2=enan, or its multi-line variant (left, below). Composition also works for heterogeneous equalities, in this case we write the base equalities in superscripts (right, below).

a0 =(e1) b0 =e1(e1)
an1 =(en) bn1 =en(en)
an bn

Here bi:Bai, ei:ai1=ai and ei:bi1=Beibi, and the resulting heterogeneous equality is b0=Bcomposite of the eisbn. We denote heterogeneous composition and filling of shapes by drawing a base diagram and a dependent diagram. We say that the right diagram is over the left one: in this case the dotted composition line has type b0=Be0bn.

Some squares can be filled by the fact that every parameterised path is natural. We denote these naturality squares by writing nat in the center:

There are some technical limitations of Cubical Agda that we have to circumvent in the formalisation, but are not visible in the text of this paper. We summarise these below.

  • Interleaved constructors of (higher) inductive-inductive datatypes are not allowed in Cubical Agda. For example, this fragment of a syntax of a type theory is not allowed:

    𝖢𝗈𝗇 :𝖳𝗒𝗉𝖾 :(Γ:𝖢𝗈𝗇)𝖳𝗒Γ𝖢𝗈𝗇
    𝖳𝗒 :𝖢𝗈𝗇𝖳𝗒𝗉𝖾 Σ :(A:𝖳𝗒Γ)𝖳𝗒(ΓA)𝖳𝗒Γ
    𝖾𝗊 :ΓΣAB=𝖢𝗈𝗇ΓAB

    Here every later constructor depends on all the previous constructors, the order cannot be modified, and first we have a 𝖢𝗈𝗇-constructor, then a 𝖳𝗒-constructor, then another 𝖢𝗈𝗇-constructor. We solve this via the encoding proposed in [24], which uses the same idea as encoding mutual inductive types as an indexed family [27]: we introduce a sort of codes 𝖢𝗈𝖽𝖾 and a family of elements 𝖤𝖫, and then all constructors are in the same sort:

    𝖢𝗈𝖽𝖾 :𝖳𝗒𝗉𝖾 :(Γ:𝖤𝖫𝖢𝗈𝗇)𝖤𝖫(𝖳𝗒Γ)𝖤𝖫𝖢𝗈𝗇
    𝖤𝖫 :𝖢𝗈𝖽𝖾𝖳𝗒𝗉𝖾 Σ :(A:𝖤𝖫(𝖳𝗒Γ))𝖤𝖫(𝖳𝗒(ΓA))𝖤𝖫(𝖳𝗒Γ)
    𝖢𝗈𝗇 :𝖢𝗈𝖽𝖾 𝖾𝗊 :ΓΣAB=𝖤𝖫𝖢𝗈𝗇ΓAB
    𝖳𝗒 :𝖤𝖫𝖢𝗈𝗇𝖢𝗈𝖽𝖾

    We use the same technique when defining our syntaxes (Definitions 2, 6, 7).

  • When we describe HIITs, we use transport and composition, but in the formalisation, we avoid them (we still use composition operators in some 2-paths). The reason is twofold: (i) Agda does not see that these operations preserve strict positivity; (ii) as the β rule for transport is not definitional, it makes it difficult to formalise strict models such as the 𝖳𝗒𝗉𝖾-interpretation. Instead, we make sure that all transports appear outermost and then can be encoded via dependent paths (a dependent path on 𝗋𝖾𝖿𝗅 computes to a nondependent one). When it is not possible to do this, we add extra constructors together with equations which singleton contract them. For example, in the text of the paper we write the substitution law for 𝖤𝗅 using a transport: (𝖤𝗅A^)[γ]=𝖤𝗅((𝖴[]γ)(A^[γ])). In the formalisation, we introduce a new constructor []𝖴:𝖳𝗆Γ𝖴𝖲𝗎𝖻ΔΓ𝖳𝗆Δ𝖴 together with the contracting equation A^[γ]=𝖴[]γA^[γ]𝖴, and then use this new constructor when describing 𝖤𝗅[].

  • When characterising the equality of normal types, in the formalisation we use the inductively defined Martin-Löf identity type instead of the built-in path type (note that they are equivalent). This is convenient because J computes definitionally on its constructor 𝗋𝖾𝖿𝗅. In the text of the paper we abstract over this.

3 Variants of the syntax and the set interpretation

In this section we define three different variants of the syntax of a type theory with dependent function space and a base family: the wild syntax, the set-truncated and the groupoid-truncated syntax. We show that types in the wild syntax do not form a set, so in particular they cannot have decidable equality. The set-syntax cannot be interpreted into the set model directly, while the groupoid-syntax can.

Parameter 1.

Everything in this section is parameterised by an X:𝖲𝖾𝗍 and a Y:X𝖲𝖾𝗍.

Definition 2 (Wild syntax ).

We define a higher inductive-inductive type with four sorts. It starts with a category with a terminal object. Objects are called contexts and morphisms are called substitutions, the terminal object is called the empty context. Note that composition takes the Γ, Δ and Θ arguments implicitly, and similarly for all the forthcoming operations and equations.

𝖢𝗈𝗇 :𝖳𝗒𝗉𝖾 𝗂𝖽𝗅 :γ.𝗂𝖽γ=γ
𝖲𝗎𝖻 :𝖢𝗈𝗇𝖢𝗈𝗇𝖳𝗒𝗉𝖾 𝗂𝖽𝗋 :γ.γ𝗂𝖽=γ
:𝖲𝗎𝖻ΔΓ𝖲𝗎𝖻ΘΔ𝖲𝗎𝖻ΘΓ :𝖢𝗈𝗇
𝖺𝗌𝗌 :γδθ.γ(δθ)=(γδ)θ ε :𝖲𝗎𝖻Γ
𝗂𝖽 :𝖲𝗎𝖻ΓΓ η :(σ:𝖲𝗎𝖻Γ)σ=ε

Types form a presheaf over the category of contexts and substitutions. The action on morphisms is called instantiation, it uses a flipped notation because of contravariance.

𝖳𝗒 :𝖢𝗈𝗇𝖳𝗒𝗉𝖾 [] :Aγδ.A[γδ]=A[γ][δ]
[] :𝖳𝗒Γ𝖲𝗎𝖻ΔΓ𝖳𝗒Δ [𝗂𝖽] :A.A[𝗂𝖽]=A

Terms form a dependent presheaf over types. The instantiation operation is overloaded. Note that the functor laws are paths dependent over the functor laws for 𝖳𝗒.

𝖳𝗆 :(Γ:𝖢𝗈𝗇)𝖳𝗒Γ𝖳𝗒𝗉𝖾 [] :aγδ.a[γδ]=𝖳𝗆Θ[]Aγδa[γ][δ]
[] :𝖳𝗆ΓA(γ:𝖲𝗎𝖻ΔΓ)𝖳𝗆Δ(A[γ]) [𝗂𝖽] :a.a[𝗂𝖽]=𝖳𝗆Γ[𝗂𝖽]Aa

In addition to context extension (infix triangle), we have lifting of substitutions which is its functorial action on morphisms. The functor laws again depend on those for 𝖳𝗒.

:(Γ:𝖢𝗈𝗇)𝖳𝗒Γ𝖢𝗈𝗇 + :γδ.(γδ)+=[]Aγδγ+δ+
+ :(γ:𝖲𝗎𝖻ΔΓ)𝖲𝗎𝖻(ΔA[γ])(ΓA) 𝗂𝖽+ :𝗂𝖽+=[𝗂𝖽]A𝗂𝖽

We have weakening 𝗉 (or first projection), and zero De Bruijn index 𝗊 (second projection). We explain how to compose either with lifted substitutions.

𝗉 :𝖲𝗎𝖻(ΓA)Γ 𝗊 :𝖳𝗆(ΓA)(A[𝗉]) 𝗉+ :γ.𝗉γ+=γ𝗉 𝗊[+] :γ.𝗊[γ+]=e𝗊

The last equation is heterogeneous over the previous one, e abbreviates the following composite path in 𝖳𝗒(ΔA[γ]): A[𝗉][γ+]=[]A𝗉γ+A[𝗉γ+]=𝗉+γA[γ𝗉]=[]Aγ𝗉A[γ][𝗉].

So far we have all weakenings and variables, for example De Bruijn index 3 is given by 𝗊[𝗉][𝗉][𝗉]. Now we introduce single substitutions via a which instantiates the last variable in the context by a, and leaves the rest. It commutes with any substitution, and we explain how to compose 𝗉 and 𝗊 with single substitutions.

:𝖳𝗆ΓA𝖲𝗎𝖻Γ(ΓA) 𝗉 :a.𝗉a=𝗂𝖽
:aγ.aγ=γ+a[γ] 𝗊[] :a.𝗊[a]=ea

Again, the last equation is heterogeneous over the previous one, where e abbreviates the following path in 𝖳𝗒Γ: A[𝗉][a]=[]A𝗉aA[𝗉a]=𝗉A[𝗂𝖽]=[𝗂𝖽]AA.

The last equation for the substitution calculus is an η law explaining that an identity substitution on an extended context is given by 𝗉 and 𝗊.

η :𝗂𝖽=𝗉+𝗊

We have a base type and a family over it, and elements of these coming from the parameters.

𝖴 :𝖳𝗒Γ 𝖤𝗅 :𝖳𝗆Γ𝖴𝖳𝗒Γ 𝗂𝗇𝖴 :X𝖳𝗆𝖴 𝗂𝗇𝖤𝗅 :Yx𝖳𝗆(𝖤𝗅(𝗂𝗇𝖴x))

The substitution law for 𝖴 is easy. To express 𝖤𝗅[], we introduce notation for the instantiation operation of terms of type 𝖴, which is just a transported version of ordinary instantiation.

𝖴[] :γ.𝖴[γ]=𝖴 []𝖴 :𝖳𝗆Γ𝖴𝖲𝗎𝖻ΔΓ𝖳𝗆Δ𝖴
𝖤𝗅[] :γ.(𝖤𝗅A^)[γ]=𝖤𝗅(A^[γ]𝖴) A^[γ]𝖴 :(𝖴[]γ)A^[γ]

We introduce a transport-filler heterogeneous equality for each A^ and γ that we will make use of later: A^[γ]𝖴𝖿𝗂𝗅𝗅𝖾𝗋:A^[γ]=𝖴[]γA^[γ]𝖴.

Dependent function space with β, η laws is defined by the isomorphism 𝖳𝗆(ΓA)B𝖳𝗆Γ(ΠAB) natural in Γ. It is enough to state naturality in one direction.

Π :(A:𝖳𝗒Γ)𝖳𝗒(ΓA)𝖳𝗒Γ Πβ :b.𝖺𝗉𝗉(𝗅𝖺𝗆b)=b
Π[] :ABγ.(ΠAB)[γ]=Π(A[γ])(B[γ+]) Πη :f.𝗅𝖺𝗆(𝖺𝗉𝗉f)=f
𝗅𝖺𝗆 :𝖳𝗆(ΓA)B𝖳𝗆Γ(ΠAB) 𝗅𝖺𝗆[] :bγ.(𝗅𝖺𝗆b)[γ]=Π[]ABγ𝗅𝖺𝗆(b[γ+])
𝖺𝗉𝗉 :𝖳𝗆Γ(ΠAB)𝖳𝗆(ΓA)B

This concludes the definition of the wild syntax.

We defined the substitution calculus in Ehrhard’s style [22, 17] instead of the more usual category with families (CwF) [21, 13]. These two presentations of the substitution calculus are isomorphic. In the above syntax, substitution extension ,:(γ:𝖲𝗎𝖻ΔΓ)𝖳𝗆Δ(A[γ])𝖲𝗎𝖻Δ(ΓA) is defined as (γ,a):γ+a. In the other direction, γ+:(γ𝗉,([]Aγ𝗉)𝗊) and a:(𝗂𝖽,([𝗂𝖽]A)a).

Although CwFs have one less operation and fewer equations, we chose the Ehrhard style syntax as there is no need to use the transport operation when specifying the equations. In CwFs, the naturality of substitution extension needs a transport in the middle: (γ,a)δ=(γδ,([]Aγδ)(a[δ])) In our syntax, all the transports are outermost, hence can be encoded by dependent paths.

Example 3 (Using the wild syntax ).

We derive the other direction of naturality for the Π-isomorphism: this is the substitution law for 𝖺𝗉𝗉 called 𝖺𝗉𝗉[].

(𝖺𝗉𝗉t)[γ+] =(Πβt)
𝖺𝗉𝗉(𝗅𝖺𝗆((𝖺𝗉𝗉t)[γ+])) =(𝗅𝖺𝗆[](𝖺𝗉𝗉t)γ+)
𝖺𝗉𝗉((Π[]ABγ)((𝗅𝖺𝗆(𝖺𝗉𝗉t))[γ])) =(Πηt)
𝖺𝗉𝗉((Π[]ABγ)(t[γ]))

Nondependent function space is encoded as AB:ΠA(B[𝗉]).

The identity function for the family 𝖴, 𝖤𝗅 is defined as

𝖨𝖣:𝖳𝗆(Π𝖴(𝖤𝗅((𝖴[]𝗉)𝗊)𝖤𝗅((𝖴[]𝗉)𝗊))) 𝖨𝖣:𝗅𝖺𝗆(𝗅𝖺𝗆𝗊)

Note that we had to transport the zero De Bruijn index 𝗊:𝖳𝗆(𝖴)(𝖴[𝗉]) so that we can apply 𝖤𝗅 to it: (𝖴[]𝗉)𝗊:𝖳𝗆(𝖴)𝖴.

In the syntax, we have the categorical application operation for Π. Ordinary application is given by :𝖳𝗆Γ(ΠAB)(a:𝖳𝗆ΓA)𝖳𝗆Γ(B[a]) defined as ta:(𝖺𝗉𝗉t)[a]. It is easy to prove its β law (𝗅𝖺𝗆t)a𝖺𝗉𝗉(𝗅𝖺𝗆t)[a]=Πβtt[a], but the η law is more involved as it needs several transports. We prove it via heterogeneous equality reasoning, where the proof of the equality of the types is written in the superscript of the equality sign.

f =(Πηf)
𝗅𝖺𝗆(𝖺𝗉𝗉f) =[𝗂𝖽]B([𝗂𝖽](𝖺𝗉𝗉f))
𝗅𝖺𝗆((𝖺𝗉𝗉f)[𝗂𝖽]) =η(η)
𝗅𝖺𝗆((𝖺𝗉𝗉f)[𝗉+𝗊]) =[]B𝗉+𝗊([](𝖺𝗉𝗉f)𝗉+𝗊)
𝗅𝖺𝗆((𝖺𝗉𝗉f)[𝗉+][𝗊]) =(𝖺𝗉𝗉[]t𝗉)
𝗅𝖺𝗆(𝖺𝗉𝗉((Π[]ABp)(f[𝗉]))[𝗊])
𝗅𝖺𝗆((Π[]ABp)(f[𝗉])𝗊)

The type of the above heterogeneous equality is f=𝖳𝗆Γ(ΠA)e𝗅𝖺𝗆((Π[]ABp)(f[𝗉])𝗊), where e is the following composite of the three heterogeneous steps in the above equality reasoning: B=[𝗂𝖽]BB[𝗂𝖽]=ηB[𝗉+𝗊]=[]B𝗉+𝗊B[𝗉+][𝗊].

Problem 4 (Type interpretation of the wild syntax ).

As a sanity check for our wild syntax, we define its type (standard, metacircular) interpretation.222Following Voevodsky [39], we call a proof relevant theorem a problem and its proof a construction.

Construction.

We define the following four recursive-recursive functions by pattern matching on the constructors of the higher inductive-inductive type.

:𝖢𝗈𝗇𝖳𝗒𝗉𝖾 :𝖳𝗒ΓΓ𝖳𝗒𝗉𝖾
:𝖲𝗎𝖻ΔΓΔΓ :𝖳𝗆ΓA(γ:Γ)Aγ

Composition is function composition (γδθ¯:γ(δθ¯)), identity is identity (𝗂𝖽γ¯:γ¯), instantiation is composition (A[γ]δ¯:A(γδ¯)), context extension is dependent sum (ΓA:(γ¯:Γ)×Aγ¯), lifting is γ+(δ¯,a¯):(γδ¯,a¯), 𝗉 and 𝗊 are first and second projections, single substitution is aγ¯:(γ¯,aγ¯). Function space is interpreted by metatheoretic functions (ΠABγ¯:(a¯:A)B(γ¯,a¯)). 𝖴 and 𝖤𝗅 are interpreted by X and Y, 𝗂𝗇𝖴 and 𝗂𝗇𝖤𝗅 simply return their arguments. All the equations are 𝗋𝖾𝖿𝗅. The standard interpretation shows that our theory is consistent, that is, not all types are inhabited: 𝖳𝗆𝖴 is interpreted by X so it is inhabited if and only if X is.

Proposition 5 ().

Types in the wild syntax (𝖳𝗒Γ for a Γ:𝖢𝗈𝗇) do not form a set.

Proof.

Every higher inductive type, including our Definition 2 can be interpreted into the unit type where all paths are interpreted by 𝗋𝖾𝖿𝗅. We use a variant of this where every sort is interpreted by except 𝖳𝗒Γ is interpreted by the circle 𝖲1. Π, 𝖴 and 𝖤𝗅 are constant 𝖻𝖺𝗌𝖾, A[γ] is interpreted by the interpretation of A. All equations are interpreted by 𝗋𝖾𝖿𝗅, except 𝖴[] which is interpreted by 𝗅𝗈𝗈𝗉. The two different proofs of 𝖴[𝗂𝖽]=𝖴, namely [𝗂𝖽]𝖴 and 𝖴[]𝗂𝖽 are interpreted by 𝗋𝖾𝖿𝗅 and 𝗅𝗈𝗈𝗉, respectively. When using the wild syntax, this is a practical problem: it can happen that we need a term of type 𝖤𝗅((𝖴[]𝗂𝖽)a), but we only have a term of type 𝖤𝗅(([𝗂𝖽]𝖴)a) available. From a broader perspective, Hedberg’s theorem [36, Theorem 7.2.5] implies that we cannot prove normalisation for the wild syntax. In principle, there could be a clever way of defining the equations in the syntax such that there is only one proof for each equation. It is not known whether this is possible [34]. Instead, we make all the equations equal by force.

Definition 6 (Set-syntax ).

The set-based syntax is the wild syntax (Definition 2) extended with the following three higher equality constructors. They truncate substitutions, types and terms to sets.

𝗂𝗌𝖲𝖾𝗍𝖳𝗒 :(ee:A0=𝖳𝗒ΓA1)e=e
𝗂𝗌𝖲𝖾𝗍𝖲𝗎𝖻 :(ee:γ0=𝖲𝗎𝖻ΔΓγ1)e=e 𝗂𝗌𝖲𝖾𝗍𝖳𝗆 :(ee:a0=𝖳𝗆ΓAa1)e=e

We do not add that contexts form a set as it is provable by induction on the context ().

Now we can hope for normalisation for this syntax, but the standard interpretation does not work anymore: the interpretation of 𝖳𝗒Γ would be Γ𝖳𝗒𝗉𝖾, but then we cannot interpret 𝗂𝗌𝖲𝖾𝗍𝖳𝗒, as 𝖳𝗒𝗉𝖾 does not form a set. We have to limit ourselves to interpreting 𝖳𝗒Γ by Γ𝖯𝗋𝗈𝗉 where 𝖯𝗋𝗈𝗉 is defined as (A:𝖳𝗒𝗉𝖾)×((xy:A)x=y). Alternatively, we can interpret 𝖳𝗒 into an inductive-recursive universe as in [5, Section 6], but we cannot interpret the set-syntax in a univalent model. To fix this, we introduce a syntax where substitutions and terms are truncated to be sets, but types are only groupoid-truncated. To make types well-behaved, we add coherence laws which are equations between equations between types. These express that the substitution laws 𝖴[], 𝖤𝗅[] and Π[] commute with the functoriality laws [], [𝗂𝖽]. In the diagrams below, the vertical directions are the substitution laws and the horizontal directions are the functoriality laws.

Definition 7 (Groupoid-syntax ).

The groupoid-based syntax is the wild syntax (Definition 2) extended with the following higher equality constructors. Some of them are drawn as commutative diagrams.

In the types of 𝖴[] and 𝖴[𝗂𝖽] above, []𝖴 and [𝗂𝖽]𝖴 abbreviate the following equality proofs. []𝖴 is the dotted line in the left dependent square which is over the right square. [𝗂𝖽]𝖴 is the dotted line in the upper dependent triangle which is over the lower triangle. As the bottom lines in the base square/triangle are reflexivities, []𝖴 and [𝗂𝖽]𝖴 are homogeneous equalities, but all the other lines in the upper shapes are heterogeneous. Fillers of the base shapes are written in their center, they are operations of the groupoid-syntax defined before. In Cubical Agda, the dotted lines are defined via heterogeneous composition. The []𝖴𝖿𝗂𝗅𝗅𝖾𝗋 operation is part of Definition 2.

In the types of Π[] and Π[𝗂𝖽] above, we used the following abbreviations of paths. [+] and [𝗂𝖽+] are the dotted lines in the upper triangles, which are over the lower triangles. The dotted lines are defined by composition. We also give names to the fillers of the upper triangles which will be used in Figures 2 and 3, respectively:

This concludes the definition of the groupoid-syntax.

Notation 8.

We denote the components of the set-syntax by S and the groupoid-syntax by G subscripts, e.g. 𝖢𝗈𝗇𝖲 and 𝖢𝗈𝗇𝖦.

We cannot redo the interpretation of Problem 4 because 𝖳𝗒𝗉𝖾 is not a groupoid, but we can refine it by interpreting types into 𝖲𝖾𝗍.

Construction 9 (Set interpretation of the groupoid-syntax ).

We define the following functions mutually by pattern matching on the groupoid-syntax where 𝖲𝖾𝗍:(X:𝖳𝗒𝗉𝖾)×((ee:x0=Xx1)e=e).

:𝖢𝗈𝗇𝖦𝖲𝖾𝗍 :𝖳𝗒𝖦ΓΓ.1𝖲𝖾𝗍
:𝖲𝗎𝖻𝖦ΔΓΔ.1Γ.1 :𝖳𝗆𝖦ΓA(γ:Γ.1)(Aγ).1

The cases for the constructors are analogous to the ones in Problem 4, with additional proofs of truncation-preservation: e.g. the empty context needs that is a set, context extension needs that Σ preserves set-truncation. 𝖴 is interpreted by X, 𝖤𝗅 by Y. We interpret the extra truncation constructors as follows: we prove 𝗂𝗌𝖦𝗋𝗉𝖽𝖳𝗒 by the fact that 𝖲𝖾𝗍 forms a groupoid, while functions between sets are sets, which proves 𝗂𝗌𝖲𝖾𝗍𝖲𝗎𝖻 and 𝗂𝗌𝖲𝖾𝗍𝖳𝗆. All 1-dimensional equalities and the 2-equalities 𝖴[𝗂𝖽], 𝖤𝗅[𝗂𝖽], Π[𝗂𝖽] are interpreted by 𝗋𝖾𝖿𝗅, while the 2-equalities 𝖴[], 𝖤𝗅[], Π[] use cubical filling because these include compositions in the formalisation (this could be avoided using the technique explained in Section 2).

The groupoid-syntax can be trivially interpreted into the set-syntax:

Construction 10 (Set-syntax interpretation of the groupoid-syntax ).

By pattern matching:

:𝖢𝗈𝗇𝖦𝖢𝗈𝗇𝖲 :𝖳𝗒𝖦Γ𝖳𝗒𝖲Γ
:𝖲𝗎𝖻𝖦ΔΓ𝖲𝗎𝖻𝖲ΔΓ :𝖳𝗆𝖲ΓA𝖳𝗆𝖲ΓA

Everything is interpreted by the corresponding component in the set-syntax, except (i) 𝗂𝗌𝖦𝗋𝗉𝖽𝖳𝗒𝖦 is interpreted by applying cumulativity of truncation levels to 𝗂𝗌𝖲𝖾𝗍𝖳𝗒𝖲; (ii) the higher equalities 𝖴[],,Π[𝗂𝖽] are interpreted by 𝗂𝗌𝖲𝖾𝗍𝖳𝗒𝖲.

4 𝛂-normalisation for the groupoid-syntax

In this section we prove that although elements of 𝖳𝗒𝖦 in the groupoid-syntax are only groupoid-truncated, they form a set. We define the set of α-normal forms for 𝖳𝗒𝖦, and then we show that every 𝖳𝗒𝖦 is a retract of its α-normal forms. α-normalisation is the process of eliminating explicit instantiations from types along the substitution laws for types.

4.1 𝛂-normal forms

Definition 11 (α-normal forms ).

α-normal forms are given by the inductive family 𝖭𝖳𝗒 which is defined mutually with the quote function . We overload constructor names and metavariables, but use brick red colour for disambiguation.

𝖭𝖳𝗒 :𝖢𝗈𝗇𝖦𝖳𝗒𝗉𝖾 :𝖭𝖳𝗒Γ𝖳𝗒𝖦Γ
𝖴 :𝖭𝖳𝗒Γ 𝖴 :𝖴𝖦
𝖤𝗅 :𝖳𝗆𝖦Γ𝖴𝖦𝖭𝖳𝗒Γ 𝖤𝗅A^ :𝖤𝗅𝖦A^
Π :(A:𝖭𝖳𝗒Γ)𝖭𝖳𝗒(Γ𝖦A)𝖭𝖳𝗒Γ ΠAB :Π𝖦AB

It is not obvious that α-normal forms are a set because 𝖭𝖳𝗒 is indexed by 𝖢𝗈𝗇𝖦 which contains elements of 𝖳𝗒𝖦 for which at this point we do not know that it forms a set. 𝖭𝖳𝗒 also includes non-normal terms (via 𝖤𝗅), hence we cannot rely on decidability of equality and Hedberg’s theorem [36, Section 7.2]. However, we can still show the following.

Lemma 12 ().

𝖭𝖳𝗒Γ forms a set.

Proof.

We use the encode-decode method [36] to characterise equality of 𝖭𝖳𝗒. The cover (or code) relation is defined by double-recursion on 𝖭𝖳𝗒, mutually with the decode function.

𝖢𝗈𝗏𝖾𝗋:𝖭𝖳𝗒Γ𝖭𝖳𝗒Γ𝖳𝗒𝗉𝖾𝖽𝖾𝖼𝗈𝖽𝖾:𝖢𝗈𝗏𝖾𝗋A0A1A0=A1
𝖢𝗈𝗏𝖾𝗋𝖴 𝖴 :
𝖢𝗈𝗏𝖾𝗋(𝖤𝗅A0^) (𝖤𝗅A1^) :A0^=A1^
𝖢𝗈𝗏𝖾𝗋(ΠA0B0) (ΠA1B1) :(A2:𝖢𝗈𝗏𝖾𝗋A0A1)×𝖢𝗈𝗏𝖾𝗋((𝖽𝖾𝖼𝗈𝖽𝖾A2)B0)B1
𝖢𝗈𝗏𝖾𝗋_ _ :

The 𝖽𝖾𝖼𝗈𝖽𝖾 function is defined by double-induction on A0 and A1. Again, by double induction on 𝖭𝖳𝗒, we prove that 𝖢𝗈𝗏𝖾𝗋 is a proposition. By mutual induction on 𝖭𝖳𝗒, we prove that 𝖢𝗈𝗏𝖾𝗋 is reflexive and decoding this reflexivity proof gives an identity (reflexivity) path.

𝗋𝖾𝖿𝗅𝖢𝗈𝖽𝖾 :(A:𝖭𝖳𝗒Γ)𝖢𝗈𝗏𝖾𝗋AA 𝖽𝖾𝖼𝖱𝖾𝖿𝗅 :(A:𝖭𝖳𝗒Γ)𝖽𝖾𝖼𝗈𝖽𝖾(𝗋𝖾𝖿𝗅𝖢𝗈𝖽𝖾A)=𝗋𝖾𝖿𝗅

We use these and J to define encode and prove that 𝖽𝖾𝖼𝗈𝖽𝖾 is a retraction:

𝖾𝗇𝖼𝗈𝖽𝖾 :A0=A1𝖢𝗈𝗏𝖾𝗋A0A1 𝖽𝖾𝖼𝖤𝗇𝖼 :(A2:A0=A1)𝖽𝖾𝖼𝗈𝖽𝖾(𝖾𝗇𝖼𝗈𝖽𝖾A2)=A2

As retractions preserve homotopy levels, from 𝖢𝗈𝗏𝖾𝗋A0A1 being a proposition, we obtain that A0=A1 is a proposition, hence 𝖭𝖳𝗒Γ is a set.

4.2 𝛂-normalisation

We want to show that :𝖭𝖳𝗒Γ𝖳𝗒𝖦Γ is a retraction, which will imply that 𝖳𝗒𝖦Γ is a set. For this, we define the other direction which is the normalisation function and its completeness.

Notation 13.

For the rest of this section, as we only talk about the groupoid-syntax, we do not write the G subscripts, so 𝖳𝗒 means 𝖳𝗒𝖦, 𝖴 means 𝖴𝖦, and so on.

Problem 14 (α-normalisation ).

We define the following two functions by mutual induction on the groupoid-syntax.

𝗇𝗈𝗋𝗆 :𝖳𝗒Γ𝖭𝖳𝗒Γ 𝖼𝗈𝗆𝗉𝗅 :(A:𝖳𝗒Γ)𝗇𝗈𝗋𝗆A=A

Construction.

On 𝖴 and 𝖤𝗅, the construction is trivial.

𝗇𝗈𝗋𝗆𝖴 :𝖴 𝗇𝗈𝗋𝗆(𝖤𝗅A^) :𝖤𝗅A^ 𝖼𝗈𝗆𝗉𝗅𝖴 :𝗋𝖾𝖿𝗅 𝖼𝗈𝗆𝗉𝗅(𝖤𝗅A^) :𝗋𝖾𝖿𝗅

On Π, we normalise recursively, but as 𝗇𝗈𝗋𝗆B:𝖭𝖳𝗒(ΓA), we need to transport it over completeness of A to obtain an 𝖭𝖳𝗒(Γ𝗇𝗈𝗋𝗆A):

𝗇𝗈𝗋𝗆(ΠAB):Π(𝗇𝗈𝗋𝗆A)((𝖼𝗈𝗆𝗉𝗅A)𝗇𝗈𝗋𝗆B)
𝖼𝗈𝗆𝗉𝗅(ΠAB):𝗇𝗈𝗋𝗆(ΠAB)
Π𝗇𝗈𝗋𝗆A(𝖼𝗈𝗆𝗉𝗅A)(𝗇𝗈𝗋𝗆B)=𝖼𝗈𝗆𝗉𝗅AΠA𝗇𝗈𝗋𝗆B=𝖼𝗈𝗆𝗉𝗅BΠAB

To define 𝗇𝗈𝗋𝗆 on instantiated types, we need to instantiate normal forms. For this, we first show the following.

Problem 15 ().

𝖭𝖳𝗒 can be equipped with an instantiation operation [] which is functorial, and is a “2-natural transformation”333We do not formally show that 𝖳𝗒 and 𝖭𝖳𝗒 form 2-functors, we use the phrase for intuition. into 𝖳𝗒, as follows (note the difference in colours for the overloaded names).

[]:𝖭𝖳𝗒Γ𝖲𝗎𝖻ΔΓ𝖭𝖳𝗒Δ[]:Aγδ.A[γδ]=A[γ][δ][𝗂𝖽]:A.A[𝗂𝖽]=A
[]:Aγ.A[γ]=A[γ]
[]:Aγδ.[𝗂𝖽]:A.

Construction for Problem 15.

Instantiation of normal types is by mutual induction with naturality of . Instantiating 𝖴 just changes the implicit context arguments, instantiating 𝖤𝗅 means instantiating the term (which is an ordinary 𝖳𝗆𝖦 term, and is not normal), instantiating Π is recursive:

𝖴[γ] :𝖴 (𝖤𝗅A^)[γ] :𝖤𝗅(A^[γ]𝖴) (ΠAB)[γ] :Π(A[γ])(B[γ+])

The operation [+] used in the codomain of Π is defined as follows. It also comes with a filler equation.

[+] :𝖭𝖳𝗒(ΓA)(γ:𝖲𝗎𝖻ΔΓ)𝖭𝖳𝗒(ΔA[γ])
B[γ+] :([]Aγ)(B[γ+])
B[γ+]𝖿𝗂𝗅𝗅𝖾𝗋:B[γ+]=[]AγB[γ+]

Analogously to [+] and [𝗂𝖽+] of Definition 7, we define their “normal substitution” versions [+] and [𝗂𝖽+]. Naturality is reusing the substitution law of the corresponding syntactic operation, and in the case of ΠAB, naturality for A and B are used (in the codomain of Π, both [+] and its filler are used):

[]𝖴γ :𝖴[γ]𝖴[γ]=𝖴[]γ𝖴𝖴[γ]
[](𝖤𝗅A^)γ :𝖤𝗅A^[γ](𝖤𝗅A^)[γ]=𝖤𝗅[]A^γ𝖤𝗅(A^[γ]𝖴)(𝖤𝗅A^)[γ]
[](ΠAB)γ :ΠAB[γ](ΠAB)[γ]=Π[]ABγΠ(A[γ])(B[γ+])=[]Bγ+
Π(A[γ])B[γ+]=Π([]Aγ)B[γ+]𝖿𝗂𝗅𝗅𝖾𝗋ΠA[γ]B[γ+](ΠAB)[γ]

The functoriality equation [] and the 2-naturality square [] are proven mutually by induction on 𝖭𝖳𝗒. The composition functor law for 𝖴 is definitional, for 𝖤𝗅 it reuses the functor law for terms of type 𝖴, for Π it is recursive:

[]𝖴γδ :𝖴[γδ]𝖴𝖴[γ][δ]
[](𝖤𝗅A^)γδ :(𝖤𝗅A^)[γδ]𝖤𝗅(A^[γδ]𝖴)=[]𝖴A^γδ𝖤𝗅(A^[γ]𝖴[δ]𝖴)(𝖤𝗅A^)[γ][δ]
[](ΠAB)γδ :(ΠAB)[γδ]Π(A[γδ])(B[(γδ)+])=Π([]Aγδ)([+]Bγδ)
Π(A[γ][δ])(B[γ+][δ+])(ΠAB)[γ][δ]

In the codomain part of the proof for Π above, we used functoriality of the [+] operation which is defined by the dotted line (given by composition) in the following left square which is over the right square. We also give name to the filler of the left square.

The []-squares for 𝖴 and 𝖤𝗅 are definitionally the same as 𝖴[] and 𝖤𝗅[], respectively. We present the diagrammatic proof of 𝖴[] for clarity, where double line means definitional equality. In this diagram, the inner and outer squares are definitionally equal. The square for Π is more involved, we present it in Figure 2 in the Appendix.

[]𝖴γδ:𝖴[]γδ
[](𝖤𝗅A^)γδ:𝖤𝗅[]A^γδ, see also Figure 1
[](ΠAB)γδ:see Figure 2

The functoriality equation [𝗂𝖽] is proven by mutual induction on 𝖭𝖳𝗒.

[𝗂𝖽]𝖴:𝖴[𝗂𝖽]𝖴[𝗂𝖽](𝖤𝗅A^):(𝖤𝗅A^)[𝗂𝖽]𝖤𝗅(A^[𝗂𝖽]𝖴)=[𝗂𝖽]𝖴A^𝖤𝗅A^
[𝗂𝖽](ΠAB):(ΠAB)[𝗂𝖽]Π(A[𝗂𝖽])(B[𝗂𝖽+])=Π([𝗂𝖽]A)([𝗂𝖽+]B)ΠAB

In the codomain part of the proof for Π above, we used functoriality of the [+] operation which is defined by the dotted line in the following upper triangle which is over the lower triangle. We also give a name to the filler of the upper triangle.

The 2-naturality triangle [𝗂𝖽] is proven by induction on 𝖭𝖳𝗒 as follows:

[𝗂𝖽]𝖴 :𝖴[𝗂𝖽] [𝗂𝖽](𝖤𝗅A^) :𝖤𝗅[𝗂𝖽]A^ [𝗂𝖽](ΠAB) :see Figure 3

This finishes the construction for Problem 15. So far, we defined 𝗇𝗈𝗋𝗆 and 𝖼𝗈𝗆𝗉𝗅 on 𝖴, 𝖤𝗅 and Π. On substituted types, we define normalisation and its completeness as follows.

𝗇𝗈𝗋𝗆(A[γ]):(𝗇𝗈𝗋𝗆A)[γ]
𝖼𝗈𝗆𝗉𝗅(A[γ]):𝗇𝗈𝗋𝗆(A[γ])(𝗇𝗈𝗋𝗆A)[γ]=[](𝗇𝗈𝗋𝗆A)γ𝗇𝗈𝗋𝗆A[γ]=𝖼𝗈𝗆𝗉𝗅AA[γ]

The action of 𝗇𝗈𝗋𝗆 on the functor laws is the corresponding functor law for instantiation of normal types, i.e. 𝗇𝗈𝗋𝗆([]Aγδ):[](𝗇𝗈𝗋𝗆A)γδ and 𝗇𝗈𝗋𝗆([𝗂𝖽]A):[𝗂𝖽](𝗇𝗈𝗋𝗆A). Completeness for the functor laws is the filling of the following two squares:

The action of 𝗇𝗈𝗋𝗆 on the substitution laws for 𝖴 and 𝖤𝗅 is given by 𝗋𝖾𝖿𝗅, and 𝖼𝗈𝗆𝗉𝗅 is given by trivial fillers for degenerate squares. The actions of 𝗇𝗈𝗋𝗆 and 𝖼𝗈𝗆𝗉𝗅 on Π[]ABγ only involve naturality squares and fillers, they are presented in Figures 4 and 5 in the appendix.

The rest of the 𝖳𝗒-paths that 𝗇𝗈𝗋𝗆 and 𝖼𝗈𝗆𝗉𝗅 have to preserve are the 2-paths 𝖴[], 𝖴[𝗂𝖽], 𝖤𝗅[], 𝖤𝗅[𝗂𝖽], Π[], Π[𝗂𝖽]. As 𝗇𝗈𝗋𝗆 returns in a set, these are all trivial. The function 𝖼𝗈𝗆𝗉𝗅 produces an equality between elements of 𝖳𝗒, and as 𝖳𝗒 is a groupoid, it trivially preserves 2-paths. Having defined 𝗇𝗈𝗋𝗆 and 𝖼𝗈𝗆𝗉𝗅, we finished the construction for Problem 14.

Theorem 16 ().

𝖳𝗒𝖦Γ is a set.

Proof.

Together, 𝗇𝗈𝗋𝗆 and 𝖼𝗈𝗆𝗉𝗅 witness that is a retraction, which preserves h-levels: as 𝖭𝖳𝗒Γ is a set, so is 𝖳𝗒Γ.

 Remark 17.

Stability of normalisation is also provable, but we do not need it in this paper.

5 Reaping the fruits

Problem 18 ().

The set-syntax is isomorphic to the groupoid-syntax.

Construction.

In Construction 10, we defined the map from the groupoid-syntax to the set-syntax. Now we define the opposite direction using that 𝖳𝗒𝖦Γ is a set. The roundtrips are proven by two simple inductions.

Construction 19 (Set interpretation of the set-syntax ).

We compose the groupoid-interpretation of the set syntax (Problem 18) and the set interpretation of the groupoid-syntax (Construction 9).

Groupoid CwFs are essentially algebras of the substitution calculus part of the groupoid-syntax (Definition 7), but we also include three coherence laws for types (the pentagon law [𝖺𝗌𝗌] and two identity triangles).

Definition 20 (Groupoid CwF, GCwF ).

An Ehrhard-style groupoid CwF is a 1-category (objects named 𝖢𝗈𝗇:𝖳𝗒𝗉𝖾, morphisms 𝖲𝗎𝖻:𝖢𝗈𝗇𝖢𝗈𝗇𝖲𝖾𝗍), a 2-presheaf of types (given by 𝖳𝗒:𝖢𝗈𝗇𝖦𝗋𝗈𝗎𝗉𝗈𝗂𝖽, []:𝖳𝗒Γ𝖲𝗎𝖻ΔΓ𝖳𝗒Δ, []:A[γδ]=A[γ][δ], [𝗂𝖽]:A[𝗂𝖽]=A, [𝖺𝗌𝗌], [𝗂𝖽𝗅], [𝗂𝖽𝗋] as depicted below), a dependent presheaf of terms over types (𝖳𝗆:(Γ:𝖢𝗈𝗇)𝖳𝗒Γ𝖲𝖾𝗍, with instantiation and functor laws), with Ehrhard-style comprehension (operations , +, 𝗉, 𝗊, with 8 equations as in Definition 2).

[𝖺𝗌𝗌]:Aγδθ. [𝗂𝖽𝗅]:Aγ. [𝗂𝖽𝗋]:Aγ.
 Remark 21 ().

In any groupoid CwF, [𝗂𝖽𝗅] and [𝗂𝖽𝗋] are interderivable. The direction [𝗂𝖽𝗅][𝗂𝖽𝗋] is described in Figure 6 in the appendix. The same proof in the context of monoidal categories appears in [28, Theorem 7].

Proposition 22 ().

In the groupoid-syntax (Definition 7), the laws [𝖺𝗌𝗌], [𝗂𝖽𝗅] and [𝗂𝖽𝗋] are admissible.

Proof.

Direct consequence of Theorem 16.

6 Conclusions

We have presented a basic coherence theorem for GCwF, enabling the interpretation of the usual decidable intrinsic syntax of type theory within models based on categories where the objects do not form a set, such as the set model. Notably, we have achieved this without relying on normalisation for the groupoid syntax or invoking Hedberg’s theorem. Furthermore, our method is adaptable, in principle, to type theories without decidable equality. An interesting feature of our approach is that it eliminates the need to explicitly incorporate the usual coherence laws for 2-categories (such as the pentagon law) into the syntax; these laws are admissible in our groupoid-syntax.

Despite these advancements, several significant challenges remain. For instance, we aim to extend this framework to include a univalent universe of propositions (i.e. 𝖯𝗋𝗈𝗉 with propositional extensionality). We also seek to address univalence for types without introducing an additional universe, thereby demonstrating that univalence can be soundly supported in this setting.

The addition of universes, even a minimal one such as a universe of Booleans with large eliminations, would require a shift in our methodology and might necessitate term normalisation. Extending the framework to accommodate multiple universes would inevitably demand a move to higher dimensions, introducing further complexity.

Our groupoid-syntax can be seen as the GCwF with Π freely generated from a set and a family over it. We would like to support more interesting generating data, i.e. generating data which can refer to the GCwF structure while being defined.

Finally, we would like to revisit the longstanding problem of modeling semi-simplicial types within this context. One potential direction is to extend our current recursive treatment of substitution and substitution-related coherence laws, using these as a foundation to systematically derive higher coherence conditions.

References

  • [1] Andreas Abel, Joakim Öhman, and Andrea Vezzosi. Decidability of conversion for type theory in type theory. Proc. ACM Program. Lang., 2(POPL):23:1–23:29, 2018. doi:10.1145/3158111.
  • [2] Arthur Adjedj, Meven Lennon-Bertrand, Kenji Maillard, Pierre-Marie Pédrot, and Loïc Pujet. Martin-Löf à la Coq. In Amin Timany, Dmitriy Traytel, Brigitte Pientka, and Sandrine Blazy, editors, Proceedings of the 13th ACM SIGPLAN International Conference on Certified Programs and Proofs, CPP 2024, London, UK, January 15-16, 2024, pages 230–245. ACM, 2024. doi:10.1145/3636501.3636951.
  • [3] Thorsten Altenkirch, Paolo Capriotti, and Nicolai Kraus. Extending homotopy type theory with strict equality. In Jean-Marc Talbot and Laurent Regnier, editors, 25th EACSL Annual Conference on Computer Science Logic, CSL 2016, August 29 - September 1, 2016, Marseille, France, volume 62 of LIPIcs, pages 21:1–21:17. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2016. doi:10.4230/LIPIcs.CSL.2016.21.
  • [4] Thorsten Altenkirch, Nils Anders Danielsson, and Nicolai Kraus. Partiality, revisited - the partiality monad as a quotient inductive-inductive type. In Javier Esparza and Andrzej S. Murawski, editors, Foundations of Software Science and Computation Structures - 20th International Conference, FOSSACS 2017, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2017, Uppsala, Sweden, April 22-29, 2017, Proceedings, volume 10203 of Lecture Notes in Computer Science, pages 534–549, 2017. doi:10.1007/978-3-662-54458-7_31.
  • [5] Thorsten Altenkirch and Ambrus Kaposi. Type theory in type theory using quotient inductive types. In Rastislav Bodík and Rupak Majumdar, editors, Proceedings of the 43rd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2016, St. Petersburg, FL, USA, January 20 - 22, 2016, pages 18–29. ACM, 2016. doi:10.1145/2837614.2837638.
  • [6] Thorsten Altenkirch and Ambrus Kaposi. Normalisation by evaluation for type theory, in type theory. Logical methods in computer science, 13, 2017. doi:10.23638/LMCS-13(4:1)2017.
  • [7] Thorsten Altenkirch and Ambrus Kaposi. A container model of type theory. In Henning Basold, editor, 27th International Conference on Types for Proofs and Programs, TYPES 2021. Universiteit Leiden, 2021. URL: https://types21.liacs.nl/download/a-container-model-of-type-theory/.
  • [8] Thorsten Altenkirch and Luis Scoccola. The integers as a higher inductive type. In Holger Hermanns, Lijun Zhang, Naoki Kobayashi, and Dale Miller, editors, LICS ’20: 35th Annual ACM/IEEE Symposium on Logic in Computer Science, Saarbrücken, Germany, July 8-11, 2020, pages 67–73. ACM, 2020. doi:10.1145/3373718.3394760.
  • [9] Danil Annenkov, Paolo Capriotti, Nicolai Kraus, and Christian Sattler. Two-level type theory and applications. Math. Struct. Comput. Sci., 33(8):688–743, 2023. doi:10.1017/S0960129523000130.
  • [10] Danil Annenkov, Paolo Capriotti, Nicolai Kraus, and Christian Sattler. Two-level type theory and applications - ERRATUM. Math. Struct. Comput. Sci., 34(1):80, 2024. doi:10.1017/S096012952300021X.
  • [11] Marc Bezem, Ulrik Buchholtz, Pierre Cagne, Bjørn Ian Dundas, and Daniel R. Grayson. Symmetry. https://github.com/UniMath/SymmetryBook. Commit: ec9be72.
  • [12] Rafaël Bocquet. Strictification of weakly stable type-theoretic structures using generic contexts. In Henning Basold, Jesper Cockx, and Silvia Ghilezan, editors, 27th International Conference on Types for Proofs and Programs, TYPES 2021, June 14-18, 2021, Leiden, The Netherlands (Virtual Conference), volume 239 of LIPIcs, pages 3:1–3:23. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2021. doi:10.4230/LIPIcs.TYPES.2021.3.
  • [13] Simon Castellan, Pierre Clairambault, and Peter Dybjer. Categories with Families: Unityped, Simply Typed, and Dependently Typed, pages 135–180. Springer International Publishing, Cham, 2021. doi:10.1007/978-3-030-66545-6_5.
  • [14] Evan Cavallo and Robert Harper. Higher inductive types in cubical computational type theory. Proc. ACM Program. Lang., 3(POPL):1:1–1:27, 2019. doi:10.1145/3290314.
  • [15] James Chapman. Type theory should eat itself. In Andreas Abel and Christian Urban, editors, Proceedings of the International Workshop on Logical Frameworks and Metalanguages: Theory and Practice, LFMTP@LICS 2008, Pittsburgh, PA, USA, June 23, 2008, volume 228 of Electronic Notes in Theoretical Computer Science, pages 21–36. Elsevier, 2008. doi:10.1016/J.ENTCS.2008.12.114.
  • [16] Pierre Clairambault and Peter Dybjer. The biequivalence of locally cartesian closed categories and martin-löf type theories. Math. Struct. Comput. Sci., 24(6), 2014. doi:10.1017/S0960129513000881.
  • [17] Thierry Coquand. Generalised algebraic presentation of type theory, 2020. URL: https://www.cse.chalmers.se/˜coquand/cwf2.pdf.
  • [18] Thierry Coquand, Simon Huber, and Anders Mörtberg. On higher inductive types in cubical type theory. In Anuj Dawar and Erich Grädel, editors, Proceedings of the 33rd Annual ACM/IEEE Symposium on Logic in Computer Science, LICS 2018, Oxford, UK, July 09-12, 2018, pages 255–264. ACM, 2018. doi:10.1145/3209108.3209197.
  • [19] Nils Anders Danielsson. A formalisation of a dependently typed language as an inductive-recursive family. In Thorsten Altenkirch and Conor McBride, editors, Types for Proofs and Programs, International Workshop, TYPES 2006, Nottingham, UK, April 18-21, 2006, Revised Selected Papers, volume 4502 of Lecture Notes in Computer Science, pages 93–109. Springer, 2006. doi:10.1007/978-3-540-74464-1_7.
  • [20] Tim Lukas Diezel and Sergey Goncharov. Towards constructive hybrid semantics. In Zena M. Ariola, editor, 5th International Conference on Formal Structures for Computation and Deduction, FSCD 2020, June 29-July 6, 2020, Paris, France (Virtual Conference), volume 167 of LIPIcs, pages 24:1–24:19. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2020. doi:10.4230/LIPIcs.FSCD.2020.24.
  • [21] Peter Dybjer. Internal type theory. In Stefano Berardi and Mario Coppo, editors, Types for Proofs and Programs, International Workshop TYPES’95, Torino, Italy, June 5-8, 1995, Selected Papers, volume 1158 of Lecture Notes in Computer Science, pages 120–134. Springer, 1995. doi:10.1007/3-540-61780-9_66.
  • [22] Thomas Ehrhard. Une sémantique catégorique des types dépendents. PhD thesis, Université Paris VII, 1988.
  • [23] Martin Hofmann. On the interpretation of type theory in locally cartesian closed categories. In Leszek Pacholski and Jerzy Tiuryn, editors, Computer Science Logic, 8th International Workshop, CSL ’94, Kazimierz, Poland, September 25-30, 1994, Selected Papers, volume 933 of Lecture Notes in Computer Science, pages 427–441. Springer, 1994. doi:10.1007/BFB0022273.
  • [24] Ambrus Kaposi. Re: Separate definition of constructors?, May 2019. Email message to the Agda mailing list. URL: https://lists.chalmers.se/pipermail/agda/2019/011176.html.
  • [25] Ambrus Kaposi and András Kovács. Signatures and induction principles for higher inductive-inductive types. Log. Methods Comput. Sci., 16(1), 2020. doi:10.23638/LMCS-16(1:10)2020.
  • [26] Ambrus Kaposi, András Kovács, and Thorsten Altenkirch. Constructing quotient inductive-inductive types. Proc. ACM Program. Lang., 3(POPL):2:1–2:24, 2019. doi:10.1145/3290315.
  • [27] Ambrus Kaposi and Jakob von Raumer. A syntax for mutual inductive families. In Zena M. Ariola, editor, 5th International Conference on Formal Structures for Computation and Deduction, FSCD 2020, June 29-July 6, 2020, Paris, France (Virtual Conference), volume 167 of LIPIcs, pages 23:1–23:21. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2020. doi:10.4230/LIPIcs.FSCD.2020.23.
  • [28] G. M. Kelly. On MacLane’s conditions for coherence of natural associativities, commutativities, etc. Journal of Algebra, 1(4):397–402, 1964. doi:10.1016/0021-8693(64)90018-3.
  • [29] Nicolai Kraus. Internal -categorical models of dependent type theory: Towards 2LTT eating HoTT. In 36th Annual ACM/IEEE Symposium on Logic in Computer Science, LICS 2021, Rome, Italy, June 29 - July 2, 2021, pages 1–14. IEEE, 2021. doi:10.1109/LICS52264.2021.9470667.
  • [30] Nicolai Kraus and Thorsten Altenkirch. Free higher groups in homotopy type theory. In Anuj Dawar and Erich Grädel, editors, Proceedings of the 33rd Annual ACM/IEEE Symposium on Logic in Computer Science, LICS 2018, Oxford, UK, July 09-12, 2018, pages 599–608. ACM, 2018. doi:10.1145/3209108.3209183.
  • [31] Peter LeFanu Lumsdaine and Michael A. Warren. The local universes model: An overlooked coherence construction for dependent type theories. ACM Trans. Comput. Log., 16(3):23:1–23:31, 2015. doi:10.1145/2754931.
  • [32] Stefano Piceghello. Coherence for monoidal groupoids in HoTT. In Marc Bezem and Assia Mahboubi, editors, 25th International Conference on Types for Proofs and Programs (TYPES 2019), volume 175 of Leibniz International Proceedings in Informatics (LIPIcs), pages 8:1–8:20, Dagstuhl, Germany, 2020. Schloss Dagstuhl – Leibniz-Zentrum für Informatik. doi:10.4230/LIPIcs.TYPES.2019.8.
  • [33] Christian Sattler. Semantics of signatures for higher inductive-inductive types (HIITs) in complete Segal types, 2019. Notes on the author’s website. URL: https://www.cse.chalmers.se/˜sattler/docs/hits.
  • [34] Mike Shulman. Homotopy type theory should eat itself (but so far, it’s too big to swallow), 2014. Blog post on the Homotopy Type Theory website. URL: https://homotopytypetheory.org/2014/03/03/hott-should-eat-itself/.
  • [35] Taichi Uemura. Normalization and coherence for -type theories. CoRR, abs/2212.11764, 2022. doi:10.48550/arXiv.2212.11764.
  • [36] The Univalent Foundations Program. Homotopy Type Theory: Univalent Foundations of Mathematics. https://homotopytypetheory.org/book, Institute for Advanced Study, 2013.
  • [37] Niels van der Weide. The internal languages of univalent categories. In 40th Annual ACM/IEEE Symposium on Logic in Computer Science, LICS 2025, Singapore, June 23-26, 2025, pages 112–126. IEEE, 2025. doi:10.1109/LICS65433.2025.00016.
  • [38] Andrea Vezzosi, Anders Mörtberg, and Andreas Abel. Cubical Agda: A dependently typed programming language with univalence and higher inductive types. J. Funct. Program., 31:e8, 2021. doi:10.1017/S0956796821000034.
  • [39] Vladimir Voevodsky. A C-system defined by a universe category, 2015. arXiv:1409.7925.
  • [40] David Wärn. Path spaces of pushouts, 2024. arXiv:2402.12339.

Appendix A More diagrams

Figure 1: This diagram is the proof [](𝖤𝗅A^)γδ, which is the outer square. Double lines mean definitional equality. The boundaries of the outer square are definitionally equal to the boundaries of the inner square, which we fill by 𝖤𝗅[]A^γδ.
Figure 2: This diagram is the proof [](ΠAB)γδ. In the upper part, we compute the square to be filled: the left hand side square is definitionally equal to the right hand side one. Then, we fill the right hand side square in the lower diagram, where the boundary of the square is the same as the upper right hand side square.
Figure 3: This diagram is the proof [𝗂𝖽](ΠAB). In the upper part, we compute the triangle to be filled: the left hand side triangle is definitionally equal to the right hand side one. Then, we fill the right hand side triangle in the lower diagram, where we duplicate the vertex ΠAB for readability.
Figure 4: Normalisation on the substitution law for Π acts as follows: 𝗇𝗈𝗋𝗆(Π[]ABγ):Π𝗋𝖾𝖿𝗅e where e is defined in the upper square in this diagram. The upper square is a dependent square over the lower one.
Figure 5: This diagram is the proof 𝖼𝗈𝗆𝗉𝗅(Π[]ABγ). The line e is defined in Figure 4.
Figure 6: Proof that [𝗂𝖽𝗅] implies [𝗂𝖽𝗋] in any groupoid CwF (Definition 20).