Univalent Double Categories

Category theory is a branch of mathematics that provides a formal framework for understanding the relationship between mathematical structures. To this end, a category not only incorporates the data of the desired objects, but also"morphisms", which capture how different objects interact with each other. Category theory has found many applications in mathematics and in computer science, for example in functional programming. Double categories are a natural generalization of categories which incorporate the data of two separate classes of morphisms, allowing a more nuanced representation of relationships and interactions between objects. Similar to category theory, double categories have been successfully applied to various situations in mathematics and computer science, in which objects naturally exhibit two types of morphisms. Examples include categories themselves, but also lenses, petri nets, and spans. While categories have already been formalized in a variety of proof assistants, double categories have received far less attention. In this paper we remedy this situation by presenting a formalization of double categories via the proof assistant Coq, relying on the Coq UniMath library. As part of this work we present two equivalent formalizations of the definition of a double category, an unfolded explicit definition and a second definition which exhibits excellent formal properties via 2-sided displayed categories. As an application of the formal approach we establish a notion of univalent double category along with a univalence principle: equivalences of univalent double categories coincide with their identities


Introduction
Double categories [13] are a categorical concept that captures more structure than a category.They are often succinctly defined as an internal (pseudo)category in the 2-category of categories.A double category has objects, two kinds of morphisms -called vertical and horizontal, respectivelyand fillers for squares formed from horizontal and vertical morphisms.As such, a double category can capture two different kinds of morphisms (and their interplay) between mathematical objects.
Many mathematical objects are better understood within a double category than within a category; for instance, the double category of sets, functions, and relations.The objects of this double category are sets  , the vertical morphisms   are functions   , the horizontal morphisms   are relations, i.e. subsets of  ×  .Considering this double category allows one to generalize classical set theory (largely overlapping with the generalization given by topos theory).Similarly, one can also consider the double category of categories, functors, and profunctors, and this has been used to great success to generalize category theory [33].
Applications of double categories have become ubiquitous in mathematics and computer science; see, for instance, its applications in systems theory [5,10,22] and programming languages theory [12,23].
In the present work we develop the notion of univalent double category and a library of univalent double categories in univalent foundations.Our main result states that the bicategory of univalent double categories is univalent.As a consequence, the type of identities  =  between univalent double categories  and  coincides with the type  ≃  of equivalences from  to .The proof of this result relies crucially on Voevodsky's univalence axiom.The result entails that any construction on univalent double categories can be transported across equivalences -an instance of the univalence principle [3].
Double categories consist of a lot of data (see Section 2), and morphisms of double categories -and morphisms between these morphisms -need to preserve that structure suitably.In other words, the bicategory of double categories is quite complicated.For this reason, a naïve, brute-force approach to proving univalence of this bicategory would lead to difficult proofs.Instead, we develop technology to build the bicategory of double categories in layers, using displayed bicategories [1].We then prove every layer univalent, and obtain that their "total bicategory" -which is the desired bicategory of univalent double categories -is univalent, by a result from [1].The key layer we consider in this approach is the layer of "2-sided displayed categories".These gadgets are a simple variation on the notion of displayed category [2].Through their use, we derive a modular proof of univalence of the bicategory of univalent double categories; in particular, we can reuse an existing proof of univalence of univalent categories from [1].
Building the bicategory of univalent double categories in a layered way also gives rise to an interesting characterization of equivalences of double categories.In Section 7, we show that a double functor between univalent double categories is an adjoint equivalence if it is a strong double functor and an adjoint equivalence on the underlying 2-sided displayed category.

UniMath
In this section we provide a brief introduction to univalent foundations and UniMath, and fix notations used throughout the paper.By univalent foundations, we mean Martin-Löf type theory (MLTT) plus Voevodsky's univalence axiom.We use standard notation for the type and term formers of MLTT; in particular, we write  =  for the type of identifications/equalities/paths from  to .
Crucially, we rely on the notion of homotopy level, and, in particular, the notions of proposition and set of univalent foundations: a type  is a proposition if ,:  =  is inhabited, and a set if the type  =  is a proposition for all ,  :  .Hence, despite working in Coq, we do not rely on the universes Prop or Set.
We do not rely on any inductive types other than the ones specified in the prelude of UniMath, such as identity types, sum types, natural numbers, and booleans.
Our key result, the univalence principle for univalent double categories, relies on the univalence principle for types, also known as Voevodsky's Univalence Axiom.This axiom is added to Coq as a postulate in UniMath.

Related Work
Double categories have been formalized in several computer proof assistants.
Murray, Pronk, and Szyld [21] worked towards defining double categories in the Lean proof assistant.The chosen approach is to define double categories as category objects in the category of categories.The corresponding pull request 1  to the mathlib library seems to have been abandoned.
Hu and Carette [16] started a library of category theory in Agda.At the time of writing that article, "[. . .] double categories [. . .] are still awaiting" formalization.In the meantime, 1 https://github.com/leanprover-community/mathlib/pull/18204the definition of double categories, as well as the construction of the dual of a double category (swapping horizontal and vertical morphisms), have been implemented. 2n Section 2, we give a more detailed comparison between the different notions of double category mentioned here.

