0
$\begingroup$

I'm trying to construct lists with elements of type $A$ as the initial algebra over a base endofunctor in $\mathsf{Set}/\mathcal{P}(A)$, such that the list is indexed by the set of its elements.

My idea is to model Cons using a bifunctor $C\colon\ \mathsf{Set}/\mathcal{P}(A)\times\mathsf{Set}/\mathcal{P}(A)\to \mathsf{Set}/\mathcal{P}(A)$.

My definition of $C$ would be $C_0 (X,f) (Y,g) := (X\times Y, \lambda(a,b).\,f(a)\cup g(b))$.

My List base functor would then be $L_0(R,r) := (1,\lambda\_.\,\emptyset ) + C_0\left(\left(A,\lambda x.\,\{x\}\right),\left(R,r\right)\right)$.

My question is: Is this kind of bifunctor $C$ a known construction? I find what it does reminiscent of the $\mu$ (join) of the Action Monad (aka Writer monad), but can't quite put my finger on it.

$\endgroup$
2
  • 1
    $\begingroup$ Note that the TeX rendering of commands might be different from a Unicode character with the same meaning: compare $\lambda λ$ \lambda λ and $\mu μ$ \mu μ. I have edited accordingly. $\endgroup$
    – LSpice
    Commented Jun 20, 2023 at 18:52
  • 1
    $\begingroup$ @LSpice Different doesn't mean worse. $\endgroup$ Commented Jun 23, 2023 at 9:26

1 Answer 1

5
$\begingroup$

In general, for any monoidal category $(\mathcal M, \otimes, I)$ and a monoid $(m, *, i) \in \mathcal M$, the slice category $\mathcal M/m$ inherits the monoidal structure pointwise, i.e. the tensor product is given by taking morphisms $f : x \to m$ and $g : y \to m$ to the morphism $x \otimes y \xrightarrow{f \otimes g} m \otimes m \xrightarrow{*} m$, and the unit is given by $i : I \to m$.

In your example, we take $(\mathbf{Set}, \times, 1)$ to be the category of sets equipped with cartesian monoidal structure and $(m, *, i)$ to be the power set monoid $(\mathcal P A, \cup, \varnothing)$.

Abstractly, we can see resulting tensor product on $\mathbf{Set}/\mathcal{P}A$ to be given by the following composite

$$(\mathbf{Set}/\mathcal{P}A)^2 \simeq (\mathbf{Set}^{\mathcal{P}A})^2 \xrightarrow{\langle-,-\rangle} (\mathbf{Set}^2)^{({\mathcal{P}A}^2)} \xrightarrow{\times^{({\mathcal{P}A}^2)}} \mathbf{Set}^{({\mathcal{P}A}^2)} \simeq \mathbf{Set}/({\mathcal{P}A}^2) \xrightarrow{\mathbf{Set}/\cup} \mathbf{Set}/{\mathcal{P}A}$$

where the equivalences are given by the correspondence between indexed sets and $\mathbf{Set}$-functors from discrete categories.

The unit is given similarly by

$$1 \xrightarrow{1} \mathbf{Set} \simeq \mathbf{Set}/1 \xrightarrow{\mathbf{Set}/i} \mathbf{Set}/{\mathcal{P}A}$$

$\endgroup$
8
  • $\begingroup$ Is this equivalent to taking the product $(x,f) × (y,g)$ in the arrow category $\mathcal{M}^→$ and then applying the left base change functor $*_!$ to it? $\endgroup$
    – cxandru
    Commented Aug 15, 2023 at 14:10
  • $\begingroup$ @cxandru: could you clarify what you mean by the left base change? What are the domain and codomain of the functor? $\endgroup$
    – varkor
    Commented Aug 18, 2023 at 12:39
  • $\begingroup$ I think I mean $∗_!:(\mathcal{M}/m⊗m)→\mathcal{M}/m$, defined as $∗!(z,h)=(z,∗∘h)$, if $*$ has type $m⊗m→m$ $\endgroup$
    – cxandru
    Commented Aug 22, 2023 at 15:02
  • $\begingroup$ The tensor product is given by a composite $\mathcal M/m \times \mathcal M/m \to \mathcal M^2/(m, m) \to \mathcal M/(m \otimes m) \to \mathcal M/m$, where the last functor is the one you mention. However, it's not possible to express this in terms of the arrow category, because we need to only consider morphisms with certain codomains (e.g. $m$). $\endgroup$
    – varkor
    Commented Aug 22, 2023 at 15:37
  • $\begingroup$ Is there a way to construct this composite without using the indexed sets correspondence? I don't want to introduce too much background. Sorry for all the back & forth. I'm using this construction in my Master's thesis btw, I've added your answer here as a citation $\endgroup$
    – cxandru
    Commented Aug 28, 2023 at 19:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .