Data Types with Symmetries via Action Containers
Abstract
We study two kinds of containers for data types with symmetries in homotopy type theory, and clarify their relationship by introducing the intermediate notion of action containers. Quotient containers are set-valued containers with groups of permissible permutations of positions, interpreted as (possibly non-finitary) analytic functors on the category of sets. Symmetric containers encode symmetries in a groupoid of shapes, and are interpreted accordingly as polynomial functors on the 2-category of groupoids.
Action containers are endowed with groups that act on their positions, with morphisms preserving the actions. We show that, as a category, action containers are equivalent to the free coproduct completion of a category of group actions. We derive that they model non-inductive single-variable strictly positive types in the sense of Abbott et al.: The category of action containers is closed under arbitrary (co)products and exponentiation with constants. We equip this category with the structure of a locally groupoidal 2-category, and prove that it locally embeds into the 2-category of symmetric containers. This follows from the embedding of a 2-category of groups into the 2-category of groupoids, extending the delooping construction.
Keywords and phrases:
Containers, Homotopy Type Theory, Agda, 2-categoriesFunding:
Philipp Joram: Participation at TYPES’24 was supported by the COST Action CA20111 – European Research Network on Formal Proofs (EuroProofNet)Copyright and License:
2012 ACM Subject Classification:
Theory of computation Type theory ; Theory of computation Categorical semanticsSupplementary Material:
Software (Agda): https://github.com/phijor/cubical-containersarchived at
swh:1:dir:a77c8b642661074b9804670b14cf97cc844aff16
Funding:
This work was supported by the Estonian Research Council grant PSG749.Editors:
Rasmus Ejlers Møgelberg and Benno van den BergSeries and Publisher:
Leibniz International Proceedings in Informatics, Schloss Dagstuhl – Leibniz-Zentrum für Informatik
1 Introduction
Containers are a representation of strictly positive data types, introduced by Abbott et al. [1]. A container consists of a type of shapes and a type of positions associated to each shape. For example, the container of ordered lists consists of natural numbers as shapes and finite ordinals as positions, the idea being that each list has a length and -many locations that can hold data. Containers can be interpreted as polynomial endofunctors, the latter being the polymorphic data types that the containers represent. For example, the interpretation of the list container is the functor.
Containers form a category. Its morphisms represent polymorphic functions between data types, which are interpreted as natural transformations between the corresponding polynomial endofunctors. This category is rich in structure; among other things it is cocartesian closed, is closed under the construction of initial algebras and terminal coalgebras, and admits a notion of derivative.
Traditionally, the theory of containers is studied in -like categories. When interpreted in such categories, the data of containers may however be too restrictive to encode certain data types of interest. This is especially the case if one wants to account for symmetries, i.e. identify configurations of positions when one can turn into the other via the action of certain permutations. For example, one can represent ordered lists, but it is not possible to represent cyclic lists or finite multisets as a container.
Some efforts have been made to enhance the expressivity of containers to represent data types with symmetries. Abbott et al. [3] introduced quotient containers, which are containers in which the assignment of values to positions is invariant under a collection of permutations on positions. This is realized by requiring the presence of a subgroup of the symmetric group on positions, corresponding to the collection of admissible permutations. Interpretation of quotient containers embeds them as a subcategory of set-endofunctors, targeting certain quotients of polynomial endofunctors. For quotient containers with finitary positions, these correspond to Joyal’s analytic functors [15].
Symmetric containers, introduced by Gylterud [10], consist of a groupoid of shapes, with positions being a set-valued functor over this groupoid. This means that the symmetries are encoded directly in the isomorphisms of the shape groupoid. From the perspective of (homotopy) type theory, symmetric containers correspond to set-bundles over homotopy-groupoids. They form a locally univalent 2-category, and are interpreted as polynomial endofunctors on the 2-category of groupoids.
Quotient and symmetric containers are two different ways to extend the expressivity of ordinary containers to include symmetries between positions. Our interest lies in understanding how these two approaches are related. To this end, we introduce an intermediate notion: action containers. An action container consists of a set of shapes and, for each shape , a set of positions and a group acting on . On one side, such containers generalize quotient containers, as the allowed permutations are determined by the action of an arbitrary group, and are not restricted to subgroups of the symmetric groups. On the other, they are a special case of symmetric containers: a -action is a functor from (as a 1-object groupoid) to , and summation of these functors over all shapes yields a symmetric container.
We describe a notion of morphisms of action containers, inspired by (pre)morphisms of quotient containers. Differently from the latter, morphisms of action containers have to explicitly preserve the structure of the groups acting on positions. Action containers form a category, and we show that this category is the free coproduct completion of a category of group actions in the form of the -construction. From this we derive closure under arbitrary products and coproducts, as well as exponentials with constant domain.
To compare action containers with the 2-category of symmetric containers, we define a notion of invertible 2-cell between these morphisms, enriching them to a 2-category. Crucially, we observe that this 2-category can again be modularly constructed starting from a 2-category of groups, group homomorphisms and conjugators [12] using the techniques of displayed bicategories [6]: we first define a 2-category of group actions, displayed over this 2-category of groups, then repeat a 2-categorical version of the -construction, presenting the 2-category of action containers as that of families of group actions.
We construct a 2-functor between the 2-categories of action containers and symmetric containers; again in multiple steps. First we notice that the delooping of a group extends to a 2-functor between the 2-categories of groups and groupoids, and that this is locally a weak equivalence. We show, again using the displayed machinery, how to lift this to a local weak equivalence between the 2-categories of group actions and set bundles.
The -construction yields a 2-functor between the 2-categories of families of group actions, i.e. action containers, and families of set bundles. We show that the action of preserves local fully-faithfullness, but that preservation of local essential surjectivity requires an application of the axiom of choice. Finally, we describe a 2-functor performing summations of family of set bundles, implicitly employing the universal property of the -construction as free coproduct completion. The latter does not seem to be fully faithful, however its restriction to set bundles with connected bases is. This implies that the composite 2-functor is locally fully faithful. This means that, not only do action containers correspond to certain symmetric containers, but so do their morphisms: conjugators between action container morphisms represent exactly identifications of symmetric container morphisms.
We implement our results using the Agda proof assistant, building on top of the agda/cubical [19] and cubical-categorical-logic [17] libraries. Our code is freely available at https://github.com/phijor/cubical-containers. The repository contains a README linking results of this paper to the corresponding formalization in the code.
1.1 Notation and Background
Our work takes place in homotopy type theory, which is a well-suited foundational framework for our investigation. This is mostly due to the fact that we can work with syntethic groupoids, i.e. h-groupoids, in place of categorical groupoids, which considerably simplify the described constructions. We take full advantage of higher inductive types (HITs) to define mere existence via propositional truncation, set quotients and the delooping of groups. In this short section, we recall some basic terminology and fix the notation we use. More details can be found in the HoTT book [20].
We write for dependent products, for their non-dependent variant, and for dependent sums. Two-argument function application is written or, to reduce visual clutter, . Most of our constructions are universe-polymorphic, but for the sake of readability in the paper we use only the lowest universe of types, denoted . The type of -sets is , the type of -groupoids is . We will often simply talk about sets and groupoids instead of -sets and -groupoids. We suppress proofs of truncation level when they are routine, e.g. for nested - and -types. The type of natural numbers is and the finite ordinals . For , we denote their type of identifications by , and call either an identification or a path. Given a family over and terms , , we write for the type of dependent paths, or when can be inferred. Defining equalities are denoted ; for judgmentally equal and , we write . For functions into -types, we use binders to name the projections: given , we write or for and .
The propositional truncation of a type is , the set truncation of is . Notice that there are two competing conventions for indexing truncation levels: (-2)-based (HoTT-book style) and 0-based (Voevodsky-style). Our formalization, done in Cubical Agda, is 0-based, yet this paper, which is written in HoTT-book style, starts indexing at -2. Whenever possible however, we will explicitly use the words “proposition”, “set” and “groupoid” to avoid confusion. Mere existential quantification is defined as . The set quotient of a type by a (possibly non-propositional) relation is . The circle is a HIT with constructors and . Propositional and set truncations, as well as set quotients and the circle, are defined as higher inductive types. The main HIT employed in this paper is the delooping of a group, introduced in Section 2.3.
Given a pointed type , its loop space is , and its fundamental group is its set truncation . The connected components of a type are collected in its set truncation . We say that is connected if is contractible.
For groups and we denote the type of group homomorphisms by . We denote the type of subgroup inclusions by . The symmetric group of a set is . The unit of this group is reflexivity , multiplication is composition of paths , inverse is path reversal. Recall that, by univalence, is equivalent to the type of equivalences . We abbreviate . An action of on a set is a group homomorphism . For , we denote simply by , and apply it to some either as or . The action is said to be faithful if is injective. The set of -orbits is denoted , and defined as the set quotient of by the orbit relation .
1.2 2-Categories
In this paper, we make use of higher categories in the form of (2,1)-categories. We follow the definitions of bicategorical concepts of [13], and adapt them to the setting of homotopy type theory: a 2-category consist of a type of objects , 1-cells , and 2-cells , with horizontal composition of 1- and 2-cells, and vertical composition of 2-cells, subject to suitable axioms. In particular, all types of 2-cells are assumed to be -sets. Composition of 1-cells is unital and associative up to a chosen identification, not just a 2-cell. All instances of 2-categories considered here are either locally strict (i.e. 1-cells form sets) or locally univalent; such 2-categories always admit a unique coherently strict structure.
If is understood from context, we write for , and for . We compose cells in diagrammatic order. Juxtaposition denotes horizontal composition, whereas vertical composition of 2-cells is denoted .
Let . Under vertical composition, 2-cells form the morphisms of an (ordinary) category, called the local category at and , denoted by its type of objects . If a proposition holds for all local categories of a 2-category, we say that it is locally . A (2,1)-category is thus defined to be a locally groupoidal 2-category, that is, one for which 2-cells in each local category are invertible. A 2-category is locally thin if is a proposition for each pair of 1-cells , i.e. there is at most one 2-cell from to . Any ordinary category forms a locally thin 2-category: 2-cells are homotopies of 1-cells, .
We use the machinery of displayed bicategories [6] to define complex 2-categories from modular gadgets. A displayed 2-category over a base 2-category consists of a family of objects , a family of 1-cells , and a family of 2-cells , satisfying dependent analogues of the 2-category axioms. If unambiguous, we write for , as well as for . The total 2-category of over is denoted , and is a 2-categorical analouge of -types: objects are pairs of objects , 1-cells are , and 2-cells . To highlight the dependency on , we sometimes write or even .
We go between 2-categories via 2-functors. For a 2-functor we denote its action on objects, 1-, and 2-cells by , and respectively. They are assumed to strictly preserve composition and units of 1-cells, that is up to an identification of 1-cells in the codomain. The actions on 1- and 2-cells define functors of local categories, and we call locally if all local functors satisfy a proposition .
We define a notion of displayed 2-functor between 2-categories displayed over and and a (base) 2-functor . To cells in it assigns cells in displayed over the image of : it consists of assignments of objects , 1-cells and 2-cells , satisfying dependent analogues of the 2-functor axioms. A displayed 2-functor induces a 2-functor between total 2-categories, denoted .
The 2-category of -groupoids is denoted by . Its 1-cells are functions between the underlying types and 2-cells are homotopies between functions.
2 Quotient and Symmetric Containers
In this section we recall the notions of quotient and symmetric containers, as well as their morphisms.
2.1 Quotient Containers
Quotient containers were introduced by Abbott et al. [3] as a way to add symmetries to containers in an extensional type theory with quotient types. Here we state their definition in HoTT.
Definition 1.
A quotient container consists of a set of shapes , a family of positions and symmetry groups for each .
Each group element defines a path . By , this induces a map ; in the remainder, we will identify and this map.
Example 2.
The quotient container of unordered -tuples has a single shape, and over it positions . On these positions, the full group of permutations acts as its symmetry group. We call the identity container; it has a single shape, on which the trivial group acts.
Like an ordinary container, a quotient container defines an endofunctor on the category of sets, called its extension. Whereas for ordinary containers this is a polynomial functor, for quotient containers it is a sum of quotients of representables:
Definition 3 (extension of quotient containers).
The extension of is the map given by
When positions are finite sets, the extension is an analytic functor in the sense of Joyal [15].
Example 4 (unordered -tuples).
The extension of is the type of unordered -tuples:
where if and only if for some permutation . When , we obtain the identity function .
Definition 5.
A premorphism of quotient containers, consists of a map of shapes , a map of positions , and a proof that preserves symmetries, .
Morphisms of quotient containers are defined up to permutation of positions, i.e. as equivalence classes of premorphisms.
Definition 6.
The type of morphisms of quotient containers is the set quotient of the type of premorphisms by the relation (defined by path induction)
Whenever , this relation posits the mere existence of a triangle filler
Definition 7.
Quotient containers and their morphisms form a category .
Extension of quotient containers is a functor , which is full and faithful. Each premorphism defines a natural transformation , with component at a map
defined by induction on set quotients as . This is well-defined on morphisms of quotient containers: If then .
2.2 Symmetric Containers
Symmetric containers were introduced by Gylterud [10] as a way of defining polynomial functors between categorical groupoids. In this section we reformulate their definition in the language of HoTT using homotopy groupoids instead.
Definition 8.
A symmetric container consists of shapes and a family of positions .
Definition 9.
A morphism of symmetric containers consists of a map of shapes and a family of maps of positions.
In a (homotopy) type-theoretic setting, the types of morphisms of a category are understood to be -sets. Morphisms of symmetric containers, however, form -groupoids.111 Observe that , which is an -groupoid since is.
Definition 10.
The 2-category has as objects symmetric containers, as 1-cells morphisms of symmetric containers, and as 2-cells identifications of such morphisms.
Definition 11.
The extension of a symmetric container is a function of -groupoids, , defined as .
Extension of symmetric containers defines a 2-functor . For any morphism , there is a pseudonatural transformation with components given by precomposition
This 2-functor is locally an equivalence of 2-categories [10, Theorem 2.2.1], thus embeds symmetric containers into endofunctors of groupoids.
One advantage of internalizing symmetric containers as -groupoids is that we are free to define groupoids of shapes as higher inductive types, encoding the desired symmetries directly in their constructors. For example, cyclic lists can be described using the symmetries of the circle, :
Example 12.
The symmetric container of cyclic lists, , is defined as follows:
-
Shapes are pairs . The first component contains the length of the list. The second has a single point, , but its loops are going to induce cyclic shifts on positions.
-
Positions are defined by induction on the circle . Over the point, we have distinct positions, . On the non-trivial path, identifies positions by a cyclic shift, . Here, is the path obtained by univalence from the successor equivalence
Since is freely generated by a single non-trivial path, identifies positions by arbitrary cyclic shifts. Let , terms of type . We are going to exhibit a path in . Since is an iterated -type, such a path is given by a triple of paths , , and . Set and . The path is dependent over , and it suffices to give a path . But we see that the right side computes to , which is .
2.3 Lifting Quotient Containers
The data of both quotient and symmetric containers define semantics for datatypes with symmetries. As we will see, it is possible to see any quotient container as a symmetric one. However, this analogy does not extend to (polymorphic) functions between such types, since it is generally not possible to lift a morphism of quotient containers to one of symmetric containers, as the former truncate evidence on how symmetries are preserved.
In order to create a symmetric container from a quotient container, we have to come up with a groupoid of shapes that encodes the symmetries present in the quotient container. We borrow an idea from algebraic topology: any group gives rise to a unique pointed, connected groupoid such that , called its delooping. This type is an instance of an Eilenberg–MacLane space, i.e. a type with a single non-trivial homotopy group. Eilenberg–MacLane spaces have been studied in HoTT [16], and our presentation of coincides with there. We define as a higher inductive type with constructors
plus one constructor asserting that is an -groupoid. Its recursion principle states that, to define a map for some groupoid , it suffices to give a point and a group homomorphism : a map is then determined by and . The recursor characterizes functions out of , in the following sense:
Proposition 13.
The recursor is an equivalence , for a groupoid. When is a set, we have .
The dependent eliminator lets us define sections of families by providing a point , dependent paths , and a coherence condition for composition of dependent paths: for all , there needs to be a path from to , dependent over .
Note that preserves the product of , hence is a morphism of groups. This lets us derive other expected coherences, such as and .
Delooping acts on group homomorphisms:
Definition 14.
Any group homomorphism induces a map of groupoids , defined by induction:
A -action is a particular homomorphism, so the above defines a type family . Let us spell this out:
Definition 15 (associated bundle).
Let act on a set via . Its associated bundle is defined by recursion on as
Note that for each , is a path .
In the context of quotient containers, we are dealing with faithful group actions, that is actions of on such that is an embedding. In this case, the associated bundle is an embedding on its path spaces, i.e. a set-truncated function [20, 7.6.1]:
Proposition 16.
If acts faithfully, the fibers of are sets.
Proof.
By [20, Lemma 7.6.2], has set-valued fibers iff is an embedding for all . This is a proposition, therefore it suffices to show this at . There, we have . But is an equivalence and an embedding, hence is an embedding as well.
For any quotient container we define a groupoid that is the collection of its delooped symmetry groups:
Definition 17.
The delooping of a quotient container is the symmetric container consisting of
-
shapes , and
-
positions , ,
where is the inclusion of symmetry groups .
We think of the shapes as consisting of the points of , with loops given by elements in freely added. Indeed, if we compute its connected components, we see that
where the last step follows from connectivity of . Similarly, we compute its first fundamental group: is a set and is contractible, thus
That each acts faithfully is reflected in the action of the groupoid , in the sense that the bundle embeds paths of :
Proposition 18.
The family is a set-truncated function.
Proof.
For each , we have , which is a set: is a set, and since we assume to be faithful, so are the fibers of by Proposition 16.
This way of obtaining a symmetric container is in some sense conservative: when comparing the associated extensions (and set-truncating that of the symmetric container), we see that they are the same function of sets:
Theorem 19.
For a quotient container and , there is an equivalence of sets
Proof.
Let us unfold the definitions of and ,
| (1) | ||||
| and, as is a set, move the truncation under the sum | ||||
| (2) | ||||
| Notice that acts on the function type via precomposition, and that its associated bundle is . By Lemma 20 below, the connected components of this bundle correspond to orbits of the action, | ||||
| (3) | ||||
| which is exactly how extension of a quotient container is defined: | ||||
| (4) | ||||
Lemma 20.
Let a -action on . The connected components of the total space of its associated bundle and -orbits are in bijection, that is .
Proof.
Let us define the left-to-right direction. Since the codomain is a set, it suffices to give by induction on . Let the surjection onto the quotient. It remains to show that this is well-defined on loops, which reduces to . This holds since by definition of the orbit relation. The inverse is defined by recursion on the set quotient and maps to . From , one constructs a path : the first component is given by , the second as dependent path from .
Theorem 19 states that, as functions between types, the diagram commutes. We are interested to see whether this generalizes to a natural isomorphism of functors. To do so, we would have to suitably extend to a functor. Unfortunately, it is not clear how to define its action on morphisms of quotient containers. Given a premorphism , we would have to provide a morphism of shapes
To define , it would suffice to provide a morphism of groups . However, we are not given this information: we know that preserves symmetries, but this only tells us that, for each , there is merely some . Even if we were given an explicit function , it would not have to be a group homomorphism. In fact, it is easy to construct counterexamples:
Example 21.
Consider . The terminal map trivially preserves symmetries: the diagram
commutes for any choice of , in particular for , which is not a group homomorphism.
Since morphisms of quotient containers are equivalence classes, it might be possible to find another premorphism in the same class for which this assignment is a morphism of groups. In fact, in the above example one could pick , which clearly is. Doing so however for arbitrary symmetry groups seems constructively impossible, without invoking some form of choice principle.
Instead, we will be looking to enhance the definition of quotient containers to include the necessary information, and investigate their relation to symmetric containers more closely.
3 Action Containers
In this section we define action containers and assemble them into a 1-category. Morphisms in this category are akin to premorphisms of quotient containers. In particular, they are not quotiented by a relation on positions. Later, in Section 4, we enrich this category to obtain a (2,1)-category whose 2-cells capture this relation.
Different from quotient containers, the symmetries of action containers are not limited to subgroups of permutations of positions. Instead, an action container has, for each shape, a chosen group acting on the set of positions. This lets us flexibly introduce symmetries, e.g. by letting the integers under addition act on a finite set, instead of having to identify the image of this action, see the forthcoming Example 23.
The category of action containers admits a number of limits and colimits, and we will derive the usual container algebra of products and coproducts from a presentation of this category as a category of families in Section 3.1.
Definition 22.
An action container consists of a set of shapes , a family of positions and group actions for each .
In the following, the word “container” refers to action containers; other kinds of containers are qualified explicitly. In Example 12, we defined cyclic lists as a symmetric container in which loops of the circle act by cyclic shifts. Since , we are inspired to define a container of cyclic lists by means of a -action:
Example 23 (cyclic lists as an action container).
The container has acting on as follows: for each , let , . Note that this action is not faithful: the kernel of consists of the integers .
In general, it is easy to define -actions: is the free group on one generator, thus it suffices to define the action of . In the example of cyclic lists, it suffices to define the cyclic shift by one position, . This is impossible for quotient containers with finitely many positions: is simply never a subgroup of finite symmetry groups.
Unlike premorphisms of quotient containers, morphism of action containers are required to preserve the full structure of containers, including their symmetries:
Definition 24.
A morphism of action containers consists of a map of shapes , a map of positions , a family of group homomorphisms , and a proof that is equivariant: for all and a commutative square
Calling equivariant is justified: each is a morphism between -sets and [18, Definition 1.2]. Theorem 27 will explain how this notion of morphism arises naturally from a category of group actions and equivariant maps between them.
Definition 25.
Action containers and their morphisms form a category .
3.1 Algebra of Action Containers
Like other categories of containers, action containers are closed under a number of constructions. In particular, has all products and coproducts. To show this, we could define each of them by hand. In that process, we would have to carefully track the variance of parts of a container. For example, the binary product of containers is a product of shapes and symmetry groups, but a (pointwise) coproduct of families of positions.
Instead, we opt to present as a category of families of group actions, from which (co)limits are easy to read off. First, we define a category of group actions. It is a version of the category of -sets (for a fixed group ), in which equivariant maps are permitted to go between sets with actions of different groups.
Definition 26.
We denote by the category of group actions and equivariant maps. It is obtained as the total category of the following category displayed over :
-
Given objects and , displayed objects are -actions on , i.e. group homomorphisms .
-
Displayed morphisms between actions and over are proofs of the proposition “ is equivariant over ”: Let .
Diagrammatically, equivariant maps compose by horizontal pasting of proofs of equivariance:
Observe how over each shape, the data of a container is exactly that of a group action: for any , acts on via . Thus, on objects, the category of action containers consists of “families” of group actions. Let us ensure that this analogy extends to morphisms of this category.
Recall that for any category , its free coproduct completion is the category of families [4, §2]. Its objects are families , morphisms are families of maps between them.
Theorem 27.
The category of action containers is equivalent to families of group actions. In particular, the functor with action on objects given by is an equivalence of categories.
Remark (univalence of ).
The above implies that is a univalent category: preserves univalence, and is a univalent displayed category by [7, Proposition 7.3].
From this presentation of , we read off closure under sums and products:
Proposition 28.
has -indexed products for all sets . In particular, the trivial group acting on the singleton set is an initial object.
Corollary 29.
Action containers are closed under products and coproducts.
Proof.
is the free coproduct completion of any category , thus is closed under coproducts. Similarly, is closed under products (Proposition 28), and Theorem 2.11 of [4] implies that families over it are as well.
Like ordinary containers [2, Proposition 3.9], constant action containers are exponentiable:
Proposition 30 (constant containers are exponentiable).
The constant container of a set is . Given a container , the exponential container is defined to have
-
shapes ,
-
positions ,
-
symmetries , and
-
actions given by action of on the second component of : for , let
Let and . The evaluation morphism is given by function application on shapes, pairing on positions, and the projection homomorphisms on symmetries.
We believe that the above is an instance of constant exponentials in families: Let have -fold products for any set ; in particular an initial object and binary products. It should be possible to show that the constant family is exponentiable.
Remark (composition of action containers).
When seen as endofunctors, composite data types are constructed as compositions of functors. For ordinary containers [2, 3.6] and symmetric containers [10, 2.2.5], this construction is reflected along : Given containers and , there is a container such that , upgrading to a strong monoidal functor. In a set-theoretic setting, Hasegawa [11, Corollary 1.18] gives a construction of composition for analytic functors in terms of wreath products of symmetry groups. Analytic functors are presented by quotient containers with finitary positions, and such a restriction of positions to a subuniverse of sets seems necessary when porting the result to action containers: positions and symmetries of the composite can otherwise not be defined coherently by induction on set quotients. This indicates to us that the definition of a composition-monoidal structure of action containers is not entirely straightforward, and we postpone its study for now.
4 The 2-Category of Action Containers
In Section 2.3 we observed that quotient containers lift to symmetric containers, but that the same does not apply to their morphisms. We defined the category of action containers to include the missing data, and are now ready to define an appropriate lifting:
Proposition 31.
The delooping of a container is the symmetric container . Each morphism defines a morphism between deloopings, .
Proof.
The family yields a map of shapes of type , defined as . The map on positions has (uncurried) type
and is defined by induction on . On the point, let . It remains to show that is well-defined on loops in . For all , we have to provide a dependent path where . By [20, Lemma 2.9.6], this is equivalent to giving paths , which we obtain from the proof that is equivariant.
As noted in Section 2.2, symmetric containers do not form an ordinary category, but a 2-category. Thus, in order to show that the above construction is functorial, we must first enrich action containers by a type of 2-cells, defining a 2-category. We do so by pulling back 2-cells of symmetric containers, and will see that this corresponds to the quotiented sets of quotient container morphisms.
We split the construction of the 2-functor taking action containers into symmetric containers into smaller steps. As in Section 3, we first seek to understand the problem for a single action, before considering entire families of such. We observe that symmetric containers, from a homotopical viewpoint, are set-bundles over groupoids: both consist of some base together with a family of fibers . Previously, we have seen that each action defines such a bundle, namely its associated bundle (Definition 15). We define 2-categories of actions (, Definition 37) and set bundles (Definition 38), and show that taking the associated bundle is a weak equivalence of their local categories (Theorem 42). This means that maps of actions are in 1-to-1 correspondence with functions on their associated bundles. By changing our point of view, and seeing actions as single-shape containers and bundles as symmetric containers, this fully classifies morphisms of (single-shape) action containers in terms of morphisms of symmetric containers.
To understand the case of many-shape containers, we give an analogue of the -construction in 2-categories, and define the 2-category of action containers as . The objects and 1-cells of this category are exactly as in Definition 26. We unfold the type of 2-cells induced by this construction (Proposition 47) and show that it is closely related to the quotient on premorphisms of quotient containers (Definition 6). We observe that set-bundles are, in a suitable sense, closed under -types, and we lift the functor to
finally establishing the connection between action containers and symmetric containers.
4.1 A 2-Category of Groups
We think of the type of -groupoids, , as an internal notion of categorical groupoids: The 2-category has as objects -groupoids, as morphisms functions of such, and as 2-cells homotopies between them. Our goal is to extend the delooping to a 2-functor taking groups into in a way that characterizes 2-cells in . We thus equip the 1-category of groups with the structure of a (2,1)-category [12]:
Definition 32.
The category of groups and group homomorphisms forms a (2,1)-category if equipped with the following 2-cells: Let . We say that is a conjugator of and if
The 2-cells compose vertically by multiplication in . The horizontal composites of and is .
Note that is not locally univalent: the identity type of group homomorphisms, , is a proposition, but the type of conjugators is a set.
Lemma 33.
Delooping extends to a 2-functor .
Proof.
A 1-cell is sent to , as in Definition 14. On 2-cells, let a conjugator of homomorphisms. Delooping assigns a 2-cell as follows: By function extensionality, it suffices to give for any . By induction on , we are left to give some in such that for all , . Choose , and compute
where uses that is a conjugator of and . By a similar argument, one shows that these assignments preserve composition and identities.
Defined this way, we see that preserves the local structure of :
Theorem 34.
The functor is locally a weak equivalence of categories, i.e. for all groups , there merely exists an inverse functor .
Note that this cannot be strengthened to a full equivalence with explicit inverse: equivalence of categories preserves properties, but is by definition locally univalent, whereas is not.
We prove Theorem 34 by showing that locally, is fully faithful and essentially surjective.
Proposition 35.
Delooping is a locally fully faithful functor: For groups , the local functor is an equivalence of categories.
Proof.
Let . We establish a chain of equivalences between the sets of 2-cells and . Starting from the definition,
| we apply the equivalence of groups, twice | ||||
| By the recursion principle, this is exactly a type of dependent functions out of , namely | ||||
| which, by function extensionality, is equivalent to | ||||
One verifies that the map underlying this chain is that of Lemma 33.
Proposition 36.
Delooping is a locally essentially surjective functor.
Proof.
Let groups, and a morphism of groupoids. We show the mere existence of some together with an isomorphism in the local category . By definition, morphisms in this category are homotopies, and it suffices to exhibit some . Since is a connected groupoid, there merely exists a path , and conjugation by induces an equivalence of groups,
We define to be the composite
By induction on , we show that . On the point, this is given by . On loops, we construct as follows: let , then
4.2 A 2-Category of Group Actions
Any -action comes with an associated bundle, (Definition 15). Let us define 2-categories of actions and of set bundles, and show that “taking the associated bundle” is a functorial construction.
Definition 37 (2-category of actions).
The 2-category of group actions displayed over consists of the following data:
-
For each group , objects are -actions .
-
1-cells between actions and over are equivariant maps where is as in Definition 26.
-
The type of 2-cells between and over a conjugator is .
The type of 2-cells says that 1-cells agree up to a permutation of their domain. Since it is a proposition, verifying the axioms of a displayed 2-category reduces to defining some identity- and composite 2-cells. The vertical composite of 2-cells and , is some identification . Since is an action, we define the composite as . Similarly, horizontal composition depends on 2-cells of being conjugators of group homomorphisms.
Definition 38 (set bundles).
The 2-category of set bundles, displayed over , consists of the following data:
-
Given , set bundles on are families .
-
Over , morphisms from to are dependent functions,
-
Displayed 2-cells between and over a 2-cell are dependent identifications, .
For an object in the total category, we call the base of the bundle, and its fibers.
We are now ready to show that taking the bundle associated to an action is a well-behaved functorial operation. In particular, each equivariant map of actions induces a morphism between associated bundles:
Definition 39.
Let , , and . Let and . The bundle morphism associated to has type and is defined using the induction principle of . On the point it has type and is given by . On a loop, we need to prove that for all . This reduces to , which is given by .
Both and are total categories, and is a 2-functor between their bases. We thus define a 2-functor only on the displayed parts:
Definition 40.
Taking associated bundles is a displayed 2-functor , consisting of the following data:
-
On objects, it sends a -action to its associated bundle .
-
On 1-cells, it associates to an equivariant map its morphism of bundles .
-
Over a 2-cell , a proof is sent to a homotopy of bundle maps using the induction principle of .
Both actions on 1- and 2-cells are defined by induction, and thus are equivalences in the sense of Proposition 13:
Lemma 41.
The action on 1-cells and 2-cells are equivalences of types.
Theorem 42.
Taking associated bundles is locally a weak equivalence.
Proof.
The total functor is locally fully faithful if is an equivalence, but this is a map on -types built from and , which are both equivalences by Theorems 34 and 41. Local essential surjectivity is proved similarly to Proposition 36, and uses that is an equivalence of types. The above theorem implies that the local category is the Rezk completion of . As such the 2-category should be the local univalent completion of in the sense of [6, Conjecture 5.6].
4.3 A 2-Categorical -Construction
In the previous section we have seen how containers with a single action relate to set bundles. To lift this relationship to families of actions, we introduce a 2-categorical -construction, again employing displayed machinery.
Definition 43 (2-category of families).
Let be a 2-category. The 2-category displayed over consists of the following data:
-
For , the displayed objects are families of -objects, .
-
Let and families , . The type of 1-cells displayed over some is .
-
Displayed 2-cells are a family defined by path-induction on 2-cells in :
Definition 44.
Any 2-functor lifts to a functor . This lifting is defined as a total functor over the identity 2-functor on the base .
Proposition 45.
Lifting to a 2-functor of families inherits the following properties:
-
1.
If is locally fully-faithful, so is .
-
2.
If is locally split-essentially surjective, so is .
-
3.
Assuming the axiom of choice for -sets and that is locally strict, if is locally essentially surjective, so is .
Proof.
Local fully-faithfulness follows from the pointwise definition of : if is an equivalence, then so is . Local split essential surjectivity follows from a similar pointwise argument.
In the non-split case, fix , and a 1-cell . It suffices to provide merely a family of sections, ; the conclusion follows using the induction principle of the truncation. The assumption that is locally eso yields , and we use choice to move the truncation outward: is a set, and so are (by local strictness of ) and local isomorphisms .
4.4 Action Containers as a 2-Category of Families
As promised, we define the 2-category of action containers as a 2-category of families:
Definition 46 (2-category of action containers).
The 2-category of action containers is that of families of actions, .
By algebra of - and -types, we see that the objects and 1-cells coincide with those of the 1-category of action containers (cf. Definition 25). In particular, we have for objects
and for 1-cells,
Unfolding the newly added type of 2-cells, we recover a familiar condition:
Proposition 47.
Let and denote and . Let and . The type of 2-cells is equivalent to
in which and are the maps of symmetries and positions of and , respectively.
Note the occurrence of the proposition : it has already appeared in the definition of quotient container morphisms as a quotient of premorphisms (Definition 6). In [3, Definition 4.1] it is explained as a necessary condition for labellings of container maps to be defined upto quotient. In our case it is necessary to characterize homotopies between induced bundle maps and (Lemma 41).
Lifting the 2-functor to families, we immediately obtain the following characterization of 1-cells of action containers. Substituting and , we see:
Corollary 48.
The lifting is:
-
1.
locally fully faithful
-
2.
assuming the axiom of choice, locally a weak equivalence
Proof.
By application of Proposition 45: The 2-category is locally strict, and locally a weak equivalence (Theorem 42). This says that constructively, morphisms of action containers correspond to a subcategory of morphisms of (families of) symmetric containers. By using the axiom of choice, one sees that this construction indeed covers all such morphism.
To connect action containers to symmetric ones, and not just families of the latter, note the following: Any family of set bundles (hence symmetric containers) can be combined into a single bundle: given , we can consider the bundle of fibers over the sum of bases, . This construction defines a 2-functor:
Definition 49 (summation of set bundles).
Summation of set bundles is a 2-functor , with the following data
-
1.
consists of the base , and fibers .
-
2.
is a pair of a reindexing function and a map of fibers, .
-
3.
On 2-cells, it takes a family of identities of bundle maps to an identity of their sums via function extensionality: .
The construction turning action containers into symmetric ones now factors as follows:
In general, we do not know whether is locally fully faithful or not. We can however consider its restriction to objects in the image of , and deduce fully-faithfulness for some of its local functors:
Lemma 50.
Let . If all bundles in have connected bases, then the local functor is fully faithful.
Proof.
The proof proceeds by showing that there is an equivalence of 2-cells. The assumption on connectedness is used as follows: Recall that has connected bases if all are connected groupoids. The base of the bundle is , and maps between such bases are typed . To characterize identifications of these maps, it is necessary show, given morphisms , that the function constant in is an equivalence. But this follows from connectedness of and the fact that is a proposition [20, 7.5.9].
Theorem 51.
The composite is locally fully faithful.
5 Conclusions
We introduced action containers for studying data types with symmetries. This class of containers is inspired by quotient containers, but are different from the latter in two key aspects: First, symmetries are encoded by arbitrary groups acting on positions, allowing for more freedom in presenting permutations of positions. Second, morphisms are required to respect symmetries in a coherent way, and are additionally not equivalence classes of an ad-hoc relation. Instead, the category of action containers is presented universally as a free coproduct completion of a category of groups and actions, from which limits and colimits of action containers are easy to read off. We reintroduce the relation between morphisms in terms of a 2-categorical structure, and show that the 2-category of action containers embeds into that of symmetric containers.
A missing piece in our analysis is the relationship between quotient and action containers. The latter subsume the former, but morphisms of action containers are more constrained than those of quotient containers. Finding a functorial connection is not straightforward: Each action container can be mapped to a quotient container with the same set of shapes and positions, but for each changing the group to , which is a subgroup of . Unfortunately this operation does not act on morphism , since group homomorphisms do not generally restrict to the image of the actions . When restricted to a 1-subcategory of action containers with faithful actions, this construction at least yields an isomorphism-on-objects functor . In the opposite direction, one could search for a functor between the category and the homotopy category of , i.e. the category with the same objects but with sets of morphisms obtained by set quotienting 1-cells by 2-cells. We have a candidate if we modify Definition 5 of premorphism by turning the existential quantifier in the preservation of symmetries into a dependent sum: send a quotient container to the action container with the same set of shapes and positions, but for each changing the group to the free group generated by , which also acts on , though not in a faithful way. This modification shows at least the existence of an action of morphisms. We postpone a deeper investigation in this direction to future work.
In Section 3.1 we analyzed some properties of the category of action containers. Ordinary containers enjoy further properties that make them suitable as a model of data types: Altenkirch et al. [8] show that the category of ordinary containers is cartesian closed, and Abbott et al. [3] construct initial algebras and final coalgebras of containers in one parameter. In the future, we plan to investigate whether action containers also enjoy these properties as well. From previous investigations [14], we know that direct construction of final coalgebras for quotient containers fails constructively. In [5] however, Ahrens et al. show that for any -valued container (with no restriction on truncation level of shapes or positions), its extension as a polynomial in admits a final coalgebra. Since extensions of symmetric containers are -polynomials as well, we would like to internalize this construction: first, find a symmetric container representing this coalgebra, then investigate if this restricts to the inclusion of action containers. This in particular requires studying the composition-monoidal structure of action containers. Similarly, it should be possible to lift the closure properties of Section 3.1 from the underlying 1-category to proper 2-(co)limits in .
In another direction we are interested to see if the heavy machinery of 2-categories can be avoided, or at least be postponed. This is guided by the following insight: The image on objects of the 2-functor is not only groupoids, but pointed, connected groupoids. The 2-category of such groupoids and pointed maps, displayed over is, surprisingly, locally thin [9, Lemma 4.4.12]. In other words, pointed, connected groupoids and pointed maps form a 1-category . A slight modification of the proof of Proposition 36 shows that the 1-category of ordinary groups is equivalent to , and that this equivalence extends to categories of actions. The same argument shows that the 2-category of skeletal groupoids222Those that come with a choice of basepoint for each connected component. and skeleton-preserving maps is locally thin. We believe that this extends to an equivalence between the 1-categories of action containers (without additional relation between morphisms) and skeletal symmetric containers, i.e. those whose shapes are skeletal groupoids, and whose morphisms preserve such skeleta. This would identify a structure on symmetric containers such that equality of morphisms becomes propositional, giving rise to a convenient 1-category of containers with symmetries.
References
- [1] Michael Abbott, Thorsten Altenkirch, and Neil Ghani. Categories of Containers. In Andrew D. Gordon, editor, Proc. of 6th Int. Conf. on Foundations of Software Science and Computation Structures, FoSSaCS’03, volume 2620 of Lecture Notes in Computer Science, pages 23–38. Springer Berlin Heidelberg, 2003. doi:10.1007/3-540-36576-1_2.
- [2] Michael Abbott, Thorsten Altenkirch, and Neil Ghani. Containers: Constructing strictly positive types. Theoretical Computer Science, 342(1):3–27, 2005. doi:10.1016/j.tcs.2005.06.002.
- [3] Michael Abbott, Thorsten Altenkirch, Neil Ghani, and Conor McBride. Constructing Polymorphic Programs with Quotient Types. In Dexter Kozen and Carron Shankland, editors, Proc. of 7th Int. Conf. on Mathematics of Program Construction, MPC’04, volume 3125 of Lecture Notes in Computer Science, pages 2–15. Springer Berlin Heidelberg, 2004. doi:10.1007/978-3-540-27764-4_2.
- [4] Jiří Adámek and Jiří Rosický. How nice are free completions of categories? Topology and its Applications, 273:106972, 2020. doi:10.1016/j.topol.2019.106972.
- [5] Benedikt Ahrens, Paolo Capriotti, and Régis Spadotti. Non-Wellfounded Trees in Homotopy Type Theory. In Thorsten Altenkirch, editor, Proc. of 13th Int. Conf. on Typed Lambda Calculi and Applications, TLCA’15, volume 38 of LIPIcs, pages 17–30. Schloss Dagstuhl, 2015. doi:10.4230/LIPICS.TLCA.2015.17.
- [6] Benedikt Ahrens, Dan Frumin, Marco Maggesi, Niccolò Veltri, and Niels van der Weide. Bicategories in univalent foundations. Mathematical Structures in Computer Science, 31(10):1232–1269, 2021. doi:10.1017/s0960129522000032.
- [7] Benedikt Ahrens and Peter LeFanu Lumsdaine. Displayed Categories. Logical Methods in Computer Science, 15(1), March 2019. doi:10.23638/lmcs-15(1:20)2019.
- [8] Thorsten Altenkirch, Paul Blain Levy, and Sam Staton. Higher-Order Containers. In Fernando Ferreira, Benedikt Löwe, Elvira Mayordomo, and Luís Mendes Gomes, editors, 6th Conf. on Computability in Europe, CiE’10, volume 6158 of LNCS, pages 11–20. Springer, 2010. doi:10.1007/978-3-642-13962-8_2.
- [9] Marc Bezem, Ulrik Buchholtz, Pierre Cagne, Bjørn Ian Dundas, and Daniel R. Grayson. Symmetry. https://github.com/UniMath/SymmetryBook. Commit: 8546527.
- [10] Håkon Robbestad Gylterud. Symmetric Containers. Master’s thesis, Department of Mathematics, Faculty of Mathematics and Natural Sciences, University of Oslo, 2011. URL: https://hdl.handle.net/10852/10740.
- [11] Ryu Hasegawa. Two applications of analytic functors. Theoretical Computer Science, 272(1–2):113–175, February 2002. doi:10.1016/s0304-3975(00)00349-2.
- [12] Pieter Hofstra and Martti Karvonen. Inner automorphisms as 2-cells. Theory and Applications of Categories, 42(2):19–40, 2024. URL: http://www.tac.mta.ca/tac/volumes/42/2/42-02abs.html.
- [13] Niles Johnson and Donald Yau. 2-Dimensional Categories. Oxford University Press, January 2021. doi:10.1093/oso/9780198871378.001.0001.
- [14] Philipp Joram and Niccolò Veltri. Constructive Final Semantics of Finite Bags. In Adam Naumowicz and René Thiemann, editors, Proc. of 14th Int. Conf. on Interactive Theorem Proving, ITP’23, volume 268 of LIPIcs, pages 12:1–12:19. Schloss Dagstuhl, 2023. doi:10.4230/LIPICS.ITP.2023.20.
- [15] André Joyal. Foncteurs analytiques et espèces de structures. In Gilbert Labelle and Pierre Leroux, editors, Combinatoire énumérative, volume 1234 of Lecture Notes in Mathematics, pages 126–159. Universite du Quebec a Montreal, Springer Berlin Heidelberg, May 1986. doi:10.1007/bfb0072514.
- [16] Daniel R. Licata and Eric Finster. Eilenberg-MacLane spaces in homotopy type theory. In Thomas A. Henzinger and Dale Miller, editors, Proc. of the Joint Meeting of the 23rd EACSL Ann. Conf. on Computer Science Logic (CSL) and the 29th Ann. ACM/IEEE Symp. on Logic in Computer Science (LICS), CSL-LICS’14, pages 66:1–66:9. ACM, 2014. doi:10.1145/2603088.2603153.
- [17] Max New, Steven Shaefer, and contributors. cubical-categorical-logic, 2024. URL: https://github.com/maxsnew/cubical-categorical-logic.
- [18] Andrew M. Pitts. Nominal sets. Number 57 in Cambridge Tracts in Theoretical Computer Science. Cambridge University Press, 2013.
- [19] The agda/cubical development team. The agda/cubical library, 2018. URL: https://github.com/agda/cubical/.
- [20] The Univalent Foundations Program. Homotopy Type Theory: Univalent Foundations of Mathematics. https://homotopytypetheory.org/book, Institute for Advanced Study, 2013.