Computer Formalization
The formalization accompanying this paper is based on the UniMath library [34], a library of computer-checked mathematics in the univalent style.UniMath itself is based on the Coq proof assistant.
Our code has been integrated in the UniMath library in commit 9e43b0d.From this commit, we compiled an HTML documentation of UniMath; throughout this article we include links to this documentation, as in disp_bicat.The interested reader can type-check our definitions by following the compilation instructions of the UniMath library.

Synopsis
In Section 2 we informally review and motivate the notion of double category, and give an elementary, unfolded definition.The unfolded definition is easy to understand, but proving a univalence principle for it directly would be tough.For this reason, we introduce, in Section 3, the notion of 2-sided displayed categories; we use these in Section 5 to build a bicategory of displayed categories that does not make use of the elementary definition.To prepare for this construction, we review the notion of displayed bicategory in Section 4. In Section 6 we construct several examples of univalent double categories.In Section 7 we give a characterization of adjoint equivalences, and of invertible 2-cells, in the bicategory of univalent double categories -that is, of equivalences of double categories and of invertible transformations between functors of univalent double categories.

Double Categories
In this section, we give a brief overview of the theory of double categories.Intuitively, a double category is a category with an extra class of morphisms.Morphisms in one class of morphisms is called vertical morphisms, and morphisms in the other class are called horizontal morphisms.We see horizontal morphisms as "extra" morphisms, and for those, the laws do not hold up to equality (see Remark 2.1).We denote the vertical morphisms by  1  2 and the horizontal morphisms by  .In addition, any double category features a collection of squares, parametrized by a boundary consisting of two horizontal and two vertical morphisms with "compatible" endpoints as follows: Such squares are also denoted as  1 For both the horizontal and the vertical morphisms we have identities and compositions.However, there is an essential difference between the two classes of morphisms: laws for the vertical morphisms hold up to equality, whereas the laws of horizontal morphisms hold up to a square.Concretely, this means that we have unitor and associator squares that witness the unitality and associativity of horizontal composition.In addition, this data is coherent: we also require the triangle and pentagon equation for this data.
Remark 2.1.The notion of double category comes in several flavors.For example, there is the notion of strict double category, and in those, unitality and associativity of composition holds as an equality.However, in the remainder of this paper, we look at pseudo double categories, and in those, composition of horizontal morphisms is only weakly unital and associative.Pseudo double categories are a useful generalization of strict double categories.Some examples, such as spans (Example 6.3) and structured cospans (Example 6.4), are pseudo double categories, but not strict ones.Double categories play a prominent role in applied category theory.For example, Clarke defined a double category of lenses [9], and lenses have become an important tool in the study of databases and datatypes; see, e.g., [7].In addition, Baez and Master [6] defined a double category of Petri Nets, which are used in the study of parallel programs [18] and modeling hardware [24].Baez and Courser defined a double category of structured cospans and of decorated cospans [4,14], which are used to model open systems.
There are several approaches to defining the notion of double category, and each comes with their own merits and drawbacks.The most concise definition is that a double category is a pseudocategory internal to the bicategory of categories.While this definition is clean and short, its drawback is that composition is described using pullbacks, which makes it more cumbersome to work with.More concretely, let us assume we have two categories C  and C  together with functors , : C  C  .If we were to use this definition, then a horizontal arrow from  : C  to  : C  would consist of an object ℎ : C  together with isomorphisms  (ℎ)  and  (ℎ) .In addition, the composition operation for horizontal arrows would take three objects , ,  : C  , two horizontal arrows ℎ,  : C  and isomorphisms  (ℎ) ,  (ℎ) ,  () , and  () , and it returns a horizontal arrow ℎ •  : C  together with isomorphisms  (ℎ • )  and  (ℎ • ) .
Remark 2.2.Note that one could also look at categories internal to a 1-category instead of a bicategory.By looking at categories internal to the 1-category of strict categories, one obtains yet another notion of double category.This approach is taken in Lean [20,21], where pullbacks are used directly, and in 1lab [30], where pullbacks are avoided by looking at the internal language of a presheaf category.However, this approach comes with a significant limitation: by looking at strict categories, one loses examples such as spans in Set (Example 6.3), and the square construction for univalent categories (Example 6.1).Note that if one assumes uniqueness of identity proofs, then internal categories in the 1-category of strict categories corresponds to strict double categories as discussed in Remark 2.1.
We can avoid pullbacks by going for an unfolded definition, which looks as follows: This data is required to satisfy several laws, stating, in particular, that horizontal identities and horizontal composition are functorial, and that the left unitor, right unitor, and associator are natural transformations.In addition, we have the triangle and pentagon law.Their description can be found in Fig. 1 and Fig. 2.
To formulate the laws in Definition 2.3, one needs to use transports.The necessity of these transports come from the laws of the squares.For example, if we compose a square  :  ℎ   with the identity square, then we should get the original square  back.However, the square  • sq id  sq () has different sides than , because the the top and bottom sides of  • sq id  sq () are composed with identities.As such, we need the laws for vertical composition in order to state the laws for composition of squares.
Remark 2.4.Strict double categories can also be defined in an unfolded style.One can do so by slightly modifying Definition 2.3: we add the requirement that the horizontal morphisms form a set and that the unitors and associators are identities.Such an approach is used in the Agda-categories library [16].
However, Definition 2.3 is still unsatisfactory for our purposes.Many notions from double category theory can be derived from the bicategory DoubleCat of double categories.For example, equivalences of double categories are the same as adjoint equivalences in DoubleCat [28], monoidal double categories are the same pseudomonoids in DoubleCat [4], and fibrations of double categories are the same as internal Street fibrations [11].For this reason, DoubleCat plays a prominent role in double category theory.
Since we are working in univalent foundations, we would also like a notion of univalence for double categories and a univalence principle for them.This principle can be formulated by saying that DoubleCat is a univalent bicategory.All in all, our goals in this paper are • to define the notion of univalent double category; • to define the bicategory DoubleCat of double categories; • to prove that DoubleCat is a univalent bicategory.
The unfolded definition from Definition 2.3 poses several complications for our purposes.More specifically, proving that DoubleCat is univalent, would become unfeasible.This is because we are forced to consider the identity type of double categories, which is rather complicated.However, by using displayed bicategories [1], one can give a simpler proof that DoubleCat is univalent.Intuitively, the idea is to break up the definition into smaller layers.The identity type of each of these layers is simpler, and that simplifies the proof of univalence.This is the basic philosophy behind the definition of double category that we describe in the remainder of this paper.More specifically, we take the following steps: • We define the notion of 2-sided displayed categories in Section 3.With 2-sided displayed categories, we can describe categories with an additional class of morphisms and squares.• In Section 5, we describe the bicategory of double categories.We start by defining the displayed bicategory of 2-sided displayed categories, and step-by-step we add data and properties to acquire double categories.For example, in Definition 5.5, we add horizontal identities to the structure, and in Definition 5.8, we add a horizontal composition operation.Simultaneously, we prove that the resulting bicategory is univalent.Another advantage of our approach is that we can use it to construct adjoint equivalences and invertible 2-cells of double categories.We describe this process in Section 7.

