• No results found

Generalized composition

4.3 Composition

4.3.2 Generalized composition

We first show how to carry out the definition of composition in B ⇒ Set even more abstractly, then discuss how it may be generalized to other functor categoriesL⇒S. Street [2012] gives the following abstract definition of composition:

(F ◦G) L=∃K. F K×G#K L, (4.3.3) where Gn =G· · · · ·G

| {z }

n

is the n-fold partitional product of G. Intuitively, this corre- sponds to a top-levelF-shape on labels drawn from the “internal” label setK, paired with #K-manyG-shapes, with the labels fromLpartitioned among all theG-shapes. The coend abstracts overK, ensuring that the precise choice of “internal” labels does not matter up to isomorphism.

Remark. Note how this corresponds to the second definition of composition given in

(4.3.2). In particular, binary partitional product allows for the labels to be parti- tioned into the empty subset and the entire subset, so an iterated partitional product corresponds to partitions which contain an arbitrary number of empty parts.

However, this definition is somewhat puzzling from a constructive point of view, since it would seem that G#K retains no information about which element of K

corresponds to which G-shape in the product. The problem boils down, again, to the use of the axiom of choice. For each finite set K we may choose some ordering

K −→∼ [#K]; this ordering then dictates how to match up the elements of K with theG-shapes in the product G#K. More formally, given a speciesGwe can define the

anafunctor G− : B → Spe which sends each finite set K to the clique of (#K)-ary products ofG, with the morphisms in the clique corresponding to permutations (since

Spe is symmetric monoidal with respect to partitional product). This then becomes a regular functor in the presence of the axiom of choice.

In the particular case of B⇒ Set, we can also avoid the axiom of choice by using a more explicit construction (again due to Street3). For a finite setK and category

C,

recall that we may represent aK-indexed tuple of objects of C by a functor K →C

(where K is considered as a discrete category). It’s important to note that this “K- tuple” has no inherent ordering (unlessK itself has one)—it simply assigns an object ofCto each element ofK. Denote by ∆K :C→CK the diagonal functor which sends

an object C∈C to the K-tuple containing only copies ofC.

Consider C=FinSet. Given any discrete categoryK, the diagonal functor ∆K : FinSet→FinSetK has both a left and right adjoint, which we call ΣK and ΠK:

ΣK a∆K aΠK.

In particular, ΣK : FinSetK → FinSet constructs K-indexed coproducts, and ΠK

constructs indexed products. (In the special case K =|2|, Σ|2| and Π|2| resolve to the

familiar notions of disjoint union and Cartesian product of finite sets, respectively.) One can see this by considering the expansion of the adjoint relations as natural isomorphisms between hom-sets. For example, in the case of ΠK, we have

(∆K A→T)∼= (A→ΠK T)

where A∈FinSetand T ∈FinSetK. Essentially this expands to something like (A→T1)× · · · ×(A→Tn)∼= (A→ΠK T),

and it is easy to see that in order for the isomorphism to hold, we should have ΠK T =T1×· · ·×TN. (In general, of course,K need not have some associated indexing

1. . . n, but the same argument can be generalized.) We often omit the subscripts, writing simply Σ and Π when K is clear from the context.

Now considerC=B. ∆Kdoes not have adjoints inB; in fact, categorical products

and coproducts can be exactly characterized as adjoints to ∆|2|, and we have already

seen that B does not have categorical products or coproducts. However, we can take ΠK,ΣK : FinSetK → FinSet and restrict them to functors BK → B. This is

well-defined since FinSet and B have the same objects, and ΠK and ΣK produce

only isomorphisms when applied to isomorphisms. For example, if α : A −→∼ A0,

L

F

6

4

F

2

5

F

0

3

1

P

Figure 4.20: Indexed species product

β : B −→∼ B0, and γ : C −→∼ C0, then Π|3|(α, β, γ) is the isomorphism α×β ×γ :

A×B×C −→∼ A0×B0 ×C0.

We can now define a general notion of indexed species product. For a species

F : B ⇒ Set and K ∈ B a finite set, FK : B Set represents the #K-fold

partitional product of F, indexed by the elements of K (see Figure 4.20):

FK L=∃(P :BK).B(ΣP, L)×Π(F ◦P).

Note thatK is regarded as a discrete category, so P ∈BK is a K-indexed collection

of finite sets. B(ΣP, L), a bijection between the coproduct of P and L, witnesses the fact that P represents a partition of L; the coend means there is only one shape per fundamentally distinct partition. The composite F ◦P = K P //B F //Set is a K-indexed collection of F-structures, one on each finite set of labels in P; the Π constructs their product.

It is important to note that this is functorial in K: the action on a morphism

σ :K −→∼ K0 is to appropriately compose σ with P. The composition F ◦G can now be defined by

(F ◦G)L=∃K. F K×GK L.

This is identical to the definition given in (4.3.3), except thatG#K has been replaced byGK, which explicitly records a mapping from elements ofK to G-shapes.

This explicit construction relies on a number of specific properties of B and Set, and it is unclear how it should generalize to other functor categories. Fortunately, in the particular case of B ⇒ S, in HoTT, this more complex construction is not necessary. The anafunctorG− :B→Spediscussed earlier corresponds in HoTT to a regular functorG− :B → (B ⇒ S): in a symmetric monoidal category, the (#K)-ary tensor product ofGis unique up to isomorphism, which in anh-category corresponds to actual equality.

More generally, if we focus on the high-level definition (F ◦G)L=∃K. F K×GK L,

Figure 4.21: (C◦L)- and (L◦C)-forms of size 3

leaving the definition of GK abstract, we can enumerate the properties required of a general functor categoryL⇒ Sto accommodate it: for starters,Smust have coends over L, and (S,×) must be monoidal. We can also say that, whatever the definition ofGK, it will involve partitional product—so we must add in all the requirements for that operation, enumerated in§4.2.3. In fact, this already covers the requirements of

S having coends and a monoid ×, so any functor category L ⇒ S which supports partitional product already supports composition as well.

For a formal proof that composition is associative, see Kelly [2005, pp. 5–6], al- though some reflection on the intuitive idea of composition should be enough to convince informally: for example, a tree which contains cycles-of-lists is the same thing as a tree-of-cycles containing lists.

Unlike the other monoidal structures on Spe(sum and Cartesian, arithmetic, and partitional product), composition is not symmetric. For example, as illustrated in Figure 4.21, there are different numbers of (C◦L)-forms and (L◦C)-forms of size 3, and hence C◦L 6∼=L◦C.

Proposition 4.3.1. (Spe,◦,X) is monoidal.

Proof. We have already seen that ◦ is associative and that X is an identity for com-

position. For formal proofs in a more generalized setting see, again, Kelly [2005]. SDG

Like associativity, the right-distributivity laws

(F +G)◦H = (∼ F ◦H) + (G◦H) (F ·G)◦H ∼= (F ◦H)·(G◦H)

are easy to grasp on an intuitive level. Their formal proofs are not too difficult; the second specifically requires an isomorphismGK1+K2 =GK1·GK2, which ought to hold

no matter what the definition of GK. The reader may also enjoy discovering why

the corresponding left-distributivity laws are false (although they do correspond to species morphisms rather than isomorphisms).