## Union of Functors and a Functor on Union

### Intro

On 10/3/2016 Paul Phillips posted an interesting question, https://twitter.com/extempore2/status/783161511724273664?cn=cmVwbHk%3D&refsrc=email - how are \/[F[A], G[A]] and F[A\/B]related. Here are my musings on this. In 2011 I already wrote this: http://vpatryshev.blogspot.com/2011/05/monad-genome-part-1.html - pretty much close to the topic; but it's better to just go into details.

### Basics

Let's fix some category

*; assume that it has all the necessary limits or colimits.***C**
Union is a special case of a coproduct; it's a functor

**⨯***C***→***C***that is right adjoint to diagonal Δ:***C***→***C***⨯***C**C*. The diagonal maps an x to (x,x).
This diagonal actually can be defined like this: given

Since the union is calculated pointwise in this case, this functor,

((Bool \/ C) => C) => C => C.**1**+**1**→**1**, where**1**is a unit, a terminal category, its exponential,*C*^{1+1}→*C*^{1}, is the same diagonal Δ.### Union of Two Endofunctors

An endofunctor on category*is a point in***C***; and a union of two endofunctors has the following signature:***C**^{C}**⨯***C*^{C}**→***C*^{C}*C**which is the same as (*^{C }**⨯***C***C**)^{C}→*C**, or*^{C}*C*^{(1+1)×C}→**C**^{C}*In Scala its type can be written as (Bool => C => C) => C => C. Here Bool is a cheap implementation of*^{}**1**+**1**.Since the union is calculated pointwise in this case, this functor,

*C*^{(1+1)×C}→*, is a right adjoint to the diagonal***C**^{C}*→***C**^{C }*C*^{(1+1)×C}.### Endofunctor following a Union

For the case where we first build a union and then apply a functor, we need three components: two objects and a functor. So we have

**⨯***C***⨯***C***→***C*^{C}*C*^{C}- here we map a triple (A,B,F) to F[A\/B].
Rewriting it, we have

*C*^{1+1+C}→*C*^{C}- this is the signature of our operation. In other words, we have
## No comments:

Post a Comment