2-Sided Displayed Categories
The notion of displayed categories was developed by Ahrens and Lumsdaine [2].Displayed categories are useful for various purposes, and among those are defining the notion of Grothendieck fibration and modularly defining univalent categories.Intuitively, a displayed category represents structure/property of objects and morphisms in some category C. Displayed categories consist of a type family of displayed objects parametrized by the objects of C, and a family of sets of displayed morphisms parametrized by the morphisms in C and displayed objects.For example, we have a displayed category of group structures over the category of sets.The displayed objects over a set  are group structures on  , and the set of displayed morphisms over  :   from a group structure   over  to a group structure   over  are proofs that  preserves the group operations.
In this section, we define 2-sided displayed categoriesa variation of the notion of displayed categories.The difference between 2-sided displayed categories and displayed categories is that displayed categories depend on one category, whereas 2-sided displayed categories depend on two categories.Note that 2-sided displayed categories share many purposes with displayed categories: they can be used to define univalent categories in a modular way, and they can be used to define 2-sided fibrations [19,29].However, in this paper we view 2-sided displayed categories in another way, namely as an extra class of morphisms on a category.
such that the following equations hold.

for all 𝑓 : 𝑥
, and ℎ : Here we use the notation = * to represent a dependent equality, i.e. a path between an element  1 :  ( 1 ) and  2 :  ( 2 ) such that  1 =  2 .Note that the laws in Items 5 and 6 in Definition 3. We also define the projection functors  D 1 : ∫ D C 2 to be the functors that take the first and second coordinate of a triple, respectively.Note that every 2-sided displayed category D over C 1 and A morphism from  1 −  2 over  and  consists of a morphism ℎ :  1  2 such that the following diagrams commute.
Example 3.6 (twosided_disp_cat_of_struct_cospans).Suppose that we have a functor  : C 1 C 2 .We define the 2-sided displayed category StructCospan() over C 1 and C 1 : • The objects over  and  are structured cospans from  : C 1 to  : C 1 , that is to say, an object  : C 2 together with morphisms () • Given two structured cospans ( 1 ) Then we define a 2-sided displayed category Lens() over C and C as follows.
• The displayed objects over  and  are lenses from  to . • Given morphisms  1 :  1  2 and  2 :  1  2 and lenses  1 from  1 to  1 and  2 from  2 to  2 , the displayed morphisms from  1 to  2 over  1 and  2 are proofs that Our next goal is to define univalent 2-sided displayed categories.To do so, we take the same approach as for categories and for displayed categories.We first define the notion of isomorphism, and we prove that the identity is an isomorphism.With that in place, we obtain a map that sends equalities of displayed objects to isomorphisms, and univalence is formulated by saying that this map is an equivalence of types.
Note that in the formalization, the definition of univalence is equivalent, but formulated slightly differently.In Definition 3.11, we only look at paths  :  =  between displayed objects lying over the same objects in the base, whereas in the formalization, we also take paths in the base into account.Each of the 2-sided displayed categories from Examples 3.3 to 3.7 is univalent.Recall that every 2-sided displayed category gives rise to a span of categories.Hence, by Proposition 3.12, every univalent 2-sided displayed category D over C 1 and C 2 gives rise to a span C 1 C 2 of univalent categories.To end this section, we define the notions of 2-sided displayed functors and 2-sided displayed natural transformations.These play a prominent role when we define the bicategory of double categories in Section 5. ( 1 ( 1 ), 2 ( 2 ) )  () such that the usual naturality condition holds.

