PhD Antoine Allioux

Michele Pagani

Colin Félix

Gaëtan

Moana Kostia

Higher Structures in Homotopy Type Theory

Keywords: homotopy type theory, higher algebra, higher category theory, polynomial monads, opetopes Emily Riehl, Paige North, Martín

The definition of algebraic structures on arbitrary types in homotopy type theory (HoTT) has proven elusive so far. This is due to types being spaces instead of plain sets in general, and equalities of elements of a type behaving like homotopies. Equational laws of algebraic structures must therefore be stated coherently. However, in set-based mathematics, the presentation of this coherence data relies on set-level algebraic structures such as operads or presheaves which are thus not subject to additional coherence conditions. Replicating this approach in HoTT leads to a situation of circular dependency as these structures must be defined coherently from the beginning.

In this thesis, we break this situation of circular dependency by extending type theory with a universe of cartesian polynomial monads which, crucially, satisfy their laws definitionally. This extension permits the presentation of types and their higher structures as opetopic types: infinite collections of cells whose geometry is described by opetopes. Opetopes are geometric shapes originally introduced by Baez and Dolan in order to give a definition of 𝑛-categories.

We open this thesis by giving a purely type-theoretical definition of opetopes in a type theory similar to book HoTT in Chapter 1. Our definition essentially defines opetopes as sequences of well-founded trees satisfying some properties which are nicely captured by their typing. The opetopic approach particularly shines in the context of type theory as well-founded trees fall within the realm of inductive types. More specifically, our construction is based on a sequence of cartesian polynomial monads, a notion which becomes central in later chapters. We conclude this chapter with an inductive definition of the faces of an opetope. This self-contained chapter is the occasion for the reader to get familiar with opetopes in type theory which are sets and therefore elude considerations of coherences before broaching on opetopic types whose complexity may hide the conceptual simplicity of opetopes.

We then extend type theory with a universe of cartesian polynomial monads closed under some monad constructors in Chapter 2. We do so in the aim of defining opetopic types in Chapter 3. Contrary to our definition of opetopes which only involves sets, opetopic types are valued in arbitrary types. As a consequence, we can no longer state the equational laws of Chapter 1 in a coherent fashion, having no means to do so. We therefore define our universe of polynomial monads in order that these equational laws hold definitionally. The constructors under which our universe is closed then allow us to define, in particular, the Baez-Dolan slice construction on which is based our definition of opetopic types. We then define a number of extensions in order to establish some more advanced results in Chapter 3.

Finally, we take advantage of our universe of polynomial monads to define opetopic types in Chapter 3. This enables us to define coherent higher algebraic structures, among which ∞-groupoids and (∞, 1)-categories. Crucially, their higher structure coincides with the one induced by their identity types. We ii Abstract then establish some expected results in order to motivate our definitions. In particular, we compare our definition of fibrant opetopic types with Baez and Dolan definition of coherent algebras, and we show that they are equivalent under certain assumptions.

Résumé

La définition de structures algébriques sur des types arbitraires en théorie des types homotopiques (HoTT) s'est révélée hors de portée jusqu'à présent. Cela est dû au fait que les types sont, en général, des espaces plutôt que de simples ensembles, et que les égalités d'éléments d'un type se comportent comme des homotopies. Les lois équationnelles des structures algébriques doivent donc être énoncées de manière cohérente. Cependant, en mathématiques ensemblistes, la présentation de ces données de cohérence se fait à l'aide de structures algébriques sur des ensembles, telles que les opérades ou les préfaisceaux, qui ne sont donc pas soumises à des conditions de cohérence supplémentaires. Reproduire cette approche en HoTT conduit à une situation de dépendance circulaire puisque ces structures doivent être définies de manière cohérente dès le départ.

Dans cette thèse, nous brisons cette circularité en étendant la théorie des types d'un univers de monades polynomiales cartésiennes qui, de manière cruciale, satisfont leurs lois définitionnellement. Cette extension permet de présenter les types et leurs structures supérieures sous forme de types opétopiques qui sont des collections infinies de cellules dont la géométrie est décrite par les opétopes. Les opétopes sont des formes géométriques introduites par Baez et Dolan afin de donner une définition des 𝑛-catégories.

Nous ouvrons cette thèse en donnant une définition des opétopes dans une théorie des types similaire à celle du livre HoTT au chapitre 1. Nous définissons les opétopes comme séquences d'arbres bien fondés satisfaisant certaines propriétés qui sont capturées par leur typage. L'approche opétopique est particulièrement adaptée au contexte de la théorie des types car ces arbres sont aisément définissables comme types inductifs. Plus précisément, notre construction est basée sur une séquence de monades polynomiales cartésiennes, une notion qui devient centrale dans les chapitres suivants. Nous concluons ce chapitre par une définition inductive des faces d'un opétope. Ce chapitre est l'occasion pour le lecteur de se familiariser avec les opétopes en théorie des types qui sont des ensembles et qui échappent donc aux considérations de cohérence avant d'aborder les types opétopiques dont la complexité peut obscurcir la simplicité conceptuelle des opétopes.

Nous étendons ensuite la théorie des types d'un univers de monades polynomiales cartésiennes clos sous certains constructeurs de monades au chapitre 2 qui nous servira à définir les types opétopiques au chapitre 3. Contrairement à notre définition des opétopes qui n'implique que des ensembles, les types opétopiques sont à valeurs dans des types arbitraires. Par conséquent, nous ne pouvons plus énoncer les lois équationnelles du chapitre 1 de façon cohérente. Nous définissons donc notre univers de monades polynomiales afin que ces lois soient satisfaites par définition. Les constructeurs sous lesquels notre univers est clos nous permettent alors de définir, en particulier, la construction tranche de Baez et Dolan sur laquelle repose notre définition de type opétopique. Nous définissons finalement un certain nombre d'extensions afin d'établir des résultats plus avancés au chapitre 3.

Enfin, nous tirons parti de notre univers de monades polynomiales pour définir les types opétopiques au chapitre 3. Cela nous permet de définir des structures algébriques supérieures cohérentes, parmi lesquelles les ∞-groupoïdes et les (∞, 1)-catégories. De manière cruciale, leur structure supérieure coïncide avec celle induite par leurs types d'identités. Nous établissons ensuite quelques résultats attendus afin de motiver nos définitions. En particulier, nous comparons notre définition de type opétopique fibrant avec la définition d'algèbre cohérente de Baez et Dolan, et nous montrons qu'elles sont équivalentes sous certaines hypothèses.

Mots clés : théorie des types homotopiques, algèbre supérieure, théorie des catégories supérieures, monades polynomiales, opétopes

Introduction Algebra in type theory

More than fifty years after its inception, Martin-Löf type theory (MLTT) in its intensional form continues to be a source of wonder. This past decade has been marked by the development of homotopy type theory (HoTT), a field which stemmed from the discovery that Martin-Löf identity types provide a link between type theory and homotopy theory, a branch of algebraic topology. Simply put: equalities of elements of a type can be regarded as paths in a space that the type represents, with equalities of equalities corresponding to higher dimensional paths. Under this correspondence, we can use topological intuition when working with types and their proof-relevant equality types.

The notion of homotopy type first arose in algebraic topology from the desire to consider topological spaces up to a coarser notion of equivalence, namely homotopy equivalence, where we ask not that a function have an inverse "on the nose", but up to deformation. The homotopy type of a space is the structure which only contains the information of the algebra of paths in the space and higher paths between them.

Over time, the notion of homotopy type became an object of study in itself. The desire to axiomatise this algebra of paths led to the connection between algebraic topology and higher category theory. Alexander Grothendieck's homotopy hypothesis asserts exactly that the algebra of higher paths can be understood as an ∞-groupoid, that is, a weak higher-dimensional category in which all higher morphisms are invertible. More recently, it was discovered that identity types of HoTT give a precise axiomatisation of ∞-groupoids. Several fundamental results in the field have made this connection precise, showing that type theory gives rise to particular definitions of ∞-groupoids [START_REF] Lumsdaine | Weak omega-categories from intensional type theory[END_REF]Van Den Berg and Garner 2011). This connection has been further generalised to establish that HoTT is the internal language of (∞, 1)-topoï [START_REF] Shulman | All (∞, 1)-toposes have strict univalent universes[END_REF]. Establishing the connection between types and ∞-groupoids allows regarding statements about types as statements about ∞-groupoids and vice versa. This has allowed the reformulation of a great body of homotopy theory results in a more conceptual way and this has led to the development of new proof techniques (Univalent Foundations Program 2013).

In light of these connections, it is possible to think of type theory as a foundation of mathematics based on strong principles, among which Voevodsky's Univalence Principle asserting that all statements about types are invariant under equivalence [START_REF] Awodey | Structuralism, invariance, and univalence[END_REF]. This foundation of mathematics should have its own theory of algebra. This, however has proven problematic. The reason is that defining algebraic structures on homotopy types requires that we do so coherently; otherwise, some expected constructions cannot be defined. So far, we have not been able to do so without assuming additional principles such as the uniqueness of identity proofs (UIP) which are not compatible with the homotopy interpretation of types that we subscribe to in HoTT. The difficulty lies in the description of the laws satisfied by the algebraic structure at hand. This problem is usually tackled in set-based mathematics -where spaces are defined in terms of sets -by using set-level algebraic structures such as operads or presheaves in order to present algebraic structures on spaces and their infinite data of coherences. However, this approach is denied to us in HoTT where types behave like spaces with equalities between elements of a type behaving like homotopies. This is a blessing as this allows to state constructions in a homotopy invariant way, but this is also a curse as this seems to prevent us from defining algebraic structures on arbitrary types. Related to this problem is the open question of defining semisimplicial types. It was raised during the special year on Univalent Foundations at the Institute for Advanced Study in 2013 and all attempts to solve it have required modifying type theory in some way by reintroducing a strict equality [START_REF] Altenkirch | Extending homotopy type theory with strict equality[END_REF][START_REF] Annenkov | Two-level type theory and applications[END_REF][START_REF] Capriotti | Univalent higher categories via complete semi-segal types[END_REF][START_REF] Kraus | Space-valued diagrams, typetheoretically[END_REF] thus defeating the foundational ambition of HoTT.

The objective of this thesis is therefore to provide the means to define a range of fully coherent and non-truncated higher algebraic structures in type theory while retaining the homotopy interpretation of types. The approach we adopt consists in extending type theory with a universe of polynomial monads. Crucially, the monad structure is defined in such a way that the laws hold definitionally. These structures are enough to define opetopic types: type-valued collections of cells whose geometry is governed by opetopes. Opetopes are many-to-one geometric shapes used in geometric approaches to higher algebra. A construction of opetopes based on polynomial monads known as the Baez-Dolan construction [START_REF] Baez | Higher-dimensional algebra III. ncategories and the algebra of opetopes[END_REF] underlies our approach. Equipped with this structure of opetopic type, we are able to define a number of higher algebraic structures, among them being ∞-groupoids and (∞, 1)-categories. We then develop opetopic methods that we apply to prove elementary facts about our higher algebraic structures.

We have implemented our system in the Agda proof assistant which has been an invaluable assistance in order to develop our ideas. We took advantage of its facilities allowing to postulate new constants and rewriting rules in order that our monads enjoy definitional laws.

Before introducing our approach in greater details, let us pause to see some of the subtleties of coherence definitions in type theory.

Coherence

A subtle consequence of the non-trivial nature of the higher structure of types is that, when one uses identity types to state algebraic laws, one has to do so coherently unless uniqueness of identity proofs (UIP) is assumed. Without these coherence laws, expected mathematical results simply do not hold. For instance, we cannot define the slice category of a category in general. Without UIP, type theory admits models in spaces and intuition of homotopy theory applies. Definitions of algebraic structures therefore become infinitary in their presentation to account for their coherence laws. Let us illustrate this phenomenon with the definition of an associative magma on a type 𝑋. This consists in a binary operation ⊗ : 𝑋 × 𝑋 → 𝑋 satisfying the associative law 𝛼 𝑎,𝑏,𝑐 : (𝑎 ⊗ 𝑏) ⊗ 𝑐 = 𝑎 ⊗ (𝑏 ⊗ 𝑐) for all elements 𝑎, 𝑏, 𝑐 : 𝑋. The definitions does not end here however, as 𝛼 𝑎,𝑏,𝑐 is a piece of data in a proof-relevant setting and its choice can not be arbitrary. It has to be coherent which means that any diagram made of 𝛼 such as the one depicted on Figure 1 must commute. This condition is stated as an identity between the two paths of this diagram. In turn, this new identity can not be arbitrary and must satisfy its own coherence laws leading to an infinite tower of data whose geometry is described by Stasheff polytopes 𝐾 𝑛 .

As an example of the ill-behaved nature of a non-coherent associative law, consider the definition in type theory of the slice category 𝐶/𝑐 where 𝑐 is an object of a category 𝐶. We witness a switch in dimension where the data of dimension 𝑛 of 𝐶/𝑐 uses the (𝑛 + 1)-dimensional data of 𝐶. In particular, when defining the composition in 𝐶/𝑐, one has to make use of the associative law in 𝐶. And when it comes to proving that the composition in 𝐶/𝑐 is associative, we are stuck unless we have the data of the MacLane's pentagon.

Specifying the infinite tower of coherence data in type theory in terms of identity types has proved elusive without the ability to resort to a strict equality which is not subject to these coherence conditions. In particular, this is the approach taken by Voevodsky's homotopy type system (Voevodsky 2013) and two-level type theory [START_REF] Altenkirch | Extending homotopy type theory with strict equality[END_REF]. In this thesis, we pursue another approach consisting in extending type theory with a universe of polynomial monads satisfying their laws definitionally. This lets us specify the necessary coherence data while retaining the homotopy interpretation of types.

Opetopic types

Our approach will consist in defining a higher-dimensional presentation of types as opetopic types. The geometry of opetopic types is governed by opetopes that can also be seen as the terminal opetopic type. Opetopes are geometric shapes, like simplices or globes, that were introduced by Baez and Dolan [START_REF] Baez | Higher-dimensional algebra III. ncategories and the algebra of opetopes[END_REF] in order to define 𝑛-categories. We chose opetopes as they can be defined using cartesian polynomial monads which lend themselves well to a definition in type theory.

Opetopes are many-to-one cells whose (𝑛 + 1)-cells can be seen as relating a source formal composite of 𝑛-cells with a target 𝑛-cell. We understand (𝑛 + 1)opetopic cells as witnessing the composition of pasting diagrams of 𝑛-cells. (𝑛 + 2)-cells then witness the laws satisfied by the composition of 𝑛-cells, (𝑛 + 3)cells witness some additional coherence data that the laws satisfy, and so forth. If enough of these cells exist, in a sense that we will make precise later, we say that the opetopic type is fibrant and we regard it as an infinite-dimensional collection of cells describing a fully coherent algebraic structure.

Let us depict some examples of opetopic cells in order to gain intuition. 0-cells They are the objects of our opetopic types, their depiction is therefore 0-dimensional:

𝑎

𝑏 𝑐 1-cells They relate a single source 0-cell to a single target 0-cell hence their depiction as arrows:

𝑎 𝑏 𝑐

Starting from this dimension we can talk about formal composites of 𝑛-cells named pasting diagrams. In dimension 1 they are just linear trees of arrows such as the following one: We understand these cells as witnessing that a certain pasting diagram of arrows composes to a particular arrow. The geometry of opetopes allows the expression of an unbiased notion of composition. The units will be given by the composition of empty pasting diagrams as depicted in the third case. Unary cells which relate a pair of parallel arrows (i.e., arrows sharing the same source and the same target) are particular cases of opetopic cells. Given that unary cells exist in all dimensions, opetopic types subsume globular types. 2-cells can be assembled into pasting diagrams by gluing the target of a 2-cell to a matching source of another 2-cell as illustrated in the next diagram:

Fibrant opetopic types

We are interested in opetopic types which satisfy the following property: for any pasting diagram of 𝑛-cells, there exists a unique composite 𝑛-cell sharing the same frame. We say that such an opetopic type is fibrant. They are the opetopic types which represent fully coherent algebras.

As an example, such an opetopic type would guarantee the existence of the red data displayed on the following diagram given the black source pasting diagram:

𝑎 𝑏 𝑐 𝑑 𝑒 𝑓 𝑔 ℎ 𝑖
Moreover, the red data formed of the pair comprising the cell ℎ and the cell 𝑖 witnessing that ℎ is a composite of its source pasting diagram is unique. By unique, we mean that the type of pairs, of which (𝑖, ℎ) is a member, is contractible. The notion of contractibility is fundamental in HoTT and is easily defined.

Polynomial monads

Cartesian polynomial monads form the backbone of our system; we will use them to define opetopes. They are at the heart of the so-called Baez-Dolan construction [START_REF] Baez | Higher-dimensional algebra III. ncategories and the algebra of opetopes[END_REF] which was introduced in the setting of operads with the aim of defining 𝑛-categories. Cartesian polynomial monads can be understood as presentations for strongly regular algebraic theories. These are algebraic theories whose equations are constrained in such a way that variables have to appear in both sides without repetition and in the same order [START_REF] Leinster | Structures in higher-dimensional category theory[END_REF]. From now on, we will not systematically specify that our polynomial monads are cartesian even though they always are in order to lighten the notation.

The endofunctor part of the polynomial monad structure is also known as an indexed container in the type theory literature [START_REF] Abbott | Containers: Constructing strictly positive types[END_REF][START_REF] Altenkirch | Indexed containers[END_REF]. They provide a calculus of datatypes used to internalise a large class of inductive datatypes in type theory allowing, for example, the conception of generic algorithms on datatypes.

Polynomial monads lend themselves well to a definition in type theory as indexed families. The data underlying a polynomial endofunctor and that we refer to as a polynomial is described by the following type families and typing function where 𝒰 stands for the universe of types: This data can be regarded as a description of a signature of an algebraic theory: the elements of Idx, which we refer to as indices serve as the sorts of the theory, and for 𝑖 : Idx, the type Cns 𝑖 is the collection of operation symbols whose "output" sort is 𝑖. The type Pos 𝑐 is then the collection of "input positions" of the operation 𝑐 which are themselves assigned an index via the function Typ. In this thesis, we will use a graphical language to depict the constructors of our polynomial monads. A constructor is depicted as a corolla whose output points downward and whose inputs point upward. In the following depiction of a corolla, the constructor is labelled 𝑓 , the inputs are labelled 𝑥 𝑖 for 1 ≤ 𝑖 ≤ 𝑛, and the target is labelled 𝑦. 𝑥 1 . . . 𝑥 𝑛

𝑓 𝑦

For any polynomial functor 𝑃, its constructors can be assembled into finite rooted trees named 𝑃-trees (Figure B.1) provided that for each inner edge, the index of the target and the index of the input of the corresponding constructors match.

The additional structure on a polynomial endowing the induced polynomial endofunctor with a structure of cartesian polynomial monad is specified, in part, by the following operations: η : (𝑖 : Idx) → Cns 𝑖 μ : {𝑖 : Idx} (𝑐 : Cns 𝑖) (𝑑 : (𝑝 : Pos 𝑐) → Cns (Typ 𝑐 𝑝)) → Cns 𝑖 These operations have to satisfy certain laws that we do not detail in this section, but we will comment both operations.

For each index 𝑖 : Idx, there is a unary constructor η 𝑖 : Cns 𝑖 whose input's index is 𝑖. We can depict this constructor as follows: a depth-2 tree such as the one displayed on the left of the following figure. The operation μ then sends this tree to a constructor sharing the same inputs and the same output such as the one depicted on the right. The fact that the input positions as well as their typing is preserved by the operation μ is due to the fact that our monads are cartesian. In addition, the operation μ has to be associative and unital with units specified by the operation η. We emphasize that we will implement our universe of polynomial monads by extending type theory in such a way that these laws hold definitionally.

Plan

We open this thesis by first giving a purely type-theoretical definition of opetopes in a type theory similar to book HoTT in Chapter 1. Our definition essentially defines opetopes as sequences of well-founded trees satisfying some properties which are nicely captured by their typing. The opetopic approach particularly shines in the context of type theory as well-founded trees fall within the realm of inductive types. More specifically, our construction is based on a sequence of polynomial monads, a notion which becomes central in later chapters. We conclude this chapter with an inductive definition of the faces of an opetope. This self-contained chapter is the occasion for the reader to get familiar with opetopes before broaching on opetopic types whose complexity may hide the conceptual simplicity of opetopes.

Equipped with the understanding of opetopes, a simple example of polynomial monads, we then extend type theory with a universe of cartesian polynomial monads ℳ closed under some monad constructors in Chapter 2. We do so in the aim of defining opetopic types, collection of types whose combinatorics is described by opetopes, in Chapter 3. Contrary to our definition of opetopes which only involves sets, opetopic types are valued in arbitrary types. As a consequence, we can no longer state the equational laws of Chapter 1 in a coherent fashion, having no means to do so. We therefore define our universe of polynomial monads in order that these equational laws hold definitionally. The constructors under which our universe is closed then allow us to define, in particular, the sequence of polynomial monads defining opetopes. In addition to this universe which constitutes the core of our addition to type theory, we add two sorts of universes as further extensions. First, we define a family of universes 𝑀 → 𝑚 𝑁 of cartesian monad morphisms from 𝑀 to 𝑁. Then, we define a family of universes ℳ↓ 𝑀 of polynomial monad families over on a monad 𝑀. These two extensions are developed in order to establish some more advanced results in Chapter 3.

Finally, we take advantage of our universe of polynomial monads to define opetopic types in Chapter 3. This enables us to define coherent higher algebraic structures, among which ∞-groupoids and (∞, 1)-categories. Crucially, their higher structure is encoded in terms of identity types. We then establish expected results in order to motivate our definitions. We first compare our definition of fibrant opetopic type with Baez and Dolan definition of "coherent 𝑂-algebras" and show that they are equivalent if we require all morphisms to be invertible. Then, we establish that set-truncated fibrant 𝑀-opetopic types are equivalent to precategories as defined in the HoTT book for some monad 𝑀. We quickly reach for the dependent monads as alluded earlier in order to establish the remaining results. We start by defining fibrations of opetopic types which are a generalisation of fibrant opetopic types then we show that fibrant opetopic types are closed under dependent sums. We also define the universal fibration of types as an opetopic type. Finally, we define Grothendieck (op)fibrations that we use to define Lurie's definition of an adjunction (Lurie 2009, Definition 5.2.2.1) as a bifibration over the interval.

Formalisation

The vast majority of the results presented in this thesis have been formalised in the Agda proof assistant (Agda development team 2022) and can be found at the following address.

Related work

As previously stated, we do not know if it is possible to express the coherences of arbitrary algebraic structures internally to homotopy type theory. Such phenomena are typically handled using a strict equality in set-based mathematics. The reintroduction of a strict equality in type theory in addition to the homotopical one forms the basis of two-level type theory [START_REF] Altenkirch | Extending homotopy type theory with strict equality[END_REF][START_REF] Annenkov | Two-level type theory and applications[END_REF][START_REF] Capriotti | Univalent higher categories via complete semi-segal types[END_REF][START_REF] Kraus | Space-valued diagrams, typetheoretically[END_REF]. Briefly, it consists in internalising homotopy type theory inside a second type theory satisfying the UIP. In such a type theory, we distinguish between the fibrant types belonging to the HoTT fragment and the non-fibrant types which live in the strict fragment. In addition, going back and forth between the two fragments is subject to some constraints. However, one drawback of this approach is that it leads us to abandon the unrestricted interpretation of all types as homotopy types since it does not apply to the non-fibrant fragment. Furthermore, introducing a second type theory in which univalence does not apply undermines the idea that mathematics can be based on homotopy theory. By contrast, our proposal preserves the unrestricted homotopy interpretation of types.

Introduction

Opetopes are geometric shapes intended to capture the combinatorics of manyto-one cells involved in certain definitions of weak 𝑛-categories and ∞-categories which are then defined as opetopic sets satisfying some properties. The 0-cells represent the objects of the categories, the 1-cells represent the morphisms, the 2-cells represent the composition of morphisms, the 3-cells represent the laws satisfied by the composition of morphisms, and so forth.

Opetopes were first introduced by Baez and Dolan [START_REF] Baez | Higher-dimensional algebra III. ncategories and the algebra of opetopes[END_REF] as a construction involving symmetric operads. Hermida, Makkai, and Power then gave their own definition based on generalised multicategories instead of operads and called them multitopes [START_REF] Hermida | On weak higher dimensional categories I: Part 1[END_REF]. Leinster defined opetopes in the more general setting of 𝑇-multicategories where 𝑇 is a cartesian monad [START_REF] Leinster | Structures in higher-dimensional category theory[END_REF]. All these definitions of opetopes were shown to be equivalent by Cheng (Cheng 2004a,b).

Finally, Kock et al. gave a definition of opetopes in the setting of cartesian polynomial monads [START_REF] Kock | Polynomial functors and opetopes[END_REF]) which naturally arise in locally cartesian closed categories (LCCC). They showed that their opetopes are equivalent to Leinster's ones. Our formulation of opetopes in type theory draws from the definition of Kock et al. which lends itself well to this task as type theory admits semantics in LCCC.

All these definitions have in common that opetopes in dimension 𝑛 + 1 are generated from opetopes in dimension 𝑛 by the so-called slice construction which can be adapted to the different mentioned settings.

Diagrammatic depiction of opetopes

We present an informal and diagrammatic depiction of opetopes inspired from Kock's "5-minute definition" of opetopes [START_REF] Kock | Polynomial functors and opetopes[END_REF]. This section aims at giving the reader an intuitive understanding of opetopes. We will give our own formal definition of opetopes in type theory in a further section.

Trees

Our definition will make use of directed finite rooted trees. This means that our trees have a single root that we draw at the bottom. Each node of a tree has a finite number of input edges and a single output edge. Edges which are both an input edge and an output edge are called internal edges. The other edges are drawn with a loose end corresponding to the absence of a source or a target. A single edge which is neither an input edge nor an output edge is a valid tree.

The following are all examples of trees: Blue boxes represent the nodes of our trees while black wires represent their edges. We will sometimes label the nodes and the edges so that we can refer to them. Any tree is endowed with a partial order on the collection of edges with the root being the maximal element and the leaves being minimal elements.

Nestings

We introduce an equivalent representation of trees named nestings. A nesting is a collection of non-intersecting boxes included in the plane endowed with a partial order induced by the inclusion relation. It must have a greatest element -there exists a box in which all the other boxes are included -and the minimal elements are the empty boxes. For the representation to be equivalent to trees, we also have to distinguish a subset of the minimal elements which correspond to the root edges of the nodes of the corresponding tree having no source.

The following nestings correspond to the four trees depicted in the previous section in a sense that we will soon make precise.

Here, we have chosen to draw the distinguished subset of empty boxes in green.

Correspondences

A correspondence between a tree and a nesting consists in an isomorphism between the boxes of the nesting and the edges of the tree. This isomorphism has to satisfy the following properties:

• The unmarked empty boxes are in bijection with the leaves of the tree.

• The isomorphism has to preserve the partial orders.

An example of correspondence between a nesting and a tree is the following:

𝑓 𝑐 𝑎 𝑏 𝑑 𝑒 𝑎 𝑏 𝑒 𝑓 𝑐 𝑑
Here, the data of the correspondence is visible through the labelling.

Subdivisions

We call subdivision the superposition of a nesting with a tree which satisfies the following properties:

• The unmarked empty boxes of the nesting are the nodes of the tree.

• The content of the other boxes must form a tree.

Note that these requirements force marked empty boxes to contain a single edge otherwise they would not be empty.

An example of such a subdivision is displayed in the following diagram:

𝑓 𝑐 𝑎 𝑏 𝑑 𝑒
We will not mark the boxes of the nesting of a subdivision in the future as this information is already conveyed by the fact that these boxes are the ones containing a single edge. Subdivisions are called that way as they correspond to nested subdivisions of a tree.

Subdivision pairings

We define a subdivision pairing to be two subdivisions such that the nesting of the first subdivision and the tree of the second subdivision are in correspondence. Such a situation is depicted in the following diagram:

𝑓 𝑐 𝑎 𝑏 𝑑 𝑒 𝑘 𝑗 𝑔 ℎ 𝑖
In the following diagram, we forget the tree of the first subdivision and the nesting of the second one to make the connection clearer. In doing so, we mark one node of the first nesting to remember that it used to contain a single edge.

𝑓

Opetopes

Opetopes are non-empty sequences of subdivisions such that two consecutive subdivisions form a subdivision pairing. Moreover, the first subdivision does not contain any tree, and is a single box if the sequence is of length 1 or is a linear nesting otherwise. The last subdivision of a sequence of length greater than one is a tree with a single node and no nesting. A sequence of 𝑛 such subdivisions denotes an opetope of dimension 𝑛 -1. We will also refer to opetopes of dimension 𝑛 as 𝑛-opetopes. We name the leaves of the last tree in the sequence the sources of the opetope while its root is called the target of the opetope. We now illustrate this definition by presenting some examples of opetopes.

The object There is a single opetope of dimension 0 called the object.

The object has no source nor target. It is a nesting consisting of a single empty box.

The arrow There is a single opetope of dimension 1 called the arrow.

𝑏 𝑎 𝑐

Boxes constituting an opetope are called faces and each corresponds to an opetope. For example, the arrow has three faces. Its top face 𝑐 is the arrow itself while both its source 𝑎 and its target 𝑏 are objects. We will often conflate the face of an opetope with the opetope it denotes.

A more common depiction of the arrow is the following:

𝑎 𝑏

𝑐

The 2-simplex The 2-simplex (a triangle) is then defined as follows, taking the second tree to be a linear tree with two nodes:

𝑐 𝑏 𝑎 𝑓 𝑑 𝑒 𝑔
The 2-simplex is more commonly depicted as a triangle:

𝑏 𝑎 𝑐 𝑒 𝑓 𝑑 𝑔
Note that the second tree will always be linear as the order of the first nesting is linear.

Loops Starting from dimension 2, we can have loops which are arrows having same source and target whose filler is witnessed by a higher-dimensional face with no source:

𝑎 𝑏 𝑐

The loop is usually depicted as a loop whence its name:

𝑎 𝑏 𝑐
One last example Our interest in opetopes stems from the fact that opetopes capture the combinatorics of the higher dimensional laws that the composition of faces has to satisfy. We therefore expect to be able to denote a particular way of composing three unary faces for example. The following opetope of We see that we are hitting the limits of the geometric depiction of opetopes, it is cumbersome to draw them in higher dimensions. The advantage of our notation is that it scales to any dimension due to the uniform nature of our trees: they are trees all the way up.

Faces of an opetope

We refer to the different boxes of a sequence of subdivisions forming an opetope as its faces. To each face corresponds an opetope that we can directly extract from the sequence. To illustrate this fact, we represent an opetope where we have highlighted the opetope corresponding to its face 𝑘:

𝑑 𝑐 𝑏 𝑎 𝑖 𝑔 𝑒 𝑓 ℎ 𝑙 𝑘 𝑗 𝑚
Note that the opetope corresponding to the face 𝑚 is the whole opetope, we also say that 𝑚 is its top face. We will often refer to an opetope using the name of its top face. We briefly describe how we obtained the highlighted opetope corresponding to the face 𝑘. First, we consider the corolla labelled 𝑘 which will become the last subdivision of the new opetope we wish to create. Then, we proceed to determine the preceding subdivisions by decreasing dimension.

Consider the edges touching 𝑘, they correspond to the faces 𝑔, ℎ, and 𝑖. The second subdivision then forgets the faces 𝑒 and 𝑓 , and the face 𝑔 becomes a node of a linear tree whose other node is ℎ. Finally, consider the edges of this tree, they correspond to the faces 𝑎, 𝑐, and 𝑑 forming a linear nesting. The sequence of subdivisions that we just obtained represents the opetope associated with the face 𝑘.

Grafting of opetopes

𝑛-opetopes can be pasted together along a matching (𝑛 -1)-face -it is possible to paste along faces of lower dimension, but we will not cover this case here. We name pasting diagram the result of such a pasting. Consider the following two opetopes: The last diagram is the result of the graft of the corolla 𝑗 on the corolla 𝑘 along the common face 𝑔. The subdivision of dimension 1 has been obtained from the corresponding subdivision of the opetope 𝑘 by substituting the corresponding subdivision of the opetope 𝑗 for the face 𝑔. Finally, the subdivision of dimension 0 has been obtained from the corresponding subdivision of the opetope 𝑘 by substituting the corresponding subdivision of the opetope 𝑗 for the face 𝑐 along with the content of its corresponding box.

𝑐

Notably, any opetope can be regarded as a pasting diagram with a single node corresponding to its top face.

Composition of opetopes

Given a pasting diagram of opetopes, there exists a unique composite which is obtained by contracting the nodes of the tree in the last dimension and by deleting the boxes of the subdivision corresponding to the inner edges which have been removed. The composition is witnessed by a unique higher-dimensional face -its filler -whose sources are in correspondence with the nodes of the tree and whose target is the composite.

We illustrate the composition with the following pasting diagram:

𝑑

Opetopes in type theory

We now give a formal definition of opetopes in type theory. We will first introduce the different signatures before giving the precise definitions. We will define opetopes as the types of a sequence of cartesian polynomial monads. The data defining opetopes is summarised in Figure 1.1 while the operations of the monad structure are summarised in Figure 1.2. We will have more to say about polynomial monads in Chapter 2. We briefly comment each type. The type 𝒪 𝑛 is the type of opetopes of dimension 𝑛. The type 𝒫 𝑜 is the type of pasting diagrams which compose to the opetope 𝑜. The type Pos 𝑥 is the type of node locations of the pasting diagram 𝑥. The opetope Typ 𝑥 𝑝 is then the opetope corresponding to the node of 𝑥 located at position 𝑝.

Defining the different types and their operations is a little involved due to their mutual dependency. The definition of opetopes will then follow the following plan:

1. Definition of opetopes (Section 1.3.1).

Definition of pasting diagrams (Section 1.3.2).

3. Definition of positions (Section 1.3.3).

4. Informal presentation of the monad structure (Section 1.3.5).

Specification of positions operations

Definition of opetopes

We define opetopes of dimension 𝑛 as sequences of trees of length 𝑛 + 1 as we did in the informal presentation. where the underscores indicate that _⊳_ is a left-associative infix operator which, when applied to the arguments 𝑥 and 𝑦, will be written 𝑥 ⊳ 𝑦.

Opetopes are either the object ob or an opetope of the form 𝑥 ⊳ 𝑦. The object has no source nor target while opetopes of the form 𝑥 ⊳ 𝑦 have a collection of sources specified by Pos 𝑦 -the type of positions of the pasting diagram 𝑦and a single target 𝑥. The typing ensures that 𝑦 is parallel to 𝑥 in that they share the same sources and the same target.

Definition of pasting diagrams

Before defining pasting diagrams, we introduce some notations to denote two different kind of families of pasting diagrams. Suppose that 𝑛 is the top face of the opetope 𝑥 and that the tree inside it is the parallel pasting diagram 𝑦. We regard a family -→ 𝒫 𝑦 as specifying a family of pasting diagrams indexed by the nodes ℎ, 𝑘, and 𝑚 that we displayed here inside their indexing opetope surrounding the pasting diagram 𝑦.

We introduce a second notation for families of pasting diagrams in the next dimension.

Notation

- → 𝒫 𝑦} → - → 𝒫 (𝑦 ◀ 𝑧) → 𝒫 (𝑥 ⊳ μ 𝑦 𝑧)
This definition involves the operations η and μ that will be explained later. We comment the role of each constructor. The constructor ob-pd corresponds to the unique pasting diagram made of the unique opetope ob of dimension 0. The leaf constructor lf 𝑜 is the empty pasting diagram made of a single edge whose source and target are both the opetope 𝑜. Finally, nd 𝑥 𝑦 𝑡 is the pasting diagram obtained from grafting the family of pasting diagrams 𝑡 indexed by the positions of 𝑦 on the sources of the opetope 𝑥 ⊳ 𝑦. We will write nd (𝑥 ⊳ 𝑦) 𝑡 instead of nd 𝑥 𝑦 𝑡 to stress that the root node of this pasting diagram is the opetope 𝑥 ⊳ 𝑦.

Definition of positions

For any pasting diagram 𝑡 : 𝒫 𝑜, the type Pos 𝑡 is the type of paths in 𝑡 from its root to its different nodes. To summarise, the unique pasting diagram made of the object has a single node. Leaves have no nodes therefore they have no node positions. Finally, a node position of a tree built from the nd constructor is either the position of its root node or the position of one of the nodes specified by the family of trees grafted on the root node.

For example, the position of the node 𝑗 in the following tree which has been highlighted in red is denoted by the term inr (𝑝 𝑒 , inr (𝑝 𝑑 , inl ★)) where 𝑝 𝑒 is the position of the source of 𝑚 corresponding to the edge 𝑒 and where 𝑝 𝑑 is the position of the source of 𝑘 corresponding to the edge 𝑑.

Inductive representation of opetopes

We now clarify the link between our type-theoretical definition of opetopes and their diagrammatic representation so that we can give some examples. We describe a depiction of opetopes by induction on opetopes and on their pasting diagrams.

We begin with the representation of pasting diagram by enumerating the three different possible cases.

• The object pasting diagram ob-pd is the unique pasting diagram composed of the object ob. We depict it as a box:

• Leaves lf 𝑜 are depicted as a single edge:

• Nodes nd (𝑥 ⊳ 𝑦) 𝑡 are depicted as trees that we recursively draw as follows.

First, we draw a node standing for the root node 𝑥 ⊳ 𝑦. Then, we recursively graft the trees 𝑡 𝑝 on the root node for each position 𝑝 : Pos 𝑦 using the present algorithm. The following figure illustrates an example of this case with a root node and two recursively grafted trees on its two positions: a leaf and a single node.

Opetopes We depict opetopes as a sequence of diagrams by recursion on their dimension.

• The first base case is the object ob; it is depicted as a box.

• The second base case is the arrow ob ⊳ ob-pd. We first draw the object ob then we draw the pasting diagram ob-pd in the object resulting in two stacked boxes. Finally, we add a corolla with a single source corresponding to the unique position of ob-pd.

• The inductive case corresponds to opetopes of shape 𝑥 ⊳ 𝑦 ⊳ 𝑧 where 𝑧 is a pasting diagram parallel to the opetope 𝑥 ⊳ 𝑦. The induction hypothesis tells us how to depict 𝑥 ⊳ 𝑦. The last diagram of the depiction of 𝑥 ⊳ 𝑦 is a corolla. As 𝑧 is parallel to 𝑥 ⊳ 𝑦, we can depict it inside that corolla as it shares its sources with the opetope it is parallel to. Then, we add a corolla to the sequence whose sources are in correspondence with the positions of the pasting diagram 𝑧. Now, an alteration of the diagram representing 𝑦 has to be performed. We start by erasing the tree while preserving its enclosing corolla then we distinguish two cases:

-If 𝑧 is of the form lf 𝑜 then we are done.

-If 𝑧 is of the form nd (𝑎 ⊳ 𝑏) 𝑡, we draw the pasting diagram 𝑏 in the empty corolla. Finally, we recursively fill each node of 𝑏 at position 𝑝 according to the data of 𝑡 𝑝 by considering the two cases presently listed.

The resulting tree is exactly 𝑦, but the diagram contains additional boxes forming a subdivision revealing where the successive substitutions took place according to the data of 𝑧.

We illustrate this last case with a few examples. Consider the loop ob ⊳ ob-pd ⊳ lf 𝑜

We start with the representation of the arrow ob ⊳ ob-pd.

We add the leaf to the last corolla.

We then add a corolla with no source as leaves have no nodes.

Finally, we alter the first diagram by removing its pasting diagram. We then reach the lf case of our algorithm and we stop.

We consider another example: the 2-simplex ob ⊳ ob-pd ⊳ 𝑡 where

𝑡 :≡ nd (ob ⊳ ob-pd) (𝜆𝑝 → nd (ob ⊳ ob-pd) (𝜆𝑞 → lf (Typ ob-pd 𝑞)))
We start with the representation of the arrow ob ⊳ ob-pd and we draw 𝑡 in its last diagram which gives us:

Then, we add a corolla whose sources are in correspondence with the nodes of 𝑡.

We finally have to alter the first diagram according to the data specified by 𝑡. We start by erasing ob-pd and keeping its enclosing box. The pasting diagram 𝑡 being equal to nd (ob ⊳ ob-pd) 𝑡 ′ for some tree 𝑡 ′ , we draw ob-pd in the empty box. Now, for each position of 𝑝 : Pos ob-pd, we recursively draw the appropriate trees according to the data of 𝑡 ′ 𝑝 by following the steps of our algorithm. There is only one such position which leads us to first add ob-pd again then we reach the lf case and we are done. We depict the changes of this first diagram over time:

The resulting diagram is therefore:

Informal presentation of the monad structure

We discuss the informal specification of the operations of Figure 1.2, and illustrate them in order that the reader understand their role in the definition of pasting diagrams. We will only define them after having introduced some further operations corresponding to the fact that the monad structure is cartesian. Note that opetopes being entirely determined by the last pasting diagram in their sequence, operations on pasting diagrams can be regarded as operations on opetopes too. We will stress this matter by illustrating the two perspectives using our graphical depiction of trees and opetopes.

The operation η

The operation η takes an opetope 𝑜 and returns the tree whose sole node is the opetope 𝑜. Its signature is η : {𝑛 : N} (𝑜 : 𝒪 𝑛) → 𝒫 𝑜 We display η 𝑜 as a corolla, just like the top face of the opetope 𝑜 itself.

. . .

𝑜

The pasting diagram η 𝑜 determines the opetope 𝑜 ⊳ η 𝑜.

. . . 𝑜 . . .

𝑜 𝑜 ⊳ η 𝑜

Here we chose to label the faces with the opetopes they correspond to. Also, we have only drawn the last two diagrams of the opetope, omitting the first ones.

The operation μ

The operation μ substitutes a family of pasting diagrams for the nodes of another pasting diagram. It is associative with unit η, but we delay the precise statement of the laws as they require the introduction of some further operations. We recall its signature where we suppose that 𝑛 is the top face of the opetope 𝑜, where 𝑡 is the tree enclosed in the face labelled 𝑛, and where the family 𝑢 is represented as the three trees indexed by the opetopes ℎ, 𝑘, and 𝑚 corresponding to the three nodes of 𝑡. Here, we have chosen to draw each tree along with their indexing opetope enclosing them.

Another way to depict this data is to draw the trees specified by 𝑢 in the nodes of 𝑡: If, instead, we consider the opetopes determined by 𝑡 and 𝑢, the arguments of μ, we can regard them as specifying a depth-2 tree of opetopes whose root opetope is 𝑜 ⊳ 𝑡 and whose opetopes grafted on 𝑜 ⊳ 𝑡 at position 𝑝 are Typ 𝑡 𝑝 ⊳ 𝑢 𝑝. Illustrating this perspective with our running example, the opetope 𝑜 ⊳ 𝑡 is the following one: This operation preserves the sources and the target. Finally, the operation μ is associative and unital with units given by η. Being unital means that substituting the nodes of a tree with corollas made of these same nodes does nothing. Being associative means that the order in which we apply different substitutions does not matter. We will only illustrate the left unitality and the right unitality of μ respectively.

Chapter 1. Opetopes in type theory The definition of the operation μ will involve a further operation:

γ : {𝑛 : N} {𝑥 : 𝒪 𝑛} {𝑦 : 𝒫 𝑥} {𝑧 : - → 𝒫 𝑦} → (𝑡 : 𝒫 (𝑥 ⊳ 𝑦)) (𝑢 : - → 𝒫 (𝑦 ◀ 𝑧)) → 𝒫 (𝑥 ⊳ μ 𝑦 𝑧)
The operation γ takes a tree 𝑡 and a family of trees 𝑢 whose targets match the sources of the former and grafts the latter on the leaves of the former.

We consider the opetope 𝑥 ⊳ 𝑦 and the family of opetopes Typ 𝑦 𝑟 ⊳ 𝑧 𝑟 for any position 𝑟 : Pos 𝑦 as specifying a depth-2 tree of opetopes constituting the indexing data for the trees we want to graft. We illustrate the action of γ on an example and represent the depth-2 tree as follows:

𝑎 𝑏 𝑓 𝑙 𝑚 𝑝 ℎ 𝑒 𝑓
We suppose that 𝑝 is the top face of the opetope 𝑥 ⊳ 𝑦 and that the two other nodes are the top faces of the opetopes Typ 𝑦 𝑟 ⊳ 𝑧 𝑟 for each position 𝑟.

Second, the tree 𝑡 on which the grafting will take place is indexed by the opetope 𝑥 ⊳ 𝑦. Therefore, we depict this tree in its indexing opetope: Note that we used the fact that the operation μ is itself left and right unital as the opetopes indexing the leaves are of the form 𝑜 ⊳ η 𝑜. Finally, the operation γ is also associative in that the order in which we perform multiple graftings does not matter.

Specification of positions operations

We will now introduce some operations witnessing that positions along with their typing information are compatible with the algebraic structure of pasting diagrams. This is due to the fact that we are defining cartesian monads. Once again we will only present the signatures of these operations along with their laws and delay their definitions until later.

Operations relative to Pos (η 𝑥)

Given an opetope 𝑥, the pasting diagram η 𝑥 has a single node which is 𝑥 itself. Its type of positions, Pos (η 𝑥), should therefore be equivalent to the unit type. This leads us to state the following operations reminiscent of the introduction and elimination rules for the unit type: The position pos η 𝑥 is the unique position of the pasting diagram composed of the single opetope 𝑥. As for the elimination rule for Pos (η 𝑥), it states that pos η 𝑥 is its unique element. The elimination rule applied to the introduction rule satisfies the following identity:

Pos-η-elim 𝑥 𝐴 𝑎 pos η (pos η 𝑥) = 𝑎 pos η (Pos-η-elim-𝛽)
Finally, the typing information is compatible with η and it is the case that Typ (η 𝑥) (pos η 𝑥) = 𝑥. As the type of positions of η 𝑥 is contractible, we have the more general rule:

Typ (η 𝑥) 𝑝 = 𝑥 (pos η -typ)
Operations relative to Pos (μ 𝑥 𝑦)

The positions operations relative to trees of the form μ 𝑥 𝑦 implement the cartesian structure of our monads. The operation μ substitutes compatible trees specified by a family of trees 𝑦 for the nodes of a given tree 𝑥. The type of positions of the resulting tree μ 𝑥 𝑦 should therefore be equivalent to the sum of the positions of the trees specified by 𝑦. Therefore, we want the positions of a tree of the form μ 𝑥 𝑦 to be characterised by the following requirements:

1. Any position 𝑝 : Pos 𝑥 along with a position 𝑞 : Pos (𝑦 𝑝) should determine a unique position of μ 𝑥 𝑦.

2. Any position of μ 𝑥 𝑦 should correspond to a position 𝑝 : Pos 𝑥 along with a position Pos (𝑦 𝑝).

3. Moreover, the induced functions should be inverse to each other.

These desiderata are captured by the following operations:

pair μ (pr μ 1 𝑝) (pr μ 2 𝑝) = 𝑝 (pair μ -𝜂) pr μ 1 (pair μ 𝑝 𝑞) = 𝑝 (pr μ 1 -𝛽) transport 𝜆𝑝→Pos (𝑧 𝑝) pr μ 1 -𝛽 (pr μ 2 (pair μ 𝑝 𝑞)) = 𝑞 (pr μ 2 -𝛽)
where we refer to pr μ 1 -𝛽 in the last equation without making explicit how we instance it, a practice we will adopt throughout this thesis.

Note how these operations along with their laws mirror the introduction and elimination rules of sigma types to the difference that the laws only hold propositionally. We have chosen to grey the transport out in order not to obfuscate the meaning of the law. We also state how the typing operation behave with regard to the substitution:

Typ (μ 𝑥 𝑦) 𝑝 = Typ (𝑦 (pr μ 1 𝑝)) (pr μ 2 𝑝) (μ-pos-typ)
In other words, the correspondence between positions under the substitution operation extends to their typing information. In future proofs we will often need the following identity that can be deduced from μ-pos-typ, pr The operation γ grafts a family of trees 𝑢 : -→ 𝒫 (𝑦 ◀ 𝑧) on the leaves of a given tree 𝑡 : 𝒫 (𝑥 ⊳ 𝑦). The type of positions of the resulting tree should be equivalent to the sum of the positions of 𝑡 with the sum of the positions of the trees specified by the family 𝑢. Therefore, we want the positions of a tree of the form γ 𝑡 𝑢 to be characterised by the following requirements:

1. For any position 𝑝 : Pos 𝑡, we can obtain a position of γ 𝑡 𝑢.

2. For any position 𝑝 : Pos 𝑦 along with a position 𝑞 : Pos (𝑢 𝑝), we can obtain a position of γ 𝑡 𝑢.

3. For any position 𝑝 : Pos (γ 𝑡 𝑢), we can either deduce a position of 𝑡 or we can deduce a position of 𝑢 𝑝 for some position 𝑝 : Pos 𝑦.

Formally, these desiderata are captured by the following operations:

Pos-γ-elim 𝐴 𝑎 inl 𝑎 inr (inl γ 𝑝) = 𝑎 inl 𝑝 (Pos-γ-elim-inl-𝛽) Pos-γ-elim 𝐴 𝑎 inl 𝑎 inr (inr γ 𝑝 𝑞) = 𝑎 inr 𝑝 𝑞 (Pos-γ-elim-inr-𝛽)
Finally, the correspondence between positions extends to the typing information:

Typ (γ 𝑡 𝑢) (inl γ 𝑝) = Typ 𝑡 𝑝 Typ (γ 𝑡 𝑢) (inr γ 𝑝 𝑞) = Typ (𝑢 𝑝) 𝑞

Definition of the monad structure

At last, we can define the monad structure. We start with the unit of the substitution operation.

Definition 1.3.5 (The unit η). The unit η has type

η : {𝑛 : N} (𝑥 : 𝒪 𝑛) → 𝒫 𝑥
It is defined by induction on 𝑥.

• If 𝑥 is of the form ob, we simply return ob-pd : 𝒫 ob, the object pasting diagram.

• If 𝑥 is of the form 𝑥 ⊳ 𝑦, we need to return a tree of type 𝒫 (𝑥 ⊳ 𝑦). We denote 𝑡 :≡ nd (𝑥 ⊳ 𝑦) (𝜆𝑝 → lf (Typ 𝑦 𝑝))

the tree with opetope 𝑥 ⊳ 𝑦 for sole node. It has type

𝒫 (𝑥 ⊳ μ 𝑦 (𝜆𝑝 → η (Typ 𝑦 𝑝)))
therefore we transport it along a path μ 𝑦 (𝜆𝑝 → η (Typ 𝑦 𝑝)) = 𝑦 which holds by μ-unit-r.

We then define the substitution operation.

Definition 1.3.6 (The substitution operation μ). The operation μ has type μ : {𝑛 : N} {𝑥 : 𝒪 𝑛} (𝑦 : 𝒫 𝑥) (𝑧 :

- → 𝒫 𝑦) → 𝒫 𝑥
The operation μ substitutes the opetopes of a pasting diagram 𝑦 -its nodes -with compatible pasting diagrams provided by the family 𝑧. It is defined by induction on 𝑦:

• If 𝑦 is ob-pd, we substitute the tree 𝑧 ★ for the only position of ob-pd therefore we simply return 𝑧 ★.

• If 𝑦 is of the form lf 𝑥, leaves have no node therefore there is nothing to substitute, and we just return the tree lf 𝑥 intact.

• If 𝑦 is of the form nd (𝑥 ⊳ 𝑦) 𝑢 with 𝑢 :

-→ 𝒫 (𝑦 ◀ 𝑡) for some family 𝑡 :

-→ 𝒫 𝑦, we have to define a tree of type 𝒫 (𝑥 ⊳ μ 𝑦 𝑡) which should be the tree nd (𝑥 ⊳ 𝑦) 𝑢 whose nodes have been recursively substituted with compatible trees specified by the family 𝑧. Therefore, the resulting tree should be the result of the grafting of the family

𝑣 𝑝 :≡ μ (𝑢 𝑝) (𝜆𝑞 → 𝑧 (inr (𝑝, 𝑞)))
-which is our induction hypothesis -on the tree 𝑧 (inl ★); that is, the tree γ (𝑧 (inl★)) 𝑣

We finally state the laws obeyed by the operation μ which is an associative and unital operation with unit η,

μ 𝑦 (𝜆 𝑝 → η (Typ 𝑦 𝑝)) = 𝑦 (μ-unit-r) transport 𝒫 pos η -typ -1 (μ (η 𝑥) 𝑦) = 𝑦 (pos η 𝑥) (μ-unit-l) μ (μ 𝑦 𝑧) 𝑤 = μ 𝑦 (𝜆 𝑝 → μ (𝑧 𝑝) (𝑤 ′ 𝑝)) (μ-assoc)
where 𝑤 ′ 𝑝 𝑞 :≡ transport 𝒫 μ-pos-typ-aux (𝑤 (pair μ 𝑝 𝑞))

We define the grafting operation γ.

Definition 1.3.7 (The grafting operation γ). The operation γ has type γ : {𝑛 : N} {𝑥 : 𝒪 𝑛} {𝑦 : 𝒫 𝑥} {𝑧 :

- → 𝒫 𝑦} → (𝑡 : 𝒫 (𝑥 ⊳ 𝑦)) (𝑢 : - → 𝒫 (𝑦 ◀ 𝑧)) → 𝒫 (𝑥 ⊳ μ 𝑦 𝑧)
The operation γ grafts the family of trees 𝑢 on the leaves of the tree 𝑡 which are determined by the positions of the tree 𝑦. This operation is defined inductively on 𝑡.

• In the case γ (lf 𝑥) 𝑡, where 𝑡 : -→ 𝒫 (η 𝑥 ◀ 𝑦), the result of grafting the sole tree specified by 𝑡 at position pos η 𝑥 on the leaf lf 𝑥 should precisely be the tree 𝑡 (pos η 𝑥). We conclude the proof by transporting it along a path

𝒫 (Typ (η 𝑥) (pos η 𝑥) ⊳ 𝑦 (pos η 𝑥)) = 𝒫 (𝑥 ⊳ μ (η 𝑥) 𝑦)
deduced from pos η -typ and μ-unit-l:

transport 𝜆(𝑥,𝑦)→𝒫 (𝑥⊳𝑦) (pair= pos η -typ -1 μ-unit-l) -1 (𝑡 (pos η 𝑥))

• In the case γ (nd (𝑥 ⊳ 𝑦) 𝑡) 𝑢, with 𝑡 : 𝒫 (𝑦 ⊳ 𝑧) and 𝑢 : 𝒫 (μ 𝑦 𝑧 ◀ 𝑤), the root node of the resulting tree will still be 𝑥 ⊳ 𝑦. We are therefore looking for some tree nd (𝑥 ⊳ 𝑦) 𝑣 where 𝑣 is a family resulting from the grafting of the family 𝑢 on the family 𝑡.

In order to graft on the family 𝑡, we need a family of families -→ 𝒫 (𝑡 𝑝 ◀ 𝑤 ′ 𝑝)

indexed by positions 𝑝 : Pos 𝑦 where the family 𝑤 ′ has yet to be defined. Such a family of families can be defined from 𝑢 as 𝑢 ′ 𝑝 𝑞 :≡ transport 𝜆(𝑥,𝑦)→𝒫 (𝑥⊳𝑦) (pair= μ-pos-typ-aux refl) (𝑢 (pair μ 𝑝 𝑞))

where 𝑢 (pair μ 𝑝 𝑞) is transported along a path

𝒫 (Typ (μ 𝑦 𝑧) (pair μ 𝑝 𝑞) ⊳ 𝑤 (pair μ 𝑝 𝑞)) = 𝒫 (Typ (𝑧 𝑝) 𝑞 ⊳ 𝑤 ′ 𝑝 𝑞)
using μ-pos-typ-aux. This forces the definition of 𝑤 ′ to be 𝑤 ′ 𝑝 𝑞 :≡ transport 𝒫 μ-pos-typ-aux (𝑤 (pair μ 𝑝 𝑞))

We therefore obtain the family

𝑣 : - → 𝒫 (𝑦 ◀ (𝜆𝑝 → μ (𝑧 𝑝) (𝑤 ′ 𝑝))) 𝑣 𝑝 :≡ γ (𝑡 𝑝) (𝑢 ′ 𝑝)
The resulting tree nd (𝑥 ⊳ 𝑦) 𝑣 has type 𝒫 (𝑥 ⊳ μ 𝑦 (𝜆𝑝 → μ (𝑧 𝑝) (𝑤 ′ 𝑝)))

where we need it to have type 𝒫 (𝑥 ⊳ μ (μ 𝑦 𝑧) 𝑤). We therefore conclude the proof by performing a last transport along a proof of associativity of μ transport 𝜆𝑦→𝒫 (𝑥⊳𝑦) μ-assoc -1 (nd (𝑥 ⊳ 𝑦) 𝑣)

Finally, we state the laws obeyed by the operation γ which is associative and unital with unit lf,

transport 𝜆𝑦→𝒫 (𝑥⊳𝑦) μ-unit-r (γ-unit-r) (γ 𝑡 (𝜆𝑝 → lf (Typ 𝑦 𝑝))) = 𝑡 for all 𝑡 : 𝒫 (𝑥 ⊳ 𝑦) transport 𝜆(𝑥,𝑦)→𝒫 (𝑥⊳𝑦) (pair= pos η -typ -1 μ-unit-l) (γ-unit-l) (γ (lf 𝑥) 𝑡) = 𝑡 (pos η 𝑥) for all 𝑡 : - → 𝒫 (η 𝑥 ◀ 𝑦) transport 𝜆𝑦→𝒫 (𝑥⊳𝑦) μ-assoc (γ-assoc) (γ (γ 𝑡 𝑢) 𝑣) = γ 𝑡 (𝜆𝑝 → γ (𝑢 𝑝) (𝑣 ′ 𝑝))
for all 𝑡 : 𝒫 (𝑥 ⊳ 𝑦), 𝑢 : -→ 𝒫 (𝑦 ◀ 𝑧), 𝑣 :

-→ 𝒫 (μ 𝑦 𝑧 ◀ 𝑤), and where 𝑣 ′ 𝑝 𝑞 :≡ transport 𝜆(𝑥,𝑦)→𝒫 (𝑥⊳𝑦) (pair= μ-pos-typ-aux refl) (𝑣 (pair μ 𝑝 𝑞))

Definition of the positions operations

Now that we have defined the different operations relative to pasting diagrams as well as the type of their positions, we can define the operations on their positions. We start with two simple lemmas that will be needed throughout this chapter and which essentially state that positions of trees are invariable under transport. For any tree 𝑡 : 𝒫 𝑥 and any identity 𝑝 : 𝑥 = 𝑦,

Pos 𝑡 = Pos (transport 𝒫 𝑝 𝑡) (Pos-transp 𝒪 )
For any tree 𝑡 : 𝒫 (𝑥 ⊳ 𝑦) and any identity 𝑝 : 𝑦 = 𝑧,

Pos 𝑡 = Pos (transport 𝜆𝑦→𝒫 (𝑥⊳𝑦) 𝑝 𝑡) (Pos-transp 𝒫 )
They are both proven by a simple induction on 𝑝.

We also define two functions akin to elimination rules for types of the form Pos (transport 𝜆𝑦→𝒫 (𝑥⊳𝑦) 𝑝 𝑡) and Pos (transport 𝜆(𝑥,𝑦)→𝒫 (𝑥⊳𝑦) 𝑝 𝑡) in order to reduce the need for annoying transports.

Pos-transp 𝒪 -elim : {𝑛 : N} {𝑥 0 𝑥 1 : 𝒪 𝑛} {𝑦 0 : 𝒫 𝑥 0 } {𝑦 1 : 𝒫 𝑥 1 } → (𝑒 : (𝑥 0 , 𝑦 0 ) = (𝑥 1 , 𝑦 1 )) → (𝑡 : 𝒫 (𝑥 0 ⊳ 𝑦 0 )) → (𝐴 : Pos (transport 𝜆(𝑥,𝑦)→𝒫(𝑥⊳𝑦) 𝑒 𝑡) → 𝒰) → ( 𝑓 : (𝑝 : Pos 𝑡) → 𝐴 (transport Pos-transp 𝒪 𝑝)) → (𝑝 : Pos (transport 𝜆(𝑥,𝑦)→𝒫(𝑥⊳𝑦) 𝑒 𝑡)) → 𝐴 𝑝 Pos-transp 𝒫 -elim : {𝑛 : N} {𝑥 : 𝒪 𝑛} {𝑦 𝑧 : 𝒫 𝑥} (𝑒 : 𝑦 = 𝑧) → (𝑡 : 𝒫 (𝑥 ⊳ 𝑦)) → (𝐴 : Pos (transport 𝜆𝑦→𝒫(𝑥⊳𝑦) 𝑒 𝑡) → 𝒰) → ( 𝑓 : (𝑝 : Pos 𝑡) → 𝐴 (transport Pos-transp 𝒫 𝑝)) → (𝑝 : Pos (transport 𝜆𝑦→𝒫(𝑥⊳𝑦) 𝑒 𝑡)) → 𝐴 𝑝
They are both trivially defined by an induction on the path 𝑒 in which case it suffices to return 𝑓 𝑝.

Operations relative to Pos (η 𝑥)

We start by showing that the type of positions of η 𝑥 is contractible for any opetope 𝑥 : 𝒪 𝑛 which will allow us to derive the introduction and elimination rules for Pos (η 𝑥).

Lemma 1.3.8. For any natural number 𝑛 : N and any opetope 𝑥 : 𝒪 𝑛, the type

Pos (η 𝑥) is contractible.
Proof. We prove this property by induction on the opetope 𝑥. If 𝑥 is of the form ob, η ob is the object pasting diagram ob-pd and its type of positions is the unit type 1 which is contractible. If 𝑥 is of the form 𝑥 ⊳ 𝑦, the unit η (𝑥 ⊳ 𝑦) is the tree

𝑡 :≡ nd (𝑥 ⊳ 𝑦) (𝜆 𝑝 → lf (Typ 𝑦 𝑝))
up to a transport along the path μ-unit-r. It is easy to show that the type Pos 𝑡 is equivalent to 1 and is therefore contractible. It suffices to transport this result along a path Pos 𝑡 = Pos (η (𝑥 ⊳ 𝑦)) to conclude that Pos (η (𝑥 ⊳ 𝑦)) is contractible as well.

□

We use the previous result to define pos η 𝑥 to be the centre of contraction of Pos (η 𝑥). As for the elimination rule, we first recall its signature:

Pos-η-elim : {𝑛 : N} (𝑜 : 𝒪 𝑛) (𝐴 : Pos (η 𝑜) → 𝒰) → (𝑎 pos η : 𝐴 (pos η 𝑜)) (𝑝 : Pos (η 𝑜)) → 𝐴 𝑝
We simply define it by transporting 𝑎 pos η from 𝐴 (pos η 𝑜) to 𝐴 𝑝 using the path from the centre of contraction of Pos (η 𝑜) to any position 𝑝 : Pos (η 𝑜). Also, the operation Pos-η-elim satisfies the law

Pos-η-elim 𝑥 𝐴 𝑎 pos η (pos η 𝑥) = 𝑎 pos η (η-pos-elim-𝛽)
Indeed, the specified path from the centre of contraction to itself is propositionally equal to refl which is a property of contractible types.

Operations relative to Pos (μ 𝑥 𝑦)

We define the three operations pair μ , pr μ 1 , and pr μ 2 relative to positions of trees of the form μ 𝑥 𝑦. The operation pair μ takes a position 𝑝 of a tree 𝑦 : 𝒫 𝑥 and a position 𝑞 of the tree 𝑧 𝑝 where 𝑧 :

-→ 𝒫 𝑦 in order to return a position of the resulting tree μ 𝑥 𝑦.

Definition 1.3.9 (pair μ ).

pair μ : {𝑛 : N} {𝑥 : 𝒪 𝑛} {𝑦 : 𝒫 𝑥} {𝑧 : - → 𝒫 𝑦} → (𝑝 : Pos 𝑦) (𝑞 : Pos (𝑧 𝑝)) → Pos (μ 𝑦 𝑧)
We define pair μ by induction on the tree 𝑦 and on the position 𝑝:

• If 𝑦 is ob-pd, μ ob-pd 𝑧 is equal to 𝑧 ★, and we are looking for a term of type Pos (𝑧 ★) but 𝑝 is of type Pos ob-pd and must be equal to ★. We therefore return 𝑞 which is of the required type.

• If 𝑦 is of the form lf 𝑥, Pos (lf 𝑥) is the empty type and we are done.

• If 𝑦 is of the form nd (𝑥 ⊳ 𝑦) 𝑢, μ (nd (𝑥 ⊳ 𝑦) 𝑢) 𝑧 is equal to γ (𝑧 (inl ★)) 𝑣 where 𝑣 𝑝 :≡ μ (𝑢 𝑝) (𝜆𝑞 → 𝑧 (inr (𝑝, 𝑞)))
In order to determine a position of γ (𝑧 (inl ★)) 𝑣, we have to proceed by induction on 𝑝:

-If 𝑝 is inl ★, 𝑞 is a position of 𝑧 (inl ★
) which is the tree on which the grafting takes place. The position that we are looking for is therefore inl γ 𝑞.

-If 𝑝 is inr (𝑟, 𝑠) with 𝑟 : Pos 𝑦 and 𝑠 : Pos (𝑢 𝑟), the position that we are looking for is a position of one of the trees specified by the family 𝑣 injected into Pos (γ (𝑧 (inl ★)) 𝑣). This family 𝑣 is indexed by Pos 𝑦 and 𝑟 is precisely such a position. We now need a position of 𝑣 𝑟, that is a position of μ (𝑢 𝑟) (𝜆𝑞 → 𝑧 (inr (𝑟, 𝑞))), which is readily obtained as pair μ 𝑠 𝑞. In the end, the position that we are looking for is inr γ 𝑝 (pair μ 𝑠 𝑞).

Conversely, the operation pr • If 𝑦 is ob-pd, we simply return the only position of ob-pd, that is ★.

• If 𝑦 is of the form lf 𝑥, we simply eliminate from the empty type Pos (lf 𝑥).

• If 𝑦 is of the form nd (𝑥 ⊳ 𝑦) 𝑢, 𝑝 is a position of the tree γ (𝑧 (inl ★)) 𝑣 where

𝑣 𝑝 :≡ μ (𝑢 𝑝) (𝜆𝑞 → 𝑧 (inr (𝑝, 𝑞)))
We will therefore have to resort to the elimination rule for γ. We are looking for a position of nd (𝑥 ⊳ 𝑦) 𝑢 therefore we set the motive to the constant 𝐴 𝑝 :≡ Pos (nd (𝑥 ⊳ 𝑦) 𝑢)

and we treat the following two cases:

-If 𝑝 is a position of the base tree 𝑧 (inl ★), we return the position of the root node of nd (𝑥 ⊳ 𝑦) 𝑢, that is inl ★.

-If 𝑝 is a position of one of the trees grafted on the base tree, we can break it down into a position 𝑟 : Pos 𝑦 and a position 𝑠 : Pos (𝑣 𝑟).

From 𝑠, we get a position of 𝑢 𝑟 as the position pr μ 1 𝑠. We finally obtain the wanted position of nd (𝑥 ⊳ 𝑦) 𝑢 as the position inr (𝑟, pr

- → 𝒫 𝑦} → (𝑝 : Pos (μ 𝑦 𝑧)) → Pos (𝑧 (pr μ 1 𝑝))
The operation pr μ 2 is defined by induction on the tree 𝑦:

• If 𝑦 is ob-pd, we need to return a position of type Pos (𝑧 (inl ★)) which is precisely the type of 𝑝 that we therefore just return.

• If 𝑦 is of the form lf 𝑥, we simply eliminate from the empty type Pos (lf 𝑥).

• If 𝑦 is of the form nd (𝑥 ⊳ 𝑦) 𝑢, 𝑝 is a position of the tree γ (𝑧 (inl ★)) 𝑣 where

𝑣 𝑝 :≡ μ (𝑢 𝑝) (𝜆𝑞 → 𝑧 (inr (𝑝, 𝑞)))
We will therefore have to resort to the elimination rule for γ. We are looking for a position of 𝑧 (pr -If 𝑝 is a position of one of the trees grafted on the base tree, we can break it down into a position 𝑟 : Pos 𝑦 and a position 𝑠 : Pos (𝑣 𝑟).

We are looking for a position of type Pos (𝑧 (pr μ 1 (inr γ 𝑟 𝑠))) that can be obtained from pr μ 2 𝑠 : Pos (𝑧 (inr (𝑟, pr μ 1 𝑠))) by transporting it along the path Pos-γ-elim-inr-𝛽 -1 remembering that pr μ 1 (inr γ 𝑟 𝑠) is defined as an application of Pos-γ-elim in the present case.

Operations relative to Pos (γ 𝑡 𝑢)

We now define the functions relative to positions of the form Pos (γ 𝑡 𝑢).

Definition 1.3.12 (inl γ ).

inl γ : {𝑛 : N} {𝑥 : 𝒪 𝑛} {𝑦 : 𝒫 𝑥} {𝑧 : - → 𝒫 𝑦} → {𝑡 : 𝒫 (𝑥 ⊳ 𝑦)} {𝑢 : - → 𝒫 (𝑦 ◀ 𝑧)} → (𝑝 : Pos 𝑡) → Pos (γ 𝑡 𝑢)
The operation inl γ is defined by induction on the tree 𝑡 and on the position 𝑝:

• If 𝑡 is of the form lf 𝑥 then we eliminate the empty type Pos (lf 𝑥).

• If 𝑡 is of the form nd (𝑥 ⊳ 𝑦) 𝑡, we have to determine a position of the tree

transport 𝜆𝑦→𝒫 (𝑥⊳𝑦) μ-assoc -1 (nd (𝑥 ⊳ 𝑦) 𝑣)
with 𝑣 defined as

𝑣 𝑝 :≡ γ (𝑡 𝑝) (𝑢 ′ 𝑝)
and 𝑢 ′ defined as

𝑢 ′ 𝑝 𝑞 :≡ transport 𝜆(𝑥,𝑦)→𝒫 (𝑥⊳𝑦) (pair= μ-pos-typ-aux refl) (𝑢 (pair μ 𝑝 𝑞))
We proceed by induction on 𝑝:

-If 𝑝 is inl ★; that is, if 𝑝 is the root
- → 𝒫 𝑦} → {𝑡 : 𝒫 (𝑥 ⊳ 𝑦)} {𝑢 : - → 𝒫 (𝑦 ◀ 𝑧)} → (𝑝 : Pos 𝑦) (𝑞 : Pos (𝑢 𝑝)) → Pos (γ 𝑡 𝑢)
The operation inr γ is defined by induction on the tree 𝑡:

• If 𝑡 is of the form lf 𝑥, 𝑝 is a position of η 𝑥, 𝑞 is a position of 𝑢 𝑝, and we have to determine a position of the tree

transport 𝜆(𝑥,𝑦)→𝒫 (𝑥⊳𝑦) (pair= pos η -typ -1 μ-unit-l) -1 (𝑢 (pos η 𝑥))
We start by establishing a position of 𝑢 (pos η 𝑥). In order to do so, we eliminate the position 𝑝 using the elimination rule for η with the motive

𝐴 𝑝 :≡ (𝑞 : Pos (𝑢 𝑝)) → Pos (𝑢 (pos η 𝑥))
and with clause 𝑎 η 𝑝 :≡ 𝑝. This elimination rule applied to 𝑝 and 𝑞 yields the required position of type Pos (𝑢 (pos η 𝑥)). It remains to perform the required transport:

transport Pos-transp 𝒫 (Pos-η-elim 𝑥 𝐴 𝑎 η 𝑝 𝑞)

• If 𝑡 is of the form nd (𝑥 ⊳ 𝑦) 𝑡 with 𝑡 :

-→ 𝒫 (𝑦 ◀ 𝑧) for some 𝑧 :

-→ 𝒫 𝑦, 𝑝 is a position of μ 𝑦 𝑧, 𝑞 is a position of 𝑢 𝑝, and we have to determine a position of the tree transport 𝜆𝑦→𝒫 (𝑥⊳𝑦) μ-assoc -1 (nd (𝑥 ⊳ 𝑦) 𝑣)

with 𝑣 defined as

𝑣 𝑝 :≡ γ (𝑡 𝑝) (𝑢 ′ 𝑝)
and 𝑢 ′ defined as

𝑢 ′ 𝑝 𝑞 :≡ transport 𝜆(𝑥,𝑦)→𝒫 (𝑥⊳𝑦) (pair= μ-pos-typ-aux refl) (𝑢 (pair μ 𝑝 𝑞))
We start by establishing a position of nd (𝑥 ⊳ 𝑦) 𝑣. In order to do that, we first define 𝑝 0 :≡ pr μ 1 𝑝 of type Pos 𝑦 and 𝑝 1 :≡ pr μ 2 𝑝 of type Pos (𝑧 𝑝 0 ) then we establish a position of 𝑣 𝑝 0 by injecting a position 𝑞 ′ of the tree 𝑢 ′ 𝑝 0 𝑝 1 into Pos (𝑣 𝑝 0 ). We define 𝑞 ′ from 𝑞 by first transporting it along the path pair μ -𝜂 -1 to obtain a position of the tree 𝑢 (pair μ 𝑝 0 𝑝 1 ) then we transport that position along the path Pos-transp 𝒪 to obtain a position of 𝑢 ′ 𝑝 0 𝑝 1 . To summarise,

𝑞 ′ :≡ transport Pos-transp 𝒪 (transport 𝜆𝑝→𝒫 (𝑢 𝑝) pair μ -𝜂 -1 𝑞)
The position of 𝑣 𝑝 0 that we are looking for is therefore the position 𝑟 :≡ inr γ 𝑝 1 𝑞 ′ . We conclude by performing the needed transport to obtain the final position transport Pos-transp 𝒫 𝑟.

Finally, we define the elimination principle for positions of type Pos (γ 𝑡 𝑢).

Definition 1.3.14 (Pos-γ-elim).

Pos-γ-elim : {𝑛 : N} {𝑥 : 𝒪 𝑛} {𝑦 : 𝒫 𝑥} {𝑧 :

- → 𝒫 𝑦} → {𝑡 : 𝒫 (𝑥 ⊳ 𝑦)} {𝑢 : - → 𝒫 (𝑦 ◀ 𝑧)} → (𝐴 : Pos (γ 𝑡 𝑢) → 𝒰) → (𝑎 inl : (𝑝 : Pos 𝑡) → 𝐴 (inl γ 𝑝)) → (𝑎 inr : (𝑝 : Pos 𝑦) (𝑞 : Pos (𝑢 𝑝)) → 𝐴 (inr γ 𝑝 𝑞)) → (𝑝 : Pos (γ 𝑡 𝑢)) → 𝐴 𝑝
We define Pos-γ-elim by induction on 𝑡:

• If 𝑡 is of the form lf 𝑥 then 𝑝 is a position of the tree transport 𝜆(𝑥,𝑦)→𝒫 (𝑥⊳𝑦) (pair= pos η -typ -1 μ-unit-l) -1 (𝑢 (pos η 𝑥))
We use the elimination rule Pos-transp 𝒪 -elim with motive 𝐴 and we are reduced to defining a term of type 𝐴 (transport Pos-transp 𝒪 𝑝) for any position 𝑝 : Pos (𝑢 (pos η 𝑥)). The term 𝑎 inr (pos η 𝑥) 𝑝 has type 𝐴 (inr γ (pos η 𝑥) 𝑝). However, inr γ (pos η 𝑥) 𝑝 is equal to transport Pos-transp 𝒪 𝑝 ′ where

𝑝 ′ :≡ Pos-η-elim 𝑥 (𝜆𝑝 → Pos (𝑢 𝑝) → Pos (𝑢 (pos η 𝑥))) (𝜆𝑝 → 𝑝) (pos η 𝑥) 𝑝
but 𝑝 ′ is equal to 𝑝 according to the 𝛽-law for Pos-η-elim, we therefore conclude with this last transport:

transport 𝜆 𝑓 →𝐴 (transport Pos-transp 𝒪 ( 𝑓 𝑝)) Pos-η-elim-𝛽 (𝑎 inr (pos η 𝑥) 𝑝) • If 𝑡 is of the form nd (𝑥 ⊳ 𝑦) {𝑧} 𝑡 then 𝑝 is a position of the tree transport 𝜆𝑦→𝒫 (𝑥⊳𝑦) μ-assoc -1 (nd (𝑥 ⊳ 𝑦) 𝑣)
where

𝑣 𝑝 :≡ γ (𝑡 𝑝) (𝑢 ′ 𝑝) 𝑢 ′ 𝑝 𝑞 :≡ transport 𝜆(𝑥,𝑦)→𝒫 (𝑥⊳𝑦) (pair= μ-pos-typ-aux refl) (𝑢 (pair μ 𝑝 𝑞))
We use the elimination principle Pos-transp 𝒫 -elim with motive 𝐴, and we are reduced to defining a term of type

𝐴 (transport Pos-transp 𝒫 𝑝)
for any position 𝑝 : Pos (nd (𝑥 ⊳ 𝑦) {𝑧} 𝑣).

We start by defining the shorthand 𝐴 ′ 𝑝 :≡ 𝐴 (transport Pos-transp 𝒫 𝑝) then we proceed by induction on 𝑝.

-If 𝑝 is of the form inl ★, we choose 𝑎 inl (inl ★) which is of the required type 𝐴 (inl γ (inl ★)) considering that there is a definitional equality

inl γ (inl ★) ≡ transport Pos-transp 𝒫 (inl ★)
-If 𝑝 is of the form inr (𝑝, 𝑞), we are looking for some term of type 𝐴 ′ (inr (𝑝, 𝑞)) for positions 𝑝 : Pos 𝑦 and 𝑞 : Pos (γ (𝑡 𝑝) (𝑢 ′ 𝑝)).

Our induction hypothesis allows applying Pos-γ-elim to 𝑞 with motive 𝜆𝑞 → 𝐴 ′ (inr (𝑝, 𝑞)) and we are reduced to defining two families covering the two possible cases for 𝑞.

We start with the definition of the family of type

𝐴 ′ (inr (𝑝, inl γ 𝑞))
for any position 𝑞 : Pos (𝑡 𝑝) that is simply obtained as 𝑎 inl (inr (𝑝, 𝑞)).

The second family to define has type

𝐴 ′ (inr (𝑝, inr γ 𝑞 𝑟))
for any positions 𝑞 : Pos (𝑧 𝑝) and 𝑟 : Pos (𝑢 ′ 𝑝 𝑞).

We use the remaining hypothesis and arrive at the following term:

𝑎 inr (pair μ 𝑝 𝑞) (transport Pos-transp 𝒪 -1 𝑟)
However, the type is not quite right as it is equal to

𝐴 ′ (inr (𝑝 ′ , inr γ 𝑞 ′ 𝑟 ′ ))
with

𝑝 ′ :≡ pr μ 1 (pair μ 𝑝 𝑞) 𝑞 ′ :≡ pr μ 2 (pair μ 𝑝 𝑞) 𝑟 ′ :≡ transport Pos-transp 𝒫 𝑟 2 𝑟 2 :≡ transport 𝜆𝑝→Pos (𝑢 𝑝) pair μ -𝜂 -1 𝑟 3 𝑟 3 :≡ transport Pos-transp 𝒫 -1 𝑟
It then remains to perform a transport along an identity (𝑝, 𝑞, 𝑟) = (𝑝 ′ , 𝑞 ′ , 𝑟 ′ ). An identity (𝑝, 𝑞) = (𝑝 ′ , 𝑞 ′ ) is readily established using both μ-pos-fst-𝛽 and μ-pos-snd-𝛽. In order to prove the identity transport 𝜆(𝑝,𝑞)→Pos (𝑢 ′ 𝑝 𝑞) (pair= μ-pos-fst-𝛽 μ-pos-snd-𝛽) 𝑟 ′ = 𝑟 we can show, albeit tediously, that the left-hand side is of the form transport Pos 𝑒 𝑟 for some path 𝑒 of type

transport 𝜆(𝑥,𝑦)→𝒫 (𝑥⊳𝑦) (pair= μ-pos-typ-aux refl) (𝑢 (pair μ 𝑝 𝑞)) = transport 𝜆(𝑥,𝑦)→𝒫 (𝑥⊳𝑦) (pair= μ-pos-typ-aux refl) (𝑢 (pair μ 𝑝 𝑞))
But, the type of trees being a set, this identity must be equal to refl which permits to conclude the proof. This concludes our definition of opetopes.

Faces of an opetope

Our inductive definition of opetopes allows to easily characterise the faces which compose them. We will define the type family

ℱ : {𝑛 : N} → 𝒪 𝑛 → N → 𝒰
For any opetope 𝑜 : 𝒪 𝑛, the elements of ℱ 𝑜 𝑚 will be the (𝑚 -1)-dimensional faces of 𝑜. We will explain why this dimension shift later on. Let us pause and think what should the faces of an opetope be. Any opetope has a top face whose dimension is the one of the opetope; therefore for any opetope 𝑜 : 𝒪 𝑛, there will be a constructor top : ℱ 𝑜 (𝑛 + 1). In particular, this will be the only face of the object ob. Now, what could the other faces of an opetope be? Any (𝑛+1)-opetope has some source faces and a single target face as 𝑛-dimensional faces. The target face is unique so, given any opetope (𝑥 ⊳ 𝑦) : 𝒪 (𝑛 + 1) there will be a constructor target : ℱ (𝑥 ⊳ 𝑦) (𝑛 + 1). As for the source faces, they are in correspondence with the node positions of 𝑦. So, for each position 𝑝 : Pos 𝑦, there will be a constructor src 𝑝 : ℱ (𝑥 ⊳ 𝑦) (𝑛 + 1). The difficulty is now to characterise the faces of lower dimension. The definition that we propose consists in identifying the remaining faces -if any -with the edges of the trees whose sequence defines an opetope.

We now present our definition of the faces of an opetope which will be followed with some examples.

Definitions

We first define the type of edges of a tree.

Definition 1.4.1 (Edges of a tree). The family of edges of a tree has signature

ℰ : {𝑛 : N} {𝑥 : 𝒪 𝑛} (𝑦 : 𝒫 𝑥) → 𝒰 It is inductively defined with constructors: lf-edge : {𝑛 : N} (𝑜 : 𝒪 𝑛) → ℰ (lf 𝑜) root-edge : {𝑛 : N} (𝑥 : 𝒪 𝑛) (𝑦 : 𝒫 𝑥) {𝑧 : - → 𝒫 𝑦} → (𝑡 : - → 𝒫 (𝑦 ◀ 𝑧)) → ℰ (nd (𝑥 ⊳ 𝑦) 𝑡) nd-edge : {𝑛 : N} (𝑥 : 𝒪 𝑛) (𝑦 : 𝒫 𝑥) {𝑧 : - → 𝒫 𝑦} → (𝑡 : - → 𝒫 (𝑦 ◀ 𝑧)) → (𝑝 : Pos 𝑦) → ℰ (𝑡 𝑝) → ℰ (nd (𝑥 ⊳ 𝑦) 𝑡)
We characterise the edges of the two possible forms of trees. In the case of a leaf, there is a single edge corresponding to the leaf itself. While in the case of a tree of the form nd (𝑥 ⊳ 𝑦) 𝑡, an edge is either the root edge or an edge of one of the trees grafted on the root node at some position 𝑝 : Pos 𝑦.

We want to collect the edges of the sequence of trees forming an opetope, we therefore need a further type collecting these edges corresponding to the lower faces of an opetope. A lower face of a (𝑛 + 1)-opetope of the form 𝑥 ⊳ 𝑦 is therefore either an edge of 𝑦 or a lower face of the opetope 𝑥. We can finally explain the dimension shift in the indexing. The edges of 𝑦 correspond to the (𝑛 -1)-dimensional faces of 𝑥 ⊳ 𝑦 but in order to avoid subtracting indices, we choose to index 𝑛-dimensional faces with the index 𝑛 + 1.

We are finally in position to define the type of faces of an opetope.

Definition 1.4.3 (Faces of an opetope). The family of faces of an opetope has type

ℱ : {𝑛 : N} (𝑜 : 𝒪 𝑛) → N → 𝒰
and is defined as an inductive type whose constructors are top

: {𝑛 : N} (𝑜 : 𝒪 𝑛) → ℱ 𝑜 (𝑛 + 1) target : {𝑛 : N} (𝑜 : 𝒪 (𝑛 + 1)) → ℱ 𝑜 (𝑛 + 1) src : {𝑛 : N} {𝑥 : 𝒪 𝑛} {𝑦 : 𝒫 𝑥} → Pos 𝑦 → ℱ (𝑥 ⊳ 𝑦) (𝑛 + 1) lower-face : {𝑛 : N} {𝑜 : 𝒪 𝑛} {𝑘 : N} → ℱ 𝑜 𝑘 → ℱ 𝑜 𝑘
The first three constructors correspond to the ones discussed in the introduction of this section and the last one corresponds to the lower faces.

The faces of an opetopes actually assemble into an opetopic type. Opetopic types will be the subject of Chapter 3; however, the precise definition of the opetopic type of the faces of an opetope is still a work in progress.

Examples

We revisit a few elementary opetopes and list their faces in order to illustrate our definition.

The object

The object has a single face top ob.

The arrow

The arrow ob ⊳ ob-pd has three faces:

𝑎 :≡ src ★ 𝑏 :≡ target (ob ⊳ ob-pd) 𝑐 :≡ top (ob ⊳ ob-pd) 𝑏 𝑎 𝑐
The 2-simplex The 2-simplex (ob ⊳ ob-pd ⊳ 𝑡) where

𝑡 :≡ nd (ob ⊳ ob-pd) (𝜆𝑝 → nd (ob ⊳ ob-pd) (𝜆𝑞 → lf (Typ ob-pd 𝑞)))
has seven faces:

𝑎 :≡ lower-face (edge (nd-edge (ob ⊳ ob-pd) 𝑡 ′ ★ (nd-edge (ob ⊳ ob-pd) (𝜆𝑝 → lf (Typ ob-pd 𝑝)) ★ (lf-edge ob)))) 𝑏 :≡ lower-face (edge (nd-edge (ob ⊳ ob-pd) 𝑡 ′ ★ (root-edge (ob ⊳ ob-pd) (𝜆𝑝 → lf (Typ ob-pd 𝑝))))) 𝑐 :≡ lower-face (edge (root-edge (ob ⊳ ob-pd) 𝑡 ′ )) 𝑑 :≡ src (inr (★, inl ★)) 𝑒 :≡ src (inl ★) 𝑓 :≡ target (ob ⊳ ob-pd ⊳ 𝑡) 𝑔 :≡ top (ob ⊳ ob-pd ⊳ 𝑡)
where

𝑡 ′ :≡ nd (ob ⊳ ob-pd) (𝜆𝑝 → lf (Typ ob-pd 𝑝)) 𝑐 𝑏 𝑎 𝑓 𝑑 𝑒 𝑔

Loops

The loop ob ⊳ ob-pd ⊳ lf ob has three faces:

𝑎 :≡ lower-face (edge (lf-edge ob))

𝑏 :≡ target (ob ⊳ ob-pd ⊳ lf ob) 𝑐 :≡ top (ob ⊳ ob-pd ⊳ lf ob) 𝑎 𝑏 𝑐
Leaves having no node, the only 1-dimensional face in this example is 𝑏 which is the target of the opetope ob ⊳ ob-pd ⊳ lf ob.

Chapter 2

Polynomial monads

In this chapter, we extend type theory with a universe of cartesian polynomial monads closed under a number of monad constructors. We will take advantage of these structures to define opetopic types, collections of types whose geometry is governed by opetopes, in Chapter 3. Opetopes are then obtained as the terminal opetopic type. Most importantly, we require the laws of polynomial monads to hold definitionally in order to avoid making the coherence laws explicit as our constructions are not sets any more in this chapter. We will finally add two extensions to our system: morphisms of monads and monad families.

Cartesian polynomial monads

Cartesian polynomial monads form the backbone of our system. They are at the heart of the so-called Baez-Dolan construction [START_REF] Baez | Higher-dimensional algebra III. ncategories and the algebra of opetopes[END_REF] which was introduced in the setting of operads for the purpose of defining 𝑛-categories.

Cartesian polynomial monads can be understood as presentations for strongly regular algebraic theories. These are algebraic theories whose equations are constrained in such a way that variables have to appear in both sides without repetition and in the same order [START_REF] Leinster | Structures in higher-dimensional category theory[END_REF]). We will not systematically specify that our polynomial monads are cartesian even though they always are in order to lighten the notation. The endofunctor part of the polynomial monad structure is also known as an indexed container in the type theory literature [START_REF] Abbott | Containers: Constructing strictly positive types[END_REF][START_REF] Altenkirch | Indexed containers[END_REF]. They provide a calculus of datatypes used to internalise a large class of inductive datatypes in type theory allowing, for example, the conception of generic algorithms on datatypes.

Polynomials

We start by postulating a universe of polynomial monads ℳ : 𝒰 whose elements are regarded as codes for our polynomial monads. Contrary to a regular universe à la Tarski there will not be a single decoding function but four of them

Idx : ℳ → 𝒰 Cns : (𝑀 : ℳ) → Idx 𝑀 → 𝒰 Pos : (𝑀 : ℳ) {𝑖 : Idx 𝑀} → Cns 𝑀 𝑖 → 𝒰 Typ : (𝑀 : ℳ) {𝑖 : Idx 𝑀} (𝑐 : Cns 𝑀 𝑖) → Pos 𝑀 𝑐 → Idx 𝑀 Figure 2
.1: The data defining a polynomial which will describe the different data defining a polynomial (Figure 2.1). For any monad 𝑀 : ℳ, we can regard this data as describing the signature of an algebraic theory: the elements of Idx 𝑀, which we refer to as indices serve as the sorts of the theory, and for 𝑖 : Idx 𝑀, the type Cns 𝑀 𝑖 is the collection of operation symbols whose output sort is 𝑖. The type Pos 𝑀 𝑐 then assigns to each operation a collection of input positions which are themselves assigned an index via the function Typ 𝑀. We will write the monad indexing the decoding functions in subscript and write Cns 𝑀 𝑖 instead of Cns 𝑀 𝑖 for example.

For any monad 𝑀, the data of its polynomial gives rise to an endomorphism called its extension ⟦𝑀⟧ : (𝑋 :

Idx 𝑀 → 𝒰) → Idx 𝑀 → 𝒰 whose defining equation is ⟦𝑀⟧ 𝑋 𝑖 :≡ (𝑐:Cns 𝑀 𝑖) (𝑝 : Pos 𝑀 𝑐) → 𝑋 (Typ 𝑀 𝑐 𝑝)
This is the type of constructors of 𝑀 whose inputs are decorated with elements in 𝑋. Polynomials are definable in any locally cartesian closed category, and their extension is then a functor on some slice category [START_REF] Gambino | Mathematical languages shape our understanding of time in physics[END_REF].

Monads

In this section, we specify some additional structure on polynomials which, in a categorical setting, endows their extension with a structure of a monad. We therefore refer to the elements of ℳ as polynomial monads by abuse of language.

η :

(𝑀 : ℳ) (𝑖 : Idx 𝑀 ) → Cns 𝑀 𝑖 μ : (𝑀 : ℳ) {𝑖 : Idx 𝑀 } (𝑐 : Cns 𝑀 𝑖) (𝑑 : ----→ Cns 𝑀 𝑐) → Cns 𝑀 𝑖
Fam 𝑀 :≡ Idx 𝑀 → 𝒰
We also introduce a notation for the type of sections of type families of the form 𝐴 • Typ 𝑀 𝑐 which are indexed by the positions of a constructor 𝑐. Given a monad 𝑀, a type family 𝐴 : Fam 𝑀 , and a constructor 𝑐 : Cns 𝑀 𝑖, we define the notation

- → 𝐴 𝑐 :≡ (𝑝 : Pos 𝑀 𝑐) → 𝐴 (Typ 𝑀 𝑐 𝑝)
A particularly recurrent family will be ----→ Cns 𝑀 𝑐 for some constructor 𝑐. A constructor 𝑐 : Cns 𝑀 𝑖 along with a family ----→ Cns 𝑀 𝑐 denote a depth-2 tree of constructors.

The structure of a polynomial monad comprises two operations (Figure 2.2). Our monads being cartesian, they will satisfy the following equivalences:

Pos 𝑀 (μ 𝑀 𝑐 𝑑) ≃ (𝑝:Pos 𝑀 𝑐) Pos 𝑀 (𝑑 𝑝) Pos 𝑀 (η 𝑀 𝑖) ≃ 1
Moreover, their typing function Typ 𝑀 is compatible with these equivalences. The unit η 𝑀 𝑖 is therefore a unary constructor whose both input and output are labelled by the index 𝑖. As for the operation μ 𝑀 , it composes a depth-2 tree of constructors to a constructor sharing its index with the one of the root node. In addition, μ 𝑀 preserves the type of positions of its input tree as well as their typing.

These operations have to satisfy a number of definitional laws which we will detail after having introduced some further operations on positions with regard to the cartesian monad structure. Indeed, the mentioned equivalences will rarely be equal to the identity. That is why we will characterise the type of positions of constructors obtained from the operations η and μ using operations that can be seen as witnessing these equivalences but which will obey definitional laws. These operations on positions correspond exactly to those introduced in Chapter 1.

Operations relative to Pos 𝑀 (η 𝑀 𝑖)

The type of positions of a unit constructor is contractible and can be characterised by the existence of a centre of contraction along with an elimination rule equivalent to the one of the unit type which leads us to postulate the following principles:

pos η : (𝑀 : ℳ) (𝑖 : Idx 𝑀 ) → Cns 𝑀 𝑖 Pos-η-elim : (𝑀 : ℳ) (𝑖 : Idx 𝑀 ) (𝑋 : Pos 𝑀 (η 𝑀 𝑖) → 𝒰) → (𝑥 pos η : 𝑋 (pos η 𝑀 𝑖)) → (𝑝 : Pos 𝑀 (η 𝑀 𝑖)) → 𝑋 𝑝
The elimination rule satisfies the following definitional computation rule:

Pos-η-elim 𝑀 𝑖 𝑋 𝑥 pos η (pos η 𝑀 𝑖) ≡ 𝑥 pos η (Pos-η-elim-𝛽)
The typing function is compatible with the operation η 𝑀 :

Typ 𝑀 (η 𝑀 𝑖) 𝑝 ≡ 𝑖 (pos η -typ) Operations relative to Pos 𝑀 (μ 𝑀 𝑥 𝑦)
The type of positions of a constructor obtained through the application of the operation μ 𝑀 is characterised by a pairing function along with two projection functions similarly to sigma types: Finally, we postulate the laws obeyed by the operations η 𝑀 and μ 𝑀 :

μ 𝑀 𝑐 (𝜆𝑝 → η 𝑀 (Typ 𝑀 𝑐 𝑝)) ≡ 𝑐 μ 𝑀 (η 𝑀 𝑖) 𝑐 ≡ 𝑐 (pos η 𝑀 𝑖) μ 𝑀 (μ 𝑀 𝑐 𝑑) 𝑒 ≡ μ 𝑀 𝑐 (𝜆𝑝 → μ 𝑀 (𝑑 𝑝) (𝜆𝑞 → 𝑒 (pair μ 𝑀 𝑝 𝑞)))
That is, the operation μ 𝑀 is associative and unital with unit η 𝑀 .

You might have noticed that we have not mentioned the operation γ so far. This is because it is not part of the definition of a polynomial monad. Instead, it will be an operation concerning a specific monad, the slice monad 𝑀/ of a monad 𝑀, and which will be used in order to define the operation μ 𝑀/ .

The universe of polynomial monads

We now populate the universe with some monad constructors. In order to do so, we postulate a new code for each monad that we want to add, then we define its corresponding decoding functions specifying the data of its polynomial along with the operations characterising its cartesian monad structure.

The identity monad

The first monad we introduce is the trivial monad with a single constructor which is unary and whose type of sorts is the unit type. We start by postulating the new code Id : ℳ. Its polynomial part is predictably defined as follows:

Idx Id :≡ 1 Cns Id 𝑖 :≡ 1 Pos Id 𝑐 :≡ 1 Typ Id 𝑐 𝑝 :≡ ★
We do not detail the definitions of the different operations relative to the identity monad as they are all trivial, having the unit type as codomain. The extension of the identity monad ⟦Id⟧ is then equivalent to the identity on Fam Id hence its name.

The pullback monad

Given a monad 𝑀 and a type family 𝑋 : Fam 𝑀 , we define a new code for the pullback monad 𝑋 * 𝑀 : ℳ which reindexes the monad 𝑀. Its constructors are constructors of 𝑀 along with a decoration of both their inputs and output with elements of the family 𝑋. Its polynomial part is defined as follows:

Idx 𝑋 * 𝑀 :≡ (𝑖:Idx 𝑀 ) 𝑋 𝑖 Cns 𝑋 * 𝑀 (𝑖, 𝑥) :≡ (𝑐:Cns 𝑀 𝑖) - → 𝑋 𝑐 Pos 𝑋 * 𝑀 (𝑐, 𝑥) :≡ Pos 𝑀 𝑐 Typ 𝑋 * 𝑀 (𝑐, 𝑥) 𝑝 :≡ Typ 𝑀 𝑐 𝑝
The operations of the pullback monad 𝑋 * 𝑀 simply use the ones of the underlying monad 𝑀.

η 𝑋 * 𝑀 (𝑖, 𝑥) :≡ (η 𝑀 𝑖, η-dec 𝑀 𝑥)
where η-dec 𝑀 𝑥 is defined as

η-dec 𝑀 𝑥 :≡ Pos-η-elim 𝑀 𝑖 (𝜆𝑝 → 𝑋 (Typ 𝑀 (η 𝑀 𝑖) 𝑝)) 𝑥
The unit then takes an index 𝑖 : Idx 𝑀 as well as an element 𝑥 : 𝑋 𝑖 and returns the unit of the underlying monad η 𝑀 𝑖 whose only position is decorated with the element 𝑥.

The multiplication is defined as

μ 𝑋 * 𝑀 (𝑐, 𝑥) 𝑑 :≡ (μ 𝑀 𝑐 (𝜆𝑝 → pr 1 (𝑑 𝑝)), 𝜆𝑝 → pr 2 (𝑑 (pr μ 1 𝑀 𝑝)) (pr μ 2 𝑀 𝑝))
The multiplication multiplies the 𝑀-constructors given by 𝑐 and 𝑑 using μ 𝑀 , then decorates the positions of the resulting constructor using the decoration specified by 𝑑 while forgetting the inner decoration specified by 𝑥.

As for the operations on the positions, they are straightforward since the pullback monad shares its type of positions with its underlying monad.

The slice monad

The slice monad of a monad 𝑀, denoted 𝑀/, is at the heart of the Baez-Dolan construction [START_REF] Baez | Higher-dimensional algebra III. ncategories and the algebra of opetopes[END_REF]. It is the monad which materialises the algebraic structure of a monad 𝑀, encoding it into data as constructors of the monad 𝑀/. Iterating this construction, we capture the laws governing the multiplication of 𝑀, then the coherences they satisfy, and so forth. This is the monad constructor which describes how to raise the dimension of opetopes.

The slice polynomial

We start by postulating a new code 𝑀/: 𝒰 for any monad 𝑀. Its indices are the constructors of 𝑀:

Idx 𝑀/ :≡ (𝑖:Idx 𝑀 ) Cns 𝑀 𝑖 Notation. We will adopt the notation of Chapter 1 and denote the elements of Idx 𝑀/ as 𝑦 ⊳ 𝑥 in place of (𝑦, 𝑥). This is meant to convey the idea that 𝑦 ⊳ 𝑥 is the data of a configuration of inputs given by 𝑥 along with the data of an output given by 𝑦. A type family Fam 𝑀/ is then regarded as a relation over this data. As the type of 𝑥 depends on 𝑦, we will often reverse the naming order and write 𝑥 ⊳ 𝑦 instead.

We also extend our notation to families. For any type family 𝑋 : Fam 𝑀/ , any constructor 𝑥 : Cns 𝑀 𝑖, and any family 𝑦 :

----→ Cns 𝑀 𝑥, we define the following notation:

- → 𝑋 (𝑥 ◀ 𝑦) :≡ (𝑝 : Pos 𝑀 𝑥) → 𝑋 (Typ 𝑀 𝑥 𝑝 ⊳ 𝑦 𝑝)
We now define the type of constructors of the slice monad of 𝑀 Cns 𝑀/ : Idx 𝑀/ → 𝒰 Constructors of the monad 𝑀/ indexed by 𝑥 ⊳ 𝑦 are well-founded trees of constructors of 𝑀 which multiply to 𝑦 -a 𝑥-indexed constructor of 𝑀 -using the monad structure of 𝑀. The type family Cns 𝑀/ is therefore defined as the following inductive type:

lf : (𝑥 : Idx 𝑀 ) → Cns 𝑀/ (𝑥 ⊳ η 𝑀 𝑥) nd : (𝑥 : Idx 𝑀 ) (𝑦 : Cns 𝑀 𝑥) {𝑧 : ----→ Cns 𝑀 𝑦} → (𝑡 : -----→ Cns 𝑀/ (𝑦 ◀ 𝑧)) → Cns 𝑀/ (𝑥 ⊳ μ 𝑀 𝑦 𝑧)
Once, again we will write nd (𝑥 ⊳ 𝑦) 𝑡 instead of nd 𝑥 𝑦 𝑡. This type is very similar to 𝒫 from Chapter 1 and it helps to understand it pictorially. The presentation given in the simpler context of opetopes transposes to this new setting. The leaf lf 𝑥 represents the empty tree with one input and one output sharing the same index 𝑥. The node nd (𝑥 ⊳ 𝑦) 𝑡 represents a tree whose root node is the constructor 𝑦 on which are recursively grafted the trees specified by 𝑡 on the positions of 𝑦. As trees are indexed by constructors, one has to first specify a family of constructors 𝑧 indexed by the positions of 𝑦. The tree 𝑡 𝑝 grafted at position 𝑝 of 𝑦 is therefore indexed by Typ 𝑦 𝑝 ⊳ 𝑧 𝑝. The resulting tree, nd (𝑥 ⊳ 𝑦) 𝑡, is indexed by 𝑥 ⊳ μ 𝑀 𝑦 𝑧 where μ 𝑀 𝑦 𝑧 is indeed its image under the operation μ 𝑀 since this operation is associative. The type of positions of a constructor of the slice monad is the type of paths from the root of the tree to its nodes:

Pos 𝑀/ (lf 𝑥) :≡ ⊥ Pos 𝑀/ (nd (𝑥 ⊳ 𝑦) 𝑡) :≡ 1 + (𝑝:Pos 𝑀 𝑦) Pos 𝑀/ (𝑡 𝑝)
The leaf has no node and therefore no position. A position of a tree made of a root node is either this root node or a position of one of the trees grafted on this node.

The typing function then projects out the index corresponding to the node indicated by a position 𝑝:

Typ 𝑀/ (nd (𝑥 ⊳ 𝑦) 𝑡) (inl ★) :≡ 𝑥 ⊳ 𝑦 Typ 𝑀/ (nd (𝑥 ⊳ 𝑦) 𝑡) (inr (𝑝, 𝑞)) :≡ Typ 𝑀/ (𝑡 𝑝) 𝑞
The monad structure

We now define the monad structure of the slice polynomial. The operations will be similar to the ones acting on 𝒫 but, considering that their laws are now taken to be definitional, their definition will be greatly simplified.

The unit takes an index 𝑥 ⊳ 𝑦 : Idx 𝑀/ and returns the tree whose sole node is 𝑥 ⊳ 𝑦:

η 𝑀/ (𝑥 ⊳ 𝑦) :≡ nd (𝑥 ⊳ 𝑦) (𝜆𝑝 → lf (Typ 𝑀 𝑦 𝑝))
The multiplication substitutes a family of compatible trees for the nodes of a given tree. It requires the definition of the grafting operation γ that we already encountered in Chapter 1:

γ : (𝑀 : ℳ) {𝑥 : Idx 𝑀 } {𝑦 : Cns 𝑀 𝑥} {𝑧 : ----→ Cns 𝑀 𝑦} → (𝑡 : Cns 𝑀/ (𝑥 ⊳ 𝑦)) (𝑢 : -----→ Cns 𝑀/ (𝑦 ◀ 𝑧)) → Cns 𝑀/ (𝑥 ⊳ μ 𝑀 𝑦 𝑧)
This operation takes a tree 𝑡 and a family of trees 𝑢 indexed by the positions of 𝑡 and returns the result of the graft of the family 𝑢 on 𝑡. It is defined by induction on 𝑡:

• If 𝑡 is of the form lf 𝑥, we simply return 𝑢 (pos η 𝑀 𝑥). Note that this typechecks due to μ-unit-l being definitional.

• If 𝑡 is of the form nd (𝑥 ⊳ 𝑦) 𝑡, we recursively graft the trees specified by 𝑡 and 𝑢 on the root node 𝑥 ⊳ 𝑦:

nd (𝑥 ⊳ 𝑦) (𝜆𝑝 → γ 𝑀 (𝑡 𝑝) (𝜆𝑞 → 𝑢 (pair μ 𝑀 𝑝 𝑞)))
We are now in position to define μ 𝑀/ 𝑐 𝑑 by induction on 𝑐:

• If 𝑐 is of the form lf 𝑥, there is nothing to substitute and we return lf 𝑥 intact.

• If 𝑐 is of the form nd (𝑥 ⊳ 𝑦) 𝑡, the root note will be substituted with the tree 𝑑 (inl ★), in consequence we recursively graft on this tree the result of the substitution of the nodes of 𝑡 with the corresponding trees specified by 𝑑:

γ 𝑀 (𝑑 (inl ★)) (𝜆𝑝 → μ 𝑀/ (𝑡 𝑝) (𝜆𝑞 → 𝑑 (inr (𝑝, 𝑞))))

Operations on positions

We now define the position operations of the slice monad. In the first case, inl γ injects a position of a tree 𝑡 into the type of positions of the tree γ 𝑀 𝑡 𝑢:

inl γ : (𝑀 : ℳ) {𝑥 : Idx 𝑀 } {𝑦 : Cns 𝑀 𝑥} {𝑧 : ----→ Cns 𝑀 𝑦} → {𝑡 : Cns 𝑀/ (𝑥 ⊳ 𝑦)} {𝑢 : -----→ Cns 𝑀/ (𝑦 ◀ 𝑧)} → (𝑝 : Pos 𝑀/ 𝑡) → Pos 𝑀/ (γ 𝑀 𝑡 𝑢)
It is defined by induction on 𝑡 and on 𝑝,

• If 𝑡 is of the form lf 𝑥, Pos 𝑡 is the empty type and there is nothing to do.

• If 𝑡 is of the form nd (𝑥 ⊳ 𝑦) 𝑡, we have to return a position of the tree nd (𝑥 ⊳ 𝑦) 𝑣 where 𝑣 𝑝 :≡ γ 𝑀 (𝑡 𝑝) (𝜆𝑞 → 𝑢 (inr (𝑝, 𝑞))). There are two cases to cover for 𝑝:

-If 𝑝 is inl ★, that is, the position of the root node of the base tree, we return the position of the root node of the resulting tree which is inl ★.

-If 𝑝 is of the form inr (𝑝, 𝑞) with 𝑝 : Pos 𝑦 and 𝑞 : Pos (𝑡 𝑝), we obtain a position of 𝑣 𝑝 as inl γ 𝑀 𝑞 and finally obtain a position of nd (𝑥 ⊳ 𝑦) 𝑣 as inr (𝑝, inl γ 𝑀 𝑞).

In the second case, given a tree 𝑡 : Cns 𝑀/ (𝑥 ⊳ 𝑦) and a family 𝑢 :

-----→

Cns 𝑀/ (𝑦 ◀ 𝑧),
inr γ injects a position of the tree 𝑢 𝑝 for some position 𝑝 : Pos 𝑀 𝑦 into the type of positions of γ 𝑀 𝑡 𝑢.

inr γ : (𝑀 : ℳ) {𝑥 : Idx 𝑀 } {𝑦 : Cns 𝑀 𝑥} {𝑧 : ----→ Cns 𝑀 𝑦} → {𝑡 : Cns 𝑀/ (𝑥 ⊳ 𝑦)} {𝑢 : -----→ Cns 𝑀/ (𝑦 ◀ 𝑧)} → (𝑝 : Pos 𝑀 𝑦) (𝑞 : Pos 𝑀/ (𝑢 𝑝)) → Pos 𝑀/ (γ 𝑀 𝑡 𝑢)
It is defined by induction on 𝑡,

• If 𝑡 is of the form lf 𝑥, we have to return a position of 𝑢 (pos We conclude with the elimination rule for positions of grafted trees:

Pos-γ-elim : (𝑀 : ℳ) {𝑥 : Idx 𝑀 } {𝑦 : Cns 𝑀 𝑥} {𝑧 : ----→ Cns 𝑀 𝑦} → (𝑡 : Cns 𝑀/ (𝑥 ⊳ 𝑦)) (𝑢 : -----→ Cns 𝑀/ (𝑦 ◀ 𝑧)) → (𝐴 : Pos 𝑀/ (γ 𝑀 𝑡 𝑢) → 𝒰) → (𝑎 inl : (𝑝 : Pos 𝑀/ 𝑡) → 𝐴 (inl γ 𝑝)) → (𝑎 inr : (𝑝 : Pos 𝑀 𝑦) (𝑞 : Pos 𝑀/ (𝑢 𝑝)) → 𝐴 (inr γ 𝑝 𝑞)) → (𝑝 : Pos 𝑀/ (γ 𝑀 𝑡 𝑢)) → 𝐴 𝑝
It is defined by induction on 𝑡 and on 𝑝:

• If 𝑡 is of the form lf 𝑥, 𝑝 is a position of 𝑢 (pos η 𝑀 𝑥).
We return the term 𝑎 inr (pos η 𝑀 𝑥) 𝑝 which has type 𝐴 (inr γ (pos η 𝑀 𝑥) 𝑝) which is definitionally equal to 𝐴 𝑝.

• If 𝑡 is of the form nd (𝑥 ⊳ 𝑦) 𝑡, 𝑝 is a position of the tree nd (𝑥 ⊳ 𝑦) 𝑣 with 𝑣 𝑝 :≡ γ 𝑀 (𝑡 𝑝) (𝜆𝑞 → 𝑢 (inr (𝑝, 𝑞))) there are two cases to cover for 𝑝:

-If 𝑝 is inl ★, we return 𝑎 inl (inl ★) which has the required type.

-If 𝑝 is of the form inr (𝑝, 𝑞), 𝑝 is a position of 𝑦 and 𝑞 is a position of 𝑣 𝑝 which leads us to eliminate 𝑞. We set the motive to 𝐵 𝑞 :≡ 𝐴 (inr (𝑝, 𝑞)) and it remains to define the two cases of the elimination with the two defining equations:

𝑏 inl 𝑞 :≡ 𝑎 inl (inr (𝑝, 𝑞)) 𝑏 inr 𝑞 𝑟 :≡ 𝑎 inr (pair μ 𝑝 𝑞) 𝑟
Packaging all this data together, we obtain the following expression:

Pos-γ-elim 𝑀 (𝑡 𝑝) (𝜆𝑞 → 𝑢 (inr (𝑝, 𝑞))) 𝐵 𝑏 inl 𝑏 inr 𝑞
μ position operations We conclude the definition of the slice monad with the definition of operations relative to positions of constructors obtained from μ.

Let 𝑥 : Idx 𝑀/ , 𝑦 : Cns 𝑀/ 𝑥, and 𝑧 :

-----→ Cns 𝑀/ 𝑦. For any positions 𝑝 : Pos 𝑀/ 𝑦 and position 𝑞 : Pos 𝑀/ (𝑧 𝑝), there is a position pair μ 𝑀/ 𝑝 𝑞 of the tree μ 𝑀/ 𝑦 𝑧 that we define by induction on 𝑦 and on 𝑝:

• If 𝑦 is of the form lf 𝑥, Pos (lf 𝑥) is the empty type and we are done.

• If 𝑦 is of the form nd (𝑥 ⊳ 𝑦) 𝑡, we are looking for a position of the tree γ 𝑀 (𝑧 (inl ★)) 𝑢 with 𝑢 𝑝 :≡ μ 𝑀/ (𝑡 𝑝) (𝜆𝑞 → 𝑧 (inr (𝑝, 𝑞))). There are two cases to cover for 𝑝: Conversely, given a position 𝑝 : Pos 𝑀/ (μ 𝑀/ 𝑦 𝑧), we define pr μ 1 𝑀/ 𝑝 and pr μ 2 𝑀/ 𝑝 by induction on 𝑦. The case of the leaf is quickly eliminated and we are left with the node case of the form nd (𝑥 ⊳ 𝑦) 𝑡. The position 𝑝 is a position of the tree γ 𝑀 (𝑧 (inl ★)) 𝑢 with 𝑢 𝑝 :≡ μ 𝑀/ (𝑡 𝑝) (𝜆𝑞 → 𝑧 (inr (𝑝, 𝑞))) and we have to eliminate it using the elimination rule for γ.

-If 𝑝 is inl ★, 𝑞
In order to define pr μ 1 𝑀/ 𝑝, we set the motive to the constant 𝐴 𝑝 :≡ Pos 𝑀/ (nd (𝑥⊳ 𝑦) 𝑡) and define:

𝑎 inl 𝑝 :≡ inl ★ 𝑎 inr 𝑝 𝑞 :≡ inr (𝑝, pr μ 1 𝑀/ 𝑞)
Indeed, the first case concerns the substitution of the root node of nd (𝑥 ⊳ 𝑦) 𝑡 and the second one corresponds to a nested substitution somewhere in one of the trees specified by 𝑡; hence the recursive call to pr This concludes the presentation of the core of our extension of type theory with polynomial monads. This is enough to internalise higher algebraic structures such as ∞-groupoids as we shall see in Chapter 3.

Morphisms of monads

The extension of type theory with polynomial monads would not be complete without also introducing their morphisms. More precisely, we will define cartesian morphisms of monads which preserve the type of positions of a constructor as well as their typing. We will only make a modest use of them as their only purpose in this thesis is to reindex opetopic types in Chapter 3.

Similarly to monads, morphisms of monads are a primitive feature of our system enjoying definitional laws. For each monads 𝑀 and 𝑁, we postulate a universe of morphisms from 𝑀 to 𝑁 whose elements are seen as codes for morphisms of monads from 𝑀 to 𝑁 𝑀 → 𝑚 𝑁 : 𝒰 Finally, monad morphisms respect the monad structure. We have a first set of laws regarding η:

cns → 𝑓 (η 𝑀 𝑥) ≡ η 𝑁 (idx → 𝑓 𝑥) pos → 𝑓 (pos η 𝑖) ≡ pos η (idx → 𝑖) pos ← 𝑓 (pos η (idx → 𝑖)) ≡ pos η 𝑖
There is a second set of laws regarding μ:

cns → 𝑓 (μ 𝑀 𝑐 𝑑) ≡ μ 𝑁 (cns → 𝑓 𝑐) (𝜆𝑝 → cns → 𝑓 (𝑑 (pos ← 𝑓 𝑝))) pos → 𝑓 (pair μ 𝑝 𝑞) ≡ pair μ (pos → 𝑓 𝑝) (pos → 𝑓 𝑞) pos → 𝑓 (pr μ 1 𝑝) ≡ pr μ 1 (pos → 𝑓 𝑝) pos → 𝑓 (pr μ 2 𝑝) ≡ pr μ 2 (pos → 𝑓 𝑝) pos ← 𝑓 (pair μ 𝑝 𝑞) ≡ pair μ (pos ← 𝑓 𝑝) (pos ← 𝑓 𝑞) pos ← 𝑓 (pr μ 1 𝑝) ≡ pr μ 1 (pos ← 𝑓 𝑝) pos ← 𝑓 (pr μ 2 𝑝) ≡ pr μ 2 (pos ← 𝑓 𝑝)
We now define a monad morphism constructor for each of the monad constructors populating the universe of monads.

Identity morphism

The identity morphism behave as expected, it sends constructors of a monad to themselves. Given a monad 𝑀, we postulate a new code for the identity morphism on 𝑀:

id 𝑀 : 𝑀 → 𝑚 𝑀

Its components are all identities:

1.

Slice monad morphisms

A monad morphism 𝑓 : 𝑀 → 𝑚 𝑁 induces a morphism between their respective slice monads preserving the structure of trees. Given such a morphism 𝑓 , we postulate a new code for the monad morphism between the slice monads 𝑀/ and 𝑁/:

𝑓 /: 𝑀/→ 𝑚 𝑁/ Its components are defined as follows:

1. For any index (𝑖, 𝑐) :

Idx 𝑀/ , idx → 𝑓 / (𝑖, 𝑐) :≡ (idx → 𝑓 𝑖, cns → 𝑓 𝑐)
2. cns → 𝑓 / is defined by induction on 𝑐 :

Cns 𝑀/ 𝑖, cns → 𝑓 / (lf 𝑖) :≡ lf (idx → 𝑓 𝑖) cns → 𝑓 / (nd (𝑥 ⊳ 𝑦) 𝑡) :≡ nd (idx → 𝑓 𝑥 ⊳ cns → 𝑓 𝑦) (𝜆𝑝 → cns → 𝑓 / (𝑡 (pos ← 𝑓 𝑝))) 3. pos → 𝑓 / is

Composition of monad morphisms

We finish this section with the definition of the composition of two monad morphisms. Let 𝑓 : 𝑋 → 𝑚 𝑌 and 𝑔 : 𝑌 → 𝑚 𝑍, we define their composition

𝑔 • 𝑚 𝑓 : 𝑋 → 𝑚 𝑍
Its components are defined as follows:

idx → 𝑔• 𝑚 𝑓 𝑖 :≡ idx → 𝑔 (idx → 𝑓 𝑖) cns → 𝑔• 𝑚 𝑓 𝑐 :≡ cns → 𝑔 (cns → 𝑓 𝑐) pos → 𝑔• 𝑚 𝑓 𝑝 :≡ pos → 𝑔 (pos → 𝑓 𝑝) pos ← 𝑔• 𝑚 𝑓 𝑝 :≡ pos ← 𝑓 (pos ← 𝑔 𝑖)

Monad families

Working in dependent type theory, it is natural to generalise polynomial monads to families of polynomial monads indexed by a monad. Roughly, we regard monad families as specifying a collection of constructors indexed by a base constructor. The algebraic structure then grants the ability to compose these constructors resulting in a constructor indexed over the composite of their base constructors. We can also regard monad families as yet another axiomatisation of cartesian morphisms of monads.

We will introduce the dependent counterpart of all the constructions that have already been introduced in this chapter. This is a very laborious albeit straightforward process therefore we will gloss over the details. For any monad 𝑀 : ℳ, we introduce a universe of monads dependent over 𝑀: ℳ↓ 𝑀 : 𝒰 Notation. We will postfix all our dependent constructions with the symbol ↓. Often, an expression named 𝑥↓ will depend on some other expression 𝑥. For example, when talking about a monad 𝑀↓ without having made explicit the type of 𝑀↓, we will assume that it is a monad family indexed by an ordinary monad 𝑀.

The polynomial part of a family of polynomial monads 𝑀↓ : ℳ↓ 𝑀 is characterised by a set of decoding functions (Figure 2.4) depending over their nondependent counterpart. Note that the type of positions of a constructor of 𝑀↓ is the one of the constructor of 𝑀 it depends on. We understand this data as defining a cartesian morphism of polynomial monads preserving the type of positions of constructors by definition. -→ 𝑋 𝑐 be a family of elements of 𝑋 indexed by the positions of 𝑐. We define the notation -→ 𝑋↓ 𝑐↓ 𝑥 as follows:

-→ 𝑋↓ 𝑐↓ 𝑥 :≡ (𝑝 : Pos 𝑀 𝑐) → 𝑋↓ (Typ↓ 𝑀↓ 𝑐↓ 𝑝) (𝑥 𝑝)

As expected, the multiplication and unit of monad families depend on their non dependent counterpart (Figure 2.5). Luckily for us, we do not have to introduce dependent versions of the operations on positions, so we can state the laws that have to be obeyed by the monad operations immediately.

μ↓ 𝑀↓ 𝑥↓ (𝜆𝑝 → η↓ 𝑀↓ (Typ↓ 𝑀↓ 𝑥↓ 𝑝)) ≡ 𝑥↓ μ↓ 𝑀↓ (η↓ 𝑀↓ 𝑥↓) 𝑦↓ ≡ 𝑦↓ (pos η 𝑀 𝑥) μ↓ 𝑀↓ (μ↓ 𝑀↓ 𝑥↓ 𝑦↓) 𝑧↓ ≡ μ↓ 𝑀↓ 𝑥↓ (𝜆𝑝 → μ↓ 𝑀↓ (𝑦↓ 𝑝) (𝜆𝑞 → 𝑧↓ (pair μ 𝑀 𝑝 𝑞)))
We are now ready to define the dependent versions of the monad constructors we had introduced at the beginning of this chapter.

The identity monad

We start with the dependent identity monad defined for any type 𝑋:

Id↓ 𝑋 : ℳ↓ Id
The polynomial part of its definition is straightforward.

Idx↓ Id↓ 𝑋 𝑖 :≡ 𝑋 Cns↓ Id↓ 𝑋 𝑖↓ 𝑐 :≡ 1 Typ↓ Id↓ 𝑋 {𝑖↓ = 𝑥} 𝑐↓ 𝑝 :≡ 𝑥
We do not describe its trivial monad structure. This family has a single unary constructor for any element 𝑥 : 𝑋. Moreover, both its input and its output have 𝑥 for index. When we omit the type 𝑋 and write Id↓, we assume that 𝑋 is the unit type 1.

The pullback monad

Given a monad family 𝑀↓ : ℳ↓ 𝑀 and a dependent family 𝑋↓ : Fam↓ 𝑋 𝑀↓ , we introduce the dependent pullback monad 𝑋↓ * 𝑀↓ : ℳ↓ 𝑋 * 𝑀 . Its polynomial part is defined as follows: where η↓-dec 𝑀 𝑥 is defined as η↓-dec 𝑀 𝑥↓ :≡ Pos-η-elim 𝑀 𝑖 (𝜆𝑝 → 𝑋↓ (Typ↓ 𝑀↓ (η↓ 𝑀↓ 𝑖↓) 𝑝) (η-dec 𝑥)) 𝑥↓

Idx↓ 𝑋↓ * 𝑀↓ (𝑖,

The slice monad

Given a monad family 𝑀↓ : ℳ↓ 𝑀 , we introduce the dependent slice monad 𝑀↓/: ℳ↓ 𝑀/ .

Notation. We extend the notation -→ 𝑋 (𝑐 ◀ 𝑑). Let 𝑀↓ : ℳ↓ 𝑀 , let 𝑋↓ : Fam↓ 𝑋 𝑀↓/ be a family indexed by the indices of the monad 𝑀↓/, let 𝑐↓ : Cns↓ 𝑀↓ 𝑖↓ 𝑐, let 𝑑↓ :

------→ Cns↓ 𝑀↓ 𝑐↓ 𝑑, and let 𝑥 :

-→ 𝑋 (𝑐 ◀ 𝑑). We define the notation -→ 𝑋↓ (𝑐↓ ◀ 𝑑↓) 𝑥 as follows:

-→ 𝑋↓ (𝑐↓ ◀ 𝑑↓) 𝑥 :≡ (𝑝 :

Pos 𝑀 𝑐) → 𝑋↓ (Typ↓ 𝑀↓ 𝑐↓ 𝑝 ⊳ 𝑑↓ 𝑝) (𝑥 𝑝)
As expected, its indices are constructors of 𝑀↓:

Idx↓ 𝑀↓/ (𝑖, 𝑐) :≡ (𝑖↓:Idx 𝑀↓ 𝑖) Cns↓ 𝑀↓ 𝑖↓ 𝑐
Its type of constructors is an inductive type with two constructors, one for each constructor of its base type:

lf↓ : {𝑖 : Idx 𝑀 } (𝑖↓ : Idx↓ 𝑀↓ 𝑖) → Cns↓ 𝑀↓/ (𝑖↓ ⊳ η↓ 𝑀↓ 𝑖↓) (lf 𝑖) nd↓ : {𝑥 : Idx 𝑀 } {𝑦 : Cns 𝑀 𝑥} {𝑧 : ----→ Cns 𝑀 𝑦} {𝑡 : ----→ Cns 𝑀 (𝑦 ◀ 𝑧)} → (𝑥↓ : Idx↓ 𝑀↓ 𝑥) (𝑦↓ : Cns↓ 𝑀↓ 𝑥↓ 𝑦) {𝑧↓ : -----→ Cns 𝑀↓ 𝑦↓ 𝑧} → (𝑡↓ : ------→ Cns↓ 𝑀↓ (𝑦↓ ◀ 𝑧↓) 𝑡) → Cns↓ 𝑀↓/ (𝑥↓ ⊳ μ↓ 𝑀↓ 𝑦↓ 𝑧↓) (nd (𝑥 ⊳ 𝑦) 𝑡)
The typing function projects out the data of the node specified by the position:

Typ↓ 𝑀↓/ (nd↓ (𝑥↓ ⊳ 𝑦↓) 𝑡↓) (inl ★) :≡ (𝑥↓ ⊳ 𝑦↓) Typ↓ 𝑀↓/ (nd↓ (𝑥↓ ⊳ 𝑦↓) 𝑡↓) (inr (𝑝, 𝑞)) :≡ Typ↓ 𝑀↓/ (𝑡↓ 𝑝) 𝑞
The unit returns a corolla whose sole node is specified by its argument:

η↓ 𝑀↓/ (𝑥↓ ⊳ 𝑦↓) :≡ nd↓ (𝑥↓ ⊳ 𝑦↓) (𝜆𝑝 → lf↓ (Typ↓ 𝑀↓ 𝑦↓ 𝑝))
In order to define μ 𝑀↓/ , we first have to define the grafting operation whose signature is

γ↓ 𝑀↓ : {𝑥 : Idx 𝑀 } {𝑦 : Cns 𝑀 𝑥} {𝑧 : ----→ Cns 𝑀 𝑦} → {𝑡 : Cns 𝑀/ (𝑥 ⊳ 𝑦)} {𝑢 : -----→ Cns 𝑀/ (𝑦 ◀ 𝑧)} → {𝑥↓ : Idx↓ 𝑀↓ } {𝑦↓ : Cns↓ 𝑀↓ 𝑥↓ 𝑦} {𝑧↓ : ------→ Cns↓ 𝑀↓ 𝑦↓ 𝑧} → (𝑡↓ : Cns↓ 𝑀↓/ (𝑥↓ ⊳ 𝑦↓) 𝑡) (𝑢↓ : -----→ Cns 𝑀/ (𝑦↓ ◀ 𝑧↓) 𝑢) → Cns↓ 𝑀↓/ (𝑥↓ ⊳ μ↓ 𝑀↓ 𝑦↓ 𝑧↓) (γ 𝑀 𝑡 𝑢)
It is defined by induction on 𝑡↓:

• If 𝑡↓ is of the form lf↓ 𝑖↓, we simply return 𝑢↓ (pos η 𝑖).

• If 𝑡↓ is of the form nd↓ (𝑥↓ ⊳ 𝑦↓) 𝑡↓, we return nd↓ (𝑥↓ ⊳ 𝑦↓) 𝑡↓ ′ with

𝑡↓ ′ 𝑝 :≡ γ↓ 𝑀↓ (𝑡↓ 𝑝) (𝜆𝑞 → 𝑢 (pair μ 𝑝 𝑞))
We are now in position to define μ↓ 𝑀↓/ 𝑐↓ 𝑑↓ by induction on 𝑐↓:

• If 𝑐↓ is of the form lf↓ 𝑖↓, there is nothing to substitute and we return lf↓ 𝑖↓ intact.

• If 𝑐↓ is of the form nd (𝑥↓ ⊳ 𝑦↓) 𝑡↓, the root note will be substituted with the tree 𝑑↓ (inl ★), in consequence we recursively graft on this tree the result of the substitution of the nodes of 𝑡↓ with the corresponding trees specified by 𝑑↓:

γ↓ 𝑀↓ (𝑑↓ (inl ★)) (𝜆𝑝 → μ↓ 𝑀↓/ (𝑡↓ 𝑝) (𝜆𝑞 → 𝑑↓ (inr (𝑝, 𝑞))))

Dependent sums

We end this chapter with the definition of dependent sums of monads which will be used to define dependent sums of opetopic types. Let 𝑀 : ℳ be a monad and let 𝑀↓ : ℳ↓ 𝑀 be a family of monads indexed by 𝑀, we form the new monad Σ 𝑚 (𝑀, 𝑀↓) : ℳ Its different components are defined by the following equations:

Idx Σ 𝑚 (𝑀,𝑀↓) :≡ (𝑖:Idx 𝑀 ) Idx↓ 𝑀↓ 𝑖 Cns Σ 𝑚 (𝑀,𝑀↓) (𝑖, 𝑖↓) :≡ (𝑐:Cns 𝑀 𝑖) Cns↓ 𝑀↓ 𝑖↓ 𝑐 Pos Σ 𝑚 (𝑀,𝑀↓) (𝑐, 𝑐↓) :≡ Pos 𝑀 𝑐 Typ Σ 𝑚 (𝑀,𝑀↓) (𝑐, 𝑐↓) 𝑝 :≡ (Typ 𝑀 𝑐 𝑝, Typ↓ 𝑀↓ 𝑐↓ 𝑝)
Its monad structure is then defined as follows:

η Σ 𝑚 (𝑀,𝑀↓) (𝑖, 𝑖↓) :≡ (η 𝑀 𝑖, η↓ 𝑀↓ 𝑖↓) μ Σ 𝑚 (𝑀,𝑀↓) (𝑐, 𝑐↓) 𝑑 :≡ (μ 𝑀 𝑐 (𝜆𝑝 → pr 1 (𝑑 𝑝)), μ↓ 𝑀↓ 𝑐↓ (𝜆𝑝 → pr 2 (𝑑 𝑝)))
We do not detail the definitions of the operations acting on positions which simply use the ones of the monad 𝑀.

We conclude with the definition of two monad morphisms witnessing that the slice monad and the pullback monad constructors both distribute over the dependent sum. We will need them in Chapter 2. We start with the slice monad. Let 𝑀 : ℳ and 𝑀↓ : ℳ↓ 𝑀 , we form the new monad morphism Σ 𝑚 /(𝑀, 𝑀↓) : Σ 𝑚 (𝑀, 𝑀↓)/ → 𝑚 Σ 𝑚 (𝑀/, 𝑀↓/) Its components are defined as follows:

1. idx → Σ 𝑚 /(𝑀,𝑀↓) 𝑖 is defined by the equation idx →

Σ 𝑚 /(𝑀,𝑀↓) ((𝑖, 𝑖↓), (𝑐, 𝑐↓)) :≡ ((𝑖, 𝑐), (𝑖↓, 𝑐↓))

2. cns → Σ 𝑚 /(𝑀,𝑀↓) 𝑐 is defined by induction on 𝑐,

cns → Σ 𝑚 /(𝑀,𝑀↓) (lf (𝑖, 𝑖↓)) :≡ (lf 𝑖, lf↓ 𝑖↓) cns → Σ 𝑚 /(𝑀,𝑀↓) (nd ((𝑥, 𝑥↓) ⊳ (𝑦, 𝑦↓)) 𝑡) :≡ (nd (𝑥 ⊳ 𝑦) (𝜆𝑝 → pr 1 (cns → Σ 𝑚 /(𝑀,𝑀↓) (𝑡 𝑝))), nd↓ (𝑥↓ ⊳ 𝑦↓) (𝜆𝑝 → pr 2 (cns → Σ 𝑚 /(𝑀,𝑀↓) (𝑡 𝑝)))) 3. pos → Σ 𝑚 /(𝑀,

Opetopic methods in type theory

We leverage the extension of type theory with polynomial monads that we introduced in Chapter 2 to define opetopic types: collections of types whose geometry is governed by opetopes. We will use them to define a range of fully coherent higher algebraic structures such as ∞-groupoids and (∞, 1)-categories.

We will then apply opetopic methods in order to establish a number of elementary results about higher algebra in homotopy type theory.

In particular, we will prove in Section 3.3 that our definition of ∞-groupoid is equivalent to a particular instance of Baez and Dolan's definition of a coherent 𝑂-algebra [START_REF] Baez | Higher-dimensional algebra III. ncategories and the algebra of opetopes[END_REF].

Opetopic types

We introduce the notion of opetopic type which is a higher-dimensional collection of elements whose combinatorics is described by opetopes. Opetopic types are parametrised by a base monad 𝑀. The collection of 0-cells is given by a first family indexed by the indices of 𝑀, that is a type family 𝑋 0 : Fam 𝑀 . We expect 1-cells to be relations between a configuration of source 0-cells and a single target 0-cell. Such a configuration is given by a constructor of 𝑀 whose inputs and output are decorated with elements of 𝑋 0 . These are precisely the constructors of the monad 𝑋 * 0 𝑀. Equivalently, these correspond to the indices of the monad (𝑋 * 0 𝑀)/. A family of 1-cells is therefore given by a family 𝑋 1 : Fam (𝑋 * 0 𝑀)/ . We can continue this process indefinitely. 𝑛 + 1-cells are then relations between a configuration of source 𝑛-cells and a single target 𝑛-cell.

Notation. The construction of a pullback monad followed by its slice monad will be pervasive in this chapter and we adopt the following notation:

𝑀/𝐴 :≡ (𝐴 * 𝑀)/

Notation. Similarly, we will write 𝑓 /𝑔 instead of the more convoluted Pb 𝑓 ,𝑔 / for the monad morphism of type 𝑀/𝐴 → 𝑚 𝑁/𝐵.

The previous informal description is captured by the following definition.

Definition 3.1.1 (Opetopic type). An opetopic type parametrised by a monad 𝑀 -or 𝑀-opetopic type -is a coinductive sequence of type families which is defined by the following data:

• A type family 𝑋 : Fam 𝑀 .

• An opetopic type parametrised by the monad 𝑀/𝑋.

We denote 𝒪 𝑀 the type of opetopic types parametrised by the monad 𝑀.

Notation. An opetopic type 𝑋 is therefore an infinite sequence of families (𝑋 0 , 𝑋 1 , 𝑋 2 , . . . ) where 𝑋 𝑛 is its (𝑛 + 1)th type family for 𝑛 : N.

We denote 𝑋 >𝑛 the opetopic type consisting of the families (𝑋 𝑛+1 , 𝑋 𝑛+2 , . . . ). We call 𝑛-cells the elements of 𝑋 𝑛 .

Our first example of opetopic type is the terminal opetopic type for a monad 𝑀, denoted 1 𝑜 𝑀 , whose type families are the trivial families with one element.

Definition 3.1.2 (Terminal 𝑀-opetopic type). Let 𝑀 be a monad, the terminal 𝑀-opetopic type 1 𝑜 𝑀 is defined coinductively as follows: • Its family of objects is the constant family 𝑋 0 𝑖 :≡ 1.

• Its opetopic type of relations is 𝑋 >0 :≡ 1 𝑜 𝑀/𝑋 0 , the terminal opetopic for the monad 𝑀/𝑋 0 .

If we take 𝑀 to be the monad Id, we precisely obtain the opetopes as defined in Chapter 1 although monad laws now hold definitionally. For now, an opetopic type is just an infinite collection of cells whose geometry of 1-cells is governed by the base monad 𝑀 and whose geometry of higher cells is given by the slice construction but which is devoid of algebraic structure. In the next section, we will introduce fibrant opetopic types which are opetopic types whose cells can be coherently composed.

A presentation of opetopic types would not be complete without introducing their morphisms. They are simply defined coinductively as levelwise functions.

Firstly, we need to define the reindexing of an opetopic type along a monad morphism. We make use of morphisms of monads that we introduced in the previous section to that effect. Definition 3.1.3 (Reindexing of an opetopic type). Given a monad morphism 𝑓 : 𝑀 → 𝑚 𝑁 and an opetopic type 𝑋 : 𝒪 𝑁 , we can reindex 𝑋 along 𝑓 and obtain a 𝑀-opetopic type, denoted 𝑓 * 𝑋, defined coinductively by the following equations:

( 𝑓 * 𝑋) 0 𝑖 :≡ 𝑋 0 (idx → 𝑓 𝑖) ( 𝑓 * 𝑋) >0 :≡ ( 𝑓 /id) * 𝑋 >0
This allows the definition of morphisms of opetopic types. Definition 3.1.4 (Morphism of opetopic types). Given a monad 𝑀 and two 𝑀opetopic types 𝑋 and 𝑌, a morphism from 𝑋 to 𝑌, denoted 𝑋 → 𝑜 𝑌, is defined coinductively and consists of the following:

• A function 𝑓 : {𝑖 : Idx 𝑀 } → 𝑋 0 𝑖 → 𝑌 0 𝑖. • A morphism of opetopic types 𝑋 >0 → 𝑜 (id 𝑀 / 𝑓 ) * 𝑌 >0 .
An equivalence of opetopic types is then a morphism of opetopic types whose levelwise functions are all equivalences.

Algebras

In this section, we discuss algebras of polynomial monads which are a first step towards the notion of fibrant opetopic type. Informally, we will express algebras as functional relations. For any monad 𝑀, an algebra will be defined as the data comprising a type family 𝑋 : Fam 𝑀 -the carrier of the algebraalong with a relation -its action -witnessing that, for any constructor of 𝑀 and any decoration of its inputs with elements of 𝑋, there exists an element decorating its output. Moreover, the data of this last element along with the element witnessing the relation live in a contractible type. Such a relation is typically defined as a type family in type theory. Its indexing type will be the type of constructors of 𝑀 whose both inputs and output are decorated with elements of 𝑋. These relations are therefore elements of type Fam 𝑀/𝑋 .

Algebraic structure

We call pasting diagram a pair (𝑐, 𝑑) of type ⟦𝑀⟧ 𝑋 𝑖 for some monad 𝑀, family 𝑋 : Fam 𝑀 , and index 𝑖 : Idx 𝑀 . We regard 𝑐 as specifying a configuration of inputs and 𝑑 as providing compatible elements of 𝑋 for each position of 𝑐. We will mostly be concerned with pasting diagrams of some slice monad 𝑀/. In this case, pasting diagrams are trees of constructors of 𝑀 decorated with compatible cells. We will extend our notion of algebra from polynomial monads to opetopic types by requiring that any two consecutive cell families (𝑋 𝑛 , 𝑋 𝑛+1 ) form an algebra for the monad indexing 𝑋 𝑛 . Given such an opetopic type, we can compose any pasting diagram of 𝑛-cells and its composite is unique up to a higher cell which happen to coincide with a propositional equality.

We start with the definition of 0-algebras. A 0-algebra determines an operation of composition of pasting diagrams witnessed by a higher cell, but this composition does not obey any law. Definition 3.2.1 (0-algebra). Given a monad 𝑀, a 0-algebra for 𝑀 is a type family 𝑋 0 : Fam 𝑀 along with a type family 𝑋 1 : Fam 𝑀/𝑋 0 such that for any index 𝑖 : Idx 𝑀 and any pasting diagram (𝑐, 𝑥) : ⟦𝑀⟧ 𝑋 0 𝑖, the following type is contractible:

(𝑦:𝑋 0 𝑖) 𝑋 1 ((𝑖, 𝑦) ⊳ (𝑐, 𝑥)) In other words, 𝑋 1 is a functional and entire relation. This predicate, being expressed as the contractibility of some type, is a proposition and therefore a property of 𝑋 1 . This property brings to mind the Segal condition as presented in the bisimplicial setting of Riehl and Shulman [START_REF] Riehl | A type theory for synthetic ∞categories[END_REF].

This property provides us with the ability to compose pasting diagrams and this composition is witnessed by a filler:

𝛼 𝑋 1 : {𝑖 : Idx 𝑀 } → ⟦𝑀⟧ 𝑋 0 𝑖 → 𝑋 0 𝑖 𝛼 fill 𝑋 1 : {𝑖 : Idx 𝑀 } → (𝑥 : ⟦𝑀⟧ 𝑋 0 𝑖) → 𝑋 1 ((𝑖, 𝛼 𝑋 1 𝑥) ⊳ 𝑥)
These two functions are simply defined to be the two components of the centre of contraction of the proof that (𝑋 0 , 𝑋 1 ) is a 0-algebra.

Notation. Note that we will often implicitly curry functions such as 𝛼 𝑋 and write 𝛼 𝑋 𝑐 𝑥 instead of 𝛼 𝑋 (𝑐, 𝑥).

We will say that a family is a 1-algebra if it satisfies the usual laws of a set-level algebra (Mac Lane 2013, VI.2); that is, the following informal diagrams should commute up to a propositional identity.

⟦𝑀⟧ ⟦𝑀⟧ 𝑋

0 ⟦𝑀⟧ 𝑋 0 ⟦𝑀⟧ 𝑋 0 𝑋 0 ⟦𝑀⟧ 𝛼 𝑋 1 μ 𝑀 𝑋 0 𝛼 𝑋 1 𝛼 𝑋 1 𝑋 0 ⟦𝑀⟧ 𝑋 0 𝑋 0 η 𝑀 𝑋 0 id 𝛼 𝑋 1
Definition 3.2.2 (1-algebra). Given a monad 𝑀 and a 0-algebra (𝑋 0 , 𝑋 1 ) with 𝑋 0 : Fam 𝑀 and 𝑋 1 : Fam 𝑀/𝑋 0 , (𝑋 0 , 𝑋 1 ) is a 1-algebra if 𝛼 𝑋 1 is compatible with the multiplication μ 𝑀 and the unit η 𝑀 of the monad 𝑀; that is, it satisfies the following identities:

𝛼 𝑋 1 (μ 𝑀 𝑐 𝑑) 𝑥 = 𝛼 𝑋 1 𝑐 (𝜆𝑝 → 𝛼 𝑋 1 (𝑑 𝑝) (𝜆𝑞 → 𝑥 (pair μ 𝑝 𝑞))) (𝛼 -μ) 𝛼 𝑋 1 (η 𝑀 𝑖) 𝑥 = 𝑥 (pos η 𝑖) (𝛼 -η)
We now state a key property of 0-algebras as a characterisation of its action family which will come handy in the rest of this chapter.

Lemma 3.2.3 (Cell characterisation).

Let 𝑀 be a monad and let (𝑋 0 , 𝑋 1 ) be a 0algebra for 𝑀. For any constructor 𝑐 : Cns 𝑀 𝑖, any family 𝑥 :

-→ 𝑋 0 𝑐, and any element 𝑦 : 𝑋 0 𝑖, a cell 𝑓 : 𝑋 1 ((𝑖, 𝑧) ⊳ (𝑐, 𝑥)) implies the existence of a family of equivalences

𝑒 𝑦 : 𝑋 1 ((𝑖, 𝑦) ⊳ (𝑐, 𝑥)) ≃ (𝑧 = 𝑦)
such that 𝑒 𝑧 𝑓 = refl. In particular, the algebra (𝑋 0 , 𝑋 1 ) guarantees the existence of the cell 𝛼 fill 𝑋 1 𝑐 𝑥 : 𝑋 1 ((𝑖, 𝛼 𝑋 1 𝑐 𝑥) ⊳ (𝑐, 𝑥)).

Proof. The equivalence follows from the HoTT book's Theorem 5.8.2 which states that if a pointed predicate (𝑅, 𝑟 * ) over a pointed type (𝐴, 𝑎 * ) is such that the type (𝑎:𝐴) (𝑅 𝑎) is contractible then the equivalence 𝑒 𝑎 : 𝑅 𝑎 ≃ (𝑎 * = 𝑎) holds for any 𝑎 : 𝐴; moreover, 𝑒 𝑎 * 𝑟 * = refl. In our situation, the pointed predicate in question is 𝑅 𝑦 :≡ 𝑋 1 ((𝑖, 𝑦) ⊳ (𝑐, 𝑥)) with point 𝑓 : 𝑅 𝑧. As (𝑋 0 , 𝑋 1 ) is a 0-algebra, the type (𝑦:𝑋 0 𝑖) 𝑅 𝑦 is contractible which allows us to conclude that there is a family of equivalences 𝑒 𝑦 : 𝑅 𝑦 ≃ (𝑧 = 𝑦) such that 𝑒 𝑧 𝑓 = refl.

□

Algebras for slice monads We now turn to algebras for slice monads and consider families 𝑋 0 : Fam 𝑀/ and 𝑋 1 : Fam 𝑀//𝑋 0 . We will see in Section 3.5 that their algebras correspond to what we call wild 𝑀-multicategories, multicategories whose arity of morphisms is parametrised by constructors of the monad 𝑀 but whose laws are not necessarily coherent.

Notation. Given a monad 𝑀, a family 𝑋 : Fam 𝑀/ , a cell 𝑡 : 𝑋 (𝑥 ⊳ 𝑦), and a family of cells 𝑢 :

-→ 𝑋 (𝑦 ◀ 𝑧), we will make great use of the depth-2 pasting diagram whose root node is decorated with the cell 𝑡 and whose family of nodes grafted on the root node is decorated with the cells specified by 𝑢. It is defined as the pair (𝑐, 𝑑) : ⟦𝑀/⟧ 𝑋 𝑥 where 𝑐 is the depth-2 tree nd (𝑥 ⊳ 𝑦) (𝜆𝑝 → η 𝑀/ (Typ 𝑀 𝑦 𝑝 ⊳ 𝑧 𝑝)) and where 𝑑 is a family decorating the nodes of 𝑐 defined by the following equations:

𝑑 (inl ★) :≡ 𝑡 𝑑 (inr (𝑝, inl ★)) :≡ 𝑢 𝑝
We denote this pasting diagram 𝜃 𝑡,𝑢 .

When (𝑋 0 , 𝑋 1 ) is a 0-algebra, we define a biased composition of 0-cells μ 𝛼 𝑋 1 along with its filler μ 𝛼 fill 𝑋 1 :

μ 𝛼 𝑋 1 : {𝑥 : Idx 𝑀 } {𝑦 : Cns 𝑀 𝑥} {𝑧 : ----→ Cns 𝑀 𝑦} → (𝑡 : 𝑋 0 (𝑥 ⊳ 𝑦)) (𝑢 : -→ 𝑋 0 (𝑦 ◀ 𝑧)) → 𝑋 0 (𝑥 ⊳ μ 𝑀 𝑦 𝑧) μ 𝛼 fill 𝑋 1 : {𝑥 : Idx 𝑀 } {𝑦 : Cns 𝑀 𝑥} {𝑧 : ----→ Cns 𝑀 𝑦} → (𝑡 : 𝑋 0 (𝑥 ⊳ 𝑦)) (𝑢 : -→ 𝑋 0 (𝑦 ◀ 𝑧)) → 𝑋 1 (((𝑥 ⊳ μ 𝑀 𝑦 𝑧), μ 𝛼 𝑋 1 𝑡 𝑢) ⊳ 𝜃 𝑡,𝑢 )
These operations are defined by the following equations:

μ 𝛼 𝑋 1 𝑡 𝑢 :≡ 𝛼 𝑋 1 𝜃 𝑡,𝑢 μ 𝛼 fill
𝑋 1 𝑡 𝑢 :≡ 𝛼 fill 𝑋 1 𝜃 𝑡,𝑢 We will see that under a certain condition, this composition is unital and associative up to a propositional identity.

We define a second operation η 𝛼 which associates to any index 𝑥 : Idx 𝑀 , a unary cell of type 𝑋 0 (𝑥 ⊳ 𝜂 𝑀 𝑥) along with its filler:

η 𝛼 𝑋 1 : (𝑥 : Idx 𝑀 ) → 𝑋 0 (𝑥 ⊳ η 𝑀 𝑥) η 𝛼 fill 𝑋 1 : (𝑥 : Idx 𝑀 ) → 𝑋 1 (((𝑥 ⊳ η 𝑀 𝑥), η 𝛼 𝑋 1 𝑥) ⊳ (lf 𝑥, ⊥-elim))
These operations are defined by the following equations:

η 𝛼 𝑋 1 𝑥 :≡ 𝛼 𝑋 1 (lf 𝑥) ⊥-elim η 𝛼 fill 𝑋 1 𝑥 :≡ 𝛼 fill 𝑋 1 (lf 𝑥) ⊥-elim
The unary cells η 𝛼 𝑋 1 𝑥 will act as units for μ 𝛼 𝑋 1 when (𝑋 0 , 𝑋 1 ) is a 1-algebra.

Algebraic laws

We now study how, given a 0-algebra (𝑋 0 , 𝑋 1 ), a second 0algebra (𝑋 1 , 𝑋 2 ) forces (𝑋 0 , 𝑋 1 ) to be a 1-algebra.

Methodology. We will quite often want to prove that two cells 𝑥, 𝑦 : 𝑋 0 𝑖 are equal. Most of the time, we will use the fact that we have a family 𝑋 1 : Fam 𝑀/𝑋 0 such that (𝑋 0 , 𝑋 1 ) is a 0-algebra and that one of 𝑥 or 𝑦 -say 𝑥 -is accompanied by a filler of type 𝑋 1 ((𝑖, 𝑥) ⊳ (𝑐, 𝑧)). That (𝑋 0 , 𝑋 1 ) is a 0-algebra means that we can deduce an identity 𝛼 𝑋 1 𝑐 𝑧 = 𝑥 from Lemma 3.2.3. Therefore, proving 𝑥 = 𝑦 amounts to finding another filler of type 𝑋 1 ((𝑖, 𝑦) ⊳ (𝑐, 𝑧)) which allows, in turn, to deduce an identity 𝛼 𝑋 1 𝑐 𝑧 = 𝑦 from which we finally deduce the identity 𝑥 = 𝑦. The difficulty will therefore lie in finding this second filler. When one has, in addition, a family 𝑋 2 : Fam 𝑀/𝑋 0 /𝑋 1 such that (𝑋 1 , 𝑋 2 ) is a 0-algebra, this filler will often be obtained as the composition of a pasting diagram of 1-cells.

Theorem 3.2.4. Given a monad 𝑀 and families 𝑋 0 : Fam 𝑀 , 𝑋 1 : Fam 𝑀/𝑋 0 , and 𝑋 2 : Fam 𝑀/𝑋 0 /𝑋 1 , if (𝑋 0 , 𝑋 1 ) and (𝑋 1 , 𝑋 2 ) are 0-algebras then (𝑋 0 , 𝑋 1 ) is a 1-algebra.

Proof. We start to prove 𝛼 -μ.

Let 𝑖 : Idx 𝑀 , 𝑐 : Cns 𝑀 𝑖, 𝑑 :

----→ Cns 𝑀 𝑐, and a family 𝑥 :

-→ 𝑋 0 (μ 𝑀 𝑐 𝑑). We want to establish the following identity in 𝑋 0 𝑖: We define it as the composition of the pasting diagram 𝜃 𝑓 ,𝑔 represented on the right part of Figure 3.1 and that we now describe. We define the family 𝑔 as the fillers witnessing the compositions of the pasting diagrams (𝑑 𝑝, 𝜆𝑞 → 𝑥 (pair μ 𝑝 𝑞)) for any position 𝑝 : Pos 𝑀 𝑐, hence:

𝛼 𝑋 1 (μ 𝑀 𝑐 𝑑) 𝑥 = 𝛼 𝑋 1 𝑐 (𝜆𝑝 → 𝛼 𝑋 1 (𝑑 𝑝) (𝜆𝑞 → 𝑥 (pair μ 𝑝 𝑞))) 𝑥 1,
𝑔 𝑝 :≡ 𝛼 fill 𝑋 1 (𝑑 𝑝) (𝜆𝑞 → 𝑥 (pair μ 𝑝 𝑞))
We then define 𝑓 as the filler for the composition of the pasting diagram made of the targets of the family 𝑔:

𝑓 :≡ 𝛼 fill 𝑋 1 𝑐 (𝜆𝑝 → 𝛼 𝑋 1 (𝑑 𝑝) (𝜆𝑞 → 𝑥 (pair μ 𝑝 𝑞))) One can finally check that μ 𝛼 𝑋 2 𝑓 𝑔 has the required type 𝑋 1 ((𝑖, 𝑦) ⊳ (μ 𝑀 𝑐 𝑑, 𝑥))
which concludes the proof of 𝛼 -μ.

We now prove 𝛼 -η. Let 𝑖 : Idx 𝑀 and 𝑥 :

-→ 𝑋 0 (η 𝑀 𝑖), we want to establish the following identity in 𝑋 0 𝑖:

𝛼 𝑋 1 (η 𝑀 𝑖) 𝑥 = 𝑥 (pos η 𝑖)
According to Lemma 3.2.3, establishing this identity amounts to defining a cell of type 𝑋 1 ((𝑖, 𝑥 (pos η 𝑖)) ⊳ (η 𝑀 𝑖, 𝑥))

The situation is represented on Figure 3.2. Using the algebraicity of 𝑋 2 , we first obtain the cell of type 𝑋 1 ((𝑖, 𝑥 (pos η 𝑖)) ⊳ (η 𝑀 𝑖, η-dec (𝑥 (pos η 𝑖))))

as η 𝛼 𝑋 2 (𝑖, 𝑥 (pos η 𝑖)). We obtain the desired cell by transporting the previous cell along a path η-dec (𝑥 (pos η 𝑖)) = 𝑥 using the elimination principle for Pos 𝑀 (𝜂 𝑀 𝑖). This concludes the proof of 𝛼 -η.

□

We now prove that, if the base monad is a slice monad of the form 𝑀/, the biased composition μ 𝛼 𝑋 1 is associative and unital.

Theorem 3.2.5. Given a monad 𝑀 and families 𝑋 0 : Fam 𝑀/ , 𝑋 1 : Fam 𝑀//𝑋 0 , and 𝑋 2 : Fam 𝑀//𝑋 0 /𝑋 1 , if (𝑋 0 , 𝑋 1 ) and (𝑋 1 , 𝑋 2 ) are 0-algebras, then μ 𝛼 𝑋 1 is associative and unital with unit η 𝛼 𝑋 1 :

μ 𝛼 𝑋 1 𝑓 (𝜆𝑝 → η 𝛼 𝑋 1 (Typ 𝑀 𝑦 𝑝)) = 𝑓 (μ 𝛼 𝑋 1 -unit-r) μ 𝛼 𝑋 1 (η 𝛼 𝑋 1 𝑥) 𝑓 = 𝑓 (pos η 𝑥) (μ 𝛼 𝑋 1 -unit-l) μ 𝛼 𝑋 1 𝑓 (𝜆𝑝 → μ 𝛼 𝑋 1 (𝑔 𝑝) (𝜆𝑞 → ℎ (pair μ 𝑝 𝑞))) = μ 𝛼 𝑋 1 (μ 𝛼 𝑋 1 𝑓 𝑔) ℎ (μ 𝛼 𝑋 1 -assoc)
Proof. We start with the proof of μ 𝛼 𝑋 1 -unit-r. Given a cell 𝑓 : 𝑋 0 (𝑥 ⊳ 𝑦), we want to prove the following equation:

μ 𝛼 𝑋 1 𝑓 (𝜆𝑝 → η 𝛼 𝑋 1 (Typ 𝑀 𝑦 𝑝)) = 𝑓
We use the fact that (𝑋 0 , 𝑋 1 ) is a 0-algebra which implies the contractibility of the following type:

(𝑔:𝑋 0 (𝑥⊳𝑦)) 𝑋 1 (((𝑥 ⊳ 𝑦), 𝑔) ⊳ η 𝑋 * 0 (𝑀/) ((𝑥 ⊳ 𝑦), 𝑓 )) The pair ( 𝑓 , η 𝛼 𝑋 2 ((𝑥 ⊳ 𝑦), 𝑓 )) lives in this type and it remains to find a second pair whose first component is therefore μ 𝛼 𝑋 1 𝑓 (𝜆𝑝 → η 𝛼 𝑋 1 (Typ 𝑀 𝑦 𝑝)) -the lefthand side of the equation that we denote 𝑙 -in order to establish the wanted identity. We obtain the second component -denoted 𝛽 on Figure 3.3 -as the composition of the pasting diagram that we now describe and which will consist in filling the units grafted on 𝑓 with leaves. This pasting diagram must have target 𝑙 and we choose its root node to be the cell μ 𝛼 fill 𝑋 1 𝑓 (𝜆𝑝 → η 𝛼 𝑋 1 (Typ 𝑀 𝑦 𝑝)). The source pasting diagram of this cell is 𝜃 𝑓 ,𝜆𝑝→η 𝛼 𝑋 1 (Typ 𝑀 𝑦 𝑝) . We define a family of trees to graft on its positions by induction. In the case of the root node, 𝑓 , we just plug a leaf lf ((𝑥 ⊳ 𝑦), 𝑓 ) as we want to keep 𝑓 intact in the first diagram. In the case of the other positions 𝑝 of 𝑦, the source of 𝑓 , we graft unit fillers corollas

η 𝛼 fill 𝑋 1 (Typ 𝑀 𝑦 𝑝) : 𝑋 1 ((((Typ 𝑀 𝑦 𝑝) ⊳ η 𝑀 (Typ 𝑀 𝑦 𝑝)), η 𝛼 𝑋 1 (Typ 𝑀 𝑦 𝑝)) ⊳ (lf (Typ 𝑀 𝑦 𝑝), ⊥-elim)) μ 𝛼 𝑋 1 𝑓 (η 𝛼 𝑋 1 𝑦 𝑖 ) η 𝛼 𝑋 1 𝑦 1 . . . η 𝛼 𝑋 1 𝑦 𝑛 𝑓 𝛽 η 𝛼 fill 𝑋 1 𝑦 1 . . . η 𝛼 fill 𝑋 1 𝑦 𝑛 μ 𝛼 fill 𝑋 1 𝑓 (η 𝛼 𝑋 1 𝑦 𝑖 ) Figure 3.3: μ 𝛼 𝑋 1 is right unital
This corresponds to filling the units in the first pasting diagram with leaves. We compose the resulting pasting diagram using the fact that (𝑋 1 , 𝑋 2 ) is a 0-algebra and obtain a cell of type

𝑋 1 ((𝑥 ⊳ 𝑦, 𝑙) ⊳ μ 𝑋 * 0 (𝑀/) (𝜃 𝑓 ,𝜆𝑝→η 𝛼 𝑋 1 (Typ 𝑀 𝑦 𝑝) ) 𝑚)
where 𝑚 is the family of pasting diagrams indexed by the positions of

𝜃 𝑓 ,𝜆𝑝→η 𝛼 𝑋 1 (Typ 𝑀 𝑦 𝑝)
determined by the source pasting diagrams of the family of cells grafted on

μ 𝛼 fill 𝑋 1 𝑓 (𝜆𝑝 → η 𝛼 𝑋 1 (Typ 𝑀 𝑦 𝑝)).
It then remains to transport this cell along the easy to establish path μ 𝑋 * 0 (𝑀/) (𝜃 𝑓 ,𝜆𝑝→η 𝛼 𝑋 1

(Typ 𝑀 𝑦 𝑝) ) 𝑚 = η 𝑋 * 0 (𝑀/) ((𝑥 ⊳ 𝑦), 𝑓 ) We now prove μ 𝛼 𝑋 1 -unit-l using a similar argument. Given an index 𝑥 : Idx 𝑀 , a family of constructors indexed by a unit 𝑦 :

----→ Cns 𝑀 (η 𝑀 𝑥), and a family 𝑓 :

-→ 𝑋 0 (η 𝑀 𝑥 ◀ 𝑦), we want to establish the following identity μ 𝛼 𝑋 1 (η 𝛼 𝑋 1 𝑥) 𝑓 = 𝑓 (pos η 𝑥) We denote 𝑙 its left-hand side. We once again use the fact that (𝑋 0 , 𝑋 1 ) is a 0-algebra and this time we are looking for a cell of type

𝑋 1 (((𝑥 ⊳ 𝑦 (pos η 𝑥)), μ 𝛼 𝑋 1 (η 𝛼 𝑋 1 𝑥) 𝑓 ) ⊳ (η 𝑋 * 0 (𝑀/) (𝑥 ⊳ 𝑦 (pos η 𝑥)), 𝑓 (pos η 𝑥)))
We obtain this cell -denoted 𝛽 on Figure 3.4 -as the composition of the pasting diagram that we now describe and which will consist in filling the unit on which is grafted 𝑓 with a leaf. This pasting diagram must have target 𝑙 and we choose its root node to be the cell μ 𝛼 fill 𝑋 1 (η 𝛼 𝑋 1 𝑥) 𝑓 . Its source pasting diagram is 𝜃 (η 𝛼 𝑋 1 𝑥), 𝑓 and we define a family of trees to graft on its positions by induction. In the case of the root node, η 𝛼 𝑋 1 𝑥, we graft the unit filler corolla

η 𝛼 fill 𝑋 1 𝑥 : 𝑋 1 (((𝑥 ⊳ η 𝑀 𝑥), η 𝛼 𝑋 1 𝑥) ⊳ (lf 𝑥, ⊥-elim)) μ 𝛼 𝑋 1 (η 𝛼 𝑋 1 𝑥) 𝑓 . . . 𝑓 η 𝛼 𝑋 1 𝑥 𝛽 η 𝛼 fill 𝑋 1 𝑥 μ 𝛼 fill 𝑋 1 (η 𝛼 𝑋 1 𝑥) 𝑓 Figure 3.4: μ 𝛼 𝑋 1 is left unital
and, in the case of the position of 𝑓 , we just plug a leaf lf ((𝑥⊳𝑦 (pos η 𝑥)), 𝑓 (pos η 𝑥)) as we want to keep 𝑓 intact in the first diagram.

The family of pasting diagrams that we just specified implicitly determines a family of source pasting diagrams that we denote 𝑚. We compose this pasting diagram using the fact that (𝑋 1 , 𝑋 2 ) is 0-algebra and obtain a cell of type

𝑋 1 ((𝑥 ⊳ 𝑦, 𝑙) ⊳ μ 𝑋 * 0 (𝑀/) (𝜃 (η 𝛼 𝑋 1 𝑥), 𝑓 ) 𝑚)
It then remains to transport this cell along the easily established path

μ 𝑋 * 0 (𝑀/) (𝜃 (η 𝛼 𝑋 1 𝑥), 𝑓 ) 𝑚 = η 𝑋 * 0 (𝑀/) ((𝑥 ⊳ 𝑦 (pos η 𝑥)), 𝑓 (pos η 𝑥))
We finally prove the associativity μ 𝛼 𝑋 1 -assoc. Given 𝑓 : 𝑋 0 (𝑥⊳𝑦), 𝑔 :

-→ 𝑋 0 (𝑦◀ 𝑧), and ℎ : -→ 𝑋 0 (μ 𝑀 𝑦 𝑧 ◀ 𝑡), we want to establish the following identity:

μ 𝛼 𝑋 1 𝑓 (𝜆𝑝 → μ 𝛼 𝑋 1 (𝑔 𝑝) (𝜆𝑞 → ℎ (pair μ 𝑝 𝑞))) = μ 𝛼 𝑋 1 (μ 𝛼 𝑋 1 𝑓 𝑔) ℎ
Establishing this identity amounts to finding two cells sharing the same source and whose target are the two sides of the identity that we denote 𝑓 (𝑔 ℎ) and ( 𝑓 𝑔)ℎ then concluding using that fact that (𝑋 0 , 𝑋 1 ) is a 0-algebra. The two cells in question correspond to the two different ways to multiply the cells 𝑓 , 𝑔, and ℎ and correspond to the cells 𝛽 and 𝛾 on Figure 3.5. We start with the case of the cell 𝛽. We obtain it as the composition of the pasting diagram whose root node is μ 𝛼 fill 𝑋 1 𝑓 𝑔 ℎ where 𝑔 ℎ is the family

𝑔 ℎ 𝑝 :≡ μ 𝛼 𝑋 1 (𝑔 𝑝) (𝜆𝑞 → ℎ (pair μ 𝑝 𝑞))
The source of this node is the pasting diagram 𝜃 𝑓 , 𝑔 ℎ and we specify the trees to graft on its positions by induction. In the case of the root node, 𝑓 , we graft a leaf, while on positions 𝑝 of 𝑦, we graft corollas We now turn to the case of the cell 𝛾. It is defined as the composition of the pasting diagram that we now describe. Its root node is μ 𝛼 fill 𝑋 1 ( 𝑓 𝑔) ℎ where 𝑓 𝑔 :≡ μ 𝛼 𝑋 1 𝑓 𝑔. The source pasting diagram is therefore 𝜃 ( 𝑓 𝑔),ℎ and we specify the pasting diagrams to graft on its positions by induction. In the case of the root node, 𝑓 𝑔, we graft the corolla μ 𝛼 fill 𝑋 1 𝑓 𝑔. As for the other positions 𝑝 of μ 𝑀 𝑦 𝑧, we simply graft leaves lf ((Typ 𝑀 (μ 𝑀 𝑦 𝑧) 𝑝 ⊳ 𝑡 𝑝), ℎ 𝑝). This concludes the description of the pasting diagram whose composition is the cell 𝛾.

μ 𝛼 fill 𝑋 1 (𝑔 𝑝) (𝜆𝑞 → ℎ (pair μ 𝑝 𝑞))
The two cells 𝛽 and 𝛾 both have a source propositionally equal to the pasting diagram denoting the unbiased composition of 𝑓 , 𝑔, and ℎ which allows us to conclude the proof.

□

We call the algebraic structure thus described a wild 𝑀-multicategory which is the subject of Section 3.5.

We finish this section with a last technical result concerning the interaction of the algebra with the grafting operation γ. Lemma 3.2.6. Let 𝑀 be a monad and let families 𝑋 0 : Fam 𝑀/ and 𝑋 1 : Fam 𝑀//𝑋 0 such that (𝑋 0 , 𝑋 1 ) is a 1-algebra. For any tree 𝑡 : Cns 𝑀/ (𝑥 ⊳ 𝑦), family 𝑢 :

-----→

Cns 𝑀/ (𝑦 ◀ 𝑧),
and family 𝑣 :

-→ 𝑋 0 (γ 𝑀 𝑡 𝑢),

𝛼 𝑋 1 (γ 𝑀 𝑡 𝑢) 𝑣 = μ 𝛼 𝑋 1 (𝛼 𝑋 1 𝑡 (𝜆𝑝 → 𝑣 (inl γ 𝑝))) (𝜆𝑝 → 𝛼 𝑋 1 (𝑢 𝑝) (𝜆𝑞 → 𝑣 (inr γ 𝑝 𝑞))) Proof.
We notice that γ 𝑀 𝑡 𝑢 is equal to μ 𝑀/ 𝜃 𝑡,𝑢 where 𝜃 𝑡,𝑢 is seen as a depth-2 pasting diagram whose root node is decorated with 𝑡 and whose children nodes are decorated with elements of the family 𝑢. This allows to conclude using the identity 𝛼 -μ as (𝑋 0 , 𝑋 1 ) is a 1-algebra.

□

The following simple corollary follows.

Corollary 3.2.7. Let 𝑀 be a monad and let families 𝑋 0 : Fam 𝑀/ and 𝑋 1 : Fam 𝑀//𝑋 0 such that (𝑋 0 , 𝑋 1 ) is a 1-algebra. For any constructor 𝑦 : Cns 𝑀 𝑥, any family of trees 𝑡 :

-----→

Cns 𝑀/ (𝑦 ◀ 𝑧), and any family 𝑣 :

-→ 𝑋 0 (nd (𝑥 ⊳ 𝑦) 𝑡),

𝛼 𝑋 1 (nd (𝑥 ⊳ 𝑦) 𝑡) 𝑣 = μ 𝛼 𝑋 1 (𝑣 (inl ★)) (𝜆𝑝 → 𝛼 𝑋 1 (𝑡 𝑝) (𝜆𝑞 → 𝑣 (inr (𝑝, 𝑞)))) Proof.
We notice that the constructor nd (𝑥 ⊳ 𝑦) 𝑡 is actually equal to γ 𝑋 1 (η 𝑀/ (𝑥 ⊳ 𝑦)) 𝑡 which allows us to apply Lemma 3.2.6. □

Fibrant opetopic types

In light of the precedent section, we can expect a fully coherent 𝑀-algebra to be an infinite sequence of families (𝑋 0 , 𝑋 1 , . . . ) such that 𝑋 𝑛+1 : Fam 𝑀/.../𝑋 𝑛 -in other words, an opetopic type -and such that any pair (𝑋 𝑛 , 𝑋 𝑛+1 ) is a 0-algebra. We call these opetopic types fibrant. Definition 3.2.8 (Fibrant opetopic type). Given a monad 𝑀 and a 𝑀-opetopic type 𝑋, we say that this opetopic type is fibrant if it satisfies the following coinductive property:

• The pair (𝑋 0 , 𝑋 1 ) is a 0-algebra.

• The opetopic type 𝑋 >0 is fibrant.

A fibrant opetopic type is to be seen as a collection of 𝑛-dimensional cells for all 𝑛 : N which can be composed. Moreover, the operations of composition are fully coherent.

We are now equipped to define our next important class of examples of opetopic types. Definition 3.2.9 (∞-groupoid). An ∞-groupoid is an Id-opetopic type which is fibrant.

Weakening this definition to only require 𝑋 >0 to be fibrant allows having 1-cells which are not necessarily invertible which is precisely the definition of an (∞, 1)-category. We will not deal with (∞, 𝑛)-categories for 𝑛 > 1 so we just call them ∞-categories for short. Definition 3.2.10 (∞-category). An ∞-category is an Id-opetopic type 𝑋 such that 𝑋 >0 is fibrant.

We will prove elementary results on ∞-groupoids and ∞-categories in order to showcase opetopic methods later on in this chapter.

Algebraic characterisation

The property of fibrancy very elegantly embodies both an algebraic structure on an opetopic type stated in terms of the existence of enough cells and a property of univalence connecting this structure with the higher structures endowing its families of cells granted by their identity types. This situation is reminiscent of complete Segal spaces. In this section we make explicit the former structure, that we call coherent 𝑀-algebra structure, and the property of univalence then show that their conjunction is equivalent to the fibrancy property. Coherent 𝑀algebras correspond to Baez and Dolan's coherent 𝑂-algebras [START_REF] Baez | Higher-dimensional algebra III. ncategories and the algebra of opetopes[END_REF] with the exception that we ask for all cells to be invertible in our case.

Notation. Let 𝑀 be a monad whose types of positions have decidable equality and let 𝑋 : Fam 𝑀 be a type family. Suppose that we have a constructor 𝑐 : Cns 𝑀 𝑖 and a family 𝑥 :

-→ 𝑋 𝑐. Given a position 𝑝 : Pos 𝑀 𝑐 and an element 𝑦 : 𝑋 (Typ 𝑀 𝑐 𝑝), we denote 𝑥[𝑦/𝑝] the function of type -→ 𝑋 𝑐 which takes the same values as 𝑥 excepted at the position 𝑝 where it is equal to 𝑦:

𝑥[𝑦/𝑝] 𝑞 :≡ 𝑦 if 𝑝 = 𝑞 𝑥 𝑞 otherwise
In the rest of this section, we assume that whenever we introduce a monad 𝑀, its types of positions have decidable equality. This property is preserved by the pullback monad constructor as positions of constructors of 𝑋 * 𝑀 are defined to be those of the underlying constructors of 𝑀. Likewise, the slice monad constructor preserves this property.

Notation. We will sometimes use ellipses in place of easily inferable indices. For example, we may write η 𝛼 𝑋 1 (. . . , 𝑓 ) instead of η 𝛼 𝑋 1 (𝑖, 𝑓 ) if 𝑖 is actually too large and can be inferred from 𝑓 in order not to clutter a proof.

We define the notions of target and source universality which are mutually dependent and which are central to the definition of coherent 𝑀-algebra in Definition 3.3.1 and Definition 3.3.2. Definition 3.3.1 (Target universality). Let 𝑋 be a 𝑀 opetopic type. A cell 𝑓 : 𝑋 1 ((𝑖, 𝑥) ⊳ (𝑐, 𝑦)) is target universal in 𝑋 if for every cell sharing the same source 𝑔 : 𝑋 1 ((𝑖, 𝑧) ⊳ (𝑐, 𝑦)), there exists a unary cell

ℎ : 𝑋 1 ((𝑖, 𝑧) ⊳ (η 𝑀 𝑖, η-dec 𝑥))
and a filler

ℎ fill : 𝑋 2 ((. . . , 𝑔) ⊳ 𝜃 ℎ, 𝑓 )
Moreover, ℎ fill is target universal in 𝑋 >0 and source universal in 𝑋 >0 at position inl ★, the position of ℎ.

A target universal cell witnesses that its target is, in some sense, a good composite of its source as any cell sharing the same source factorises through it uniquely. Note that this is an additional structure and not a proposition.

Similarly, we define the notion of source universality. where 𝜃 𝑓 ,ℎ denotes the pasting diagram with root node 𝑓 on which are grafted leaves expected at position 𝑝 where we graft ℎ. Moreover ℎ fill is target universal in 𝑋 >0 and source universal in 𝑋 >0 at position inr (𝑝, inl ★), the position of ℎ.

Note that, once again, being source universal is an additional structure.

We now define the structure of coherent 𝑀-algebra on a 𝑀-opetopic type. This definition is heavily inspired from Baez and Dolan's coherent 𝑂-algebras with the exception that we ask for all cells to be target universal in our case corresponding to the fact that we only deal with invertible cells. • The opetopic type 𝑋 >0 has a structure of coherent 𝑀/𝑋 0 -algebra.

Note that we reused the symbols 𝛼 and 𝛼 fill , the context should disambiguate whether they refer to the fibrant structure or to the structure of coherent 𝑀algebra. This also applies to the operations η 𝛼 , μ 𝛼 , and their fillers that we now introduce.

This definition allows us to recover the biased operators that we defined earlier, among them:

η 𝛼 𝑋 : (𝑥 : Idx 𝑋 * 0 𝑀 ) → 𝑋 1 (𝑥 ⊳ η 𝑋 * 0 𝑀 𝑥) μ 𝛼 𝑋 : {𝑥 : Idx 𝑋 * 0 𝑀 } {𝑦 : Cns 𝑋 * 0 𝑀 𝑥} {𝑧 : ------→ Cns 𝑋 * 0 𝑀 𝑦} → 𝑋 1 (𝑥 ⊳ 𝑦) → -→ 𝑋 1 (𝑦 ◀ 𝑧) → 𝑋 1 (𝑥 ⊳ μ 𝑋 *
0 𝑀 𝑦 𝑧) Note that 𝛼 𝑋 satisfies the algebraic laws and that μ 𝛼 𝑋 is associative and unital with units given by η 𝛼 𝑋 . These laws are not witnessed by an identity this time but by a higher unary cell and are obtained by following the proofs exposed earlier in this chapter using target universality instead of the 0-algebra property. We now define univalent coherent 𝑀-algebras. In a coherent 𝑀-algebra, all cells are target universal and all unary cells are therefore equivalences. Supposing that we have a 𝑀-opetopic type 𝑋 equipped with a structure of coherent 𝑀-algebra, we define id-to-equiv 𝑋 : {𝑖 :

Idx 𝑀 } {𝑥 𝑦 : 𝑋 0 𝑖} → 𝑥 = 𝑦 → 𝑋 1 ((𝑖, 𝑦) ⊳ (η 𝑀 𝑖, η-dec 𝑥))
with defining equation id-to-equiv 𝑋 refl 𝑥 :≡ η 𝛼 𝑋 (𝑖, 𝑥) This leads us to the definition of univalent coherent 𝑀-algebras. Definition 3.3.4 (Univalent coherent 𝑀-algebra). Let 𝑋 be a 𝑀-opetopic type with a structure of coherent 𝑀-algebra. We say that 𝑋 is univalent if the function id-to-equiv 𝑋 is an equivalence and if the opetopic type 𝑋 >0 is univalent.

We will see that being a univalent coherent 𝑀-algebra is a property. We have now introduced all the required notions in order to state the main theorem of this section.

Theorem 3.3.5. Let 𝑋 be a 𝑀-opetopic type. The property witnessing that 𝑋 is fibrant is equivalent to the structure of univalent coherent 𝑀-algebra on 𝑋.

The plan of the proof is to first establish the corresponding logical equivalence and conclude with the observation that being a univalent coherent 𝑀-algebra is a property. We start with a number of lemmas about algebras which we will later use to make the connection between fibrancy and target and source universality. Lemma 3.3.6. Let a monad 𝑀 and let families 𝑋 0 : Fam 𝑀 , 𝑋 1 : Fam 𝑀/𝑋 0 , and 𝑋 2 : Fam 𝑀/𝑋 0 /𝑋 1 such that (𝑋 0 , 𝑋 1 ) and (𝑋 1 , 𝑋 2 ) are 0-algebras. Let a constructor 𝑐 : Cns 𝑀 𝑖, a position 𝑝 : Pos 𝑀 𝑐, two cells 𝑦 𝑓 , 𝑦 𝑔 : 𝑋 0 𝑖, a cell 𝑓 : 𝑋 1 ((𝑖, 𝑦 𝑓 ) ⊳ (𝑐, 𝑥)), and a cell 𝑔 : 𝑋 1 ((𝑖, 𝑦 𝑔 ) ⊳ (𝑐, 𝑥)). Then we have the following equivalence:

( (ℎ:𝑋 1 ((𝑖,𝑦 𝑔 )⊳(η 𝑀 𝑖,η-dec 𝑦 𝑓 ))) 𝑋 2 ((. . . , 𝑔) ⊳ 𝜃 ℎ, 𝑓 )) ≃ ((𝑦 𝑓 , 𝑓 ) = (𝑦 𝑔 , 𝑔))
Proof. We equivalently define the equivalence

(ℎ:𝑋 1 ((𝑖,𝑦 𝑔 )⊳(η 𝑀 𝑖,η-dec 𝑦 𝑓 ))) 𝑋 2 ((. . . , 𝑔) ⊳ 𝜃 ℎ, 𝑓 ) ≃ (𝑞:𝑦 𝑓 =𝑦 𝑔 ) transport 𝜆𝑦→𝑋 1 ((𝑖,𝑦)⊳(𝑐,𝑥)) 𝑞 𝑓 = 𝑔
We first apply Lemma 3.2.3 with the cell η 𝛼 𝑋 2 (𝑖, 𝑦 𝑓 ) : 𝑋 1 ((𝑖, 𝑦 𝑓 ) ⊳ (η 𝑀 𝑖, η-dec 𝑦 𝑓 )) in order to establish the family of equivalences

𝑒 𝑦 𝑔 : 𝑋 1 ((𝑖, 𝑦 𝑔 ) ⊳ (η 𝑀 𝑖, η-dec 𝑦 𝑓 )) ≃ (𝑦 𝑓 = 𝑦 𝑔 )
such that 𝑒 𝑦 𝑓 (η 𝛼 𝑋 2 (𝑖, 𝑦 𝑓 )) = refl. We finally define, for any identity 𝑞 : 𝑦 𝑓 = 𝑦 𝑔 , the equivalence 𝑋 2 ((. . . , 𝑔) ⊳ 𝜃 𝑒 -1 𝑞, 𝑓 ) ≃ (transport 𝜆𝑦→𝑋 1 ((𝑖,𝑦)⊳(𝑐,𝑥)) 𝑞 𝑓 = 𝑔)

We assume that 𝑞 ≡ refl therefore 𝑒 -1 𝑞 = η 𝛼 𝑋 2 (𝑖, 𝑦 𝑓 ) and we are left to establish the equivalence

𝑋 2 ((. . . , 𝑔) ⊳ 𝜃 η 𝛼 𝑋 2 (𝑖,𝑦 𝑓 ), 𝑓 ) ≃ ( 𝑓 = 𝑔)
Applying Lemma 3.2.3, we obtain the equivalence

𝑋 2 ((. . . , 𝑔) ⊳ 𝜃 η 𝛼 𝑋 2 (𝑖,𝑦 𝑓 ), 𝑓 ) ≃ (μ 𝛼 𝑋 2 (η 𝛼 𝑋 2 (𝑖, 𝑦 𝑓 )) 𝑓 = 𝑔)
We conclude by left unitality of μ 𝛼 𝑋 2 .

□

We deduce the following corollary. -→ 𝑋 0 𝑐. Suppose given two cells 𝑓 : 𝑋 1 ((𝑖, 𝑥 𝑓 ) ⊳ (𝑐, 𝑦)) and 𝑔 : 𝑋 1 ((𝑖, 𝑥 𝑔 ) ⊳ (𝑐, 𝑦)), the following type is contractible:

(ℎ:𝑋 1 ((𝑖,𝑦 𝑔 )⊳(η 𝑀 𝑖,η-dec 𝑦 𝑓 ))) 𝑋 2 ((. . . , 𝑔) ⊳ 𝜃 ℎ, 𝑓 )
Proof. This last type is equivalent to the identity type (𝑥 𝑓 , 𝑓 ) = (𝑥 𝑔 , 𝑔) by Lemma 3.3.6 which lives in the type (𝑥:𝑋 0 𝑖) 𝑋 1 ((𝑖, 𝑥) ⊳ (𝑐, 𝑦)) which we know to be contractible since (𝑋 0 , 𝑋 1 ) is a 0-algebra.

□

We can derive similar results for identities between two cells which differ at a source position.

Lemma 3.3.8. Let a monad 𝑀 and let families 𝑋 0 : Fam 𝑀 , 𝑋 1 : Fam 𝑀/𝑋 0 , and 𝑋 2 : Fam 𝑀/𝑋 0 /𝑋 1 such that (𝑋 0 , 𝑋 1 ) and (𝑋 1 , 𝑋 2 ) are 0-algebras. Let a cell 𝑥 : 𝑋 0 𝑖, a constructor 𝑐 : Cns 𝑀 𝑖, a position 𝑝 : Pos 𝑀 𝑐, a family 𝑦 :

-→ 𝑋 0 𝑐 defined everywhere but at position 𝑝, two cells 𝑦 𝑓 , 𝑦 𝑔 : 𝑋 0 (Typ 𝑀 𝑐 𝑝), a cell 𝑓 : 𝑋 1 ((𝑖, 𝑥) ⊳ (𝑐, 𝑦[𝑦 𝑓 /𝑝])), and a cell 𝑔 : 𝑋 1 ((𝑖, 𝑥) ⊳ (𝑐, 𝑦[𝑦 𝑔 /𝑝])). Then we have the following equivalence:

( (ℎ:𝑋 1 ((...,𝑦 𝑓 )⊳(η 𝑀 ...,η-dec 𝑦 𝑔 ))) 𝑋 2 ((. . . , 𝑔) ⊳ 𝜃 𝑓 ,ℎ )) ≃ ((𝑦 𝑔 , 𝑔) = (𝑦 𝑓 , 𝑓 ))
Proof. We equivalently define the equivalence (ℎ:𝑋 1 ((...,𝑦 𝑓 )⊳(η 𝑀 ...,η-dec 𝑦 𝑔 ))) 𝑋 2 ((. . . , 𝑔) ⊳ 𝜃 𝑓 ,ℎ ) ≃ (𝑞:𝑦 𝑔 =𝑦 𝑓 ) transport 𝜆𝑦 𝑝 →𝑋 1 ((𝑖,𝑥)⊳(𝑐,𝑦[𝑦 𝑝 /𝑝])) 𝑞 𝑔 = 𝑓 We first use Lemma 3.2.3 with the cell

η 𝛼 𝑋 2 (𝑖, 𝑦 𝑔 ) : 𝑋 1 ((. . . , 𝑦 𝑔 ) ⊳ (η 𝑀 . . . , η-dec 𝑦 𝑔 ))
in order to establish the family of equivalences

𝑒 𝑦 𝑓 : 𝑋 1 ((. . . , 𝑦 𝑓 ) ⊳ (η 𝑀 . . . , η-dec 𝑦 𝑔 )) ≃ (𝑦 𝑔 = 𝑦 𝑓 )
such that 𝑒 𝑦 𝑔 (η 𝛼 𝑋 2 (. . . , 𝑦 𝑔 )) = refl. We finally define, for any identity 𝑞 : 𝑦 𝑔 = 𝑦 𝑓 , the equivalence 𝑋 2 ((. . . , 𝑔) ⊳ 𝜃 𝑓 ,𝑒 -1 𝑞 ) ≃ (transport 𝜆𝑦 𝑝 →𝑋 1 ((𝑖,𝑥)⊳(𝑐,𝑦[𝑦 𝑝 /𝑝])) 𝑞 𝑔 = 𝑓 )

We assume that 𝑞 ≡ refl therefore 𝑒 -1 𝑞 = η 𝛼 𝑋 2 (. . . , 𝑦 𝑔 ) and we are left to establish the equivalence 𝑋 2 ((. . . , 𝑔) ⊳ 𝜃 𝑓 ,η 𝛼 𝑋 2 (...,𝑦 𝑔 ) ) ≃ (𝑔 = 𝑓 ) Applying Lemma 3.2.3, we obtain the equivalence

𝑋 2 ((. . . , 𝑔) ⊳ 𝜃 𝑓 ,η 𝛼 𝑋 2 (...,𝑦 𝑔 ) ) ≃ (μ 𝛼 𝑋 2 𝑓 (η-dec (η 𝛼 𝑋 2 (𝑖, 𝑦 𝑓 ))) = 𝑔)
We conclude by right unitality of μ 𝛼 𝑋 2 .

□

This lemma has a corresponding corollary which differs from Corollary 3.3.7 in that we need a further assumption.

Corollary 3.3.9. Let a monad 𝑀 and let families 𝑋 0 : Fam 𝑀 , 𝑋 1 : Fam 𝑀/𝑋 0 , and 𝑋 2 : Fam 𝑀/𝑋 0 /𝑋 1 such that (𝑋 0 , 𝑋 1 ) and (𝑋 1 , 𝑋 2 ) are 0-algebras. Let a cell 𝑥 : 𝑋 0 𝑖, a constructor 𝑐 : Cns 𝑀 𝑖, and a family of cells 𝑦 :

-→ 𝑋 0 𝑐 defined everywhere but at a position 𝑝 : Pos 𝑀 𝑐. We suppose the following type to be a proposition:

(𝑦 𝑝 :𝑋 0 (Typ 𝑀 𝑐 𝑝)) 𝑋 1 ((𝑖, 𝑥) ⊳ (𝑐, 𝑦[𝑦 𝑝 /𝑝]))

Suppose given two cells 𝑦 𝑓 , 𝑦 𝑔 : 𝑋 0 (Typ 𝑀 𝑐 𝑝) and another two cells 𝑓 : 𝑋 1 ((𝑖, 𝑥) ⊳ (𝑐, 𝑦[𝑦 𝑓 /𝑝])) and 𝑔 : 𝑋 1 ((𝑖, 𝑥) ⊳ (𝑐, 𝑦[𝑦 𝑔 /𝑝])), the following type is contractible:

(ℎ:𝑋 1 ((...,𝑦 𝑓 )⊳(η 𝑀 ...,η-dec 𝑦 𝑔 ))) 𝑋 2 ((. . . , 𝑔) ⊳ 𝜃 𝑓 ,ℎ )

Proof. This last type is equivalent to the identity type (𝑦 𝑓 , 𝑓 ) = (𝑦 𝑔 , 𝑔) by Lemma 3.3.8 which lives in the type (𝑦 𝑝 :𝑋 0 (Typ 𝑀 𝑐 𝑝)) 𝑋 1 ((𝑖, 𝑥) ⊳ (𝑐, 𝑦[𝑦 𝑝 /𝑝])) which we know to be a proposition by assumption.

□

We now establish the counterpart of Lemma 3.2.3 in the case of a univalent coherent 𝑀-algebra. Lemma 3.3.10. Let 𝑋 be a 𝑀-opetopic type with a structure of univalent coherent 𝑀-algebra. For any constructor 𝑐 : Cns 𝑀 𝑖, any family 𝑦 :

-→ 𝑋 0 𝑐, and any element 𝑥 : 𝑋 0 𝑖, a cell 𝑓 : 𝑋 1 ((𝑖, 𝑧) ⊳ (𝑐, 𝑦)) implies the existence of a family of equivalences

𝑒 𝑥 : 𝑋 1 ((𝑖, 𝑥) ⊳ (𝑐, 𝑦)) ≃ (𝑧 = 𝑥)
such that 𝑒 𝑧 𝑓 = refl. In particular, the structure of coherent 𝑀-algebra guarantees the existence of the cell 𝛼 fill 𝑋 𝑐 𝑦 : 𝑋 1 ((𝑖, 𝛼 𝑋 𝑐 𝑦) ⊳ (𝑐, 𝑦)).

Proof. Note that the proof is stated by taking 𝑓 to be 𝛼 fill 𝑋 𝑐 𝑦 but the truth of this lemma does not depend on this choice.

Proving this lemma amounts to establishing the family of equivalences

𝑒 𝑥 : 𝑋 1 ((𝑖, 𝑥) ⊳ (𝑐, 𝑦)) ≃ 𝑋 1 ((𝑖, 𝑥) ⊳ (η 𝑀 𝑖, η-dec (𝛼 𝑋 𝑐 𝑦)))
such that 𝑒 𝛼 𝑋 𝑐 𝑦 (𝛼 fill 𝑋 𝑐 𝑦) = η 𝛼 𝑋 (𝑖, 𝛼 𝑋 𝑐 𝑦) and concluding by univalence. In the forward direction, given a cell 𝑓 : 𝑋 1 ((𝑖, 𝑥) ⊳ (𝑐, 𝑦)), there exists another cell sharing the same source 𝛼 fill 𝑋 𝑐 𝑦 : 𝑋 1 ((𝑖, 𝛼 𝑋 𝑐 𝑦) ⊳ (𝑐, 𝑦)). This last cell being target universal, we obtain the wanted unary cell 𝑔 : 𝑋 1 ((𝑖, 𝑥) ⊳ (η 𝑀 𝑖, η-dec (𝛼 𝑋 𝑐 𝑦))).

We check that 𝑒 𝛼 𝑋 𝑐 𝑦 (𝛼 𝑋 𝑐 𝑦 ). By source universality of 𝑔 fill , we obtain the required unary cell 𝑋 2 ((. . . , 𝑔) ⊳ (η 𝑀/𝑋 0 . . . , η-dec (η 𝛼 𝑋 (𝑖, 𝛼 𝑋 𝑐 𝑦)))). In the other direction, from a unary cell 𝑓 : 𝑋 1 ((𝑖, 𝑥) ⊳ (η 𝑀 𝑖, η-dec (𝛼 𝑋 𝑐 𝑦))), we obtain the wanted cell as μ 𝛼 𝑋 >0 𝑓 (𝛼 fill 𝑋 𝑐 𝑦) : 𝑋 1 ((𝑖, 𝑥) ⊳ (𝑐, 𝑦)). It remains to show that the two sides of the equivalence are inverse to each other. Starting with a cell 𝑓 : 𝑋 1 ((𝑖, 𝑥) ⊳ (𝑐, 𝑦)), we want to establish the identity μ 𝛼 𝑋 >0 𝑔 (𝛼 fill 𝑋 𝑐 𝑦) = 𝑓 where 𝑔 is the lift of 𝑓 that we obtain by target universality of 𝛼 fill 𝑋 𝑐 𝑦. This amounts to finding a unary cell 𝑋 1 ((. . . , 𝑓 ) ⊳ (η 𝑀/𝑋 0 . . . , η-dec (μ 𝛼 𝑋 >0 𝑔 (𝛼 fill 𝑋 𝑐 𝑦)))). We obtain it by target universality of μ 𝛼 fill 𝑋 >0 𝑔 (𝛼 fill 𝑋 𝑐 𝑦) : 𝑋 2 ((. . . , μ 𝛼 𝑋 >0 𝑔 (𝛼 fill 𝑋 𝑐 𝑦)) ⊳ 𝜃 𝑔,𝛼 fill 𝑋 𝑐 𝑦 ) along with the second cell sharing the same source: 𝑔 fill : 𝑋 2 ((. . . , 𝑓 ) ⊳ 𝜃 𝑔,𝛼 fill 𝑋 𝑐 𝑦 ). Finally, starting with a cell 𝑓 : 𝑋 1 ((𝑖, 𝑥) ⊳ (η 𝑀 𝑖, η-dec (𝛼 𝑋 𝑐 𝑦))), we want to establish the identity 𝑔 = 𝑓 where 𝑔 is the lift of μ Proof. We show that (𝑋 0 , 𝑋 1 ) is a 0-algebra. That is, given a constructor 𝑐 : Cns 𝑀 𝑖, and a family 𝑥 :

-→ 𝑋 0 𝑐, the following type is contractible:

(𝑦:𝑋 0 𝑖) 𝑋 1 ((𝑖, 𝑦) ⊳ (𝑐, 𝑥))
The centre of contraction is readily provided by the structure of coherent 𝑀algebra. It remains to show that for any pair of cells 𝑓 : 𝑋 1 ((𝑖, 𝑦 𝑓 ) ⊳ (𝑐, 𝑥))

and 𝑔 : 𝑋 1 ((𝑖, 𝑦 𝑔 ) ⊳ (𝑐, 𝑥)), there is an identity (𝑦 𝑓 , 𝑓 ) = (𝑦 𝑔 , 𝑔). Consider Lemma 3.3.6 and notice that its proof only uses Lemma 3.2.3 that we reestablished in Lemma 3.3.10 in the case of univalent coherent 𝑀-algebras. This signifies that we have the equivalence

( (ℎ:𝑋 1 ((𝑖,𝑦 𝑔 )⊳(η 𝑀 𝑖,η-dec 𝑦 𝑓 ))) 𝑋 2 ((. . . , 𝑔) ⊳ 𝜃 ℎ, 𝑓 )) ≃ ((𝑦 𝑓 , 𝑓 ) = (𝑦 𝑔 , 𝑔))
We are then reduced to finding a pair of type

(ℎ:𝑋 1 ((𝑖,𝑦 𝑔 )⊳(η 𝑀 𝑖,η-dec 𝑦 𝑓 ))) 𝑋 2 ((. . . , 𝑔) ⊳ 𝜃 ℎ, 𝑓 )
which is obtained by target universality of 𝑓 .

Finally, the coinductive hypothesis applied to 𝑋 >0 , which has a structure of univalent coherent 𝑀-algebra, allows us to conclude that 𝑋 is fibrant.

□

It remains to establish the other side of the equivalence. We start by proving the following two lemmas. Lemma 3.3.12. Let 𝑋 be a fibrant 𝑀-opetopic type. Any cell of type 𝑋 1 ((𝑖, 𝑦) ⊳ (𝑐, 𝑥)) is uniquely target universal. Lemma 3.3.13. Let 𝑋 be a fibrant 𝑀-opetopic type. Let a cell 𝑥 : 𝑋 0 𝑖, a constructor 𝑐 : Cns 𝑀 𝑖, a position 𝑝 : Pos 𝑀 𝑐, and a family of cells 𝑦 :

-→ 𝑋 0 𝑐. We suppose the following type to be a proposition:

(𝑦 𝑝 :𝑋 0 (Typ 𝑀 𝑐 𝑝)) 𝑋 1 ((𝑖, 𝑥) ⊳ (𝑐, 𝑦[𝑦 𝑝 /𝑝]))

Then any cell 𝑓 : 𝑋 1 ((𝑖, 𝑥) ⊳ (𝑐, 𝑦)) is uniquely source universal at position 𝑝.

It is important to note that, when an opetopic type 𝑋 is fibrant, being target universal is no longer an additional structure but a property as we shall see. The same remark applies in the case of source universality under the appropriate condition.

Proof of Lemma 3.3.12. Let 𝑋 be a fibrant 𝑀-opetopic type. The coinductive hypothesis allows us to establish that property for 𝑋 >0 which is fibrant.

It remains to show that all 1-cells are uniquely target universal. Consider a cell 𝑓 : 𝑋 1 ((𝑖, 𝑦 𝑓 ) ⊳ (𝑐, 𝑥)) that we want to show to be target universal and another cell sharing the same source 𝑔 : 𝑋 1 ((𝑖, 𝑦 𝑔 ) ⊳ (𝑐, 𝑥)). The 0-algebra provides us with an identity (𝑦 𝑓 , 𝑓 ) = (𝑦 𝑔 , 𝑔) that gives us a pair (ℎ, ℎ fill ) :

(ℎ:𝑋 1 ((𝑖,𝑦 𝑔 )⊳(η 𝑀 𝑖,η-dec 𝑦 𝑓 ))) 𝑋 2 ((. . . , 𝑔) ⊳ 𝜃 ℎ, 𝑓 ) by Lemma 3.3.6. Moreover, this pair lives in a contractible type by Corollary 3.3.7. To conclude that 𝑓 is target universal, we have to prove that ℎ fill is target universal and source universal at position inl ★. The coinductive hypothesis allows to readily conclude that ℎ fill is uniquely target universal.

In order to conclude that it is also uniquely source universal we first note that the type (ℎ:𝑋 1 ((𝑖,𝑦 𝑔 )⊳(η 𝑀 𝑖,η-dec 𝑦 𝑓 ))) 𝑋 2 ((. . . , 𝑔) ⊳ 𝜃 ℎ, 𝑓 ) is contractible and is, in particular, a proposition, as it is equivalent to a path (𝑦 𝑓 , 𝑓 ) = (𝑦 𝑔 , 𝑔) by Lemma 3.3.6 which lives in a contractible type. This allows us to conclude that ℎ fill is uniquely source universal at position inl ★ by applying Lemma 3.3.13.

□

Proof of Lemma 3.3.13. For any cell 𝑦 𝑔 : 𝑋 0 (Typ 𝑀 𝑐 𝑝) and cell 𝑔 : 𝑋 1 ((𝑖, 𝑥) ⊳ (𝑐, 𝑦[𝑦 𝑔 /𝑝])), we apply Corollary 3.3.9 to obtain the pair (ℎ, ℎ fill ) : (ℎ:𝑋 1 ((...,𝑦)⊳(η 𝑀 ...,η-dec 𝑦 𝑔 ))) 𝑋 2 ((. . . , 𝑔) ⊳ 𝜃 𝑓 ,ℎ ) which therefore lives in a contractible type. We apply Lemma 3.3.12 to deduce that ℎ fill is uniquely target universal, and we use the coinductive hypothesis along with the fact that the type of the pair (ℎ, ℎ fill ) is contractible, and is therefore a proposition, to conclude that ℎ fill is uniquely source universal at position inr (𝑝, inl ★), the position of ℎ.

□

Corollary 3.3.14. For a 𝑀-opetopic type, being a univalent coherent 𝑀-algebra is a property.

We want to emphasise the surprising nature of this result. Being a coherent 𝑀-algebra is an additional structure which turns out to be a property when the structure is univalent.

Proof. Let 𝑋 be a 𝑀-opetopic type and suppose it is a univalent coherent 𝑀algebra. By Lemma 3.3.11, 𝑋 is therefore fibrant and, for any pasting diagram, its composition and filler live in a contractible type. Finally, Lemma 3.3.12 informs us that the data witnessing that any cell is target universal lives in a contractible type too. We conclude that being a univalent coherent 𝑀-algebra is therefore a property.

□

At last, we define the remaining side of the equivalence. Lemma 3.3.15. A fibrant 𝑀-opetopic type has a unique structure of univalent coherent 𝑀-algebra.

Proof. Let 𝑋 be a fibrant 𝑀-opetopic type. The coinductive hypothesis allows us to establish that 𝑋 >0 , which is fibrant, has a unique structure of univalent coherent 𝑀-algebra. Now, the composition and filler for pasting diagrams of 0-cells are readily given by the 0-algebra (𝑋 0 , 𝑋 1 ) and live in a contractible type. The fact that any 1-cell is uniquely target universal follows from Lemma 3.3.12.

□

We summarise our results in the proof of Theorem 3.3.5.

Proof of Theorem 3.3.5. Corollary 3.3.14 states that being a univalent coherent 𝑀-algebra is a property. Lemma 3.3.11 and Lemma 3.3.15 establish a logical equivalence between being fibrant and being a univalent coherent 𝑀-algebra. We conclude that this logical equivalence is an equivalence of types.

□

An explicit characterisation of the composition

Given a monad 𝑀 and a 𝑀-0-algebra (𝑋 0 , 𝑋 1 ), Lemma 3.2.3 informs us that 𝑋 1 is equivalent to a family of identity types. A family 𝑋 2 : Fam 𝑀/𝑋 0 /𝑋 1 such that (𝑋 1 , 𝑋 2 ) is a 0-algebra then induces an operation of composition on these 1cells. In this section we provide a concrete definition of this composition acting on these identity types in terms of the usual operations on identity types and prove that it is equivalent to the one induced by 𝑋 2 . This perspective allows to leverage the body of results that has already been established about identity types to deduce properties about the multiplication induced by 𝑋 2 . This result was initially used by the author in order to gain intuition about the properties of the multiplication induced by 𝑋 2 .

We start with the definition of the families 𝑋 = 1 : Fam 𝑀/𝑋 0 and 𝑋 = 2 : Fam 𝑀/𝑋 0 /𝑋 = 1 where 𝑋 = 1 equivalent to 𝑋 1 under Lemma 3.2.3.

Definition 3.4.1. Let 𝑀 be a monad and let the families 𝑋 0 : Fam 𝑀 , 𝑋 1 : Fam 𝑀/𝑋 0 , and 𝑋 2 : Fam 𝑀/𝑋 0 /𝑋 1 such that (𝑋 0 , 𝑋 1 ) and (𝑋 1 , 𝑋 2 ) are 0-algebras. For any constructor 𝑐 : Cns 𝑀 𝑖, any family of elements 𝑥 :

-→ 𝑋 0 𝑐, and any element 𝑦 : 𝑋 0 𝑖, we define the family

𝑋 = 1 ((𝑖, 𝑦) ⊳ (𝑐, 𝑥)) :≡ 𝛼 𝑋 1 𝑐 𝑥 = 𝑦
We define an operation of composition of pasting diagrams of cells valued in 𝑋 = 1 ; that is, given a constructor 𝑐 : Cns 𝑀/𝑋 0 𝑖 and a family 𝑥 :

-→ 𝑋 = 1 𝑐, we define an element of 𝑋 = 1 𝑖. We name this operation 𝛼 𝑋 = 2 which defines a family 𝑋 = 2 : Fam 𝑀/𝑋 0 /𝑋 = 1 defined as

𝑋 = 2 ((𝑖, 𝑦) ⊳ (𝑐, 𝑥)) :≡ 𝛼 𝑋 = 2 𝑐 𝑥 = 𝑦 We define 𝛼 𝑋 =
2 by induction on 𝑐. • If 𝑐 is of the form lf (𝑖, 𝑥), we need to define an element of type 𝑋 = 1 ((𝑖, 𝑥) ⊳ (η 𝑀 𝑖, η-dec 𝑥)), that is an identity 𝛼 𝑋 1 (η 𝑀 𝑖) (η-dec 𝑥) = 𝑥 which we define to be 𝛼 -η using the fact that 𝑋 1 is a 1-algebra.

• If 𝑐 is of the form nd ((𝑖, 𝑦) ⊳ (𝑐, 𝑧)) {𝑤} 𝑡, we need to define an identity of type

𝛼 𝑋 1 (μ 𝑀 𝑐 (𝜆𝑝 → pr 1 (𝑤 𝑝))) (𝜆𝑝 → pr 2 (𝑤 (pr μ 1 𝑝)) (pr μ 2 𝑝)) = 𝑦 We use 𝛼 -μ to establish the first identity: 𝛼 𝑋 1 (μ 𝑀 𝑐 (𝜆𝑝 → pr 1 (𝑤 𝑝))) (𝜆𝑝 → pr 2 (𝑤 (pr μ 1 𝑝)) (pr μ 2 𝑝)) = 𝛼 𝑋 1 𝑐 (𝜆𝑝 → 𝛼 𝑋 1 (pr 1 (𝑤 𝑝)) (𝜆𝑞 → pr 2 (𝑤 𝑝) 𝑞))
Then, we get a second identity by congruence and from the induction hypothesis applied to the pasting diagram (𝑡 𝑝, 𝜆𝑞 → 𝑥 (inr (𝑝, 𝑞))) for any position 𝑝 : Pos 𝑀 𝑐:

𝛼 𝑋 1 𝑐 (𝜆𝑝 → 𝛼 𝑋 1 (pr 1 (𝑤 𝑝)) (𝜆𝑞 → pr 2 (𝑤 𝑝) 𝑞)) = 𝛼 𝑋 1 𝑐 𝑧
Finally, the last identity 𝛼 𝑋 1 𝑐 𝑧 = 𝑦 is given by 𝑥 (inl ★).

In the end, the formal definition of the identity thus defined is:

𝛼 -μ ap (𝛼 𝑋 1 𝑐) (funext (𝜆𝑝 → 𝛼 𝑋 = 2 (𝑡 𝑝) (𝜆𝑞 → 𝑥 (inr (𝑝, 𝑞))))) 𝑥 (inl ★)
By contractibility of singletons, (𝑋 = 1 , 𝑋 = 2 ) is a 0-algebra and we now want to check that 𝑋 = 2 is equivalent to 𝑋 2 in a suitable sense in order to transport the properties of 𝛼 𝑋 = 2 to 𝛼 𝑋 2 . To this effect, we first have to show that the equivalence of Lemma 3.2.3 is a morphism of 0-algebras -in that the laws are not mapped -from (𝑋 1 , 𝑋 2 ) to (𝑋 = 1 , 𝑋 = 2 ).

Lemma 3.4.2. Let 𝑀 be a monad and let the families 𝑋 0 : Fam 𝑀 , 𝑋 1 : Fam 𝑀/𝑋 0 , and 𝑋 2 : Fam 𝑀/𝑋 0 /𝑋 1 such that (𝑋 0 , 𝑋 1 ) and (𝑋 1 , 𝑋 2 ) are 1-algebras. Consider the 0-algebra (𝑋 = 1 , 𝑋 = 2 ) defined in Definition 3.4.1. The equivalence 𝑒 of Lemma 3.2.3where we take the cell 𝑓 to be the filler provided by the algebra

(𝑋 0 , 𝑋 1 ) -is a morphism of 0-algebras from (𝑋 1 , 𝑋 2 ) to (𝑋 = 1 , 𝑋 = 2 ), that is 𝑒 (𝛼 𝑋 2 𝑐 𝑥) = 𝛼 𝑋 = 2 𝑐 (𝜆𝑝 → 𝑒 (𝑥 𝑝))
for any constructor 𝑐 : Cns 𝑀/𝑋 0 𝑖 and family 𝑥 :

-→ 𝑋 1 𝑐.
Proof. We proceed by induction on 𝑐.

• If 𝑐 is of the form lf (𝑖, 𝑦), we have to establish the following identity:

𝑒 (𝛼 𝑋 2 (lf (𝑖, 𝑦)) 𝑥) = 𝑒 (transport 𝜆𝑦→𝑋 1 ((𝑖,𝑦 (pos η 𝑖))⊳(η 𝑀 𝑖,𝑦)) 𝑝 (η 𝛼 𝑋 2 (𝑖, 𝑦))) with 𝑝 :≡ funext (Pos-η-elim 𝑀 𝑖 (𝜆𝑝 → 𝑦 = 𝑦) refl) and where the righthand side is the formal definition of 𝛼 -η established in Theorem 3.2.4. Remember that η 𝛼 𝑋 2 (𝑖, 𝑦) ≡ 𝛼 𝑋 2 (lf (𝑖, 𝑦)) ⊥-elim. It is clear that 𝑝 = refl and we conclude the proof by noticing that 𝑥 = ⊥-elim is obviously true as they are both functions with domain ⊥.

• If 𝑐 is of the form nd ((𝑖, 𝑦) ⊳ (𝑐, 𝑧)) {𝑤} 𝑡, we have to establish the following identity:

𝑒 (𝛼 𝑋 2 (nd ((𝑖, 𝑦) ⊳ (𝑐, 𝑧)) {𝑤} 𝑡) 𝑥) = 𝛼 -μ ap (𝛼 𝑋 1 𝑐) 𝑝 𝑒 (𝑥 (inl ★)) with 𝑝 :≡ funext (𝜆𝑝 → 𝛼 𝑋 = 2 (𝑡 𝑝) (𝜆𝑞 → 𝑒 (𝑥 (inr (𝑝, 𝑞))))
). We first establish the identity

𝑒 (𝛼 𝑋 2 (nd ((𝑖, 𝑦) ⊳ (𝑐, 𝑧)) 𝑡) 𝑥) = 𝑒 (μ 𝛼 𝑋 2 (𝑥 (inl ★)) (𝜆𝑝 → 𝛼 𝑋 2 (𝑡 𝑝) (𝜆𝑞 → 𝑥 (inr (𝑝, 𝑞))))) using Corollary 3.2.7 in context.
Then we establish the identity

𝑒 (μ 𝛼 𝑋 2 (𝑥 (inl ★)) (𝜆𝑝 → 𝛼 𝑋 2 (𝑡 𝑝) (𝜆𝑞 → 𝑥 (inr (𝑝, 𝑞))))) = 𝛼 -μ ap (𝛼 𝑋 1 𝑐) 𝑞 𝑒 (𝑥 (inl ★))
where 𝑞 :≡ funext (𝜆𝑝 → 𝑒 (𝛼 𝑋 2 (𝑡 𝑝) (𝜆𝑞 → 𝑥 (inr (𝑝, 𝑞))))).

Instead, we prove the more general statement:

𝑒 (μ 𝛼 𝑋 2 𝑓 𝑔) = 𝛼 -μ ap (𝛼 𝑋 1 𝑐) (funext (𝜆𝑝 → 𝑒 (𝑔 𝑝))) 𝑒 𝑓
for any constructors 𝑐 : Cns 𝑀 𝑖 and 𝑑 :

----→ Cns 𝑀 𝑐, any 0-cells 𝑥 : 𝑋 0 𝑖, 𝑦 :

-→ 𝑋 0 𝑐, and 𝑧 : -→ 𝑋 0 (μ 𝑀 𝑐 𝑑), and any 1-cells 𝑓 : 𝑋 1 ((𝑖, 𝑥) ⊳ (𝑐, 𝑦)) and

𝑔 : -→ 𝑋 1 ((𝑐, 𝑦) ◀ (𝜆𝑝 → (𝑑 𝑝, 𝜆𝑞 → 𝑧 (pair μ 𝑝 𝑞)))).
Knowing that (𝑋 0 , 𝑋 1 ) is a 0-algebra, we can eliminate 𝑓 and 𝑔 and assume the following equalities

𝑔 𝑝 ≡ 𝛼 fill 𝑋 1 (𝑑 𝑝) (𝜆𝑞 → 𝑧 (pair μ 𝑝 𝑞)) 𝑓 ≡ 𝛼 fill 𝑋 1 𝑐 (𝜆𝑝 → 𝛼 𝑋 1 (𝑑 𝑝) (𝜆𝑞 → 𝑧 (pair μ 𝑝 𝑞)
)) Then we readily obtain 𝑒 (μ 𝛼 𝑋 2 𝑓 𝑔) ≡ 𝛼 -μ according to the definition of 𝛼 -μ that we gave in Theorem 3.2.4 and it remains to show that both 𝑒 𝑓 and ap (𝛼 𝑋 1 𝑐) (funext (𝜆𝑝 → 𝑒 (𝑔 𝑝))) are equal to refl. But both 𝑒 𝑓 and 𝑒 (𝑔 𝑝) are equal to refl by the very definition of 𝑒 which concludes the proof.

Returning to the original proof, it is easy to establish the remaining identity by applying the induction hypothesis in context:

funext (𝜆𝑝 → 𝑒 (𝛼 𝑋 2 (𝑡 𝑝) (𝜆𝑞 → 𝑥 (inr (𝑝, 𝑞))))) = funext (𝜆𝑝 → 𝛼 𝑋 = 2 (𝑡 𝑝) (𝜆𝑞 → 𝑒 (𝑥 (inr (𝑝, 𝑞)))))

□

This last lemma allows concluding that 𝑋 = 2 is equivalent to 𝑋 2 . Lemma 3.4.3. Let 𝑀 be a monad and let the families 𝑋 0 : Fam 𝑀 , 𝑋 1 : Fam 𝑀/𝑋 0 , and 𝑋 2 : Fam 𝑀/𝑋 0 /𝑋 1 such that (𝑋 0 , 𝑋 1 ) and (𝑋 1 , 𝑋 2 ) are 1-algebras. For any constructor 𝑐 : Cns 𝑀/𝑋 0 𝑖 and 1-cells 𝑥 :

-→ 𝑋 1 𝑐 and 𝑦 :

𝑋 1 𝑖, 𝑋 2 ((𝑖, 𝑦) ⊳ (𝑐, 𝑥)) ≃ 𝑋 = 2 ((𝑖, 𝑒 𝑦) ⊳ (𝑐, 𝜆𝑝 → 𝑒 (𝑥 𝑝)))
with 𝑒 the equivalence established in Lemma 3.4.2 where we take the cell 𝑓 to be the filler provided by the algebra (𝑋 0 , 𝑋 1 ).

Proof. Let 𝑐 : Cns 𝑀/𝑋 0 𝑖 be a constructor and let 𝑥 :

-→ 𝑋 1 𝑐 and 𝑦 : 𝑋 1 𝑖 be 1-cells. We start by applying Lemma 3.2.3 and obtain a first equivalence:

𝑋 2 ((𝑖, 𝑦) ⊳ (𝑐, 𝑥)) ≃ (𝛼 𝑋 2 𝑐 𝑥 = 𝑦)
Then using the fact that 𝑒 is an equivalence, we obtain the second equivalence:

(𝛼 𝑋 2 𝑐 𝑥 = 𝑦) ≃ (𝑒 (𝛼 𝑋 2 𝑐 𝑥) = 𝑒 𝑦)
Finally, using the equivalence established in Lemma 3.4.2 we obtain the final equivalence:

(𝑒 (𝛼 𝑋 2 𝑐 𝑥) = 𝑒 𝑦) ≃ (𝛼 𝑋 = 2 𝑐 (𝜆𝑝 → 𝑒 (𝑥 𝑝)) = 𝑒 𝑦)

□

Having established that 𝑋 2 is equivalent to 𝑋 = 2 , let us revisit Corollary 3.3.7 and Corollary 3.3.9 in light of this new connection. In the former case, establishing that the following type is contractible

(ℎ:𝑋 1 ((𝑖,𝑦 𝑔 )⊳(η 𝑀 𝑖,η-dec 𝑦 𝑓 ))) 𝑋 2 ((. . . , 𝑔) ⊳ 𝜃 ℎ, 𝑓 )
for any 1-cells 𝑓 : 𝑋 1 ((𝑖, 𝑦 𝑓 ) ⊳ (𝑐, 𝑥)) and 𝑔 : 𝑋 1 ((𝑖, 𝑦 𝑔 ) ⊳ (𝑐, 𝑥)) is equivalent to showing that the following type is contractible

(ℎ:𝑋 = 1 ((𝑖,𝑦 𝑔 )⊳(η 𝑀 𝑖,η-dec 𝑦 𝑓 ))) 𝑋 = 2 ((. . . , 𝑔) ⊳ 𝜃 ℎ, 𝑓 )
for any 1-cells 𝑓 : 𝑋 = 1 ((𝑖, 𝑦 𝑓 ) ⊳ (𝑐, 𝑥)) and 𝑔 : 𝑋 = 1 ((𝑖, 𝑦 𝑔 ) ⊳ (𝑐, 𝑥)). Using the definition of 𝑋 = 2 , we realise that this actually amounts to showing that the following function is an equivalence:

𝜆ℎ → 𝛼 𝑋 = 2 𝜃 ℎ, 𝑓 for any 1-cell 𝑓 : 𝑋 = 1 ((𝑖, 𝑦 𝑓 ) ⊳ (𝑐, 𝑥)).
Or, equivalently, if we replace 𝛼 𝑋 = 2 by its definition:

𝜆ℎ →𝛼 -μ ap (𝛼 𝑋 1 (η 𝑀 𝑖)) (funext (η-dec (𝛼 𝑋 = 2 (η 𝑀/𝑋 0 ((𝑖, 𝑦 𝑓 ) ⊳ (𝑐, 𝑥))) (η-dec 𝑓 )))) ℎ which can, in the present case, be simplified to 𝜆ℎ → 𝛼 -μ ap (𝛼 𝑋 1 (η 𝑀 𝑖)) 𝑓 ℎ
owing to the fact that (𝑋 = 1 , 𝑋 = 2 ) is a 1-algebra as the equivalent algebra (𝑋 1 , 𝑋 2 ) is a 1-algebra too. But, this function is obviously an equivalence as the operation of precomposing with an identity is an equivalence. Now, in the case of Corollary 3.3.9 things become a bit more subtle. Establishing that the following type is contractible (ℎ:𝑋 1 ((...,𝑥 𝑓 )⊳(η 𝑀 ...,η-dec 𝑥 𝑔 ))) 𝑋 2 ((. . . , 𝑔) ⊳ 𝜃 𝑓 ,ℎ )

for any 1-cells 𝑓 : 𝑋 1 ((𝑖, 𝑦)⊳(𝑐, 𝑥[𝑥 𝑓 /𝑝])) and 𝑔 : 𝑋 1 ((𝑖, 𝑦)⊳(𝑐, 𝑥[𝑥 𝑔 /𝑝])) amounts to showing that the following function is an equivalence under the hypotheses mentioned in the corollary:

𝜆ℎ → 𝛼 𝑋 = 2 𝜃 𝑓 ,ℎ for any 1-cell 𝑓 : 𝑋 = 1 ((𝑖, 𝑦) ⊳ (𝑐, 𝑥[𝑥 𝑓 /𝑝]))
and where ℎ has type 𝑋 = 1 ((. . . , 𝑥 𝑓 ) ⊳ (η 𝑀 . . . , η-dec 𝑥 𝑔 )). Or, equivalently, using the definition of

𝛼 𝑋 = 2 𝜆ℎ →𝛼 -μ ap (𝛼 𝑋 1 𝑐) (funext (𝜆𝑝 → 𝛼 𝑋 = 2 (𝑑 𝑝) (ℎ ′ 𝑝))
) 𝑓 where 𝑑 and ℎ ′ are defined as follows:

𝑑 𝑞 :≡ η 𝑀/𝑋 0 ((Typ 𝑀 𝑐 𝑝, 𝑥 𝑓 ) ⊳ (η 𝑀 (Typ 𝑀 𝑐 𝑝), η-dec 𝑥 𝑔 )) if 𝑞 ≡ 𝑝 lf (Typ 𝑀 𝑐 𝑞, 𝑥 𝑞) otherwise ℎ ′ 𝑞 :≡ η-dec ℎ if 𝑞 ≡ 𝑝 ⊥-elim otherwise
Using the fact that (𝑋 = 1 , 𝑋 = 2 ) is a 1-algebra, we consider the following equivalent function:

𝜆ℎ →𝛼 -μ ap (𝛼 𝑋 1 𝑐) (funext (𝜆𝑝 → 𝛼 -η)) ap (𝜆𝑥 𝑝 → 𝛼 𝑋 1 𝑐 𝑥[𝑥 𝑝 /𝑝]) ℎ 𝑓
This function is an equivalence if and only if the following function is itself an equivalence:

𝜆ℎ → ap (𝜆𝑥 𝑝 → 𝛼 𝑋 1 𝑐 𝑥[𝑥 𝑝 /𝑝]) ℎ
which is equivalent to requiring that the function 𝜆𝑥 𝑝 → 𝛼 𝑋 1 𝑐 𝑥[𝑥 𝑝 /𝑝] is an embedding. But this corresponds exactly to the hypothesis of Corollary 3.3.9 stating that the following type is a proposition:

(𝑥 𝑝 :𝑋 0 (Typ 𝑀 𝑐 𝑝)) 𝑋 1 ((𝑖, 𝑦) ⊳ (𝑐, 𝑥[𝑥 𝑝 /𝑝]))

𝑀-multicategories

In this section, we define 𝑀-multicategories which are a generalisation of ordinary categories whose arity of morphisms is specified by the constructors of a monad 𝑀. We establish an equivalence between 𝑀-multicategories and fibrant 𝑀/-opetopic types whose family of 1-cells is a set. This equivalence specialises to categories if we take the monad 𝑀 to be the identity monad Id.

Definition 3.5.1 (Wild 𝑀-multicategory). Let 𝑀 be a monad. A wild 𝑀multicategory 𝐶 is defined by the following data:

• A family 𝑋 : Fam 𝑀/ whose elements are called morphisms. The objects are then the indices of the monad 𝑀.

• A function providing a unary morphism for every index:

η 𝛼 𝐶 : (𝑥 : Idx 𝑀 ) → 𝑋 (𝑥 ⊳ η 𝑀 𝑥)
• For every objects 𝑥 : Idx 𝑀 , 𝑦 : Cns 𝑀 𝑥, and 𝑧 :

----→ Cns 𝑀 𝑦, a composition function μ 𝛼 𝐶 : 𝑋 (𝑥 ⊳ 𝑦) → - → 𝑋 (𝑦 ◀ 𝑧) → 𝑋 (𝑥 ⊳ μ 𝑀 𝑦 𝑧)
• The composition μ 𝐶 is right and left unital. That is, for every morphism 𝑓 : 𝑋 (𝑥 ⊳ 𝑦), we have the following identity:

μ 𝛼 𝐶 𝑓 (𝜆𝑝 → η 𝛼 𝐶 (Typ 𝑀 𝑦 𝑝)) = 𝑓
Likewise, for every families 𝑦 :

----→ Cns 𝑀 (η 𝑀 𝑥) and 𝑓 : -→ 𝑋 (η 𝑀 𝑥 ◀ 𝑦), we have the following identity:

μ 𝛼 𝐶 (η 𝑀 𝑥) 𝑓 = 𝑓 (pos η 𝑥)
• The composition μ 𝛼 𝐶 is associative. For every morphisms 𝑓 : 𝑋 (𝑥 ⊳ 𝑦), 𝑔 :

-→ 𝑋 (𝑦 ◀ 𝑧), and ℎ :

-→ 𝑋 (μ 𝑀 𝑦 𝑧 ◀ 𝑡), we have

μ 𝛼 𝐶 𝑓 (𝜆𝑝 → μ 𝛼 𝐶 (𝑔 𝑝) (𝜆𝑞 → ℎ (pair μ 𝑀 𝑝 𝑞))) = μ 𝛼 𝐶 (μ 𝛼 𝐶 𝑓 𝑔) ℎ
We borrow the terminology of Capriotti and Kraus [START_REF] Capriotti | Univalent higher categories via complete semi-segal types[END_REF] and call a 𝑀-multicategory whose family of morphisms is not a set wild. These multicategories do not necessarily satisfy their laws coherently. Definition 3.5.2 (𝑀-multicategory). Let 𝑀 be a monad. A 𝑀-multicategory is a wild 𝑀-multicategory such that its family of morphisms is a set.

The type of objects of a 𝑀-multicategory is the type of indices of the monad 𝑀, that is Idx 𝑀 . It is clear from this definition that, given a family of sets 𝑋 : 1 → 𝒰, (𝑋 * Id)-multicategories are nothing more than precategories -as defined in the HoTT book -whose type of objects is 𝑋 ★.

We now state the theorem of this section.

Theorem 3.5.3. Let 𝑀 be a monad. 𝑀-multicategories are equivalent to fibrant 𝑀/opetopic types 𝑋 whose family 𝑋 1 is a set.

We break its proof into several lemmas.

Lemma 3.5.4. Let 𝑀 be a monad and let 𝑋 0 : Fam 𝑀/ , 𝑋 1 : Fam 𝑀//𝑋 0 , and 𝑋 2 : Fam 𝑀//𝑋 0 /𝑋 1 be families such that 𝑋 0 is a set. If (𝑋 0 , 𝑋 1 ) and (𝑋 1 , 𝑋 2 ) are 0-algebras then we can define a 𝑀-multicategory whose family of morphisms is given by 𝑋 0 .

Proof. The data defining the wild multicategory has been established in Section 3.2. In addition, we use the fact that 𝑋 0 is a set.

□

The previous lemma admits a reciprocal and we break this result down into two lemmas which will each define the required 0-algebra. Lemma 3.5.5. Let 𝑋 be a 𝑀-multicategory and let 𝑋 0 : Fam 𝑀/ be its family of morphisms. The structure of multicategory gives rise to a family 𝑋 1 : Fam 𝑀//𝑋 0 such that (𝑋 0 , 𝑋 1 ) is a 1-algebra.

Proof. We want 𝑋 1 to witness the composition of morphisms given by μ 𝛼 𝑋 , and we start by defining an unbiased composition function:

𝛼 𝑋 1 : {𝑖 : Idx 𝑀/ } (𝑐 : Cns 𝑀/ 𝑖) (𝑥 : -→ 𝑋 0 𝑐) → 𝑋 0 𝑖
We define it by induction on 𝑐:

• If 𝑐 is of the form lf 𝑥 then we need a cell 𝑋 0 (𝑥 ⊳ η 𝑀 𝑥) which we define to be η 𝛼 𝑋 𝑥.

• If 𝑐 is of the form nd (𝑤 ⊳ 𝑦) {𝑧} 𝑡, we need a cell of type 𝑋 0 (𝑤 ⊳ μ 𝑀 𝑦 𝑧) which is given by μ 𝛼 𝑋 (𝑥 (inl ★)) (𝜆𝑝 → 𝛼 𝑋 1 (𝑡 𝑝) (𝜆𝑞 → 𝑥 (inr (𝑝, 𝑞)))). We now define 𝑋 1 : Fam 𝑀//𝑋 0 , 𝑋 1 ((𝑖, 𝑦) ⊳ (𝑐, 𝑥)) :≡ 𝛼 𝑋 1 𝑐 𝑥 = 𝑦 An element of 𝑋 1 then witnesses that a certain pasting diagram of 0-cells (𝑐, 𝑥) multiplies to the target 0-cell 𝑦. It is immediate that (𝑋 0 , 𝑋 1 ) is a 0-algebra as the type (𝑦:𝑋 0 𝑖) (𝛼 𝑋 1 𝑐 𝑥 = 𝑦) is contractible. Note how 𝛼 𝑋 1 that we just defined coincides exactly with the composition function induced by the structure of 0-algebra on (𝑋 0 , 𝑋 1 ) therefore there is no clash of notation.

We now show that the 0-algebra (𝑋 0 , 𝑋 1 ) is a 1-algebra. We start with the unit law which asserts that, for any index 𝑖 : Idx 𝑀/ and family 𝑥 :

-→ 𝑋 0 (η 𝑀/ 𝑖), the identity 𝛼 𝑋 1 (η 𝑀/ 𝑖) 𝑥 = 𝑥 (pos η 𝑖) holds. By definition of 𝛼 𝑋 1 and pos η 𝑖, this amounts to proving the identity ★) which holds by right-unitality of μ 𝛼 𝑋 . In order to show that 𝛼 𝑋 1 is compatible with μ 𝑀/ , we first need to show that it is compatible with the grafting operation γ 𝑀 . That is, for any tree 𝑡 : Cns 𝑀/ (𝑥⊳𝑦), any family 𝑢 :

μ 𝛼 𝑋 (𝑥 (inl ★)) (𝜆𝑝 → η 𝛼 𝑋 (Typ 𝑀/ (η 𝑀/ 𝑖) 𝑝)) = 𝑥 (inl
-----→

Cns 𝑀/ (𝑦 ◀ 𝑧), and any family 𝑣 :

-→ 𝑋 0 (γ 𝑀 𝑡 𝑢):

𝛼 𝑋 1 (γ 𝑀 𝑡 𝑢) 𝑣 = μ 𝛼 𝑋 (𝛼 𝑋 1 𝑡 (𝜆𝑝 → 𝑣 (inl γ 𝑝))) (𝜆𝑝 → 𝛼 𝑋 1 (𝑢 𝑝) (𝜆𝑞 → 𝑣 (inr γ 𝑝 𝑞)))
We proceed by induction on 𝑡:

• If 𝑡 is of the form lf 𝑥 then, by definition of 𝛼 𝑋 1 , we are left to prove the following identity which holds by virtue of the fact that μ 𝛼 𝑋 is left-unital.

𝛼 𝑋 1 (𝑢 (pos η 𝑥)) 𝑣 = μ 𝛼 𝑋 (η 𝛼 𝑋 𝑥) (𝜆𝑝 → 𝛼 𝑋 1 (𝑢 𝑝) (𝜆𝑞 → 𝑣 (inr γ 𝑝 𝑞)))
• If 𝑡 is of the form nd (𝑥 ⊳ 𝑦) 𝑡, the left-hand side is equal to

μ 𝛼 𝑋 (𝑣 (inl ★)) (𝜆𝑝 → 𝛼 𝑋 1 (γ 𝑀 (𝑡 𝑝) (𝜆𝑞 → 𝑢 (pair μ 𝑝 𝑞))) (𝜆𝑞 → 𝑣 (inr (𝑝, 𝑞))))
As for the right-hand side, it is of the form μ 𝛼 𝑋 (μ 𝛼 𝑋 𝑣 1 𝑣 2 ) 𝑣 3 where 𝑣 1 , 𝑣 2 , and 𝑣 3 are defined as follows:

𝑣 1 :≡ 𝑣 (inl ★) 𝑣 2 𝑝 :≡ 𝛼 𝑋 1 (𝑡 𝑝) (𝜆𝑞 → 𝑣 (inr (𝑝, inl γ 𝑞))) 𝑣 3 𝑝 :≡ 𝛼 𝑋 1 (𝑢 𝑝) (𝜆𝑞 → 𝑣 (inr (pr μ 1 𝑝, inr γ (pr μ 2 𝑝) 𝑞)))
Using the inductive hypothesis we get a first identity:

μ 𝛼 𝑋 𝑣 1 (𝜆𝑝 → 𝛼 𝑋 1 (γ 𝑀 (𝑡 𝑝) (𝜆𝑞 → 𝑢 (pair μ 𝑝 𝑞))) (𝜆𝑞 → 𝑣 (inr (𝑝, 𝑞)))) = μ 𝛼 𝑋 𝑣 1 (𝜆𝑝 → μ 𝛼 𝑋 (𝑣 2 𝑝) (𝜆𝑞 → 𝑣 3 (pair μ 𝑝 𝑞)))
Therefore, we are left to show that

μ 𝛼 𝑋 𝑣 1 (𝜆𝑝 → μ 𝛼 𝑋 (𝑣 2 𝑝) (𝜆𝑞 → 𝑣 3 (pair μ 𝑝 𝑞))) = μ 𝛼 𝑋 (μ 𝛼 𝑋 𝑣 1 𝑣 2 ) 𝑣 3
But this is readily proved as we know that μ 𝛼 𝑋 is associative. We can now prove that 𝛼 𝑋 1 is compatible with the operation μ 𝑀/ . That is, given an index 𝑥 : Idx 𝑀/ , a constructor 𝑦 : Cns 𝑀/ 𝑥, a family of constructors 𝑧 :

-----→ Cns 𝑀/ 𝑦, and a family of elements 𝑣 :

-→ 𝑋 0 (μ 𝑀/ 𝑦 𝑧), we have the following identity:

𝛼 𝑋 1 (μ 𝑀/ 𝑦 𝑧) 𝑣 = 𝛼 𝑋 1 𝑦 (𝜆𝑝 → 𝛼 𝑋 1 (𝑧 𝑝) (𝜆𝑞 → 𝑣 (pair μ 𝑝 𝑞)))
We proceed by induction on 𝑦:

• If 𝑦 is of the form lf 𝑥, both sides of the identity reduce to η 𝛼 𝑋 𝑥 by definition of 𝛼 𝑋 1 and we conclude the proof by reflexivity.

• If 𝑦 is of the form nd (𝑥 ⊳ 𝑦) 𝑡, the left-hand side of the identity is equal to

𝛼 𝑋 1 (γ 𝑀 (𝑧 (inl ★)) (𝜆𝑝 → μ 𝑀/ (𝑡 𝑝) (𝜆𝑞 → 𝑧 (inr (𝑝, 𝑞))))) 𝑣
while the right-hand side is equal to

μ 𝛼 𝑋 𝑣 1 (𝜆𝑝 → 𝛼 𝑋 1 (𝑡 𝑝) (𝜆𝑞 → 𝛼 𝑋 1 (𝑧 (inr (𝑝, 𝑞))) (𝜆𝑟 → 𝑣 (inr γ 𝑝 (pair μ 𝑞 𝑟)))))
where 𝑣 1 :≡ 𝛼 𝑋 1 (𝑧 (inl ★)) (𝜆𝑝 → 𝑣 (inl γ 𝑝)). We obtain a first identity using the fact that 𝛼 𝑋 1 is compatible with γ 𝑀 .

𝛼 𝑋 1 (γ 𝑀 (𝑧 (inl ★)) (𝜆𝑝 → μ 𝑀/ (𝑡 𝑝) (𝜆𝑞 → 𝑧 (inr (𝑝, 𝑞))))) 𝑣 = μ 𝛼 𝑋 𝑣 1 (𝜆𝑝 → 𝛼 𝑋 1 (μ 𝑀/ (𝑡 𝑝) (𝜆𝑞 → 𝑧 (inr (𝑝, 𝑞)))) (𝜆𝑞 → 𝑣 (inr γ 𝑝 𝑞)))
We conclude the proof using the inductive hypothesis to establish the following identity for any position 𝑝 : Pos 𝑀/ 𝑦:

𝛼 𝑋 1 (μ 𝑀/ (𝑡 𝑝) (𝜆𝑞 → 𝑧 (inr (𝑝, 𝑞)))) (𝜆𝑞 → 𝑣 (inr γ 𝑝 𝑞))) = 𝛼 𝑋 1 (𝑡 𝑝) (𝜆𝑞 → 𝛼 𝑋 1 (𝑧 (inr (𝑝, 𝑞))) (𝜆𝑟 → 𝑣 (inr γ 𝑝 (pair μ 𝑞 𝑟))))

□

We are now in a position to define the second 0-algebra.

Lemma 3.5.6. Let 𝑋 be a 𝑀-multicategory and let 𝑋 0 : Fam 𝑀/ be its family of morphisms. Let 𝑋 1 : Fam 𝑀//𝑋 0 be the family that we defined in Lemma 3.5.5, the structure of 𝑋 gives rise to a family 𝑋 2 : Fam 𝑀//𝑋 0 /𝑋 1 such that (𝑋 1 , 𝑋 2 ) is a 0-algebra.

Proof. We first need to establish a composition function on 1-cells which has the following type:

𝛼 𝑋 2 : {𝑖 : Idx 𝑀//𝑋 0 } (𝑐 : Cns 𝑀//𝑋 0 𝑖) → (𝑥 : -→ 𝑋 1 𝑐) → 𝑋 1 𝑖
Let us pause a moment to understand what such a function amounts to. The definition will essentially be the same as the one of 𝛼 𝑋 = 2 that we introduced in Definition 3.4.1.

The type 𝑋 1 ((𝑖, 𝑦)⊳(𝑐, 𝑥)) is defined as 𝛼 𝑋 1 𝑐 𝑥 = 𝑦. An inhabitant of this type then witnesses that the pasting diagram (𝑐, 𝑥) multiplies to 𝑦. Now, suppose we have a pasting diagram of 1-cells (𝑑, 𝑧) : ⟦𝑀//𝑋 0 ⟧ 𝑋 1 ((𝑖, 𝑦) ⊳ (𝑐, 𝑥)). The pasting diagram (𝑑, 𝑧) then denotes a way of composing its source pasting diagram (𝑐, 𝑥) to 𝑦. Having a function 𝛼 𝑋 2 then amounts to saying that for any such configuration, we can prove that the unbiased composition of (𝑐, 𝑥) composes to 𝑦.

We define 𝛼 𝑋 2 𝑐 𝑣 inductively on 𝑐:

• If 𝑐 is of the form lf (𝑖, 𝑥) then we have to inhabit the type

𝑋 1 ((𝑖, 𝑥) ⊳ η 𝑋 * 0 𝑀/ (𝑖, 𝑥)) which is defined as 𝛼 𝑋 1 (η 𝑀/ 𝑖) (η-dec 𝑀/ 𝑋 0 𝑥) = 𝑥
and which holds since (𝑋 0 , 𝑋 1 ) is an algebra according to Lemma 3.5.5.

• If 𝑐 is nd ((𝑖, 𝑥) ⊳ (𝑐, 𝑦)) {𝑧} 𝑡 then we have to inhabit the type 𝑋 1 ((𝑖, 𝑥) ⊳ μ 𝑋 * 0 𝑀/ (𝑐, 𝑦) 𝑧) which is defined as

𝛼 𝑋 1 (μ 𝑀/ 𝑐 (𝜆𝑝 → pr 1 (𝑧 𝑝))) (𝜆𝑝 → pr 2 (𝑧 (pr μ 1 𝑝)) (pr μ 2 𝑝)) = 𝑥
The operation 𝛼 𝑋 1 being compatible with μ 𝑀/ , we have the identity 𝛼 -μ:

𝛼 𝑋 1 (μ 𝑀/ 𝑐 (𝜆𝑝 → pr 1 (𝑧 𝑝))) (𝜆𝑝 → pr 2 (𝑧 (pr μ 1 𝑝)) (pr μ 2 𝑝)) = 𝛼 𝑋 1 𝑐 (𝜆𝑝 → 𝛼 𝑋 1 (pr 1 (𝑧 𝑝)) (pr 2 (𝑧 𝑝)))
For any position 𝑝 : Pos 𝑀/ 𝑐, the inductive hypothesis 𝛼 𝑋 2 (𝑡 𝑝) (𝜆𝑞 → 𝑣 (inr (𝑝, 𝑞))) of type 𝛼 𝑋 1 (pr 1 (𝑧 𝑝)) (pr 2 (𝑧 𝑝)) = 𝑦 𝑝 allows us to establish the second identity:

𝛼 𝑋 1 𝑐 (𝜆𝑝 → 𝛼 𝑋 1 (pr 1 (𝑧 𝑝)) (pr 2 (𝑧 𝑝))) = 𝛼 𝑋 1 𝑐 𝑦
Finally, 𝑣 (inl ★) concludes the proof by providing the following identity:

𝛼 𝑋 1 𝑐 𝑦 = 𝑥
We finally define the type family 𝑋 2 : Fam (𝑀//𝑋 0 /𝑋 1 ) with defining equation

𝑋 2 ((𝑖, 𝑦) ⊳ (𝑐, 𝑥)) :≡ 𝛼 𝑋 2 𝑐 𝑥 = 𝑦
Once again, it is immediate that (𝑋 1 , 𝑋 2 ) is a 0-algebra as the type

(𝑦:𝑋 1 𝑖) (𝛼 𝑋 2 𝑐 𝑥 = 𝑦)
is contractible for any constructor 𝑐 : Cns 𝑀 𝑖 and family 𝑥 :

-→ 𝑋 1 𝑐.

□

At this stage, the data of wild multicategory structure allowed us to construct the two families 𝑋 1 and 𝑋 2 . Now, if we require in addition that 𝑋 0 is a family of sets, we can define a fibrant 𝑀/-opetopic type whose first three cell families are 𝑋 0 , 𝑋 1 , and 𝑋 2 .

Lemma 3.5.7. Let 𝐶 be a 𝑀-multicategory. Consider the 𝑀/-opetopic type 𝑋 defined as follows:

• 𝑋 0 is the family of morphisms of 𝐶.

• 𝑋 1 and 𝑋 2 are the families defined in Lemma 3.5.5 and Lemma 3.5.6.

• 𝑋 >2 is the terminal opetopic type for the monad 𝑀//𝑋 0 /𝑋 1 /𝑋 2 .

Then 𝑋 is a fibrant opetopic type.

Proof. We already know that (𝑋 0 , 𝑋 1 ) and (𝑋 1 , 𝑋 2 ) are 0-algebras. We therefore have to show that the opetopic type 𝑋 >1 is fibrant. We show that (𝑋 2 , 𝑋 3 ) is a 0-algebra, that is, for any index 𝑖 : Idx 𝑀//𝑋 0 /𝑋 1 , and pasting diagram (𝑐, 𝑦) : ⟦𝑀//𝑋 0 /𝑋 1 ⟧ 𝑋 2 𝑖, the type (𝑥:𝑋 2 𝑖) 𝑋 3 ((𝑖, 𝑥) ⊳ (𝑐, 𝑦)) is contractible. It suffices to show that both types of the sigma type are contractible. We already know that 𝑋 3 is a trivial family so all its fibres are contractible.

As for 𝑋 2 , it is defined as a family of identity types living in fibres of 𝑋 1 which is itself defined as a family of identity types living in fibres of 𝑋 0 which are sets. We deduce that 𝑋 1 is a family of propositions and that 𝑋 2 is a family of contractible types. We are left with 𝑋 >2 but this is the terminal opetopic type

1 𝑜 𝑀//𝑋 0 /𝑋 1 /𝑋 2
which is trivially fibrant.

□

It remains to show that our constructions are inverse to each other. Lemma 3.5.8. Let 𝐶 be a 𝑀-multicategory and let 𝐶 ′ be the 𝑀-multicategory associated to the fibrant 𝑀/-opetopic type obtained from 𝐶 using Lemma 3.5. [START_REF]𝑀,𝑀↓) {𝑐} 𝑝 is defined by induction on 𝑐 and 𝑝, pos ← Σ 𝑚 /(𝑀,𝑀↓) {nd (𝑥 ⊳ 𝑦) 𝑡} (inl ★) :≡ inl ★ Σ 𝑚 /(𝑀,𝑀↓) {nd (𝑥 ⊳ 𝑦) 𝑡} (inr (𝑝, 𝑞)[END_REF]Lemma 3.5.5,and Lemma 3.5.6. The 𝑀-multicategories 𝐶 and 𝐶 ′ are equivalent.

Proof. Firstly, the family of morphisms 𝑋 : Fam 𝑀/ remains unchanged and all we have to show is that the structure of 𝑀-multicategory of 𝐶 ′ is equivalent to the one of 𝐶. As 𝑋 is a family of sets, we readily obtain that the laws are propositions and must be equal. Therefore, we only have to show that the units η 𝐶 and η 𝐶 ′ as well as the composition operations μ 𝐶 and μ 𝐶 ′ are equal.

For any index 𝑥 : Idx 𝑀 , we have the following definitional equalities:

η 𝐶 ′ 𝑥 3.5.4 ≡ 𝛼 𝑋 1 (lf 𝑥) ⊥-elim 3.5.5 ≡ η 𝐶 𝑥
where 𝑋 1 is the family of 1-cells of the opetopic type obtained from 𝐶.

As for the composition operation, given a morphism 𝑓 : 𝑋 (𝑥 ⊳ 𝑦), and a family 𝑔 : -→ 𝑋 (𝑦 ◀ 𝑧), we have:

μ 𝐶 ′ 𝑓 𝑔 3.5.4 ≡ 𝛼 𝑋 1 𝜃 𝑓 ,𝑔 3.5.5 ≡ μ 𝐶 𝑓 (𝜆𝑝 → μ 𝐶 (𝑔 𝑝) (𝜆𝑞 → η 𝐶 (𝑧 (pair μ 𝑝 𝑞)))) = μ 𝐶 𝑓 𝑔
where the last identity is obtained by right unitality of μ 𝐶 .

□

Finally, we prove that defining a multicategory out of a fibrant set-truncated opetopic type then reconstructing a fibrant opetopic type from this information gives us back an equivalent opetopic type. Lemma 3.5.9. Let 𝑋 be a fibrant 𝑀/-opetopic type whose family 𝑋 0 is a family of sets. Let 𝑋 ′ be the 𝑀/-opetopic type obtained from the 𝑀-multicategory associated with 𝑋 using Lemma 3.5.4,Lemma 3.5.5,and Lemma 3.5.6. Then 𝑋 and 𝑋 ′ are equivalent opetopic types.

Proof. We have to show an equivalence of opetopic types between 𝑋 and 𝑋 ′ (see Definition 3.1.4); that is, we need to define a coinductive sequence of equivalences between their cell families. We start by noticing that 𝑋 0 ≡ 𝑋 ′ 0 therefore we simply use the identity equivalence. Next, we have to show that for all index 𝑖 : Idx (𝑀//𝑋 0 ), the equivalence 𝑋 1 𝑖 ≃ 𝑋 ′ 1 𝑖 holds. But Lemma 3.5.5 defines 𝑋 ′ 1 ((𝑖, 𝑦) ⊳ (𝑐, 𝑥)) to be 𝛼 𝑋 ′ 1 𝑐 𝑥 = 𝑦 and Lemma 3.2.3 applied to 𝑋 1 gives us the equivalence 𝑋 1 ((𝑖, 𝑦) ⊳ (𝑐, 𝑥)) ≃ (𝛼 𝑋 1 𝑐 𝑥 = 𝑦). We therefore conclude by establishing the identity 𝛼 𝑋 1 𝑐 𝑥 = 𝛼 𝑋 ′ 1 𝑐 𝑥 for any constructor 𝑐 : Cns 𝑀 𝑖 and family 𝑥 :

-→ 𝑋 0 𝑐 by induction on 𝑐.

• If 𝑐 is of the form lf (𝑖, 𝑦), we must define the identity 𝛼 𝑋 1 (lf (𝑖, 𝑦)) 𝑥 = η 𝛼 𝑋 1 (𝑖, 𝑦). But η 𝛼 𝑋 1 (𝑖, 𝑦) ≡ 𝛼 𝑋 1 (lf (𝑖, 𝑦)) ⊥-elim thus it suffices to show that 𝑥 = ⊥-elim which is the case as both functions have domain the empty type ⊥.

• If 𝑐 is of the form nd (𝑦 ⊳ 𝑧) 𝑡, the identity to define is now

𝛼 𝑋 1 (nd (𝑦 ⊳ 𝑧) 𝑡) 𝑥 = μ 𝛼 𝑋 1 (𝑥 (inl ★)) (𝜆𝑝 → 𝛼 𝑋 ′ 1 (𝑡 𝑝) (𝜆𝑞 → 𝑥 (inr (𝑝, 𝑞)))
) which is readily established by applying Corollary 3.2.7 and by using the induction hypothesis.

Finally, in order to conclude that the opetopic types 𝑋 >1 and 𝑋 ′ >1 are equivalent -up to a base change-we note that they are both fibrant and that their families of objects have contractible fibres. They are therefore necessarily equivalent to the terminal opetopic type for the appropriate monad.

□

We gather these results into the proof of our main theorem.

Proof of Theorem 3.5.3. Lemmas 3.5.4,3.5.5,3.5.6,and 3.5.7 define the two directions of the equivalence. Lemmas 3.5.8 and 3.5.9 show that they are both inverse to each other.

□

This concludes this section which shown that the type of truncated fibrant 𝑀/-opetopic types and 𝑀-multicategories are equivalent.

Fibrations of opetopic types

We take advantage of monad families and extend opetopic types to families of opetopic types indexed over an opetopic type. We regard these families as specifying a collection of opetopic cells each indexed over a base cell. We conclude by introducing their fibrations which generalise the notion of fibrant opetopic type to families of opetopic types. We will apply these notions in the context of ∞-categories in a subsequent section.

Families of opetopic types

Definition 3.6.1 (Family of opetopic types). Given a monad family 𝑀↓ : ℳ↓ 𝑀 and an opetopic type 𝑋 : 𝒪 𝑀 , a family of opetopic types indexed by the monad family 𝑀↓ over the opetopic type 𝑋 is defined by the following data:

• A type family 𝑋↓ : Fam↓ 𝑋 0 𝑀↓ .

• A family of opetopic types indexed by the monad family 𝑀↓/𝑋↓ over the opetopic type 𝑋 >0 .

We denote 𝒪↓ 𝑋 𝑀↓ the type of opetopic types over an opetopic type 𝑋 : 𝒪 𝑀 and indexed by a monad family 𝑀↓ : ℳ↓ 𝑀 .

Dependent algebras

Likewise, we extend the notions of algebras and fibrant opetopic types to the dependent setting.

Notation. We extend the notation for pasting diagrams to monad families. Let 𝑀↓ : ℳ↓ 𝑀 be a monad family indexed over a monad 𝑀 and let 𝑋↓ : Fam↓ 𝑋 𝑀↓ be a family of types dependent on the indices of 𝑀↓ and on a family 𝑋 : Fam 𝑀 . Let 𝑖↓ : Idx↓ 𝑀↓ 𝑖 be an index and let We start with the definition of dependent 0-algebras.

Definition 3.6.2 (Dependent 0-algebra). Let 𝑀↓ : ℳ↓ 𝑀 be a monad family, let 𝑋 0 : Fam 𝑀 , let 𝑋 1 : Fam 𝑀/𝑋 0 , let 𝑋↓ 0 : Fam↓ 𝑋 0 𝑀↓ , and let 𝑋↓ 1 : Fam↓ 𝑋 1 𝑀↓/𝑋↓ 0 . We say that (𝑋↓ 0 , 𝑋↓ 1 ) is a dependent 0-algebra if for any base cell 𝑢 : 𝑋 1 ((𝑖, 𝑦) ⊳ (𝑐, 𝑥))

and any pasting diagram (𝑐↓, 𝑥↓) : ⟦𝑀↓⟧ 𝑋↓ 0 𝑖↓ (𝑐, 𝑥), the following type is contractible:

(𝑦↓:𝑋↓ 0 𝑖↓ 𝑦) 𝑋↓ 1 ((𝑖↓, 𝑦↓) ⊳ (𝑐↓, 𝑥↓)) 𝑢 Let 𝑀↓ : ℳ↓ 𝑀 be a monad family and let 𝑋↓ 0 : Fam↓ 𝑋 0 𝑀↓ and 𝑋↓ 1 :

Fam↓ 𝑋 1 𝑀↓/𝑋↓ 0 be families. If (𝑋 0 , 𝑋 1 ) and (𝑋↓ 0 , 𝑋↓ 1 ) are 0-algebras, we recover the usual operations of composition of cells.

𝛼↓ 𝑋↓ 1 : {𝑖 : Idx 𝑀 } {𝑥 : ⟦𝑀⟧ 𝑋 𝑖} {𝑖↓ : Idx↓ 𝑀↓ 𝑖} (𝑥↓ : ⟦𝑀↓⟧ 𝑋↓ 𝑖↓ 𝑥)

→ 𝑋↓ 0 𝑖↓ (𝛼 𝑋 1 𝑥) 𝛼↓ fill
𝑋↓ 1 : {𝑖 : Idx 𝑀 } {𝑥 : ⟦𝑀⟧ 𝑋 𝑖} {𝑖↓ : Idx↓ 𝑀↓ 𝑖} (𝑥↓ : ⟦𝑀↓⟧ 𝑋↓ 𝑖↓ 𝑥)

→ 𝑋↓ 1 ((. . . , 𝛼↓ 𝑋 1 𝑥↓) ⊳ 𝑥↓) (𝛼 fill 𝑋 1 𝑥)
They are defined as the two projections of the centre of contraction of the witness of the corresponding dependent 0-algebra using 𝛼 fill 𝑋 1 𝑐 𝑥 as base cell. Note the use of the 0-algebra (𝑋 0 , 𝑋 1 ) to index the resulting dependent cells. We will often place ourselves in a case where the base opetopic type is fibrant.

Similarly, in the case of dependent 0-algebras of a slice monad 𝑀/, we obtain the following operators:

η↓ 𝛼 𝑋↓ 1 : {𝑖 : Idx 𝑀 } (𝑖↓ : Idx↓ 𝑀↓ 𝑖) → 𝑋↓ 0 (𝑖↓ ⊳ η↓ 𝑀↓ 𝑖↓) (η 𝛼 𝑋 1 𝑖) η↓ 𝛼 fill 𝑋↓ 1 : {𝑖 : Idx 𝑀 } (𝑖↓ : Idx↓ 𝑀↓ 𝑖) → 𝑋↓ 1 ((. . . , η↓ 𝛼 𝑋↓ 1 𝑖↓) ⊳ (lf↓ 𝑖↓, ⊥-elim)) (η 𝛼 fill
𝑋 1 𝑖) with definining equations:

η↓ 𝛼 𝑋↓ 1 𝑖↓ :≡ 𝛼↓ 𝑋↓ 1 (lf↓ 𝑖↓) ⊥-elim η↓ 𝛼 fill 𝑋↓ 1 𝑖↓ :≡ 𝛼↓ fill 𝑋↓ 1 (lf↓ 𝑖↓) ⊥-elim
In addition, we have a biased composition along with its filler:

μ↓ 𝛼
→ 𝑋↓ 0 (𝑥↓ ⊳ μ↓ 𝑀↓ 𝑦↓ 𝑧↓) (μ 𝛼 𝑋 1 𝑓 𝑔) μ↓ 𝛼 fill 𝑋↓ 1 : {𝑥 : Idx 𝑀 } {𝑦 : Cns 𝑀 𝑥} {𝑧 : ----→ Cns 𝑀 𝑦} → { 𝑓 : 𝑋 0 (𝑥 ⊳ 𝑦)} {𝑔 : -→ 𝑋 0 (𝑦 ◀ 𝑧)} → {𝑥↓ : Idx↓ 𝑀↓ 𝑥} {𝑦↓ : Cns↓ 𝑀↓ 𝑥↓ 𝑦} {𝑧↓ : ------→ Cns↓ 𝑀↓ 𝑦↓ 𝑧} → ( 𝑓 ↓ : 𝑋↓ 0 (𝑥↓ ⊳ 𝑦↓) 𝑓 ) (𝑔↓ : --→ 𝑋↓ 0 (𝑦↓ ◀ 𝑧↓) 𝑔) → 𝑋↓ 1 ((. . . , μ↓ 𝛼 𝑋↓ 1 𝑓 ↓ 𝑔↓) ⊳ 𝜃 𝑓 ↓,𝑔↓ ) (μ 𝛼 fill 𝑋 1 𝑓 𝑔) with definining equations: μ↓ 𝛼 𝑋↓ 1 𝑓 ↓ 𝑔↓ :≡ 𝛼↓ 𝑋↓ 1 𝜃 𝑓 ↓,𝑔↓ μ↓ 𝛼 fill 𝑋↓ 1 𝑓 ↓ 𝑔↓ :≡ 𝛼↓ fill 𝑋↓ 1 𝜃 𝑓 ↓,𝑔↓

Algebraic laws

In the presence of a further dependent algebra, we recover a dependent version of the algebraic laws satisfied by a 1-algebra.

Let 𝑀↓ : ℳ↓ 𝑀 be a monad family indexed over a monad 𝑀 and let 𝑋↓ 0 :

Fam↓ 𝑋 0 𝑀↓ , 𝑋↓ 1 : Fam↓ 𝑋 1 𝑀↓/𝑋↓ 0
, and 𝑋↓ 2 : Fam↓ 𝑋 2 𝑀↓/𝑋↓ 0 /𝑋↓ 1 be dependent families over the families 𝑋 0 , 𝑋 1 , and 𝑋 2 . We suppose that (𝑋↓ 0 , 𝑋↓ 1 ) and (𝑋↓ 1 , 𝑋↓ 2 ) are dependent 0-algebras and that (𝑋 0 , 𝑋 1 ) and (𝑋 1 , 𝑋 2 ) are 0-algebras.

In that case, (𝑋↓ 0 , 𝑋↓ 1 ) satisfies the usual algebraic laws albeit with an additional transport:

transport 𝑋↓ 0 𝑖↓ 𝛼 -η (𝛼↓ 𝑋↓ 1 (η↓ 𝑋↓ 1 𝑖↓) 𝑥↓) = 𝑥↓ (pos η 𝑖) transport 𝑋↓ 0 𝑖↓ 𝛼 -μ (𝛼↓ 𝑋↓ 1 (μ↓ 𝑋↓ 1 𝑐↓ 𝑑↓) 𝑥↓) = 𝛼↓ 𝑋↓ 1 𝑐↓ (𝜆𝑝 → 𝛼↓ 𝑋↓ 1 (𝑑↓ 𝑝) (𝜆𝑞 → 𝑥↓ (pair μ 𝑝 𝑞)))
We do not prove these laws as they are a straightforward generalisation of the non-dependent ones. We say that (𝑋↓ 0 , 𝑋↓ 1 ) is a dependent 1-algebra.

Similarly, if the monad 𝑀 is of the form 𝑀 ′ / for some monad 𝑀 ′ , the operation μ↓ 𝛼 𝑋↓ 1 is associative and unital with unit η↓ 𝛼 𝑋↓ 1 :

transport 𝑋↓ 0 (𝑥↓⊳𝑦↓) μ 𝛼 𝑋 1 -unit-r (μ↓ 𝛼 𝑋↓ 1 𝑓 ↓ (𝜆𝑝 → η↓ 𝛼 𝑋↓ 1 (Typ↓ 𝑀↓ 𝑦↓ 𝑝))) = 𝑓 ↓ transport 𝑋↓ 0 (𝑥↓⊳𝑦↓ (pos η 𝑖)) μ 𝛼 𝑋 1 -unit-l (μ↓ 𝛼 𝑋↓ 1 (η↓ 𝑋↓ 1 𝑖↓) 𝑓 ↓) = 𝑓 ↓ (pos η 𝑖) transport 𝑋↓ 0 (𝑥↓⊳μ↓ 𝑀↓ 𝑦↓ (𝜆𝑝→μ↓ 𝑀↓ (𝑧↓ 𝑝) (𝜆𝑞→𝑡↓ (pair μ 𝑝 𝑞)))) μ 𝛼 𝑋 1 -assoc (μ↓ 𝛼 𝑋↓ 1 𝑓 ↓ (𝜆𝑝 → μ↓ 𝛼 𝑋↓ 1 (𝑔↓ 𝑝) (𝜆𝑞 → ℎ↓ (pair μ 𝑝 𝑞)))) = μ↓ 𝛼 𝑋↓ 1 (μ↓ 𝛼 𝑋↓ 1 𝑓 ↓ 𝑔↓) ℎ↓

Fibrations of opetopic types

We are now able to define fibrations of opetopic types. Definition 3.6.3 (Fibration of opetopic types). Let 𝑀↓ : ℳ↓ 𝑀 be a monad family indexed over a monad 𝑀 and let 𝑋↓ be a 𝑀↓-opetopic type over a 𝑀-opetopic type 𝑋. We say that 𝑋↓ is a fibration of opetopic types if it satisfies the following conditions:

• (𝑋↓ 0 , 𝑋↓ 1 ) is a dependent 0-algebra.

• 𝑋↓ >0 is a fibration of opetopic types.

We also define fibrations of ∞-categories which we will use in Section 3.9. Definition 3.6.4 (Fibration of ∞-categories). Let 𝑋 be an ∞-category. A family of opetopic types 𝑋↓ : 𝒪↓ 𝑋 Id↓ over 𝑋 is a fibration of ∞-categories if 𝑋↓ >0 is a fibration of opetopic types. We denote ∞-category↓ 𝑋 the type of fibrations of ∞-categories over 𝑋.

We expect the fibres of a fibration of ∞-categories to be ∞-categories. However, there is no easy way to define such a construction in our current formalism.

Dependent sums of opetopic types

Opetopic types are closed under dependent sums. Let 𝑋↓ : 𝒪↓ 𝑋 𝑀↓ be a family of opetopic types indexed over an opetopic type 𝑋 : 𝒪 𝑀 . We form the opetopic type

Σ 𝑜 (𝑋 , 𝑋↓) : 𝒪 Σ 𝑚 (𝑀,𝑀↓)
It is defined by coinduction by the following equations

Σ 𝑜 (𝑋 , 𝑋↓) 0 :≡ Σ↓(𝑋 0 , 𝑋↓ 0 ) Σ 𝑜 (𝑋 , 𝑋↓) >0 :≡ 𝑓 * (Σ 𝑜 (𝑋 >0 , 𝑋↓ >0 ))
where the second equation specifies a reindexing (Definition 3.1.3) along a monad map 𝑓 whose type is

Σ 𝑚 (𝑀, 𝑀↓)/Σ↓(𝑋 0 , 𝑋↓ 0 ) → 𝑚 Σ 𝑚 (𝑀/𝑋 0 , 𝑀↓/𝑋↓ 0 )
and which is defined as

Σ 𝑚 /(𝑋 * 0 𝑀, 𝑋↓ * 0 𝑀↓) • 𝑚 Σ 𝑚 * (𝑀, 𝑀↓, 𝑋 0 , 𝑋↓ 0 )/
We end this short section by proving that fibrant opetopic types are closed under dependent sums.

Lemma 3.6.5. Let 𝑋↓ : 𝒪↓ 𝑋 𝑀↓ be a fibration of opetopic types indexed over a fibrant opetopic type 𝑋 : 𝒪 𝑀 . The opetopic type Σ 𝑜 (𝑋 , 𝑋↓) is fibrant.

Proof. We first have to show that for any index (𝑖, 𝑖↓) : Idx Σ 𝑚 (𝑀,𝑀↓) , any constructor (𝑐, 𝑐↓) : Cns Σ 𝑚 (𝑀,𝑀↓) (𝑖, 𝑖↓), and any family of elements 𝑥 :

----------→ Σ 𝑚 (𝑀, 𝑀↓) 𝑐, the following type is contractible:

((𝑦,𝑦↓):

(𝑦:𝑋 0 𝑖) 𝑋↓ 0 𝑖↓ 𝑦) (𝑧:𝑋 1 ((𝑖,𝑦)⊳(𝑐,pr 1 •𝑥))) 𝑋↓ 1 ((𝑖↓, 𝑦↓) ⊳ (𝑐↓, pr 2 • 𝑥)) 𝑧 Reordering the sigma types, it is equivalent to prove that the following type is contractible:

((𝑦,𝑧):

(𝑦:𝑋 0 𝑖) 𝑋 1 ((𝑖, 𝑦) ⊳ (𝑐, pr 1 • 𝑥))) (𝑦↓:𝑋↓ 0 𝑖↓ 𝑦) 𝑋↓ 1 ((𝑖↓, 𝑦↓) ⊳ (𝑐↓, pr 2 • 𝑥)) 𝑧
But this follows from the fact that (𝑋 0 , 𝑋 1 ) and (𝑋↓ 0 , 𝑋↓ 1 ) are 0-algebras. Sigma types of contractible types are again contractible.

It remains to prove that the opetopic type 𝑓 * (Σ 𝑜 (𝑋 >0 , 𝑋↓ >0 )) is fibrant where 𝑓 is the appropriate monad morphism. But fibrant opetopic types are closed under reindexing and the coinduction hypothesis states that Σ 𝑜 (𝑋 >0 , 𝑋↓ >0 ) is fibrant as 𝑋 >0 and 𝑋↓ >0 are themselves fibrant which concludes this proof. □

The opetopic universe of types

A compelling argument in favour of an opetopic theory of types is the ease with which we can define the universal opetopic fibration of types. Recall that in type theory, the universal fibration of types is the first projection of pointed types pr 1 : (𝐴:𝒰) 𝐴 → 𝒰 (see Section 4.8 of the HoTT book).

The universal fibration of Id-opetopic types is the unique fibration 𝑓 : 𝒰 𝑜 • → 𝒰 𝑜 such that any fibration of Id-opetopic types 𝑔 : 𝐴 → 𝐵 arises uniquely as the pullback of some fibration g : 𝐵 → 𝒰 𝑜 along 𝑓 .

𝐴 𝒰 𝑜 • 𝐵 𝒰 𝑜 𝑔 𝑓 g
In this section, we will only define the map 𝑓 : 𝒰 𝑜 • → 𝒰 𝑜 regarded as a family of opetopic types 𝒰 𝑜

• : 𝒪↓ 𝒰 𝑜 Id↓ over 𝒰 𝑜 : 𝒪 Id without proving that it is a fibration, let alone that it is the universal one which is left for future work.

Intuitively, 𝒰 𝑜 is the opetopic type whose objects are types and whose higher cells are fibrant relations: relations which intuitively correspond to equivalences.

𝒰 𝑜

• is then the family of opetopic types whose objects over a type 𝑋 are the elements of 𝑋 and whose higher cells over a given fibrant relation and a frame -the data of a source pasting diagram and a target cell -are the witnesses that this relation holds for the given frame.

First, note that for any monad 𝑀 : ℳ and monad family 𝑀↓ : ℳ↓ 𝑀 over This concludes the definition of the universal fibration of fibrant opetopic types.

The opetopic type associated with a type

It is well-known that types are ∞-groupoids [START_REF] Lumsdaine | Weak omega-categories from intensional type theory[END_REF]Van Den Berg and Garner 2011). It is therefore expected that we can define the fibrant Id-opetopic type associated with a type 𝑋. To this effect, we will use the monad family Id↓ 𝑋 .

First, note that for any monad 𝑀 and monad family 𝑀↓ : ℳ↓ 𝑀 , there are two canonical type families Rel 𝑀↓ : Fam 𝑀 and Rel↓ 𝑀↓ : Fam↓ The opetopic type associated with a type 𝑋 is the opetopic type Id↓ 𝑜 𝑋 .

It remains to establish that Id↓ 𝑜 𝑋 is fibrant. To this effect, we introduce a few more results about monad families and in particular those of the form 𝑀↓/Rel↓ 𝑀↓ .

First, we will need the notion of fibration of monads.

Definition 3.8.2 (Fibration of monads). Let 𝑀↓ be a monad family indexed over a monad 𝑀. We say that 𝑀↓ is a fibration of monads if, for any constructor 𝑐 : Cns 𝑀 𝑖 and family of indices 𝑥 :

----→ Idx↓ 𝑀 𝑐, there is an index 𝑖↓ : Idx↓ 𝑀↓ 𝑖, a constructor 𝑐↓ : Cns↓ 𝑀↓ 𝑖↓ 𝑐 satisfying Typ↓ 𝑀↓ 𝑐↓ = 𝑥. Moreover, this data is unique. That is, the following type is contractible:

(𝑖↓:Idx↓ 𝑀↓ 𝑖) (𝑐↓:Cns↓ 𝑀↓ 𝑖↓ 𝑐) Typ↓ 𝑀↓ 𝑐↓ = 𝑥 In particular, one can establish that a fibration of monads 𝑀↓ implies that (Idx↓ 𝑀↓ , Idx↓ 𝑀↓/Rel↓ 𝑀↓ ) is a 0-algebra using the equivalence We now show that a particular slice construction is a fibration of monads.

Lemma 3.8.3. Let 𝑀↓ be a monad family indexed over a monad 𝑀. The monad family 𝑀↓/Rel↓ 𝑀↓ is a fibration of monads over 𝑀/Rel 𝑀↓ .

Proof. We only sketch the proof, the fully detailed proof can be found in the formalisation. Let 𝑖 : Idx 𝑀/Rel 𝑀↓ , 𝑐 : Cns 𝑀/Rel 𝑀↓ 𝑖, and 𝑥 :

-----------→ Idx↓ 𝑀↓/Rel↓ 𝑀↓ 𝑐. We prove that the necessary data exists and is unique by induction on 𝑐. Essentially, we show that a pasting diagram 𝑐 can be uniquely lifted to a pasting diagram dependent on 𝑐 -therefore having the same form -and whose nodes are given by 𝑥.

• If 𝑐 is of the form lf (𝑖, 𝑖↓), it uniquely lifts to lf↓ (𝑖↓, refl) and the identity Typ↓ 𝑀↓/Rel↓ 𝑀↓ (lf↓ (𝑖↓, refl)) = 𝑥 is uniquely witnessed as the two sides of the identity are functions whose domain is the empty type.

• If 𝑐 is of the form nd (𝑦 ⊳ 𝑧) 𝑡, it uniquely lifts to nd↓ (𝑥 (inl★)) 𝑡↓ such that

Typ↓ 𝑀↓/Rel↓ 𝑀↓ (nd↓ (𝑥 (inl★)) 𝑡↓) = 𝑥
where 𝑡↓ is the induction hypothesis applied to 𝑡 𝑝 and 𝜆𝑞 → 𝑥 (inr (𝑝, 𝑞)) for any position 𝑝 : Pos 𝑀/Rel 𝑀↓ 𝑧 up to a tedious transport that we do not detail in order to get the indexing right.

□

This suffices to define a fibrant opetopic type from a fibration of monads.

Lemma 3.8.4. Let 𝑀↓ be a fibration of monads over a monad 𝑀. Then the opetopic type 𝑀↓ 𝑜 is fibrant.

Proof. Proving that (𝑀↓ 𝑜 0 , 𝑀↓ 𝑜 1 ) is a 0-algebra essentially uses the fact that 𝑀↓ is a fibration of monads along with Equivalence 3.1.

We conclude by applying the coinductive hypothesis to the monad family 𝑀↓/Rel↓ 𝑀↓ which is a fibration of monads according to Lemma 3.8.3.

□

As a corollary, we obtain that Id↓ 𝑜 𝑋 is fibrant.

Corollary 3.8.5. The opetopic type Id↓ 𝑜 𝑋 is fibrant.

Proof. It is easy to check that Id↓ 𝑋 is a fibration of monads which allows to conclude that Id↓ 𝑜 𝑋 is fibrant by virtue of Lemma 3.8.4.

□

The operation of defining a fibrant opetopic type from a type and the operation of extracting the type of objects of a fibrant opetopic type are actually inverse to each other. This statement corresponds to the internalisation of the result stating that types are ∞-groupoids [START_REF] Finster | Types are internal ∞-groupoids[END_REF] whose proof is not detailed here.

Adjunctions

In order to display the capabilities of our formalism, we define the notion of adjoint functors following Lurie's definition (Lurie 2009, Definition 5.2.2.1) as an ∞-category over the interval.

Notation.

In this section we will only deal with ∞-categories which are Id-indexed opetopic types 𝑋 whose morphisms are therefore unary. We will denote their type of objects 𝑋 0 instead of 𝑋 0 ★. Also, for any pair of objects 𝑥, 𝑦 : 𝑋 0 , we will write 𝑋 1 (𝑥 ⊲ 𝑦) for their type of morphisms from 𝑥 to 𝑦 instead of the more convoluted 𝑋 1 ((★, 𝑦) ⊳ (★, 𝜆𝑝 → 𝑥)).

Similarly for fibrations of ∞-categories 𝑋↓ over an ∞-category 𝑋, we will denote 𝑋↓ 0 𝑥 their type of objects over an object 𝑥 instead of 𝑋↓ 0 ★ 𝑥. Also, for any pair of objects 𝑥↓ : 𝑋↓ 0 𝑥 and 𝑦↓ : 𝑋↓ 0 𝑦 along with a base morphism 𝑓 : 𝑋 1 (𝑥 ⊲ 𝑦), we will write 𝑋↓ 1 (𝑥↓ ⊲ 𝑦↓) 𝑓 for the type of morphisms from 𝑥↓ to 𝑦↓ over 𝑓 in place of 𝑋↓ 1 ((★, 𝑦↓) ⊳ (★, 𝜆𝑝 → 𝑥↓)) 𝑓 .

Finally, we will denote the composition of morphisms 𝑔 • 𝑓 instead of μ 𝛼 𝑋 2 𝑔 (η-dec 𝑓 ) or μ↓ 𝛼 𝑋↓ 2 𝑔 (η-dec 𝑓 ) in the dependent case. As for the unit, we will write 1 𝑥 instead of η 𝛼 𝑋 2 𝑥 or η↓ 𝛼 𝑋 2 𝑥 in the dependent case.

We start with the definition of the higher categorical counterpart of Grothendieck (op)fibrations which rely on the existence of enough (co)cartesian morphisms.

Definition 3.9.1 (Cartesian morphism). Let 𝑋↓ : ∞-category↓ 𝑋 be a fibration of ∞-categories over an ∞-category 𝑋. Let 𝑓 ↓ : 𝑋↓ 1 (𝑥↓ ⊲ 𝑦↓) 𝑓 be a morphism over 𝑓 : 𝑋 1 (𝑥 ⊲ 𝑦), 𝑓 ↓ is a cartesian morphism if for any morphism 𝑔↓ : 𝑋 1 (𝑧↓ ⊲ 𝑦↓) 𝑔 over 𝑔 : 𝑋 1 (𝑧 ⊲ 𝑦) and any morphism ℎ : 𝑋 1 (𝑧 ⊲ 𝑥) such that there is an identity 𝑝 : 𝑓 • ℎ = 𝑔, there exists a unique morphism ℎ↓ : 𝑋↓ 1 (𝑧↓ ⊲ 𝑥↓) ℎ such that

transport 𝑋↓ 1 (𝑧↓⊲𝑦↓) 𝑝 ( 𝑓 ↓ • ℎ↓) = 𝑔↓
That is, the following type is contractible

(ℎ↓:𝑋↓ 1 (𝑧↓⊲𝑥↓) ℎ) transport 𝑋↓ 1 (𝑧↓⊲𝑦↓) 𝑝 ( 𝑓 ↓ • ℎ↓) = 𝑔↓
This leads us to the definition of Grothendieck fibration.

Definition 3.9.2 (Grothendieck fibration). Let 𝑋↓ : ∞-category↓ 𝑋 be a fibration of ∞-categories over 𝑋. 𝑋↓ is a Grothendieck fibration if for any morphism 𝑓 : 𝑋 1 (𝑥 ⊲ 𝑦) and any object 𝑦↓ : 𝑋↓ 0 𝑦 there is an object 𝑥↓ : 𝑋↓ 0 𝑥 and a cartesian morphism 𝑓 ↓ : 𝑋↓ 1 (𝑥↓ ⊲ 𝑦↓) 𝑓 over 𝑓 .

Similarly, we define cocartesian morphisms and opfibrations.

Definition 3.9.3 (Cocartesian morphism). Let 𝑋↓ : ∞-category↓ 𝑋 be a fibration of ∞-categories over an ∞-category 𝑋. Let 𝑓 ↓ : 𝑋↓ 1 (𝑥↓ ⊲ 𝑦↓) 𝑓 be a morphism over 𝑓 : 𝑋 1 (𝑥 ⊲ 𝑦), 𝑓 ↓ is a cocartesian morphism if for any morphism 𝑔↓ : 𝑋 1 (𝑥↓ ⊲ 𝑧↓) 𝑔 over 𝑔 : 𝑋 1 (𝑥 ⊲ 𝑧) and any morphism ℎ : 𝑋 1 (𝑦 ⊲ 𝑧) such that there exists an identity 𝑝 : ℎ • 𝑓 = 𝑔, there exists a unique morphism ℎ↓ : 𝑋↓

1 (𝑦↓ ⊲ 𝑧↓) ℎ such that transport 𝑋↓ 1 (𝑥↓⊲𝑧↓) 𝑝 (ℎ↓ • 𝑓 ↓) = 𝑔↓
That is, the following type is contractible (ℎ↓:𝑋↓ 1 (𝑦↓⊲𝑧↓) ℎ) transport 𝑋↓ 1 (𝑥↓⊲𝑧↓) 𝑝 (ℎ↓ • 𝑓 ↓) = 𝑔↓ Definition 3.9.4 (Grothendieck opfibration). Let 𝑋↓ : ∞-category↓ 𝑋 be a fibration of ∞-categories over 𝑋. 𝑋↓ is a Grothendieck opfibration if for any morphism 𝑓 : 𝑋 1 (𝑥 ⊲ 𝑦) and any object 𝑥↓ : 𝑋↓ 0 𝑥 there is an object 𝑦↓ : 𝑋↓ 0 𝑦 and a cocartesian morphism 𝑓 ↓ : 𝑋↓ 1 (𝑥↓ ⊲ 𝑦↓) 𝑓 over 𝑓 .

Next, we define the interval ∞-category 𝐼.

Definition 3.9.5. The interval 𝐼 is the ∞-category defined as follows:

• The type of objects 𝐼 0 is 2 whose sole elements are 0 and 1.

• The family of morphisms is defined by case analysis on the objects:

𝐼 1 (𝑥 ⊲ 𝑦) :≡ 0 if 𝑥 ≡ 1 and 𝑦 ≡ 0 1 otherwise • 𝐼 >1 is 1 𝑜 Id/𝐼 0 /𝐼 1
, the terminal opetopic type for the monad Id/𝐼 0 /𝐼 1 .

It is easy to see that the opetopic type 𝐼 >0 is fibrant. 𝐼 is therefore an ∞-category.

At last, we define adjunctions following Lurie's definition (Lurie 2009, Theorem 5.2.2.1) although we cannot establish a formal equivalence between each fibre and their corresponding ∞-category (i.e., we cannot state that the fibres of a fibration of ∞-categories are ∞-categories in the present formalism). Definition 3.9.6 (Adjunction). An adjunction is a fibration of ∞-categories over the interval 𝐼 which is both a Grothendieck fibration and a Grothendieck opfibration.

In that case, the adjunction is between the two ∞-categories defined by the fibres. We now show that this definition is compatible with a more explicit characterisation of adjunction in low dimensions. We will in particular show that it induces a map on objects, a map on morphisms which satisfies the usual laws of functors, and, moreover, an equivalence of homs stemming from the adjunction.

We first check the functor part.

Lemma 3.9.7. Given a Grothendieck opfibration over the interval 𝐶 : ∞-category↓ 𝐼 , we can define two functions between the two fibres:

𝑓 0 : 𝐶 0 0 → 𝐶 0 1 𝑓 1 : {𝑥 𝑦 : 𝐶 0 0} → 𝐶 1 (𝑥 ⊳ 𝑦) 1 0 → 𝐶 1 ( 𝑓 0 𝑥 ⊳ 𝑓 0 𝑦) 1 1
satisfying the following laws:

𝑓 1 (𝑔 • 𝑓 ) = 𝑓 1 𝑔 • 𝑓 1 𝑓 𝑓 1 1 𝑥 = 1 𝑓 0 𝑥
Proof. The proof is standard in category theory. We start with the definition of 𝑓 0 . For any object 𝑥 : 𝐶 0 0, the Grothendieck opfibration guarantees the existence of a morphism over ★ : 𝐼 (0 ⊲ 1) that we denote 𝑓 fill 0 𝑥 whose source is 𝑥 and whose target over 1 is the image of 𝑥 under 𝑓 0 .

Next, for any morphism 𝑔 : 𝐶 1 (𝑥 ⊲ 𝑦) 1 0 in the fibre over 0, we can compose it with 𝑓 fill 0 𝑦 : 𝐶 1 (𝑦 ⊲ 𝑓 0 𝑦) ★ and, given that 𝑓 fill 0 𝑥 is a cocartesian morphism, there exists a morphism of type 𝐶 1 ( 𝑓 0 𝑥 ⊲ 𝑓 0 𝑦) 1 1 which, composed with 𝑓 fill 0 𝑥 is equal to 𝑓 fill 0 𝑦 • 𝑔. We associate this morphism with the image of 𝑔 under 𝑓 1 . This determines the function 𝑓 1 .

𝑥 𝑓 0 𝑥 𝑦 𝑓 0 𝑦 𝑔 𝑓 fill 0 𝑥 𝑓 1 𝑔 𝑓 fill 0 𝑦
It remains to check the laws. Let 𝑔 : 𝐶 1 (𝑥⊲𝑦) 1 0 and ℎ : 𝐶 1 (𝑦⊲𝑧) 1 0 be morphisms in the fibre over 0. We want to establish the identity 𝑓

1 (ℎ • 𝑔) = 𝑓 1 ℎ • 𝑓 1 𝑔.
We start by noticing that 𝑓 1 (ℎ • 𝑔) is obtained as the lift of the morphism 𝑓 fill 0 𝑧 • ℎ • 𝑔 along the cocartesian morphism 𝑓 fill 0 𝑥. We have to show that 𝑓 1 ℎ • 𝑓 1 𝑔 is another lifting candidate then conclude by uniqueness of the lift. By definition of 𝑓 1 𝑔, we have a first identity 𝑓 1 𝑔 • 𝑓 fill 0 𝑥 = 𝑓 fill 0 𝑦 • 𝑔 then by definition of 𝑓 1 ℎ, we have a second identity 𝑓 1 ℎ • 𝑓 fill 0 𝑦 = 𝑓 fill 0 𝑧 • ℎ. This allows to conclude that

𝑓 1 ℎ • 𝑓 1 𝑔 • 𝑓 fill 0 𝑥 is equal to 𝑓 fill 0 𝑧 • ℎ • 𝑔 and therefore that 𝑓 1 (ℎ • 𝑔) = 𝑓 1 ℎ • 𝑓 1 𝑔 by uniqueness of the lift. 𝑥 𝑓 0 𝑥 𝑦 𝑓 0 𝑦 𝑧 𝑓 0 𝑧 𝑔 𝑓 fill 0 𝑥 𝑓 1 𝑔 ℎ 𝑓 fill 0 𝑦 𝑓 1 ℎ 𝑓 fill 0 𝑧
Regarding the mapping of identities, for any object 𝑥 : 𝐶 0 0 in the fibre over 0, the morphism 1 𝑓 0 𝑥 is defined as the lift of 𝑓 fill 0 𝑥 • 1 𝑥 , that is 𝑓 fill 0 𝑥, along 𝑓 fill 0 𝑥. But 1 𝑓 0 𝑥 is an equally good lifting candidate therefore we conclude by uniqueness of the lift.

𝑥 𝑓 0 𝑥 𝑥 𝑓 0 𝑥 1 𝑥 𝑓 fill 0 𝑥 1 𝑓 0 𝑥 𝑓 fill 0 𝑥

□

A Grothendieck fibration induces the same data but in the other direction.

Lemma 3.9.8. Given a Grothendieck fibration over the interval 𝐶 : ∞-category↓ 𝐼 , we can define two functions:

𝑓 0 : 𝐶 0 1 → 𝐶 0 0 𝑓 1 : {𝑥 𝑦 : 𝐶 0 1} → 𝐶 1 (𝑥 ⊳ 𝑦) 1 1 → 𝐶 1 ( 𝑓 0 𝑥 ⊳ 𝑓 0 𝑦) 1 0
satisfying the following laws:

𝑓 1 (𝑔 • 𝑓 ) = 𝑓 1 𝑔 • 𝑓 1 𝑓 𝑓 1 1 𝑥 = 1 𝑓 0 𝑥
Proof. The proof is similar to the one of about Grothendieck opfibrations but proceeds in the other direction.

□

We now check that the pair of functors thus defined forms an adjunction.

Lemma 3.9.9. Let 𝐶 be an adjunction. For any pair of objects 𝑥, 𝑦 : 𝐶 0 0 in the fibre over 0, we have the following equivalence:

𝐶 1 ( 𝑓 0 𝑥 ⊲ 𝑦) 1 1 ≃ 𝐶 1 (𝑥 ⊲ 𝑔 0 𝑦) 1 0
where 𝑓 0 (resp. 𝑔 0 ) is the action on objects due to the structure of Grothendieck opfibration (resp. fibration).

Proof. We start with the definition of the forward direction of the equivalence and define the function

𝑒 : 𝐶 1 ( 𝑓 0 𝑥 ⊲ 𝑦) 1 1 → 𝐶 1 (𝑥 ⊲ 𝑔 0 𝑦) 1 0
Given a morphism ℎ : 𝐶 1 ( 𝑓 0 𝑥 ⊲ 𝑦) 1 1 , we compose it with 𝑓 fill 0 𝑥 then we use the cartesian nature of 𝑔 fill 0 𝑦 to obtain a morphism of type 𝐶 1 (𝑥 ⊲ 𝑔 0 𝑦) 1 0 that we assign to the image of ℎ under 𝑒. This is the unique morphism satisfying

𝑔 fill 0 𝑦 • 𝑒 ℎ = ℎ • 𝑓 fill 0 𝑥. 𝑥 𝑓 0 𝑥 𝑔 0 𝑦 𝑦 𝑒 ℎ 𝑓 fill 0 𝑥 ℎ 𝑔 fill 0 𝑦
Conversely, we define the reciprocate function

𝑒 -1 : 𝐶 1 (𝑥 ⊲ 𝑔 0 𝑦) 1 0 → 𝐶 1 ( 𝑓 0 𝑥 ⊲ 𝑦) 1 1
Given a morphism ℎ : 𝐶 1 (𝑥 ⊲ 𝑔 0 𝑦) 1 0 , we compose it with 𝑔 fill 0 𝑦 then we use the cocartesian nature of 𝑓 fill 0 𝑥 to obtain a morphism of type 𝐶 1 ( 𝑓 0 𝑥 ⊲ 𝑦) 1 1 that we assigns to the image of ℎ under 𝑒 -1 . This is the unique morphism satisfying

𝑒 -1 ℎ • 𝑓 fill 0 𝑥 = 𝑔 fill 0 𝑦 • ℎ. We now show that 𝑒 is a section. Let ℎ : 𝐶 1 ( 𝑓 0 𝑥 ⊲ 𝑦) 1 1 be a morphism. 𝑒 -1 (𝑒 ℎ) is the unique morphism such that 𝑒 -1 (𝑒 ℎ)• 𝑓 fill 0 𝑥 = 𝑔 fill 0 𝑦 • 𝑒 ℎ. But 𝑒 ℎ is the unique morphism such that 𝑔 fill 0 𝑦 • 𝑒 ℎ = ℎ • 𝑓 fill 0 𝑥.
From these two identities we deduce that 𝑒 -1 (𝑒 ℎ) • 𝑓 fill 0 𝑥 = ℎ • 𝑓 fill 0 𝑥 and therefore that 𝑒 -1 (𝑒 ℎ) = ℎ using the fact that 𝑓 fill 0 𝑥 is cocartesian. The fact that 𝑒 is a retraction follows from the same argument therefore we do not detail the proof.

□

Conclusion

We have explored an extension of type theory in which higher algebraic structures on types are definable. We managed to use this type theory to define an important range of algebraic structures including ∞-groupoids and (∞, 1)categories as well as to prove elementary facts about them. To this end, we chose to use opetopes: geometrical shapes which capture the combinatorics of the coherence data that we wish to describe.

We therefore opened this thesis by first giving a purely type-theoretical definition of opetopes in a type theory similar to book HoTT in Chapter 1. Our definition essentially defines opetopes as sequences of well-founded trees satisfying some properties which are nicely captured by their typing. The opetopic approach particularly shines in the context of type theory as well-founded trees fall within the realm of inductive types. More specifically, our construction is based on a sequence of polynomial monads, a notion which becomes central in later chapters. We concluded this chapter with an inductive definition of the faces of an opetope. This self-contained chapter is the opportunity for the reader to get familiar with opetopes before broaching on opetopic types whose complexity may hide the conceptual simplicity of opetopes.

Equipped with the understanding of opetopes, a simple example of polynomial monads, we extended type theory with a universe of cartesian polynomial monads ℳ closed under some monad constructors in Chapter 2. We did so in the aim of defining opetopic types, collection of types whose combinatorics is described by opetopes, in Chapter 3. Contrary to our definition of opetopes which only involves sets, opetopic types are valued in arbitrary types. As a consequence, we can no longer state the equational laws of Chapter 1 in a coherent fashion, having no means to do so! We therefore defined our universe of polynomial monads in order that these equational laws hold definitionally. The constructors under which our universe is closed then allow us to define, in particular, the sequence of polynomial monads defining opetopes. In addition to this universe which constitutes the core of our addition to type theory, we added two sorts of universes as further extensions. First, we defined a family of universes 𝑀 → 𝑚 𝑁 of cartesian monad morphisms from 𝑀 to 𝑁. Then, we defined a family of universes ℳ↓ 𝑀 of polynomial monad families over on a monad 𝑀. These two extensions were developed in order to establish some more advanced results in Chapter 3.

Finally, we took advantage of our universe of polynomial monads to define opetopic types in Chapter 3. This enabled us to define coherent higher algebraic structures, among which ∞-groupoids and (∞, 1)-categories. Crucially, their higher structure is encoded in terms of identity types. We then established expected results in order to motivate our definitions. We first compared our definition of fibrant opetopic type with Baez and Dolan definition of "coherent 𝑂-algebras" and shown that they were equivalent if we require all morphisms to be invertible. Then, we established that set-truncated fibrant Id-opetopic types are equivalent to precategories as defined in the HoTT book. We quickly reached for the dependent monads as alluded earlier in order to establish the remaining results. We started by defining fibrations of opetopic types which are a generalisation of fibrant opetopic types then we showed that fibrant opetopic types are closed under dependent sums. We also defined the universal fibration of types as an opetopic type. Finally, we defined Grothendieck (op)fibrations that we applied in order to define Lurie's definition of an adjunction (Lurie 2009, Definition 5.2.2.1) as a bifibration over the interval.

As future work, we aim to first improve our system by extending type theory with a primitive notion of opetopic types instead of relying on a universe of polynomial monads. This more synthetic framework would prevent some difficulties that we had to face with the current one. In particular, we could dispense with the universes of monad morphisms which have been introduced for purely technical reasons while none of our results crucially rely on it. Concerning the results that we wish to establish, we would like to first fully formalise the equivalence between types and ∞-groupoids that we presented at LICS2021 [START_REF] Finster | Types are internal ∞-groupoids[END_REF]. Next, a work in progress consists in defining the fibrant opetopic types of the faces of an opetope. These opetopic types would correspond to the representable functors on the category of opetopes. A more ambitious project consists in the development of higher category theory in univalent opetopic foundations. A lot of basic category theory results remain to be established such as the slice construction of an opetopic type which we have failed to define so far. In that respect, there is no reason to think that approaches similar to ours but based on other geometries could not be fruitful. In particular, a presentation of types based on simplicial sets might be useful in order to get closer to the current higher category literature. However, we do not expect simplicial techniques to directly transfer to a homotopy type theory in which all types are homotopy types.

Apart from the wealth of results that remain to be established in our system, we identify two other themes for future work. The first one is the development of a dedicated type checker for our type theory or even a dedicated Agda mode. Our present implementation has been carried out in Agda and its system of rewrite rules has been invaluable to quickly implement and experiment with our framework. However, we had to get around some of its shortcomings more than once, and we feel that we have hit some of its limits. The second theme is the semantic justification of our system on which we stayed silent in this thesis. Once we reach an optimal presentation of our framework, we should investigate its precise semantics.

More broadly, regarding the general challenge of defining higher algebraic structures on types, the opetopic approach that we propose is the first which departs from the line of work based on two-level type theory [START_REF] Altenkirch | Extending homotopy type theory with strict equality[END_REF][START_REF] Annenkov | Two-level type theory and applications[END_REF][START_REF] Capriotti | Univalent higher categories via complete semi-segal types[END_REF][START_REF] Kraus | Space-valued diagrams, typetheoretically[END_REF] which originates with Voevodsky's Homotopy Type System (Voevodsky 2013). Instead of reintroducing a strict equality, incompatible with the homotopy interpretation of types, we introduce a means of presentation for higher dimensional structures based on opetopes. This approach is still in its infancy, and only a better theoretical understanding of our system will allow us to grasp the full extent of its capabilities and how practical they are. Nonetheless, it paves the way for future approaches.

forbidden as it allows concluding the truth of a proposition without explicitly proving it by virtue of the fact that, in the Platonic realm of mathematical truths, any proposition is either true or false. The axiom of choice (AC) is also commonly rejected as it entails the LEM by Diaconescu's theorem. Though, depending on its formulation, some forms of it can be accepted. Rejecting the LEM implies rejecting the double negation elimination as well. This means that we cannot prove a proposition 𝑃 by assuming ¬𝑃 and deriving a contradiction. However, we can still prove ¬𝑃 by assuming 𝑃 and deriving a contradiction.

Hermann Weyl, who temporarily adopted the intuitionistic views of Brouwer, held that if knowledge is a treasure then an existential statement in classical logic asserts the presence of a treasure without disclosing its location (Weyl 1921). A simple and illuminating example is the proof that there exist irrational numbers 𝑥 and 𝑦 such that 𝑥 𝑦 is rational. The classical proof goes as follows: either √ 2

√ 2 is a rational number therefore we take 𝑥 = 𝑦 = √ 2, or √ 2 √ 2 is not a rational number and we take 𝑥 = √ 2 √ 2 and 𝑦 = √ 2 as, in this case, 𝑥 𝑦 = 2 which is a rational number. Such a proof rests upon the use of the LEM as it uses the fact that √ 2 √ 2 is either rational or irrational. Constructivists object that this proof is not satisfying as it does not inform us about which one of the two pairs (𝑥, 𝑦) is the one having the required property. A constructive proof of the same statement is the following: consider the two irrational numbers 𝑥 = √ 2 and 𝑦 = 2 log 2 3, the number 𝑥 𝑦 = 3 is indeed a rational number. Such a proof gives concrete evidence of its truth by specifying particular irrational numbers 𝑥 and 𝑦 satisfying the proposition. Another gripe with the LEM is that it allows to assert the truth of propositions dealing with infinite collections that we might not be able to check anyway. Consider the statement "There are seven 7's in a row in the decimal representation of 𝜋". The LEM allows concluding that this is either true or false. Constructively, we would have to check each decimal until we find an instance of these seven 7's in order to conclude that this statement is provable. However, we could not refute it as we cannot check the infinity of digits of 𝜋 in a finite amount of time.

There are other grounds for rejecting classical principles. In particular, statements which do not make use of classical reasoning principles are valid in more models. For example, a statement in intuitionistic logic is true in any topos, not just boolean ones which are home to classical logic. Another reason to be constructive is if one wants to extract a program from a proof. This is particularly useful when one wants to certify a piece of software. In this thesis, we reject unrestricted classical principles on the ground that they are, in general, incompatible with univalence which is central to homotopy type theory. However, HoTT identifies a class of types for which these principles apply. In that sense, we regard HoTT as subsuming set theory and classical logic. Despite Brouwer's hostility towards formalism, one of his students, Arend Heyting, devised intuitionistic logic [START_REF] Heyting | Die formalen Regeln der intuitionistischen Logik[END_REF] in order to give a formal foundation to Brouwer's mathematics. This logic is characterised by two key properties: the existence and the disjunction properties. The existence property asserts that a proposition of the form ∃𝑥.𝐵(𝑥) is true if and only if there is a particular element 𝑎 such that 𝐵(𝑎) is true. As for the disjunction property, it asserts that a proposition of the form 𝐴 ∨ 𝐵 is true if and only if we can prove that either 𝐴 or 𝐵 is true. The strong interpretation of the existential quantifier in intuitionistic logic reflects a shift in the interpretation of the truth of a proposition. In this logic, truth is identified with provability. It is then natural to see the notion of time emerging from this interpretation. Being able to prove 𝐴 ∨ ¬𝐴 for example is being able to prove 𝐴 or ¬𝐴 right now which might not be possible. Consider an open conjecture such as the Riemann hypothesis for example. We cannot prove it nor refute it at the time of writing. This notion of time is implicit in Kripke models for intuitionistic logic where a model consists of a collection of consistent states of knowledge assembled into a poset modelling the accumulation of knowledge consistent with previously established facts. Today, some physicists study whether intuitionistic logic could be better suited to the study of the physical world than classical logic (Gisin 2020).

Having rejected the interpretation of logical judgements in terms of truth values, an explanation of their meaning is given by the so-called Brouwer-Heyting-Kolmogorov interpretation of intuitionistic logic. In this interpretation, logical connectors and quantifiers are explained in terms of their collections of proofs:

A proof of consists of 𝐴 ∧ 𝐵 a proof of 𝐴 and a proof of 𝐵 𝐴 ∨ 𝐵 a proof of 𝐴 or a proof of 𝐵 𝐴 =⇒ 𝐵 a method which takes a proof of 𝐴 and returns a proof of 𝐵 ∃𝑥.𝐵(𝑥)

an element 𝑎 along with a proof of 𝐵(𝑎) ∀𝑥.𝐵(𝑥) a method which, for any element 𝑥, produces a proof of 𝐵(𝑥) ¬𝐴 a proof of 𝐴 =⇒ ⊥ ⊥ nothing This interpretation does not specify what a proof is nor what a method is, it is left to the ambient logical system to specify these notions. We can regard intuitionistic type theory as giving a formal treatment to the BHK interpretation. N : 𝒰 2. Introduction rules. The introduction rules introduce the canonical elements of N. In the case of the unary definition of natural numbers, we distinguish two cases:

A.2 Intuitionistic type theory

• There is an element 0 : N standing for the natural number 0.

• For any natural number 𝑛 : N, there is an element suc(𝑛) : N standing for the successor of 𝑛. N elim (𝑋 , 𝑥 0 , 𝑥 suc , 0)

≡ 𝑥 0 N elim (𝑋 , 𝑥 0 , 𝑥 suc , suc(𝑛)) ≡ 𝑥 suc (𝑛, N elim (𝑋 , 𝑥 0 , 𝑥 suc , 𝑛))

In addition to these four sorts of rules, there might be additional rules specific to the type in question. It is for example common to specify uniqueness rules, often named 𝜂-rules, stating how should the introduction rules behave with regard to the elimination rule. For example, pairing the projections of a pair 𝑝 should be a pair definitionally equal to 𝑝: (pr 1 (𝑝), pr 2 (𝑝)) ≡ 𝑝. Similarly, any function 𝑓 should satisfy the equality (𝜆𝑥 → 𝑓 (𝑥)) ≡ 𝑓 .

The definition of natural numbers that we just gave is synthetic or axiomatic as we directly state what they are without defining them out of more primitive constructions as it is customary in set theory. This definition is an example of a certain class of types named inductive types which are freely generated by their constructors.

Of course, the elimination rule cannot be arbitrary or else we run the risk of being inconsistent. It has to follow from the introduction rules, which was pointed out by Belnap [START_REF] Belnap | Tonk, Plonk and Plink[END_REF]) and named logical harmony by Dummett [START_REF] Dummett | The logical basis of metaphysics[END_REF]. To a first approximation, when introduction and elimination rules are in harmony, we can infer no more and no less than what has been established by the introduction rules. In the particular case of inductive types, a more algebraic point of view on this matter is to consider them as initial algebras for some endofunctor. The elimination rule then defines the unique homomorphism out of this algebra. The picture becomes more subtle when considering the particular case of identity types whose elimination rule does not allow deducing that its sole elements are the ones introduced by the introduction rules. This is a fundamental observation which allowed to postulate new principles such as the univalence axiom and higher inductive types which constitute the novelties of homotopy type theory.

Often, we will want to use a more general elimination rule where the motive is a type dependent on the type being defined, that is 𝑋 : N → 𝒰 in the case of natural numbers. The data to provide now consists of 𝑥 0 : 𝑋(0) and 𝑥 suc : (𝑛 :

N) → 𝑋(𝑛) → 𝑋(suc(𝑛)). The dependent elimination, also called the induction principle, then provides the following element N ind (𝑋 , 𝑥 0 , 𝑥 suc , 𝑛) : 𝑋(𝑛) subject to the same computation rules as the ordinary elimination principle. While we can see the regular elimination principle as defining functions by recursion over the type being defined, the induction principle can be regarded as defining proofs by induction over this same type.

A.3 Propositions as types

In addition to being able to define mathematical constructions, we need to be able to formulate propositions about those constructions and be able to prove them. If we subscribe to the Brouwer-Heyting-Kolmogorov interpretation of intuitionistic logic, the meaning of a proposition is determined by its collection of proofs. Framing this interpretation in type-theoretical terms, we define propositions as types whose introduction and elimination rules reflect their counterpart in intuitionistic logic. This is known as the propositions-as-types paradigm (Wadler 2015) which establishes the following connection between logic and type theory: Type theory is therefore a language rich enough to accommodate and unify seemingly disparate concepts such as mathematical constructions and logical propositions. Typing judgements can thus have the following readings depend-ing on how we interpret the types in question.

𝐴 : 𝒰

𝑥 : 𝐴 𝐴 is a type 𝑥 is an element of type 𝐴 𝐴 is a proposition 𝑥 is a proof of the proposition 𝐴 𝐴 is a specification 𝑥 is a program meeting the specification 𝐴 The second interpretation is the point of view of the propositions-as-types paradigm. The third one corresponds to the interpretation of ITT as a programming language.

The richness of types even opens up the possibility of defining types which have no direct counterpart either as a set-based mathematical construction or as a logical proposition. This observation is at the root of homotopy type theory whose motivation is to classify and study types according to their intrinsic geometrical content.

The connection between types and propositions had already been noticed. There is a precise correspondence between types of the simply typed lambda calculus (STLC) and intuitionistic propositional logic (IPC) known as the Curry-Howard correspondence [START_REF] Howard | The formulae-as-types notion of construction[END_REF]. Under this view, the typing rules of STLC can be seen as an annotated version of the rules of natural deduction for IPC. Lambda terms can then be seen as certificates for the proof derivations they denote. The correspondence includes a correspondence between the reduction rules of the lambda calculus and proof normalisation of natural deduction. De Bruijn himself arrived independently at a similar correspondence. Lambek further extended this connection to category theory and showed that the STLC was the internal language of cartesian closed categories [START_REF] Lambek | Introduction to higher-order categorical logic[END_REF]. The Curry-Howard correspondence has since been extended to more expressive lambda calculi (Sørensen and Urzyczyn 2006).

We finish this section by considering the decidability of judgements. Typing judgements of the form 𝑥 : 𝐴 are decidable. The rules of ITT are such that 𝑥 acts as a certificate from which we can establish the derivation leading to the judgement in question. It then suffices to check that this derivation is correct. The same applies to a judgement of the form 𝑥 ≡ 𝑦 : 𝐴, it suffices to compare the normal forms of 𝑥 and 𝑦 -up to certain rules -in order to conclude. In contrast, a judgement like 𝐴 true that can be derived only if there exists some term 𝑡 such that the judgement 𝑡 : 𝐴 holds, is undecidable. It is missing a piece of information, namely the data of 𝑡, in order to decide whether it holds. However, there does not exist any algorithm able to establish whether a type is inhabited or not as this problem is undecidable. This distinction is important for proof assistants which are programs that help mathematicians check that their proofs are correct. Because of this limitation, mathematicians are still expected to produce a proof in the first place, although this process can be automated to some extent. This distinction corresponds to the one between analytic and synthetic judgements which goes back to Kant (Martin-Löf 1994). Analytic judgements distinguish themselves from synthetic judgements by the fact that they carry their own proof. and Streicher 1998) who defined a model of ITT, the groupoid model, where it does not hold. In this model, a type 𝐴 : 𝒰 is interpreted as a groupoid whose objects are the elements of 𝐴 and whose morphisms between two objects corresponding to two elements 𝑥, 𝑦 : 𝐴 correspond to identities 𝑥 = 𝐴 𝑦. The structure of groupoid stems from the operations that can be defined using the induction principle of identity types. For any type 𝐴 : 𝒰 and triplet 𝑥, 𝑦, 𝑧 : 𝐴 there is a composition operation Then, considering the group Z 2 viewed as a one-object groupoid, for example, there is an identity 𝑝 : * = 𝑍 2 * different from refl * which disproves the UIP.

This observation paved the way for a line of work clarifying the semantics of type theory in its intensional form. The tools of homotopy theory proved themselves to be adapted to this task with Gambino and Garner [START_REF] Gambino | The identity type weak factorisation system[END_REF] showing that the axioms of identity types induce a weak factorisation system on the syntactic category of type theory and Awodey and Warren [START_REF] Awodey | Homotopy theoretic models of identity types[END_REF] showing that there is a Quillen model structure on this category where identity types play the role of path objects.

Similarly, the tools of higher algebra allowed Lumsdaine (Lumsdaine 2010) and Van Den Berg and Garner (Van Den Berg and Garner 2011) to generalise the Hoffman-Streicher interpretation of types to ∞-groupoids using globular operads.

A.4.2 Univalence

In his note (Voevodsky 2006), the mathematician Vladimir Voevodsky identified a missing principle in type theory. It is commonplace in mathematical practice to use the same notation for different but equivalent mathematical structures without being explicit about it. Informally, we say that we are making an abuse of language. Framing this principle in type-theoretical terms and identifying mathematical structures with (families of) types, given two types 𝐴, 𝐵 : 𝒰 and an equivalence of types 𝑒 : 𝐴 ≃ 𝐵, we expect that any structure 𝑇 -modeled as a type family 𝑇 : 𝒰 → 𝒰 -on 𝐴 gives rise to the same structure on 𝐵; that is, we want a function 𝑇(𝐴) → 𝑇(𝐵). In other words, we want the types 𝐴 and 𝐵 to be indiscernible which amounts to having an identity 𝐴 = 𝐵. However, there is no way to obtain an identity from an equivalence of types in ITT in general. For example, the type of booleans have two automorphisms, one being the identity function and the other being the function swapping its elements, however there is no identity corresponding to this second equivalence.

Voevodsky then drafted a model of type theory in simplicial sets in which equivalence of types coincides with identities between types leading to the simplicial model as we know it [START_REF] Kapulkin | The simplicial model of Univalent Foundations (after Voevodsky)[END_REF]. Although there is no term in ITT corresponding to this principle, it is consistent to assume it as the axiom known as the univalence axiom UA : (𝑋 𝑌 : 𝒰) → (𝑋 = 𝑌) ≃ (𝑋 ≃ 𝑌) such that UA(𝑋 , 𝑋 , refl 𝑋 ) = id 𝑋 .

We understand this axiom as formalising the equivalence principle: any statement about types should be invariant under equivalence. The idea of having a logical foundation respecting the principle of equivalence is not new and was the original motivation for the FOLDS system [START_REF] Makkai | First order logic with dependent sorts, with applications to category theory[END_REF].

A family of type theories with models in cubical sets have since been developed in order to give a computational meaning to UA, they are referred to as cubical type theories [START_REF] Angiuli | Syntax and models of Cartesian cubical type theory[END_REF][START_REF] Bezem | A Model of Type Theory in Cubical Sets[END_REF][START_REF] Cohen | Cubical type theory: a constructive interpretation of the univalence axiom[END_REF].

Related to the UA is the development of the univalent foundations of mathematics which refers to the practice of mathematics in mathematical foundations satisfying the univalence axiom, ITT + UA being one of them. This project was popularised by Univalent Foundations Program 2013 which is the result of the special year on Univalent Foundations of Mathematics which took place at the Institute for Advanced Study in Princeton in 2012-2013. In this book is presented homotopy type theory which is ITT + UA + HITs, also known as book HoTT, as well as a number of mathematical results in homotopy theory, category theory, set theory, and logic developed in this new foundation.

A.5 Our setting

We introduce the type theory used in this thesis. This section is self-contained and will recall some definitions which were already discussed in the preceding sections.

Our type theory is the one implemented by Agda which is an enhanced version of Martin-Löf's logical framework [START_REF] Martin-Löf | Intuitionistic type theory[END_REF]. We will make heavy use of the most cutting-edge features of Agda such as inductiveinductive definitions, rewriting rules, and coinductive records to name a few. We will be concerned with two kinds of judgements. The judgement 𝑥 : 𝐴 means that 𝑥 is an element of type 𝐴 while the judgement 𝑥 ≡ 𝑦 : 𝐴 means that 𝑥 and 𝑦 are definitionally equal elements of type 𝐴. There is a type universe à la Russell 𝒰 𝑛 : 𝒰 𝑛+1 for 𝑛 : N. We will intentionally omit the universe level in order not to clutter the notation and simply write 𝒰. This defines a structure of groupoid on types.

Composition

𝑛-Types

We recall that types can be classified into 𝑛-types: types which are contractible above the dimension 𝑛. We will in particular use the explicit definition of the following three particular cases.

Monades polynomiales cartésiennes

Nous étendons ensuite la théorie des types d'un univers de monades polynomiales cartésiennes ℳ clos sous certains constructeurs de monades au chapitre 2 qui nous servira à définir les types opétopiques au chapitre 3. Les monades polynomiales cartésiennes constituent la fondation de notre système. Elles sont au coeur de la construction dite de Baez-Dolan [START_REF] Baez | Higher-dimensional algebra III. ncategories and the algebra of opetopes[END_REF] qui a été introduite dans le cadre des opérades dans le but de définir les 𝑛-catégories. Les monades polynomiales cartésiennes peuvent être considérées comme des présentations de théories algébriques fortement régulières. Ce sont des théories algébriques dont les équations sont contraintes de telle sorte que les variables doivent apparaître des deux côtés sans répétition et dans le même ordre [START_REF] Leinster | Structures in higher-dimensional category theory[END_REF]). À partir de maintenant, nous ne préciserons pas systématiquement que nos monades polynomiales sont cartésiennes même si elles le sont toujours afin d'alléger la notation.

Les monades polynomiales se prêtent bien à une définition en théorie des types en tant que familles indexées. Les éléments de notre univers ℳ sont considérés comme des codes pour nos monades. Pour toute monade 𝑀 : ℳ, la donnée définissant son endofoncteur sous-jacent est spécifiée par les familles de types et la fonction de typage suivantes : celui représenté à gauche de la figure suivante. L'opération μ envoie alors cet arbre sur un constructeur partageant les mêmes entrées et la même sortie tel que celui représenté à droite. Le fait que les positions des entrées ainsi que leur typage soient préservés par l'opération μ est dû au fait que nos monades sont cartésiennes. En outre, l'opération μ est associative et unitaire, les unités étant spécifiées par l'opération η. Nous soulignons que nous mettrons en oeuvre notre univers de monades polynomiales en étendant la théorie des types de manière que ces lois soient définitionnelles. Contrairement à notre définition des opétopes qui n'implique que des ensembles, les types opétopiques sont à valeurs dans des types arbitraires. Par conséquent, nous ne pouvons plus énoncer les lois équationnelles du chapitre 1 de façon cohérente. Nous définissons donc notre univers de monades polynomiales afin que ces lois soient satisfaites par définition. Les constructeurs sous lesquels notre univers est clos nous permettent alors de définir, en particulier, la construction tranche de Baez-Dolan sur laquelle repose notre définition des types opétopiques.

𝑎

En plus de cet univers qui constitue le coeur de notre ajout à la théorie des types, nous définissons deux extensions supplémentaires. Tout d'abord, pour toutes monades 𝑀 et 𝑁, nous définissons un univers de morphismes cartésiens de monades de 𝑀 vers 𝑁 dénoté 𝑀 → 𝑚 𝑁. Ensuite, pour toute monade 𝑀, nous définissons un univers de monades polynomiales au dessus de 𝑀 dénoté ℳ↓ 𝑀 . Ces deux extensions permettent d'établir des résultats plus avancés au chapitre 3. propriété coinductive suivante. Premièrement, pour tout constructeur décoré (𝑐, 𝑥) : 𝑐:Cns 𝑀 𝑖 -→ 𝑋 0 𝑐, il existe un unique composite 𝑦 : 𝑋 0 𝑖 ainsi qu'un remplissage de type 𝑋 1 ((𝑖, 𝑦)⊳(𝑐, 𝑥)). En d'autres termes, le type 𝑦:𝑋 0 𝑖 𝑋 1 ((𝑖, 𝑦)⊳(𝑐, 𝑥)) est contractile. Deuxièmement, le type opétopique 𝑋 >0 est fibrant. Autrement dit, pour tout schéma de composition de 𝑛-cellules, il existe un unique composite de 𝑛-cellules partageant le même cadre. Ces types opétopiques représentent des algèbres cohérentes.

À titre d'exemple, un type opétopique fibrant garantit l'existence des cellules rouges affichées sur le diagramme suivant étant donné le schéma de composition affiché en noir :

𝑎

(Figure 1 :

 1 Figure 1: Stasheff polytope 𝐾 2

  They relate a source pasting diagram of 1-cells -a possibly empty linear tree -to a single arrow. Some examples of 2-cells are the following:

  𝑗 and 𝑘 are glued along the common face 𝑔.3-cells As a last example, consider the following 3-cell 𝑚: the diagram on the left -is a pasting diagram of 2-cells; that is, a formal composite of the 2-cells 𝑗 and 𝑘 glued along a common face 𝑔. Its target is the 2-cell 𝑙 whose frame -its source pasting diagram along with its target cell -matches the one of the source pasting diagram of 𝑚.

  Idx : 𝒰 Cns : Idx → 𝒰 Pos : {𝑖 : Idx} → Cns 𝑖 → 𝒰 Typ : {𝑖 : Idx} (𝑐 : Cns 𝑖) → Pos 𝑐 → Idx

  Figure 2: A 𝑃-tree

  of a tree along with a constructor sharing its boundary consists in drawing the tree inside the constructor in question.

  dimension 3 can be seen as denoting a way of composing the faces 𝑒, 𝑓 , and ℎ: the previous diagram is more commonly depicted as follows:

  graft 𝑗 on 𝑘 along the common face 𝑔 whose corresponding opetope has been highlighted. The resulting pasting diagram is the following one:

  𝑙 has been obtained by contracting the nodes of the tree. The face 𝑔 corresponding to its inner edge has therefore been removed.The opetope filler is witnessing that the tree composes to the composite: fact that pasting diagrams of opetopes have a unique composite and a unique filler, opetopes are entirely determined by their source pasting diagram.

  Figure 1.1: The data defining opetopes

  Opetopes). The family of opetopes 𝒪 : N → 𝒰 is defined as an inductive type with two constructors ob : 𝒪 0 _ ⊳ _ : {𝑛 : N} (𝑜 : 𝒪 𝑛) → 𝒫 𝑜 → 𝒪 (𝑛 + 1)

Notation.

  For any opetope 𝑥 : 𝒪 𝑛 and any pasting diagram 𝑦 : 𝒫 𝑥, we introduce the notation -→ 𝒫 𝑦 :≡ (𝑝 : Pos 𝑦) → 𝒫 (Typ 𝑦 𝑝) denoting families of pasting diagrams indexed by the opetopes corresponding to the nodes of 𝑦. Let 𝑥 : 𝒪 𝑛 be an opetope and let 𝑦 : 𝒫 𝑥 be a pasting diagram. Consider the following figure:

.

  For any opetope 𝑥 : 𝒪 𝑛, any pasting diagram 𝑦 : 𝒫 𝑥, and any family of pasting diagrams 𝑧 : -→ 𝒫 𝑦, we introduce the notation -→ 𝒫 (𝑦 ◀ 𝑧) :≡ (𝑝 : Pos 𝑦) → 𝒫 (Typ 𝑦 𝑝 ⊳ 𝑧 𝑝) denoting families of pasting diagrams indexed by the opetopes Typ 𝑦 𝑝 ⊳ 𝑧 𝑝 for any position 𝑝 : Pos 𝑥. Consider again the previous figure and suppose that it displays the data of the family of pasting diagrams 𝑧 indexed by the nodes of the pasting diagram 𝑦. We think of a family of type -→ 𝒫 (𝑦 ◀ 𝑧) as specifying a family of pasting diagrams which, for each position 𝑝 : Pos 𝑦, specifies a pasting diagram of type 𝒫 (Typ 𝑦 𝑝 ⊳ 𝑧 𝑝). Consider the node 𝑘 for example, a pasting diagram of the appropriate type for this position would be a pasting diagram having the pasting diagram made of the nodes 𝑖 and 𝑗 for source and the opetope 𝑘 for target. We are now ready to define pasting diagrams of opetopes. Definition 1.3.2 (Pasting diagrams). Pasting diagrams are inductively defined as the type family 𝒫 : {𝑛 : N} (𝑜 : 𝒪 𝑛) → 𝒰 whose constructors are: ob-pd : 𝒫 ob lf : {𝑛 : N} (𝑜 : 𝒪 𝑛) → 𝒫 (𝑜 ⊳ η 𝑜) nd : {𝑛 : N} (𝑥 : 𝒪 𝑛) (𝑦 : 𝒫 𝑥) {𝑧 :

  Positions of a pasting diagram). The family of node positions of a pasting diagram Pos : {𝑛 : N} {𝑜 : 𝒪 𝑛} (𝑡 : 𝒫 𝑜) → 𝒰 is defined by recursion on 𝑡: Pos ob-pd :≡ ⊤ Pos (lf 𝑜) :≡ ⊥ Pos (nd (𝑥 ⊳ 𝑦) 𝑡) :≡ ⊤ + (𝑝:Pos 𝑦) Pos (𝑡 𝑝)

  able to define the typing function Typ which simply projects out the opetope at a specified position of a pasting diagram. Definition 1.3.4 (Typing of positions of a pasting diagram). The function giving the typing of positions of a pasting diagram Typ : {𝑛 : N} {𝑜 : 𝒪 𝑛} (𝑝 : 𝒫 𝑜) → Pos 𝑡 → 𝒪 𝑛 is defined by induction on pasting diagrams and on their positions. Typ ob-pd ★ :≡ ob Typ (nd (𝑥 ⊳ 𝑦) 𝑡) (inl ★) :≡ (𝑥 ⊳ 𝑦) Typ (nd (𝑥 ⊳ 𝑦) 𝑡) (inr (𝑝, 𝑞)) :≡ Typ (𝑡 𝑝) 𝑞

μ

  : {𝑛 : N} {𝑜 : 𝒪 𝑛} (𝑡 : 𝒫 𝑜) → -→ 𝒫 𝑡 → 𝒫 𝑜 The arguments of the operation μ comprise a pasting diagram 𝑡 : 𝒫 𝑜 and a family of pasting diagrams 𝑢 : -→ 𝒫 𝑡 indexed by the positions of 𝑡. An example of such data is depicted in the figure

  operation μ then returns the pasting diagram resulting from the substitution Chapter 1. Opetopes in type theory of the trees specified by 𝑢 for the nodes of 𝑡: pasting diagram 𝑡 and the resulting pasting diagram share the same indexing opetope 𝑛.

  opetopes specified by the family 𝑢, they are the following ones:

For

  family 𝑢 specifies a family of trees to graft on the leaves of 𝑡 indexed by the opetopes specified by Typ 𝑦 𝑟 ⊳ 𝑧 𝑟 for any position 𝑟 of 𝑦. We therefore complete our example with this new data: operation γ defines a tree resulting from the grafting of the family 𝑢 on the tree 𝑡. The opetope indexing this new tree is then obtained by taking the image of the depth-2 indexing tree -in green -under the operation μ, hence the type of the resulting tree 𝒫 (𝑥 ⊳ μ 𝑦 𝑧): see, the operation γ satisfies some laws. It is unital and its units are leaves indexed by opetopes of the form 𝑜 ⊳ η 𝑜. Consider the following two situations: being right and left unital, the image under γ of these two con-

  pos η : {𝑛 : N} (𝑥 : 𝒪 𝑛) → Pos (η 𝑥) Pos-η-elim : {𝑛 : N} (𝑥 : 𝒪 𝑛) (𝐴 : Pos (η 𝑥) → 𝒰) → (𝑎 pos η : 𝐴 (pos η 𝑥)) (𝑝 : Pos (η 𝑥)) → 𝐴 𝑝

→

  pair μ : {𝑛 : N} {𝑥 : 𝒪 𝑛} {𝑦 : 𝒫 𝑥} {𝑧 : : Pos 𝑦) (𝑞 : Pos (𝑧 𝑝)) → Pos (μ 𝑦 𝑧) pr μ 1 : {𝑛 : N} {𝑥 : 𝒪 𝑛} {𝑦 : 𝒫 𝑥} {𝑧 : Pos (μ 𝑦 𝑧) → Pos 𝑦 pr μ 2 : {𝑛 : N} {𝑥 : 𝒪 𝑛} {𝑦 : 𝒫 𝑥} {𝑧 : : Pos (μ 𝑦 𝑧)) → Pos (𝑧 (pr μ 1 𝑝)) Moreover, these operations obey the following laws:

  Typ (μ 𝑥 𝑦) (pair μ 𝑝 𝑞) = Typ (𝑦 𝑝) 𝑞 (μ-pos-typ-aux) Operations relative to Pos (γ 𝑡 𝑢)

  inl γ : {𝑛 : N} {𝑥 : 𝒪 𝑛} {𝑦 : 𝒫 𝑥} {𝑧 : -→ 𝒫 𝑦} → {𝑡 : 𝒫 (𝑥 ⊳ 𝑦)} {𝑢 : -→ 𝒫 (𝑦 ◀ 𝑧)} → Pos 𝑡 → Pos (γ 𝑡 𝑢) inr γ : {𝑛 : N} {𝑥 : 𝒪 𝑛} {𝑦 : 𝒫 𝑥} {𝑧 : -→ 𝒫 𝑦} → {𝑡 : 𝒫 (𝑥 ⊳ 𝑦)} {𝑢 : -→ 𝒫 (𝑦 ◀ 𝑧)} → (𝑝 : Pos 𝑦) → Pos (𝑢 𝑝) → Pos (γ 𝑡 𝑢) A further function, akin to an elimination rule, states that the only positions of γ 𝑡 𝑢 are obtained with the operations inl γ and inr γ : Pos-γ-elim : {𝑛 : N} {𝑥 : 𝒪 𝑛} {𝑦 : 𝒫 𝑥} {𝑧 : : Pos (γ 𝑡 𝑢) → 𝒰) → (𝑎 inl γ : (𝑝 : Pos 𝑡) → 𝐴 (inl γ 𝑝)) → (𝑎 inr γ : (𝑝 : Pos 𝑦) (𝑞 : Pos (𝑢 𝑝)) → 𝐴 (inr γ 𝑝 𝑞)) → (𝑝 : Pos (γ 𝑡 𝑢)) → 𝐴 𝑝 Moreover, it satisfies the following laws:

μ

  1 takes a position of μ 𝑥 𝑦 and returns a position of the first tree 𝑥. : N} {𝑥 : 𝒪 𝑛} {𝑦 : 𝒫 𝑥} {𝑧 : : Pos (μ 𝑦 𝑧)) → Pos 𝑦 The operation pr μ 1 is defined by induction on the tree 𝑦:

Finally

  position of μ 𝑥 𝑦 and returns a position of the tree 𝑦 (pr

pr μ 2 :

 2 {𝑛 : N} {𝑥 : 𝒪 𝑛} {𝑦 : 𝒫 𝑥} {𝑧 :

μ1

  𝑝) therefore we set the motive to 𝐵 𝑝 :≡ Pos (𝑧 (pr μ 1 𝑝)) It remains to treat the two cases that we are facing: -If 𝑝 is a position of the base tree 𝑧 (inl ★), we have to return a position of type Pos (𝑧 (pr μ 1 (inl γ 𝑝))) that can be obtained from 𝑝 : Pos (𝑧 (inl ★)) by transporting it along the path Pos-γ-elim-inl-𝛽 -1 remembering that pr μ 1 (inl γ 𝑝) is defined as an application of Pos-γ-elim in the present case.

  node of the base tree then we need to determine the root node of the tree nd (𝑥 ⊳ 𝑦) 𝑣 up to the required transport which is transport Pos-transp 𝒫 (inl ★) -If 𝑝 is of the form inr (𝑝, 𝑞) where 𝑝 : Pos 𝑦 and 𝑞 : Pos (𝑡 𝑝), we use our induction hypothesis inl γ 𝑞 to obtain a position of 𝑣 𝑝, and we deduce that inr (𝑝, inl γ 𝑞) is the position of nd (𝑥 ⊳ 𝑦) 𝑣 that we are looking for. Finally, we return the position transport Pos-transp 𝒫 (inr (𝑝, inl γ 𝑞)) Definition 1.3.13 (inr γ ). inr γ : {𝑛 : N} {𝑥 : 𝒪 𝑛} {𝑦 : 𝒫 𝑥} {𝑧 :

Definition 1. 4 . 2 .

 42 The family of lower faces of an opetope has type ℱ : {𝑛 : N} (𝑜 : 𝒪 𝑛) → N → 𝒰 and is defined as an inductive type with two constructors edge : {𝑛 : N} {𝑥 : 𝒪 𝑛} {𝑦 : 𝒫 𝑥} → ℰ 𝑦 → ℱ (𝑥 ⊳ 𝑦) 𝑛 lower : {𝑛 : N} {𝑥 : 𝒪 𝑛} (𝑦 : 𝒫 𝑥) {𝑘 : N} → ℱ 𝑥 𝑘 → ℱ (𝑥 ⊳ 𝑦) 𝑘

Figure 2 . 2 :

 22 Figure 2.2: The monad structure

  pair μ : (𝑀 : ℳ) {𝑖 : Idx 𝑀 } (𝑐 : Cns 𝑀 𝑖) (𝑑 : ----→ Cns 𝑀 𝑐) → (𝑝 : Pos 𝑀 𝑐) (𝑞 : Pos 𝑀 (𝑑 𝑝)) → Pos 𝑀 (μ 𝑀 𝑐 𝑑) pr μ 1 : (𝑀 : ℳ) {𝑖 : Idx 𝑀 } {𝑐 : Cns 𝑀 𝑖} {𝑑 : ----→ Cns 𝑀 𝑐} → Pos 𝑀 (μ 𝑀 𝑐 𝑑) → Pos 𝑀 𝑐 pr μ 2 : (𝑀 : ℳ) {𝑖 : Idx 𝑀 } {𝑐 : Cns 𝑀 𝑖} {𝑑 : ----→ Cns 𝑀 𝑐} → (𝑝 : Pos 𝑀 (μ 𝑀 𝑐 𝑑)) → Pos 𝑀 (𝑑 (pr μ 1 𝑝)) These functions are inverse to each other which is witnessed by the following definitional equalities: is stated without having to transport the left-hand side along pr μ 1 -𝛽 now that the laws are definitional. The typing function is compatible with the operation μ 𝑀 Typ 𝑀 (μ 𝑀 𝑐 𝑑) 𝑝 = Typ 𝑀 (𝑑 (pr μ 1 𝑀 𝑝)) (pr μ 2 𝑀 𝑝) (μ-pos-typ)

  pos η 𝑋 * 𝑀 (𝑖, 𝑥) :≡ pos η 𝑀 𝑖 Pos-η-elim 𝑋 * 𝑀 (𝑖, 𝑥) 𝑋 𝑥 pos η 𝑝 :≡ Pos-η-elim 𝑀 𝑖 𝑋 𝑥 pos η 𝑝 Finally, the positions operations with regard to the operation μ are defined as follows: pair μ 𝑋 * 𝑀 𝑝 𝑞 :≡ pair μ 𝑀 𝑝 𝑞 pr μ 1 𝑋 * 𝑀 𝑝 :≡ pr μ 1 𝑀 𝑝 pr μ 2 𝑋 * 𝑀 𝑝 :≡ pr μ 2 𝑀 𝑝

η

  position operations Let an index 𝑖 : Idx 𝑀/ , we define pos η 𝑀/ 𝑖 to be the only position of η 𝑀/ 𝑖: pos η 𝑀/ 𝑖 :≡ inl ★ As for the elimination rule, Pos-η-elim 𝑀/ 𝑖 𝑋 𝑥 η 𝑝 is defined by induction on 𝑝 of type Pos 𝑀/ (η 𝑀/ 𝑖) whose sole case is when 𝑝 is equal to pos η 𝑀/ 𝑖: Pos-η-elim 𝑀/ 𝑖 𝑋 𝑥 η (pos η 𝑀/ 𝑖) :≡ 𝑥 η γ position operations We need some operations characterising the positions of constructors obtained through γ before moving on to the μ case. The positions of trees of the form γ 𝑀 𝑡 𝑢 fall into two categories.

η

  𝑀 𝑥) but 𝑞 is a position of 𝑢 𝑝 where 𝑝 : Pos 𝑀 (η 𝑀 𝑥). We therefore have to use the corresponding elimination principle with motive 𝐴 𝑝 :≡ Pos 𝑀/ (𝑢 𝑝) → Pos 𝑀/ (𝑢 (pos η 𝑀 𝑥)) and return the position Pos-η-elim 𝑀 𝑥 𝐴 (𝜆𝑝 → 𝑝) 𝑝 𝑞 • If 𝑡 is of the form nd (𝑥 ⊳ 𝑦) {𝑧} 𝑡, we have to return a position of the tree nd (𝑥 ⊳ 𝑦) 𝑣 where 𝑣 𝑝 :≡ γ 𝑀 (𝑡 𝑝) (𝜆𝑞 → 𝑢 (inr (𝑝, 𝑞))). In this context, 𝑝 has type Pos 𝑀 (μ 𝑀 𝑦 𝑧). We first obtain a position of 𝑣 (pr μ 1 𝑝) as inr γ (pr μ 2 𝑝) 𝑞 and we finally get a position of nd (𝑥 ⊳ 𝑦) 𝑣 as inr (pr μ 1 𝑝, inr γ (pr μ 2 𝑝) 𝑞).

  is a position of 𝑧 (inl ★) and we inject it as inl γ 𝑀 𝑞. -If 𝑝 is of the form inr (𝑝, 𝑟) where 𝑟 is a position of 𝑡 𝑝 then 𝑞 is a position of 𝑧 (inr (𝑝, 𝑟)). We therefore obtain a position of 𝑢 𝑝 as pair μ 𝑀/ 𝑟 𝑞 that we inject it as inr γ 𝑀 𝑝 (pair μ 𝑀/ 𝑟 𝑞).

μ1

  𝑀/ . Finally, to define pr μ 2 𝑀/ 𝑝, we set the motive to 𝐴 𝑝 :≡ Pos 𝑀/ (𝑧 (pr μ 1 𝑀/ 𝑝)) and define: 𝑎 inl 𝑝 :≡ 𝑝 𝑎 inr 𝑝 𝑞 :≡ pr μ 2 𝑀/ 𝑞

  Figure 2.3: The data defining a monad morphism

Idx↓Figure 2 . 4 :

 24 Figure 2.4: The data of a monad family

  Figure 2.5: The monad structure

  𝑥) :≡ (𝑖↓:Idx↓ 𝑀↓ 𝑖) 𝑋↓ 𝑖↓ 𝑥 Cns↓ 𝑋↓ * 𝑀↓ (𝑖↓, 𝑥↓) (𝑐, 𝑦) :≡ (𝑐↓:Cns↓ 𝑀↓ 𝑖↓ 𝑐) -→ 𝑋↓ 𝑐↓ 𝑦 Typ↓ 𝑋↓ * 𝑀↓ (𝑐↓, 𝑥↓) 𝑝 :≡ Typ↓ 𝑀↓ 𝑐↓ 𝑝 Once again, its monad structure is a straightforward generalisation of the nondependent version. η↓ 𝑋↓ * 𝑀↓ (𝑖↓, 𝑥↓) :≡ (η↓ 𝑀↓ 𝑖↓, η↓-dec 𝑥↓) μ↓ 𝑋↓ * 𝑀↓ (𝑐↓, 𝑦↓) 𝑑↓ :≡ (μ↓ 𝑀↓ 𝑐↓ (𝜆𝑝 → pr 1 (𝑑↓ 𝑝)), 𝜆𝑝 → pr 2 (𝑑↓ (pr μ 1 𝑀 𝑝)) (pr μ 2 𝑀 𝑝))

  𝑀↓) {𝑐} 𝑝 is defined by induction on 𝑐 and 𝑝, pos → Σ 𝑚 /(𝑀,𝑀↓) {nd (𝑥 ⊳ 𝑦) 𝑡} (inl ★) :≡ inl ★ pos → Σ 𝑚 /(𝑀,𝑀↓) {nd (𝑥 ⊳ 𝑦) 𝑡} (inr (𝑝, 𝑞)) :≡ inr (𝑝, pos → Σ 𝑚 /(𝑀,𝑀↓) {𝑡 𝑝} 𝑞)Similarly, we define the map witnessing that pullback monad constructors distribute over dependent sum constructors. Let 𝑀 : ℳ and 𝑀↓ : ℳ↓ 𝑀 be two monads and let 𝑋 : Fam 𝑀 and 𝑋↓ : Fam↓ 𝑋 𝑀↓ be two type families. We form the new monad mapΣ 𝑚 * (𝑀, 𝑀↓, 𝑋 , 𝑋↓) : Σ↓(𝑋 , 𝑋↓) * (Σ 𝑚 (𝑀, 𝑀↓)) → 𝑚 Σ 𝑚 (𝑋 * 𝑀, 𝑋↓ * 𝑀↓)where the family Σ↓(𝑋 , 𝑋↓) : Fam Σ 𝑚 (𝑀,𝑀↓) is defined by the equation Σ↓(𝑋 , 𝑋↓) (𝑖, 𝑖↓) :≡ (𝑥:𝑋 𝑖) 𝑋↓ 𝑖↓ 𝑥 Its components are defined as follows: 1. idx → Σ 𝑚 * (𝑀,𝑀↓,𝑋 ,𝑋↓) 𝑖 is defined by the equation idx → Σ 𝑚 * (𝑀,𝑀↓,𝑋 ,𝑋↓) ((𝑖, 𝑖↓), (𝑥, 𝑥↓)) :≡ ((𝑖, 𝑥), (𝑖↓, 𝑥↓)) 2. cns → Σ 𝑚 * (𝑀,𝑀↓,𝑋 ,𝑋↓) 𝑐 is defined by the equation cns → Σ 𝑚 * (𝑀,𝑀↓,𝑋 ,𝑋↓) ((𝑐, 𝑐↓), 𝑥) :≡ ((𝑐, 𝜆𝑝 → pr 1 (𝑥 𝑝)), (𝑐↓, 𝜆𝑝 → pr 2 (𝑥 𝑝))) 3. pos → Σ 𝑚 * (𝑀,𝑀↓,𝑋 ,𝑋↓) 𝑝 is defined by the equation pos → Σ 𝑚 * (𝑀,𝑀↓,𝑋 ,𝑋↓) 𝑝 :≡ 𝑝 4. pos ← Σ 𝑚 * (𝑀,𝑀↓,𝑋 ,𝑋↓) 𝑝 is defined by the equation pos ← Σ 𝑚 * (𝑀,𝑀↓,𝑋 ,𝑋↓) 𝑝 :≡ 𝑝 Chapter 3

Figure 3 . 5 :

 35 Figure 3.5: The two different ways to associate 𝑓 𝑔 ℎ

  Definition 3.3.3 (Coherent 𝑀-algebra structure). A 𝑀-opetopic type 𝑋 has a structure of coherent 𝑀-algebra if it satisfies the following conditions: • Every pasting diagram (𝑐, 𝑥) : ⟦𝑀⟧ 𝑋 0 𝑖 has a composite 𝛼 𝑋 𝑐 𝑥 : 𝑋 0 𝑖 and a filler 𝛼 fill 𝑋 𝑐 𝑥 : 𝑋 1 ((𝑖, 𝛼 𝑋 𝑐 𝑥) ⊳ (𝑐, 𝑥)). • Every cell 𝑋 1 ((𝑖, 𝑥) ⊳ (𝑐, 𝑦)) is target universal.

(

  𝑐, 𝑦) : ⟦𝑀⟧ 𝑋 𝑖 be a pasting diagram. We define a notation for pasting diagrams of cells depending on the cells of a base pasting diagram: ⟦𝑀↓⟧ 𝑋↓ 𝑖↓ (𝑐, 𝑦) :≡ (𝑐↓:Cns↓ 𝑀↓ 𝑖↓ 𝑐) -→ 𝑋↓ 𝑐↓ 𝑦 Notation. We extend our notation for depth-2 pasting diagrams of dependent cells. Given a monad family 𝑀↓ : ℳ↓ 𝑀 , a family 𝑋↓ : Fam↓ 𝑋 𝑀↓/ , a cell 𝑡↓ : 𝑋↓ (𝑥↓ ⊳ 𝑦↓) 𝑡, and a family of cells 𝑢↓ : -→ 𝑋↓ (𝑦↓ ◀ 𝑧↓) 𝑢, we define the type of depth-2 pasting diagrams whose root node is decorated with the cell 𝑡↓ and whose family of nodes grafted on the root node is decorated with the cells specified by 𝑢↓. It is defined as the pair (𝑐↓, 𝑑↓) : ⟦𝑀/↓⟧ 𝑋↓ 𝑥↓ 𝜃 𝑡,𝑢 where 𝑐↓ is the depth-2 tree nd↓ (𝑥↓ ⊳ 𝑦↓) (𝜆𝑝 → η↓ 𝑀↓/ (Typ↓ 𝑀 𝑦↓ 𝑝 ⊳ 𝑧↓ 𝑝)) and where 𝑑↓ is a family decorating the nodes of 𝑐↓ defined by the following equations: 𝑑↓ (inl ★) :≡ 𝑡↓ 𝑑↓ (inr (𝑝, inl ★)) :≡ 𝑢↓ 𝑝 We denote this pasting diagram 𝜃 𝑡↓,𝑢↓ .

𝑋↓ 1 :

 1 {𝑥 : Idx 𝑀 } {𝑦 : Cns 𝑀 𝑥} {𝑧 : ----→ Cns 𝑀 𝑦} → { 𝑓 : 𝑋 0 (𝑥 ⊳ 𝑦)} {𝑔 : -→ 𝑋 0 (𝑦 ◀ 𝑧)} → {𝑥↓ : Idx↓ 𝑀↓ 𝑥} {𝑦↓ : Cns↓ 𝑀↓ 𝑥↓ 𝑦} {𝑧↓ : ------→ Cns↓ 𝑀↓ 𝑦↓ 𝑧} → ( 𝑓 ↓ : 𝑋↓ 0 (𝑥↓ ⊳ 𝑦↓) 𝑓 ) (𝑔↓ : --→ 𝑋↓ 0 (𝑦↓ ◀ 𝑧↓) 𝑔)

  Rel 𝑀↓ :≡ Idx↓ 𝑀↓ Rel↓ 𝑀↓ 𝑖↓ 𝑗↓ :≡ 𝑖↓ = 𝑗↓ This is enough to define the opetopic type associated with a type. Definition 3.8.1 (Associated opetopic type). For any family of monad 𝑀↓ : ℳ↓ 𝑀 , we define the 𝑀-opetopic type 𝑀↓ 𝑜 : 𝑀↓ 𝑜 0 :≡ Idx↓ 𝑀↓ 𝑀↓ 𝑜 >0 𝑖 :≡ (𝑀↓/Rel↓ 𝑀↓ ) 𝑜

(

  (𝑖↓:Idx↓ 𝑀↓ 𝑖) (𝑐↓:Cns↓ 𝑀↓ 𝑖↓ 𝑐) Typ↓ 𝑀↓ 𝑐↓ = 𝑥) (3.1) ≃ ( (𝑖↓:Idx↓ 𝑀↓ 𝑖) Idx↓ 𝑀↓/Rel↓ 𝑀↓ ((𝑖, 𝑖↓) ⊳ (𝑐, 𝑥)))

3. 4 .

 4 Elimination rules. The elimination rule states the consequences that can be derived from an arbitrary element of N. It prescribes how to define any function 𝑓 : N → 𝑋 for an arbitrary type 𝑋 that we sometimes call the motive of the elimination[START_REF] Mcbride | Elimination with a motive[END_REF]. In our case, this corresponds to functions defined by primitive recursion.For any type 𝑋 : 𝒰, a function defined by primitive recursion requires the data of a base case 𝑥 0 : 𝑋 and a function 𝑥 suc : N → 𝑋 → 𝑋. Then, for any natural number 𝑛 : N, there is an element N elim (𝑋 , 𝑥 0 , 𝑥 suc , 𝑛) : 𝑋 Computation rules. The computation rules state how the elimination rules behave with regard to the introduction rules. In the present case, we have to treat the two different introduction rules which correspond to the definition of a primitive recursive function:

  ∈ 𝐴).𝐵(𝑥) (𝑥:𝐴) 𝐵(𝑥) ∀(𝑥 ∈ 𝐴).𝐵(𝑥) (𝑥 : 𝐴) → 𝐵(𝑥)

  𝑥 = 𝑦 → 𝑦 = 𝑧 → 𝑥 = 𝑧We denote 𝑝 𝑞 the identity resulting from the composition of two identities 𝑝 and 𝑞. There is a second operation inverting identities𝑥 = 𝑦 → 𝑦 = 𝑥We denote 𝑝 -1 the inverse of the identity 𝑝. We can prove that those operations satisfy the following propositional laws for any 𝑝 : 𝑥 = 𝑦, 𝑞 : 𝑦 = 𝑧, and 𝑟 : 𝑧 = 𝑡:𝑝 refl 𝑦 = refl 𝑥 𝑝 = 𝑝 𝑝 𝑝 -1 = refl 𝑥 𝑝 -1 𝑝 = refl 𝑦 (𝑝 𝑞) 𝑟 = 𝑝 (𝑞 𝑟)

  Let 𝐴 be a type, let 𝑥, 𝑦, 𝑧 : 𝐴, let 𝑝 : 𝑥 = 𝑦, and let 𝑦 = 𝑧, then there exists an identity 𝑥 = 𝑧 that we denote 𝑝 𝑞. It is defined by induction on 𝑝 or 𝑞. The composition satisfies the following propositional laws for any 𝑝 : 𝑥 = 𝑦, 𝑞 : 𝑦 = 𝑧, and 𝑟 : 𝑧 = 𝑡:𝑝 refl 𝑦 = refl 𝑥 𝑝 = 𝑝 𝑝 𝑝 -1 = refl 𝑥 𝑝 -1 𝑝 = refl 𝑦 (𝑝 𝑞) 𝑟 = 𝑝 (𝑞 𝑟)

  Definition A.5.1 (Contractible type). A type 𝐴 is contractible if there exists an element 𝑥 : 𝐴 such that, for all elements 𝑦 : 𝐴, we have 𝑥 = 𝑦. The element 𝑥 is named the centre of contraction. is-contr 𝐴 :≡ (𝑥:𝐴) (𝑦 : 𝐴) → 𝑥 = 𝑦 Definition A.5.2 (Proposition). A type 𝐴 is a proposition if any two elements 𝑥, 𝑦 : 𝐴 are equal. is-prop 𝐴 :≡ (𝑥 𝑦 : 𝐴) → 𝑥 = 𝑦 Definition A.5.3 (Set). A type is a set if, for any two elements 𝑥, 𝑦 : 𝐴 and any two identities 𝑝, 𝑞 : 𝑥 = 𝑦 then 𝑝 = 𝑞. is-set 𝐴 :≡ {𝑥 𝑦 : 𝐴} (𝑝 𝑞 : 𝑥 = 𝑦) → 𝑝 = 𝑞 Moreover, it can be shown that is-contr(𝐴), is-prop(𝐴), and is-set(𝐴) are all propositions. We now give a definition of equivalence of types based on contractible functions; we refer the reader to Chapter 4 of the HoTT book (Univalent Foundations Program 2013) for other equivalent definitions. Definition A.5.4 (Homotopy fibre). The homotopy fibre of a function 𝑓 : 𝐴 → 𝐵 at a point 𝑦 : 𝐵 is the subtype of 𝐴 which has image 𝑦 under 𝑓 . fib 𝑓 𝑦 :≡ (𝑥:𝐴) 𝑓 𝑥 = 𝑦 We define equivalences as functions whose fibres are contractible. Definition A.5.5 (Equivalence). A function 𝑓 : 𝐴 → 𝐵 is an equivalence if for every element 𝑦 : 𝐵, the type fib 𝑓 𝑦 is contractible.is-equiv 𝑓 :≡ (𝑦 : 𝐵) → is-contr (fib 𝑓 𝑦) source et la même cible. l'occasion pour le lecteur de se familiariser avec les opétopes en théorie des types qui sont des ensembles et qui échappent donc aux considérations de cohérence avant d'aborder les types opétopiques dont la complexité peut obscurcir la simplicité conceptuelle des opétopes.

  de représenter un arbre ainsi qu'un constructeur partageant les mêmes sources et cibles consiste à dessiner l'arbre à l'intérieur du constructeur en question.

  For any index 𝑖 : Idx 𝑀 , idx → id 𝑀 𝑖 :≡ 𝑖 2. For any constructor 𝑐 : Cns 𝑀 𝑖, cns → id 𝑀 𝑐 :≡ 𝑐 3. For any constructor 𝑐 : Cns 𝑀 𝑖 and position 𝑝 : Pos 𝑀 𝑐,

	pos → id 𝑀 𝑝 :≡ 𝑝 pos ← id 𝑀 𝑝 :≡ 𝑝

3 Pullback monad morphisms

  defined by induction on 𝑐 : Cns 𝑀/ 𝑖 and 𝑝 : Pos 𝑀/ 𝑐, Given a monad morphism 𝑓 : 𝑀 → 𝑚 𝑁, two type families 𝐴 : Fam 𝑀 and 𝐵 : Fam 𝑁 as well as a function 𝑔 : {𝑖 :Idx 𝑀 } → 𝐴 𝑖 → 𝐵 (idx →𝑓 𝑖), we postulate a new code for the induced morphism between the pullback monads 𝐴 * 𝑀 and 𝐵 * 𝑁:Pb 𝑓 ,𝑔 : 𝐴 * 𝑀 → 𝑚 𝐵 * 𝑁 This morphism acts by mapping constructors and their decoration. Its components are defined as follows:1. For any index (𝑖, 𝑥) : Idx 𝐴 * 𝑀 ,

	idx → Pb 𝑓 ,𝑔 (𝑖, 𝑥) :≡ (idx → 𝑓 𝑖, 𝑔 𝑥)
	pos → 𝑓 / (nd (𝑥 ⊳ 𝑦) 𝑡) (inl ★) pos → 𝑓 / (nd (𝑥 ⊳ 𝑦) 𝑡) (inr (𝑝, 𝑞)) :≡ inr (pos → :≡ inl ★ 𝑓 𝑝, pos → 𝑓 / 𝑞)
	4. pos ←

/ 𝑓 is defined by induction on 𝑐 : Cns 𝑀/ 𝑖 and 𝑝 : Pos 𝑁/ (cns → 𝑓 / 𝑐), pos ← 𝑓 / (nd (𝑥 ⊳ 𝑦) 𝑡) (inl ★) :≡ inl ★ pos ← 𝑓 / (nd (𝑥 ⊳ 𝑦) 𝑡) (inr (𝑝, 𝑞)) :≡ inr (pos ← 𝑓 𝑝, pos ← 𝑓 / 𝑞) 2.3.2. For any constructor (𝑐, 𝑥) : Cns 𝐴 * 𝑀 (𝑖, 𝑦), cns → Pb 𝑓 ,𝑔 (𝑐, 𝑥) :≡ (cns → 𝑓 𝑐, 𝜆𝑝 → 𝑔 (𝑥 (pos ← 𝑓 𝑝)) 3. For any constructor 𝑐 : Cns 𝐴 * 𝑀 𝑖 and position 𝑝 : Pos 𝐴 * 𝑀 𝑐, pos → Pb 𝑓 ,𝑔 𝑝 :≡ pos → 𝑓 𝑝 4. For any constructor 𝑐 : Cns 𝐴 * 𝑀 𝑖 and position 𝑝 : Pos 𝐵 * 𝑁 (cns → Pb 𝑓 ,𝑔 𝑐), pos ← Pb 𝑓 ,𝑔 𝑝 :≡ pos ← 𝑓 𝑝

  This concludes the description of the pasting diagram whose composition is the cell 𝛽.

	. . . ℎ 1,1 . . . ℎ 1,𝑛 1 . . .		. . . ℎ 𝑚,1 . . . ℎ 𝑚,𝑛 𝑚 . . .	. . . 𝑔 ℎ fill 1	. . . . . . 𝑔 ℎ fill 𝑚
	𝑔 1	𝑔 ℎ 1	. . . 𝑓	𝑔 𝑚	𝑓 (𝑔 ℎ) 𝑔 ℎ 𝑚	𝑓 (𝑔 ℎ) fill	𝛽
	. . . ℎ 1,1 . . . ℎ 1,𝑛 1 . . . 𝑔 1	. . .	𝑔 𝑚 ℎ 𝑚,1 . . . ℎ 𝑚,𝑛 𝑚 . . . . . .	. . .	. . . 𝑓 𝑔 fill
			𝑓	𝑓 𝑔	( 𝑓 𝑔)ℎ		𝛾

( 𝑓 𝑔)ℎ fill

  Definition 3.3.2 (Source universality). Let 𝑋 be a 𝑀 opetopic type. A cell 𝑓 : 𝑋 1 ((𝑖, 𝑥) ⊳ (𝑐, 𝑦)) is source universal in 𝑋 at position 𝑝 : Pos 𝑀 𝑐 if for any cell 𝑧 : 𝑋 0 (Typ 𝑀 𝑐 𝑝) and cell 𝑔 : 𝑋 1 ((𝑖, 𝑥) ⊳ (𝑐, 𝑦[𝑧/𝑝])), there exists a unary cell ℎ : 𝑋 1 ((Typ 𝑀 𝑐 𝑝, 𝑦 𝑝) ⊳ (η 𝑀 (Typ 𝑀 𝑐 𝑝), η-dec 𝑧))

	and a filler
	ℎ

fill : 𝑋 2 ((. . . , 𝑔) ⊳ 𝜃 𝑓 ,ℎ )

  Let a monad 𝑀 and let families 𝑋 0 : Fam 𝑀 , 𝑋 1 : Fam 𝑀/𝑋 0 , and 𝑋 2 : Fam 𝑀/𝑋 0 /𝑋 1 such that (𝑋 0 , 𝑋 1 ) and (𝑋 1 , 𝑋 2 ) are 0-algebras. Let two cells 𝑥 𝑓 , 𝑥

Corollary 3.3.7. 𝑔 : 𝑋 0 𝑖, a constructor 𝑐 : Cns 𝑀 𝑖, and a family of cells 𝑦 :

  fill 𝑋 𝑐 𝑦) = η 𝛼 𝑋 (𝑖, 𝛼 𝑋 𝑐 𝑦). By target universality of 𝛼 fill 𝑋 𝑐 𝑦, we have a unary cell 𝑔 : 𝑋 1 ((𝑖, 𝛼 𝑋 𝑐 𝑦) ⊳ (η 𝑀 𝑖, η-dec (𝛼 𝑋 𝑐 𝑦))) along with its filler 𝑔 fill : 𝑋 2 ((. . . , 𝛼 fill 𝑋 𝑐 𝑦) ⊳ 𝜃 𝑔,𝛼 fill 𝑋 𝑐 𝑦 ). By left-unitality of μ 𝛼 𝑋 , we have a concurrent unary cell η 𝛼 𝑋 (𝑖, 𝛼 𝑋 𝑐 𝑦) : 𝑋 1 ((𝑖, 𝛼 𝑋 𝑐 𝑦)⊳(η 𝑀 𝑖, η-dec (𝛼 𝑋 𝑐 𝑦))) along with its filler μ 𝛼 fill 𝑋 >0 (η 𝛼 𝑋 (𝑖, 𝛼 𝑋 𝑐 𝑦)) (𝛼 fill 𝑋 𝑐 𝑦) : 𝑋 2 ((. . . , 𝛼 fill 𝑋 𝑐 𝑦) ⊳ 𝜃 η 𝛼 𝑋 (𝑖,𝛼 𝑋 𝑐 𝑦),𝛼 fill

  obtained by target universality of 𝛼 fill 𝑋 𝑐 𝑦. The corresponding filler is 𝑔 fill : 𝑋 2 ((. . . , μ 𝛼 𝑋 >0 𝑓 (𝛼 fill 𝑋 𝑐 𝑦)) ⊳ 𝜃 𝑔,𝛼 fill 𝑋 𝑐 𝑦 ). Consider the other cell μ 𝛼 fill 𝑋 𝑓 (𝛼 fill 𝑋 𝑐 𝑦) : 𝑋 2 ((. . . , μ 𝛼 𝑋 >0 𝑓 (𝛼 fill 𝑋 𝑐 𝑦)) ⊳ 𝜃 𝑓 ,𝛼 fill 𝑋 𝑐 𝑦 ). By source universality of 𝑔 fill , we use μ 𝛼 fill 𝑋 𝑔 (𝛼 fill 𝑋 𝑐 𝑦) to obtain the required unary cell and conclude by univalence. □ This allows us to deduce that such an opetopic type is fibrant.

𝛼 𝑋 >0 𝑓 (𝛼 fill 𝑋 𝑐 𝑦) : 𝑋 1 ((𝑖, 𝑥)⊳(𝑐, 𝑦)) Lemma 3.3.11. A 𝑀-opetopic type 𝑋 with a structure of univalent coherent 𝑀-algebra is fibrant.

  𝑀, there are two canonical type families Rel 𝑀↓ : Fam 𝑀 and Rel↓ 𝑀↓ : Fam↓ Rel 𝑀↓ 𝑖 :≡ Idx↓ 𝑀↓ 𝑖 → 𝒰 Rel↓ 𝑀↓ 𝑖↓ 𝑅 :≡ 𝑅 𝑖↓ We will see that these two families arrange themselves into opetopic types. The type family Rel 𝑀↓ can be regarded as a family of relations over Idx↓ 𝑀↓ 𝑖 while the family Rel↓ 𝑀↓ associates, to any relation 𝑅 and any element 𝑖↓ : Idx↓ 𝑀↓ 𝑖, the type 𝑅 𝑖↓ of witnesses that 𝑖↓ satisfies the relation 𝑅.As we are interested in fibrant relations, we specialise our type families in the case the indexing monad is of the form 𝑀↓/𝑋↓ for some monad family 𝑀↓ : ℳ↓ 𝑀 and dependent family 𝑋↓ :Fam↓ 𝑋 𝑀↓ : 𝑅-is-algebraic) :≡ 𝑅 𝑖↓where is-algebraic is a predicate defined as follows:is-algebraic ((𝑖, 𝑦) ⊳ (𝑐, 𝑥)) 𝑅 :≡ {𝑖↓ : Idx↓ 𝑀↓ 𝑖} (𝑐↓ : Cns↓ 𝑀↓ 𝑖↓ 𝑐) (The opetopic universe of types). The opetopic universe of types and their fibrant relations 𝒰 𝑜 is the Id-opetopic type defined by the equations ℳ↓ 𝑀 and family 𝑋↓ : Fam↓ 𝑋 𝑀↓ . ℳ↓ 𝑀 and family 𝑋↓ : Fam↓ 𝑋 𝑀↓ .

	Rel 𝑀↓ 𝑀↓ 𝑀↓,𝑋↓ is defined coinductively by the equations defined by the following equations: Rel 𝑓 𝑀↓,𝑋↓ 𝑖 :≡ (𝑅:Rel 𝑀↓/𝑋↓ 𝑖) is-algebraic 𝑖 𝑅 Rel↓ 𝑓 𝑋↓ 𝑀↓ 𝑐↓ 𝑥) → is-contr ( (𝑦↓:𝑋↓ 𝑖↓ 𝑦) 𝑅((𝑖↓, 𝑦↓), (𝑐↓, 𝑥↓))) We now define the universe. Definition 3.7.1 𝒰 𝑜 0 :≡ Rel Id↓ 𝒰 𝑜 >0 :≡ 𝒰 𝑜 Id↓,Rel Id↓ where the 𝑀/𝑋-opetopic type 𝒰 𝑜 (𝒰 𝑜 𝑀↓,𝑋↓ ) 0 :≡ Rel 𝑓 𝑀↓,𝑋↓ (𝒰 𝑜 𝑀↓,𝑋↓ ) >0 :≡ 𝒰 𝑜 𝑀↓/𝑋↓,Rel 𝑓 𝑀↓,𝑋↓ for any monad family 𝑀↓ : We continue with the definition of the universal fibration. Definition 3.7.2 (The universal opetopic fibration of types). The universal opetopic fibration of types 𝒰 𝑜 • is the family of opetopic types over 𝒰 𝑜 indexed by the monad family Id↓: 𝒰 𝑜 • 0 :≡ Rel↓ Id↓ 𝒰 𝑜 • >0 :≡ 𝒰 𝑜 • Id↓,Rel↓ Id↓ where the family of opetopic types 𝒰 𝑜 • Id↓,Rel↓ Id↓ over 𝒰 𝑜 Id↓,Rel↓ Id↓ indexed by the monad family 𝑀↓/𝑋↓ is defined coinductively by the equations (𝒰 𝑜 • 𝑀↓,𝑋↓ ) 0 :≡ Rel↓ 𝑓 𝑀↓,𝑋↓ (𝒰 𝑜 • 𝑀↓,𝑋↓ ) >0 :≡ 𝒰 𝑜 • 𝑀↓/𝑋↓,Rel↓ 𝑓 𝑀↓,𝑋↓ 𝑀↓,𝑋↓ 𝑖↓ (𝑅, → (𝑥↓ : Fam↓ for any monad family 𝑀↓ :

  The formation rule introduces a new type by asserting that N is an element of the universe of types.

	Intuitionistic intensional type theory is a formal language due to Per Martin-Löf (Martin-Löf 1975) which can serve as a foundation for constructive mathemat-ics. It is a formal system of abstract constructions classified by types. Types are defined by specifying their canonical elements as well as when two terms of a type are equal by definition. This leads us to consider the following two forms of judgements:
	Judgement Meaning

𝑥 : 𝐴 𝑥 is a term of type 𝐴 𝑥 ≡ 𝑦 : 𝐴 𝑥 and 𝑦 are definitionally equal terms of type 𝐴 1. Formation rule.

  De plus, la donnée rouge formée de la paire comprenant la cellule ℎ et la cellule 𝑖 témoignant que ℎ est un composite de son schéma de composition source est unique. Par unique, nous entendons que le type de paires dont (𝑖, ℎ) est membre est contractile. La notion de contractilité est fondamentale en HoTT et est très naturellement définie.Nous clôturons cette thèse par la définition de structures algébriques supérieures cohérentes et nous motivons ces définitions en prouvant un certain nombre de résultats attendus. Les types opétopiques fibrants nous permettent de définir, en particulier, les infini-groupoïdes et les (infini, 1)-catégories. De manière cruciale, leur structure supérieure est univalente en ce sens qu'elle coïncide avec celle induite par leurs types d'identités. Ensuite, nous comparons notre définition de type opétopique fibrant à la définition d'algèbre cohérente de Baez et Dolan, et nous montrons qu'elles sont équivalentes sous certaines hypothèses. Puis, nous établissons que les types opétopiques indexés par la monade identité et dont la famille de 1-cellules est un ensemble sont équivalents aux précatégories telles que définies dans le livre HoTT. Nous nous tournons vers les monades dépendantes auxquelles nous avons fait allusion plus tôt afin d'établir les résultats restants. Nous commençons par définir les fibrations de types opétopiques qui sont une généralisation des types opétopiques fibrants, puis nous montrons que les types opétopiques fibrants sont clos sous les sommes dépendantes. Nous définissons également la fibration universelle des types opétopiques. Enfin, nous définissons les (op)fibrations de Grothendieck que nous appliquons à la définition de Lurie d'une adjonction comme bifibration au-dessus de l'intervalle.

	𝑒	𝑏	𝑓	𝑖	𝑐	𝑔
			ℎ			𝑑
	Applications

Acknowledgements

I could not have undertaken this journey without the people who made it possible. I am deeply indebted to Matthieu Sozeau, my unofficial supervisor, for giving me the opportunity to do this PhD. Eric Finster for his pioneering work on opetopic approaches in type theory: my thesis owes a lot to Eric's work and it has been a pleasure to collaborate with him. Samuel Mimram and Marcelo Fiore, the "rapporteurs" as we say in French, for the time they dedicated to the review and the evaluation of this thesis, and for their helpful comments.

Ces données peuvent être considérées comme une description de la signature d'une théorie algébrique : les éléments de Idx, que nous appelons indices, sont les sortes de la théorie, et pour chaque index 𝑖 : Idx, le type Cns 𝑖 est le types des symboles d'opérations dont la sorte de "sortie" est 𝑖. Le type Pos 𝑐 est alors le type des "positions d'entrée" de l'opération 𝑐 auxquelles sont affectées un index via la fonction Typ.

Dans cette thèse, nous utiliserons un langage graphique pour représenter les constructeurs de nos monades polynomiales. Un constructeur est représenté

Univalent Foundations Program, The (2013). Homotopy Type Theory: Univalent Foundations of Mathematics. Institute for Advanced Study: https://homotopytypetheory. org/book (cit. on pp. 1, 127, 136, 141). Van Den Berg, Benno and Richard Garner (2011). "Types are weak 𝜔-groupoids".

In: Proceedings of the london mathematical society 102.2, pp. 370-394 (cit. on pp. 1, 111, 135). Voevodsky, Vladimir (2006). "A very short note on the homotopy 𝜆-calculus".

In: Unpublished note, pp. 10-27 (cit. on p. 135). -( 2013). "A simple type system with two identity types". In: Unpublished note (cit. on pp. 4, 121). Wadler, Philip (2015). "Propositions as types". In: Communications of the ACM 58.12, pp. 75-84 (cit. on p. 132). Weyl, Herman (1921). "On the New Foundational Crisis of Mathematics". In:

(cit. on p. 128).

Appendix A

Background material

We recall homotopy type theory and its history then we recall elementary results from the HoTT book (Univalent Foundations Program 2013) that will be used throughout this thesis in Section A.5. Homotopy type theory is an extension of Intuitionistic intensional type theory (ITT), a formal language which can serve as a foundation for constructive mathematics. It internalises certain principles which are satisfied by homotopical models of ITT.

A.1 Constructive mathematics

Broadly speaking, constructive mathematics qualifies the mathematics done in such a way that asserting the existence of a mathematical object consists in exhibiting a particular instance of this object. This implies that certain modes of reasoning typical of classical logic such as the double negation elimination are prohibited. There are a number of reasons why one would like to avoid those principles ranging from philosophical reasons to more practical ones.

There are many schools of constructivism with diverging motivations. Intuitionism, on which is based intuitionistic logic, the logic implemented by ITT, originates with the work of [START_REF] Brouwer | Over de grondslagen der wiskunde[END_REF]. Brouwer advocates a mathematics conceived as a construction of the mind appealing to our intuitions: "There are no non-experienced truths"(L. E. J. [START_REF] Brouwer | Consciousness, Philosophy, and Mathematics[END_REF]. In this philosophy of mathematics, one cannot appeal to the properties of a Platonic realm of mathematical truths where any proposition is either true or false. This belief, not motivated by any intrinsic mathematical reason, and legitimised in some formal systems by logical axioms such as the law of excluded middle (LEM) made Brouwer suspicious of both Platonists and Formalists. He particularly denied the "creative role" of logic as he held the belief that logic had to be submitted to mathematics and not the other way around.

In Intuitionism, in order to assert the existence of a mathematical object, one has to provide a concrete construction of that object. Mathematics exist only to the extent that we can write them therefore we are constrained by the language we use and our means of calculation. This is to be compared with an "ideal mathematician" with unlimited memory and time. In this respect, the LEM is Judgements are the facts that can be established in our type theory. A judgement is an "object of knowledge" (Martin-Löf 1996). They are assertions about the meta-language and cannot be denied internally. Compare a typing judgement with a set-theoretical membership proposition: one is external while the other is internal. In set-theory it is possible to ask whether the proposition 0 ∈ 1 is true while there exists no corresponding typing judgement in type theory where such a question is just nonsensical.

New judgements may be derived from prior ones using the inference rules of type theory. For example, proving a mathematical proposition using the propositions-as-types paradigm corresponds to deriving a judgement of the form 𝑡 : 𝐴 where 𝐴 is the type corresponding to the proposition that we want to prove and 𝑡 is a term witnessing the truth of this proposition.

Defining a new type consists in adding new inference rules to our type theory. Contrast this approach with the set-theoretical one where inference rules are fixed -they are most often those of first-order logic -and where new sets are built from existing ones using a fixed set of axioms -the Zermelo-Fraenkel axioms for example. Set theory lacks the distinction between judgementswhich are external statements -and internal statements.

Our type theory has a universe à la Russell; that is, a family of types (𝒰 𝑛 ) 𝑛:N such that 𝒰 𝑛 : 𝒰 𝑛+1 . Any type inhabits a particular universe and a universe inhabits a greater universe in order to prevent paradoxes such as Russell's paradox. In order not to clutter the notation, we will omit the universe levels in this informal presentation of type theory.

ITT can be seen as a dependently typed lambda calculus as soon as we introduce function types which allow internalising hypothetical judgements. Let 𝐴, 𝐵 : 𝒰 be two types, we define their function type 𝐴 → 𝐵 : 𝒰. Considering a term 𝑡 : 𝐵 under the assumption that a variable 𝑥 : 𝐴 may appear in 𝑡, there is a function (𝜆𝑥 → 𝑡) : 𝐴 → 𝐵 where 𝑥 is now no longer an assumption -it is bound. Given a function 𝑓 : 𝐴 → 𝐵 and a term 𝑡 : 𝐴, 𝑓 can be applied to 𝑡 to yield the term 𝑓 (𝑡) : 𝐵. The application has to satisfy the 𝛽-reduction rule (𝜆𝑥 → 𝑢)(𝑡) ≡ 𝑢[𝑡/𝑥] where 𝑢[𝑡/𝑥] is the capture-avoiding substitution of the occurrences of 𝑥 in 𝑢 by the term 𝑡.

Along with the universe 𝒰, function types permit the definition of type families -also called dependent types -which are functions of type 𝐴 → 𝒰, where 𝐴 is a type. This allows the generalisation of function types to dependent function types. Let 𝐴 : 𝒰 be a type and let 𝐵 : 𝐴 → 𝒰 be a type family. We form the type (𝑥 : 𝐴) → 𝐵(𝑥) : 𝒰. Dependent functions are then introduced as sections of 𝐵; given a term 𝑡 : 𝐵(𝑥) for any 𝑥 : 𝐴 where the variable 𝑥 may appear in 𝑡, we introduce the function (𝜆𝑥 → 𝑡) : (𝑥 : 𝐴) → 𝐵(𝑥). Given a function 𝑓 : (𝑥 : 𝐴) → 𝐵(𝑥) and a term 𝑡 : 𝐴, 𝑓 can be applied to 𝑡 to yield the term 𝑓 (𝑡) : 𝐵(𝑡). The application also has to satisfy the 𝛽-reduction rule (𝜆𝑥 → 𝑢)(𝑡) ≡ 𝑢[𝑡/𝑥]. If 𝐵 is the constant family 𝜆𝑥 → 𝐵 then (𝑥 : 𝐴) → 𝐵(𝑥) coincides with the ordinary function type 𝐴 → 𝐵.

Defining a new type, in the predicative version of type theory, consists in introducing new inference rules following a particular pattern that we now illustrate with the definition of the type of natural numbers N.

A.4 Homotopy type theory A.4.1 The genesis

Homotopy type theory refers to ITT extended with principles consistent with the homotopy interpretation of types. Under this interpretation, types enjoy the rich structure of abstract space conferred by their identity types.

Martin-Löf identity types are the types which correspond to propositional equality under the propositions-as-types paradigm. From their proof-relevance arises interesting phenomena. We present them using the formulation due to Paulin-Mohring [START_REF] Paulin-Mohring | Inductive definitions in the system Coq rules and properties[END_REF].

Let 𝐴 : 𝒰 be a type and let 𝑥, 𝑦 : 𝐴, we form the type 𝑥 = 𝐴 𝑦 : 𝒰 of identifications between 𝑥 and 𝑦. We will often drop the type indication 𝐴 when it can be inferred from the context. Identity types have a single introduction rule refl 𝑥 : 𝑥 = 𝐴 𝑥 for any 𝑥 : 𝐴 corresponding to the fact that any definitional equality 𝑥 ≡ 𝑦 can be turned into a propositional one. We say that 𝑥 = 𝐴 𝑦 is parametrised by 𝐴 and 𝑥 and indexed by 𝑦 in that 𝐴 and 𝑥 are fixed before defining the introduction rule (i.e., it is not constrained by it) while 𝑦 is constrained to be definitionally equal to 𝑥 by the introduction rule. We now describe the corresponding induction principle. Let 𝐴 : 𝒰 and 𝑥 : 𝐴 be the parameters of our type. Let 𝐵 : (𝑦 : 𝐴) → 𝑥 = 𝐴 𝑦 → 𝒰 be a type family which will play the role of the motive of elimination. In order to define a term 𝐵(𝑦, 𝑝) for any identity 𝑝 : 𝑥 = 𝐴 𝑦, it suffices to provide a term 𝑑 : 𝐵(𝑥, refl 𝑥 ). The induction principle therefore provides us with the term = ind (𝐴, 𝑥, 𝐵, 𝑑, 𝑦, 𝑝) : 𝐵(𝑦, 𝑝) satisfying the following computation rule when applied to refl 𝑥 :

The assumption 𝑑 of the induction principle corresponds to the data needed to cover the unique case where 𝑝 is refl 𝑥 .

The induction principle of identity types allows deriving a substitution principle which is a formal version of Leibniz's identity of indiscernibles. Given two elements 𝑥, 𝑦 : 𝐴 and an identity 𝑝 : 𝑥 = 𝑦 then, for any type family 𝐵 : 𝐴 → 𝒰, there is a function 𝑝 * : 𝐵(𝑥) → 𝐵(𝑦). Conversely, the identity of indiscernibles implies the corresponding identity type. This logical equivalence can be turned into an equivalence of types assuming internal parametricity [START_REF] Abel | Leibniz equality is isomorphic to Martin-Löf identity, parametrically[END_REF].

Interestingly, this induction principle does not allow proving that any identity 𝑝 : 𝑥 = 𝐴 𝑥 is equal to refl 𝑥 ! This principle, named uniqueness of identity proofs (UIP), is summarised as

Determining whether such a principle was provable in ITT remained an open question for a long time until it was settled by Hofmann and Streicher ( HofmannWe introduce the basic type formers of our type theory that we will use throughout this thesis.

A.5.1 Function types

We open this section with a stylistic remark. Our notation for application departs from the one used in the preceding sections in that we will write 𝑥 𝑦 instead of 𝑥(𝑦) to lessen the number of parentheses in large lambda terms.

Let 𝐴, 𝐵 : 𝒰 be two types, we form the type of functions with domain 𝐴 and codomain 𝐵 denoted 𝐴 → 𝐵. Given a term 𝑡 : 𝐵 which may contain an occurrence of a variable 𝑥 : 𝐴, we introduce the function Finally, we introduce a notation for implicit arguments of functions. When the argument of a function can be inferred from the type of its application, this argument can be omitted in the notation. We use curly brackets for implicit arguments such that 𝑓 : {𝑥 : 𝐴} → 𝐵 𝑥 is a function whose argument 𝑥 is implicit. This notation is particularly convenient in nested function types when an argument depends on a number of previous arguments. For example, given a function 𝑓 : {𝑥 𝑦 : 𝐴} (𝑧 : 𝐵 𝑥 𝑦) → 𝐶 𝑥 𝑦 𝑧 and an element 𝑧 : 𝐵 𝑥 𝑦 for 𝑥 and 𝑦 two elements of 𝐴, we denote 𝑓 𝑧 the application of 𝑓 to the arguments 𝑥, 𝑦, and 𝑧 but omitting the first two in the notation. Not all arguments can be made implicit, and we will only employ them when it is easy for the reader to infer them. Sometimes we will want to make explicit the implicit arguments in which case we write 𝑓 {𝑥} {𝑦} 𝑧.

A.5.2 Σ-types

Σ-types are the types of dependent pairs. Let 𝐴 : 𝒰 and 𝐵 : 𝐴 → 𝒰, we form the type (𝑥:𝐴) 𝐵 𝑥 : 𝒰. A pair of elements 𝑥 : 𝐴 and 𝑦 : 𝐵 𝑥 defines an element (𝑥, 𝑦) : (𝑥:𝐴) 𝐵 𝑥. Conversely, given a pair 𝑝 : (𝑥:𝐴) 𝐵 𝑥, we can project its two components as pr 1 𝑝 : 𝐴 and pr 2 𝑝 : 𝐵 (pr 1 𝑝) such that, for any 𝑥 : 𝐴 and 𝑦 : 𝐵 𝑥, pr 1 (𝑥, 𝑦) ≡ 𝑥 and pr 2 (𝑥, 𝑦) ≡ 𝑦 which constitute the two 𝛽-laws of Σ-types. Moreover, Σ-types satisfy the 𝜂-law 𝑝 ≡ (pr 1 𝑝, pr 2 𝑝) for any 𝑝 : (𝑥:𝐴) 𝐵 𝑥.

When defining a mathematical structure as a type endowed with a number of operations each satisfying some laws, we implicitly formalise it as a nested sigma type. For example, if we have to write the definition of an associative magma, we will say that it is the data of • A type 𝑋 : 𝒰.

• A binary operation 𝑚 : 𝑋 × 𝑋 → 𝒰.

• A proof that 𝑚 is associative; that is, for any triplet 𝑥, 𝑦, 𝑧 : 𝑋, a proof of 𝑚 (𝑚 𝑥 𝑦) 𝑧 = 𝑚 𝑥 (𝑚 𝑦 𝑧).

but implicitly we have to think of this definition as being formalised as the type (𝑋:𝒰) ( (𝑚:𝑋×𝑋→𝒰) (𝑥 𝑦 𝑧 : 𝑋) → 𝑚 (𝑚 𝑥 𝑦) 𝑧 = 𝑚 𝑥 (𝑚 𝑦 𝑧)) We allow coinductive definitions as implemented in Agda [START_REF] Abel | Copatterns: Programming infinite structures by observations[END_REF], in which case we drop the 𝜂-law as it could lead to non-terminating typechecking. For example, the type Stream 𝐴 of stream of type 𝐴 is defined as the data of • An element of type 𝐴.

• A stream Stream 𝐴 .

A.5.3 Inductive types

Most of the types that we will be using fall within the scope of inductive types which, intuitively, are freely generated by their introduction rules that we name constructors. Their elimination rules then naturally follow from their constructors and consist of a clause specifying what to do for each of the constructors. We introduce a few inductive types which will be used throughout this thesis.

Empty type

The empty type ⊥ has no constructor. Given a type family 𝐴 : ⊥ → 𝒰, defining a function 𝑓 : (𝑥 : ⊥) → 𝐴 𝑥 requires no clause corresponding to the fact that there is no constructor inhabiting this type. Its induction principle is where 𝑓 inl : (𝑎 : 𝐴) → 𝐶 (inl 𝑎) and 𝑓 inl : (𝑏 : 𝐵) → 𝐶 (inr 𝑏).

A.5.4 Identity types

Identity types model the notion of propositional identity. Let 𝐴 : 𝒰 be a type. Given two elements 𝑥, 𝑦 : 𝐴, we form their identity type 𝑥 = 𝐴 𝑦 : 𝒰 dropping the type annotation and writing 𝑥 = 𝑦 instead when it can be inferred from the context. Its sole constructor is refl 𝑥 : 𝑥 = 𝑥 for any element 𝑥 : 𝐴. Identity types 𝑥 = 𝐴 𝑦 depart from ordinary inductive types in that they are inductively defined family of types indexed by 𝑦. The sole constructor of identity types then specifies an inhabitant of the fibre over 𝑥.

In order to define the elimination principle for identity types, we consider a type family 𝐵 : (𝑦 : 𝐴) → 𝑥 = 𝑦 → 𝒰. Note how 𝐵 depends on 𝑦 being variable owing to the fact that 𝑦 is the index of this inductively defined family of types. Now, in order to define an element of 𝐵 𝑦 𝑝 for any element 𝑦 : 𝐴 and identity 𝑝 : 𝑥 = 𝑦, it suffices to define an element 𝑑 : 𝐵 𝑥 refl 𝑥 . Intuitively, we imagine 𝑝 to be a path whose 𝑦 endpoint is free in such a way that we can contract 𝑝 to refl 𝑥 then use 𝑑. Moreover, if 𝑝 was definitionally equal to refl 𝑥 in the first place, we just return 𝑑.

To summarise, the induction principle has type:

→ 𝐵 𝑝 subject to the equation

This induction principle reduces to the following substitution principle when 𝐵 does not depend on the particular identity:

The use of transport is ubiquitous in ITT and can often obfuscate the crux of a proof. We will therefore adopt the notation transport 𝐵 𝑝 𝑢 in place of transport 𝐵 𝑝 𝑢 in order to highlight the term being transported which is 𝑢 in the present case. When 𝐵 is the identity function id 𝒰 , we will even omit 𝐵 and write transport 𝑝 𝑢.

We recall a number of definitions relative to HoTT which make use of identity types and which will be used throughout this thesis.

Inverse Let 𝐴 be a type, let 𝑥, 𝑦 : 𝐴, and let 𝑝 : 𝑥 = 𝑦. There exists an identity 𝑦 = 𝑥 that we denote 𝑝 -1 . It is defined by induction on 𝑝. This, in turn, allows us to define equivalences of types. Definition A.5.6 (Equivalence of types). An equivalence of types 𝐴 ≃ 𝐵 is a function 𝐴 → 𝐵 together with a proof that it is an equivalence. We therefore define 𝐴 ≃ 𝐵 :≡ ( 𝑓 :𝐴→𝐵) (is-equiv 𝑓 )

We will often use the more practical definition of quasi inverse. It is logically equivalent to an equivalence of types, but it is not as well-behaved as it is in general not a proposition. However, from a quasi inverse we can always define an equivalence of types. When defining an equivalence we will then often just provide a quasi inverse.

Definition A.5.7 (Quasi inverse). A function 𝑓 : 𝐴 → 𝐵 has a quasi-inverse if there exists a function 𝑔 : 𝐵 → 𝐴 such that

We will denote 𝑒 -1 the inverse of an equivalence 𝑒. We finally recall the univalence axiom. First, notice that for any two types 𝐴 and 𝐵, there is a function id-to-equiv : 𝐴 = 𝐵 → 𝐴 ≃ 𝐵 defined by induction which associates to any identity 𝑝 : 𝐴 = 𝐵 the function

together with a proof that it is an equivalence -easily proven by an induction on 𝑝.

Definition A.5.8 (Univalence axiom). For any two types 𝐴 and 𝐵, the function id-to-equiv is an equivalence. In particular, we have

It is well known that univalence implies function extensionality.

Definition A.5.9 (Function extensionality). Let 𝐴 : 𝒰 be a type and let 𝐵 : 𝐴 → 𝒰 be a family of types. Let 𝑓 , 𝑔 : (𝑥 : 𝐴) → 𝐵 𝑥 be two functions, if 𝑓 and 𝑔 are pointwise equal then 𝑓 = 𝑔.

The definition uses the univalence axiom and can be found in Section 4.9 of the HoTT book.

We define a last operation which relates pairs of identities and identities of pairs.

Appendix B

Extended abstract (French version)

La définition de structures algébriques sur des types arbitraires en théorie des types homotopiques (HoTT) s'est révélée hors de portée jusqu'à présent. Cela est dû au fait que les types sont, en général, des espaces plutôt que de simples ensembles, et que les égalités d'éléments d'un type se comportent comme des homotopies. Les lois équationnelles des structures algébriques doivent donc être énoncées de manière cohérente. Cependant, en mathématiques ensemblistes, la présentation de ces données de cohérence se fait à l'aide de structures algébriques sur des ensembles, telles que les opérades ou les préfaisceaux, qui ne sont par conséquent pas soumises à des conditions de cohérence supplémentaires. Reproduire cette approche en HoTT conduit à une situation de dépendance circulaire puisque ces structures doivent être définies de manière cohérente dès le départ.

Dans cette thèse, nous brisons cette circularité en étendant la théorie des types d'un univers de monades polynomiales cartésiennes qui, de manière cruciale, satisfont leurs lois définitionnellement. Cette extension permet de présenter les types et leurs structures supérieures sous forme de types opétopiques qui sont des collections infinies de cellules dont la géométrie est décrite par les opétopes.

Opétopes

Nous ouvrons cette thèse en donnant une définition des opétopes dans une théorie des types similaire à celle du livre HoTT au chapitre 1. Les opétopes sont des formes géométriques introduites par Baez et Dolan afin de donner une définition des 𝑛-catégories. Les opétopes de dimension 𝑛 + 1 ont pour source une collection d'opétopes de dimension 𝑛 et ont pour cible un unique opétope de dimension 𝑛. Nous définissons les opétopes comme séquences d'arbres bien fondés satisfaisant certaines propriétés qui sont capturées par leur typage. L'approche opétopique est particulièrement adaptée au contexte de la théorie des types car ces arbres sont aisément définissables comme types inductifs.

Plus précisément, notre construction est basée sur une séquence de monades polynomiales cartésiennes, une notion qui devient centrale dans les chapitres suivants.

Nous décrivons informellement quelques exemples d'opétopes en basse dimension afin d'en saisir l'intuition. 0-opétope Il y a un seul opétope de dimension 0 que l'on représente par un point.

• 1-opétope Il y a un seul opétope de dimension 1 que l'on représente par une flèche. Elle a une unique source et une cible qui sont tous deux des 0-opétopes.

• •

À partir de cette dimension, on peut former des composites formels de 𝑛opétopes aussi appelés schémas de composition. En dimension 1 ce ne sont que des chaînes de 1-opétopes comme celle-ci :

2-opétopes Les 2-opétopes ont une source constituée d'une chaîne de 1-opétopes (possiblement vide) et ont pour cible l'unique 1-opétope. Les diagrammes suivants illustrent des exemples de 2-opétopes :

Les 2-opétopes peuvent être assemblés pour former des schémas de composition de 2-opétopes en collant la cible d'un 2-opétope à l'une des sources d'un second 2-opétope comme illustré sur le diagramme suivant : Nous nommons ces quadruplets cadres et les dénotons (𝑖, 𝑦) ⊳ (𝑐, 𝑥). Nous considérons les familles de type Fam 𝑀/𝑋 comme des familles de remplissages pour ces cadres mettant en relation une configuration d'entrées spécifiée par (𝑐, 𝑥) avec la sortie (𝑖, 𝑦).

Les constructeurs de 𝑀/𝑋 indexés par un cadre (𝑖, 𝑦) ⊳ (𝑐, 𝑥) sont alors des arbres bien fondés de cadres qui se multiplient en (𝑖, 𝑦) ⊳ (𝑐, 𝑥) en utilisant la multiplication μ 𝑀 pour réduire les constructeurs et en oubliant les décorations des arêtes internes. La corolle ayant (𝑖, 𝑦) ⊳ (𝑐, 𝑥) pour seul noeud est une unité pour la monade 𝑀/𝑋. La grande force de l'approche opétopique est que de tels arbres sont très commodément définis comme types inductifs. Cependant, leur indexation utilisant la structure des monades, nous avons besoin que les lois des monades soient définitionnelles afin de ne pas rencontrer de problèmes de cohérence.

Étant donné un constructeur 𝑐 : Cns 𝑀/𝑋 𝑖, son type de positions Pos 𝑀/𝑋 𝑐 est le type de chemins de la racine de 𝑐 à ses différents noeuds. La fonction de typage attribue alors le cadre correspondant à un noeud de 𝑐 à une position spécifiée.

Enfin, la multiplication μ 𝑀/𝑋 prend un arbre 𝑐 : Cns 𝑀/𝑋 𝑖 ainsi qu'une famille d'arbres 𝑑 :

------→ Cns 𝑀/𝑋 𝑐 indexés par les positions de 𝑐 et substitue les arbres spécifiés par 𝑑 aux noeuds de 𝑐. Nous définissons également cette multiplication de manière à ce qu'elle soit associative et unitaire définitionnellement.

Types opétopiques

Nous tirons parti de notre univers de monades polynomiales pour définir les types opétopiques au chapitre 3. Étant donné une monade 𝑀, un type 𝑀opétopique 𝑋 : 𝒪 𝑀 (Figure B.2) est une collection coinductive de cellules opétopiques. On note 𝑋 𝑛 la (𝑛 + 1)-ième famille de cellules d'un type opétopique 𝑋 et on note 𝑋 >𝑛 le type opétopique des familles 𝑋 𝑚 pour 𝑚 > 𝑛.

Nous qualifions un type opétopique 𝑋 : 𝒪 𝑀 de fibrant s'il possède la