A Recap on (Displayed) Bicategories
Our next goal is to construct the bicategory of double categories.To do so, we recall in this section the definitions and propositions that we use in the remainder of this paper.These definitions were originally introduced in [1], and full definitions can be found there.Recall that a bicategory not only has objects and morphisms, but also 2-cells.The notion of displayed bicategory is similar to that of displayed category.In addition, there should be suitable identities, composition, unitors, and associators, and the usual coherence laws should be satisfied.
There are numerous examples of displayed bicategories and they are discussed in [1], and we quickly recall the ones that we need in Section 5.If we have displayed bicategories D 1 and D 2 over B, then we have a displayed bicategory D 1 × D 2 over D whose displayed objects, 1-cells, and 2-cells are pairs of displayed objects, 1-cells, and 2-cells of D 1 and D 2 respectively.The full subbicategory can also be defined using a displayed bicategory: if we have a predicate  on the objects of a bicategory B, then we define a displayed bicategory over B whose displayed objects over  are proofs of  (), and whose displayed 1-cells and 2-cells are inhabitants of the unit type.
Every displayed bicategory gives rise to a total bicategory.Definition 4.2 (total_bicat).Given a displayed bicategory D over B, we define its total bicategory as the bicategory whose objects are given by pairs of objects  : B and  : D  .The 1-cells and 2-cells are defined similarly.
Univalent bicategories are defined in a similar way as univalent categories, but there is a slight difference.For categories, univalence is expressed by saying that identity of objects is equivalent to isomorphisms between objects.For bicategories on the other hand, we formulate univalence in two steps.First of all, we say that identity of 1-cells is equivalent to invertible 2-cells between them.This is called local univalence in [1].Secondly, we say that identity of objects is equivalent to adjoint equivalences between them.In [1], this is called global univalence.Then a univalent bicategory is a bicategory that is both locally and globally univalent.Similarly, we define univalent displayed bicategories.The key theorem for univalent displayed bicategories is the following.One key application of univalence for bicategories, is equivalence induction.More specifically, to prove some property for every invertible 2-cell, it suffices to only consider identity 2-cells.Similarly, to prove some property for every adjoint equivalence, one only has to show it for identity equivalences.This is similar to path induction in homotopy type theory [26,31].Proposition 4.4 (J_2_0).Let B be a univalent bicategory, and suppose that for all objects ,  : B, we have a predicate  on adjoint equivalences  ≃ .Then  holds for every adjoint equivalence if  holds for id  :  ≃  for every  : B. Proposition 4.5 (J_2_1).Let B be a univalent bicategory, and suppose that for all objects ,  : B and 1-cells  ,  :  , we have a predicate  on invertible 2-cells  .Then  holds for every invertible 2-cell if  holds for id  :   for every  :  .

The Bicategory of Double Categories
In this section, we define the bicategory of univalent double categories, and we prove that this bicategory is univalent.The notion of displayed bicategory plays a key role in this construction [1].The construction proceeds in several steps.We start in Definition 5.1 by defining a displayed bicategory TwoSidedDisp d over the bicategory UnivCat of univalent categories, and the objects over C are 2-sided displayed categories D over C and C. If we look at the total bicategory TwoSidedDisp of this displayed bicategory, then the objects consists of a category C and a 2-sided displayed D over C and C.This means that we have a category with an extra class of morphisms and a class of squares.
To obtain a the bicategory of double categories, we need to add more structure.We define two displayed bicategories HorId d and HorComp d over TwoSidedDisp in Definition 5.5 and Definition 5.8.The displayed bicategory HorId d adds horizontal identities to the structure, and HorComp d adds horizontal compositions.By taking their product and the total bicategory, we obtain the bicategory HorIdComp, of which the objects consists of a category, horizontal morphisms, squares, horizontal identities, and compositions.
Next we define displayed bicategories Lun d , Run d , and Assoc d over HorIdComp.These add the left unitor, the right unitor, and the associator to the structure.Again we take their product and the total bicategory to obtain the bicategory UnAssoc.Finally, we define DoubleCat as a full subbicategory of UnAssoc: the predicate we use, expresses the triangle and pentagon coherence.
At each step, we prove that the relevant displayed bicategories are univalent.The machinery of displayed bicategories allows us to combine all of this to conclude that DoubleCat is univalent.The advantage of using displayed bicategories over a direct approach is that the proof of univalence becomes simpler and more modular.This is because the displayed approach allows us to consider the identity of each part individually, and we are able to reuse results (e.g., the bicategory of univalent categories is univalent).
The main idea behind this construction is that we can split up the definition of a double category into several layers.Instead of looking at the whole, we look at these layers separately, and that allows for reusability and modularity.This is also why the notion of 2-sided displayed category plays an important role in this construction: it is one of the layers to define double categories. ( 1 , 2 ) .The vertical identity and composition for squares is given by the identity and composition in D, respectively, and similarly for the laws involving vertical composition of squares.Proposition 5.2 (univalent_2_twosided_disp_cat).The displayed bicategory TwoSidedDisp d is univalent.

Identities and Composition
Next we add horizontal identities (Items 3 and 8 in Definition 2.3 and composition (Items 4 and 9 in Definition 2.3), in the form of two displayed bicategories over TwoSidedDisp.
To define the first one, we define when a 2-sided displayed category supports horizontal identities.
We also define when a 2-sided displayed functor preserves horizontal identities.Definition 5.4 (double_functor_hor_id).Let D be a 2-sided displayed category over C and C and let D ′ be a 2-sided displayed category over C ′ and C ′ .Suppose that we have a functor  : C C ′ and a 2-sided displayed functor  from D to D ′ over  and  , and that D and D ′ have horizontal identities.Then we say that  preserves horizontal identities if for all  : C 1 we have a natural square  id () : id D ′ h ( ()) (id  ( ) ,id  ( ) )  (id D h ()).
The precise naturality condition for the square can be found in the formalization.In addition, note that we consider lax double functors: we do not require  id () to be invertible.Definition 5.5 (disp_bicat_twosided_disp_cat_hor_id).We define the displayed bicategory HorId d over TwoSidedDisp as follows: • the displayed objects over a pair of a univalent category C and a univalent 2-sided displayed category D are horizontal identities for D (Definition 5.3); • the displayed 1-cells over a functor  : C 1 C 2 and 2-sided displayed functor  from D 1 to D 2 that preserve horizontal identities (Definition 5.4); • the displayed 2-cells over a natural transformations  : ⇒  and a 2-sided displayed natural transformation  are proofs that  preserves horizontal identities.The precise formulation can be found in the formalization.
Next we look at horizontal compositions.We define HorIdComp d to be HorId d ×HorComp d , and we define HorIdComp to be the total bicategory of HorIdComp d .Proposition 5.9 (disp_univalent_2_disp_bicat_twos ided_disp_cat_id_hor_comp).The displayed bicategory HorIdComp d is univalent.

Unitors and Associators
At this point, we obtained the bicategory HorIdComp, and the objects of that bicategory consists of a univalent category C, a univalent displayed D over C and C, together with horizontal identities (Definition 5.3) and horizontal compositions (Definition 5.6).This corresponds to Items 1 to 9 in Definition 2.3 and now we look at Items 10 to 12 from Definition 2.3.For each of these, we define a displayed bicategory over HorIdComp.Due to space constraints, we only say how the displayed objects of those displayed bicategories are defined.
Definition 5.10 (disp_bicat_lunitor).We define a displayed bicategory Lun d over HorIdComp whose displayed objects over a univalent category C and a univalent 2-sided displayed category D with horizontal identities and compositions consists of a natural isomorphism id D h () ⊙ ℎ (id  ,id  ) ℎ for each ℎ : D (,) .Definition 5.11 (disp_bicat_runitor).We define a displayed bicategory Run d over HorIdComp whose displayed objects over a univalent category C and a univalent 2-sided displayed category D with horizontal identities and compositions consists of a natural isomorphism ℎ ⊙ id D h () (id  ,id  ) ℎ for each ℎ : D (,) .Definition 5.12 (disp_bicat_lassociator).We define a displayed bicategory Assoc d over HorIdComp whose displayed objects over a univalent category C and a univalent 2-sided displayed category D with horizontal identities and compositions consists of a natural isomorphism for all ℎ 1 : D (, ) , ℎ 2 : D (,) , and ℎ 3 : D (, ) .
We define UnAssoc d to be Lun d × Run d × Assoc d , and we define UnAssoc to be the total bicategory of UnAssoc d .Proposition 5.13 (is_univalent_2_bicat_unitors_and_assoc iator).The displayed bicategory UnAssoc d is univalent.Definition 5.14 (bicat_of_double_cats).We define the bicategory DoubleCat of double categories as the full subbicategory where the predicate expresses that the triangle and pentagon laws are satisfied.The objects of DoubleCat collect all the data and properties mentioned in this section.Each of these data and properties correspond to some part of Definition 2.3.For that reason, we can conclude that these two definitions of double categories are actually equivalent.Theorem 5.16 (double_cat_weq_univalent_doublecategor y).The type of objects of DoubleCat is equivalent to the type of double categories as defined in Definition 2.3.
Remark 5.17.Notice the unfolded definition in Definition 2.3 does not include a univalence condition, as we characterize univalent double categories as the ones for which the corresponding 2-sided displayed category under the equivalence given in Theorem 5.16 is univalent in the sense of Definition 3.11.
The 1-cells in DoubleCat are lax double functors.They consist of an underlying functor and 2-sided displayed functor that preserve horizontal identities and compositions as described in Definitions 5.4 and 5.7.Finally, every 2-cell in DoubleCat has an underlying natural transformation and 2-sided displayed natural transformation.
Remark 5.18.Note that the double categories in DoubleCat are univalent, and this univalence condition means that the underlying category and 2-sided displayed category are univalent.From this, we see that objects in DoubleCat are the same as pseudocategories internal to the bicategory of univalent categories.
In [3, Example 9.3], a notion of univalent double bicategory is defined such that identities correspond to gregarious equivalences of double bicategories.In the particular case where the underlying bicategory given by objects, vertical morphisms and squares is a category (meaning the 1-morphisms form a set and the assignment from identities of 1-morphisms to 2-morphisms is an equivalence), our notion of univalence coincides with the notion introduced in [3].

Examples of Double Categories
Now we construct several examples of double categories using Definition 5.14.All of the double categories considered here are univalent.Example 6.1 (square_double_cat).Let C be a univalent category.In Example 3.3, we defined the 2-sided displayed category Arr(C) over C and C.This gives rise to a double category as follows.
• the horizontal identities are given by the identity morphism; • horizontal composition is given by the composition of morphisms.
The unitality and associativity of horizontal composition reduce to the ordinary laws of composition for morphisms.All laws involving squares hold because the type of morphisms in a category is a set.
Example 6.2 (kleisli_double_cat). Let  be a monad on a univalent category C. In Example 3.4, we defined the 2sided displayed category Comma(, ) for arbitrary functors  : C 1 C 3 and  : C 2 C 3 .We take  to be the identity on C and  to be the endofunctor underlying  .Concretely, we look at Comma(id C , ), meaning that the horizontal morphisms are morphisms in the Kleisli category of  .We obtain the following double category.
• the horizontal identities are given by the unit of  ; • given morphisms ℎ :   () and  :   (), their horizontal composition is defined as the following composition The construction of the unitors and associators for this double category reduces to proving unitality and associativity of composition in the Kleisli category.
One way to instantiate Example 6.2 is by taking C to be Set and  to be the power set monad.Note that morphisms from  to  in the Kleisli category of the power set monad are the same as relations between  and  .Hence, the resulting double category has functions as vertical morphisms, and relations as horizontal morphisms.
Note that both Examples 6.1 and 6.2 are strict double categories.In both cases, the type of horizontal morphisms is a set and unitality and associativity for horizontal composition holds up to equality.Example 6.3 (spans_double_cat).Let C be a univalent category with pullbacks.We defined the 2-sided displayed category Span(C) in Example 3.5.This gives rise to a double category.
• The horizontal identity on an object  : C is given by the span • Suppose that we have spans  1 Their composition is given by the following span Here  is the pullback of  1 and  2 .
To construct the right unitor of this double category, we consider the following diagram The square in this diagram is a pullback, and from this, we get the desired isomorphism for the right unitor.Similarly, we can define the left unitor and the associator.The proofs of the triangle and pentagon laws follow by diagram chasing, and details can be found in the formalization.Example 6.4 (structured_cospans_double_cat).Suppose that we have a functor  : C 1 C 2 between univalent categories and suppose that C 2 has pushouts.In Example 3.6 we defined the 2-sided displayed category StructCospan() over C 1 and C 1 of structured cospans.This gives rise to a double category.
• The horizontal identity on an object  : C 1 is given by the cospan • The construction of the horizontal composition is dual to how horizontal composition is defined in Example 6.3.
Example 6.5 ([27], lenses_double_cat).Let C be a univalent category with chosen binary products.Then we define the double category of lenses of C as follows.In Example 3.7, we defined the 2-sided displayed category Lens(C).We construct a double category from it as follows.
• The identity lens from  : C to  : C is given by id  :   and  1 :  ×  .Note that there are different gadgets called "lenses" in the literature.The lenses by Clarke [9,Def. 3.20] are, more specifically, "delta lenses".The double category of delta lenses has, as objects, (small) categories, as horizontal morphisms functors between categories, and vertical morphisms delta-lenses, that is, functors equipped with an extra "lifting operation"see [9, Def.2.1] for details.Squares are suitable commutative squares of functors.

Equivalences of Double Categories
In this section, we give sufficient conditions to show that a 1-cell in DoubleCat is an adjoint equivalence (Theorem 7.3), and that a 2-cell in DoubleCat is invertible (Theorem 7.1).Since these proofs are similar, we only discuss how Theorem 7.3 is proven.Let us first give conditions for when a 2-cell in DoubleCat is invertible.
Theorem 7.1 (invertible_double_nat_trans_weq).Let  be a 2-cell in DoubleCat.Then  is an invertible 2-cell if and only if its underlying natural transformation and 2-sided displayed natural transformation are pointwise isomorphisms.
To characterize adjoint equivalences, we need the notion of a strong double functor.Definition 7.2 (is_strong_double_functor).Let  be a lax double functor.We say that  is a strong double functor if  id () and  comp (ℎ, ) are isomorphisms for all suitably typed , ℎ, and .

Theorem 7.3 (adjoint_equivalence_double_functor_weq).
Let  : C 1 C 2 be a 1-cell DoubleCat.Then  is an adjoint equivalence if and only if  is a strong double functor and  is an adjoint equivalence in TwoSidedDisp.
We give a sketch of our proof of Theorem 7.3; it follows the construction of TwoSidedDisp in Section 5.As such, we first show that  lifts to an adjoint equivalence in HorIdComp, then we show that  lifts to an adjoint equivalence in UnAssoc, and finally, we conclude that  gives rise to an adjoint equivalence in DoubleCat.
Next we show that  lifts to an adjoint equivalence in HorIdComp, and to do so, we construct a displayed adjoint equivalence over  in both HorId d and HorComp d .We simplify this construction by using induction over adjoint equivalences (Proposition 4.4) for which we use that the bicategory HorComp d is univalent.Intuitively, this allows us to assume that  is the identity equivalence.More concretely, we show the following.id  for each .Then  is a displayed adjoint equivalence if  () is an isomorphism for every .
In our situation, the assumption in Lemma 7.4 follows from the fact that  preserves the identity up to isomorphism.Similarly, we can construct a displayed adjoint equivalence over  in HorComp d , and this gives us the adjoint equivalence in HorIdComp.
To lift  to an adjoint equivalence in UnAssoc, we need to construct displayed adjoint equivalences over  in Lun d , Run d , and Assoc d .Note that each of these displayed bicategories live over HorIdComp.Again we use Proposition 4.4, so we assume that  is the identity.Constructing the displayed adjoint equivalences then follows from diagram chasing, and the precise proof can be found in the formalization.
To conclude Theorem 7.3, we note that DoubleCat is defined as a full subbicategory of UnAssoc.Since adjoint equivalences in full subbicategories of some bicategory B are the same as adjoint equivalences in B, we get the desired adjoint equivalence in DoubleCat.
For the converse, we first note that whenever  is an adjoint equivalence DoubleCat, then  is an adjoint equivalence in TwoSidedDisp.This is because pseudofunctors preserve adjoint equivalence.To show that  is a strong double functor, we use Proposition 4.4, so it suffices to show that the identity is a strong double functor.This follows from the fact that the identity is an isomorphism.
Note that Shulman proves Theorem 7.3 for framed bicategories in a different way [28,Corollary 7.9].Whereas our proof follows the construction of DoubleCat via displayed bicategories and makes use of induction over adjoint equivalences, Shulman's proof makes use of fully faithful and essentially surjective strong double functors.

Formalizing Weak Double Categories
In Section 5 we constructed the univalent bicategory of univalent double categories, establishing that identities in the type of objects capture the data of equivalences of double categories.This is a direct continuation of [1], where the authors constructed the univalent bicategory of univalent categories.However, while the notion of equivalence of categories is established and consistent throughout the literature, there are several relevant notions of equivalences of double categories, resulting in several relevant univalence principles.
In this work we focused on equivalences coming from pseudo-double category theory, known as vertical equivalences, following conventions in [15, Section 3.5.5]or [17,Proposition 12.3.21].In this approach the definition of equivalence depends on a choice of direction in which the double categorical data is assumed to be strict (in our case the vertical direction, whereas, for example in [15, Section 3.5.5], the horizontal direction).
On the other side, there is another important notion of equivalence of double categories in the literature, known as gregarious equivalences of double categories [8, Slide 16], which is symmetric and does not come from categorical equivalences in either direction 3 .This necessitates a formalization of double categorical structures that are non-strict in both the horizontal and vertical direction.
In future work, we define and then formalize weak double categories (Definition 8.1), building on Verity's work on double bicategories [33,Definition 1.4.1].We then build on our understanding of the univalence principle [3] to define and study univalent weak double categories (Definition 8.3) and establish a univalence principle for gregarious equivalences [25,Slide 20].This illustrates how the structural features and the chosen strictness of the formalization directly correlates with its equivalences and univalence principle.We can already witness this phenomenon in [1], where the authors formalize 2-categories and bicategories with diverging univalence principles.
Concretely we will focus on the following definitions and conjectures.
Definition 8.1.A pre-pseudo-category is a pseudo-category object in the (3, 1)-category of 2-groupoids.A pseudo-category is a pre-pseudo category whose hom-types are groupoids.A weak double category is a pseudo-category object in pseudocategories with a set of squares.
Weak double categories defined in this way are not identical to double bicategories, However, we conjecture that they are related.

Conjecture 8.2.
There is a fully faithful embedding of weak double categories into Verity's double bicategories with essential image given by double bicategories in which the given horizontal (vertical) bicategory coincides with the bicategory given by objects, horizontal (vertical) morphisms and squares whose vertical (horizontal) edges are identities.
The condition that the objects in the essential image satisfy should be thought of as a bicategorical completeness condition, which guarantees that we have well-defined underlying horizontal and vertical bicategories.This condition has already been considered in [3,Example 9.3], where a double bicategory satisfying such a condition is called a doubly weak double category.Assuming this conjecture, we can summarize the relation between (strict) double categories, weak double categories and double bicategories via the following diagram of inclusions: Double Category

Weak Double Category Double Bicategory
As discussed above, we can build on this first conjecture to define univalent weak double categories.Definition 8.3.A univalent weak double category is a weak double category such that its corresponding double bicategory is univalent.
Unwinding definitions, an identity in the type of objects corresponds to a gregarious equivalence in a double category (as discussed in Remark 5.18).

Remark 8.4.
A key aspect of this definition of a weak double category and univalence that distinguishes it from the notion of double category studied throughout this paper, is that its definition is symmetric and not dependent on choosing a direction.
The difference between univalent double categories (in the sense of Definition 5.14) and their weak version introduced here is indeed non-trivial, as can be seen by the following conjectural example, which should be understood as the categorified version of Example 6.3.Weak double categories assemble into a tricategory, with a sub-tricategory consisting of univalent weak double categories.We now have the following major conjecture, analogous to Theorem 5.15.

Conclusion
In this paper, we constructed the univalent bicategory of univalent double categories.The main tool in the construction is the notion of 2-sided displayed categories, which represent categories with an extra class of morphisms and squares.We also characterized the adjoint equivalences and invertible 2-cells in the bicategory of univalent double categories, and in that characterization, we made use of univalence at several points.Finally, we gave numerous examples of univalent double categories.Among our examples are the double categories of lenses and of structured cospans.
There are numerous ways to extend on this work.An interesting special case of double categories is given by framed bicategories [28].We can obtain a univalent bicategory of univalent framed bicategories by extending the work in Section 5: we take a full subbicategory of DoubleCat that expresses that the the double category is framed (i.e., some functor is a fibration).However, currently framed bicategories are not considered in our formalization.Furthermore, in many applications, one would like to have more structure on a double category, such as a (symmetric) monoidal structure.Such structures can conveniently be defined by looking at pseudomonoids in DoubleCat.To construct a univalent bicategory of (symmetric) monoidal double categories, one would need to combine ideas from [1,32] and [35].
In addition, our notion of univalent double category is unable to capture univalent categories with profunctors.This is because we do not have a category of univalent categories, but only a bicategory.This is another situation where the right solution is to pursue a formalization of double bicategories [33] and its suitable notion of univalence [3,Example 9.3].

Proposition 3 .
12 (is_univalent_total).If D is a univalent 2-sided displayed category over C 1 and C 2 , and C 1 and C 2 are univalent, then ∫ D is univalent as well.

Definition 4 . 1
(disp_bicat).Let B be a bicategory.A displayed bicategory D over B consists of • for each object  : B, a type D  of objects over ; • for all 1-cells  :   and displayed objects  : D  and  : D  , a type    of 1-cells over  ; • for all 2-cells  :  ⇒  and displayed 1-cells  :    and  :   , a set  ⇒   of 2-cells over .

Definition 5 . 1 1 ℎ𝑘
(disp_bicat_twosided_disp_cat).The displayed bicategory TwoSidedDisp d over UnivCat is defined as follows: • The displayed objects over C are univalent 2-sided displayed categories D over C and C. • The displayed morphisms from D 1 to D 2 over  : C 1 C 2 are 2-sided displayed functors  over  and  from D 1 to D 2 .• The displayed 2-cells from  to  over  :  ⇒  are 2-sided displayed natural transformations over  and  from  to .We define TwoSidedDisp to be ∫ TwoSidedDisp d .An object of TwoSidedDisp consists of a univalent category C and a univalent 2-sided displayed category D over C and C. If we compare this to Definition 2.3, then we already got the data from Items 1, 2 and 5 to 7. The vertical category is given by C, the horizontal morphisms from  to  are given by the displayed objects D (,) , and the squares   2 are given by displayed morphisms ℎ

Definition 5 . 7
(double_functor_hor_comp). Let D be a 2-sided displayed categories over C and C and let D ′ be 2sided displayed categories over C ′ and C ′ .Suppose that we have a functor  : C C ′ and a 2-sided displayed functor  from D to D ′ over  and  , and that D 1 and D 2 have horizontal identities.Then we say that  preserves horizontal compositions if for all ℎ : D (,) and  : D (, ) we have a natural square  comp (ℎ, ) :  (ℎ) ⊙  () id  ( ) id  ()  (ℎ ⊙ ) .Definition 5.8 (disp_bicat_twosided_disp_cat_hor_comp).The displayed bicategory HorComp d over TwoSidedDisp is defined as follows: • the displayed objects over a pair of a univalent category C and a univalent 2-sided displayed category D are horizontal composition for D (Definition 5.6); • the displayed 1-cells over a functor  : C 1 C 2 and 2-sided displayed functor  from D 1 to D 2 that preserve horizontal composition (Definition 5.7); • the displayed 2-cells over a natural transformations  :  ⇒  and a 2-sided displayed natural transformation  are proofs that  preserves horizontal composition.The precise formulation can be found in the formalization.
(  1 , 2 ) , then the left-hand side of  • id  = *  is a morphism that lives over  1 • id  1 and  2 • id  2 , respectively.However, the right-hand side lives over  1 and  2 , and thus their types are not equal.We can solve this by properly using a transport.
( ,)  2 is defined to be the collection of proofs that  •  2 =  1 • .The total category ∫ Arr(C) is equivalent to the arrow category of C. • The objects over  and  are spans from  : C to  : C.More concretely, they consist of an object  : C and two morphisms  :   and  :  .• Suppose that we have  :  1  2 and  :  1  2 .
Definition 5.6 (hor_comp).Let C be a category and let D be a 2-sided displayed category over C and C. Then we say that D has horizontal composition if • for all ℎ : D (,) and  : D (, ) , we have a displayed object ℎ ⊙  : D (, ) ; • for all displayed morphisms  1 : ℎ 1 ( 1 , 2 ) ℎ 2 and

•
Suppose we have lenses  1 from  to  and  2 from  to .Then we have a lens  1 ⊙  2 from  to  such that get  1 ⊙ 2 = get  1 • get  2 , and such that put  1 ⊙ 2 is the following composition.
Lemma 7.4.Let D : TwoSidedDisp.Suppose that  1 and  2 are objects over D in HorId d , and that  :  1 id D  2 .Note that  consists of a natural square  : id