6

Given a monad $(T,\mu,\eta)$, a map $\alpha : TA\to A$ commuting with $\mu$ and $\eta$ is a $T$-algebra.

Given a set $D$, the continuation monad is given by the functor $C:X\mapsto D^{(D^X)}$ (see also here). So an algebra for the continuation monad is a map $D^{(D^A)}\to A$. Interestingly, if we take $D=0$, this corresponds to the law of the excluded middle in logic: $\neg\neg A\to A$. This seems to imply that algebras for the continuation monad can't be constructed easily.

From the question What are the algebras of the double powerset monad?, it seems that for $D=2$ we can take $X$ to be a complete boolean algebra, ie. $X=2^Y$: $$f\mapsto(y\mapsto f(\eta_Y(y))) \quad:\quad 2^{(2^{(2^Y)})}\to2^Y.$$

There is also the free algebra $$\mu_X:CCX\to CX$$

but both of these examples seem a bit contrived. For $D=0$ and $D=1$ there only seem to be trivial examples.

Are there simpler but nontrivial/interesting examples?

Couchy
  • 2,796
  • 2
    Well, if I'm not mistaken $D$ is an algebra via $\alpha : D^{(D^D)} \to D, f \mapsto f(\operatorname{id}_D)$. And therefore, any product of $D$ (for example a function space $D^Y$) also has a canonical algebra structure. – Daniel Schepler Jan 04 '23 at 21:35

2 Answers2

6

I asked this same question on zulip some time ago, and we concluded (well, Todd Trimble did teach us ;D) that if $D$ has at least two elements the category of algebras for the continuation monad is $Set^{op}$, or to put it more precisely, $[-,B] : Set^{op}\to Set$ is monadic (note that the continuation monad is the monad of the self-adjoint functor $[-,B]$).

Proof: check each condition in Beck's monadicity.

fosco
  • 12,564
3

I am going to argue that a C-algebra $(A,\; \alpha : CA \to A)$ is the same thing as a set $A$ equipped with a bunch of infinitary operations satisfying some equations. (I'll also explain how Fosco's answer relates to this.)

  • The operations are $\overline{t}_A : A^I \to A$ for each set $I$ and $t : D^I \to D$.
  • The equations are all the equations involving variables and successive applications of operations that are satisfied by the "tautological" algebra $A=D$ with $\overline{t}_D = t$. They are generated by:
    • (1) $\quad\overline{t}_A \circ \langle \overline{(s_i)}_A \rangle_{i\in I} = \overline{(t \circ \langle s_i \rangle_{i\in I})}_A\quad$ (for simplifying nested applications)
    • (2) $\quad\overline{(v \mapsto v(i))}_A((a_i)_i) = a_i\quad$ (for variables)

Equivalently, this means that $\overline{t}_A = F(t)$ for some product-preserving functor $F$ from the full subcategory of Set consisting of powers of $D$ to Set such that $F(A) = D$. (In other words, $F$ is a model of the infinitary Lawvere theory given by this subcategory.)

The morphisms between these algebras are the $f : A \to B$ such that $\overline{t}_B((f(a_i))_{i \in I}) = f(\overline{t}_A((a_i)_{i\in I}))$, they correspond to natural transformations between the product-preserving functors.

We will see that the monadicity result mentioned by Fosco basically means that:

  • (a) every such algebra is isomorphic to one of the form $D^X$ with the operations applied pointwise,
  • (b) the morphisms $D^X \to D^Y$ are exactly the reindexings $(d_x)_{x \in X} \mapsto (d_{f(y)})_{y \in Y}$ for $f : Y \to X$.

It would be nice to get elementary proofs of the latter two items (I might think about it later).

The case of booleans: In the case $D=\mathbb{B}=\{\mathrm{true,false}\}$, our algebras support the following operations:

  • an $I$-ary join operation $\bigvee_A : A^I \to A$ defined by $\bigvee_A = \overline{(\text{disjunction} : \mathbb{B}^I \to \mathbb{B})}_A$ for any set $I$;
  • similarly, a meet operation of any arity corresponding to boolean conjunction;
  • a complementation operation corresponding to negation.

In fact these suffice to generate all other operations, since every function $\mathbb{B}^I \to \mathbb{B}$ can be written as a disjunctive normal form. Since the axioms of completely distributive complete boolean algebras (CDCBAs) suffice to derive all equations valid for $\mathbb{B}$ (by syntactic rewriting into full disjunctive normal forms), we see that our algebras are precisely CDCBAs for $D=\mathbb{B}$.

The aforementioned consequence (a) of monadicity is the classical fact that CDCBAs are the same thing as complete atomic boolean algebras (i.e. those of the form $\mathbb{B}^X$)!

From operations to a C-algebra structure: Let $A$ be a set equipped with $\overline{t}_A : A^I \to A$ for every set $I$ and $t : D^I \to D$, which satisfy the above-mentioned equations. We can define: $$\alpha : t \in CA \mapsto \overline{t}_A(\mathrm{id}_A) \in A$$

The unit law $\alpha\circ\eta_A=\mathrm{id}_A$ of C-algebras comes from Equation (2), noting that the unit of the continuation monad satisfies $\eta_I(i) = (v \mapsto v(i))$. The multiplication law $\alpha \circ C\alpha = \alpha \circ \mu_A$ comes from Equation (1). One can check that a function is a C-algebra morphism if and only if it preserves the operations.

Converse direction: Let $(A,\; \alpha : CA \to A)$ be a C-algebra. For any set $I$ and $v : I \to A$, let $\varphi_v = \alpha \circ Cv$ be the unique C-algebra morphism $CI \to A$ (using the free C-algebra structure on $CI$) that corresponds to $v$ via the free/forgetful adjunction. For $t \in CI$, let $$\overline{t}_A : v \in A^I \mapsto \varphi_v(t) \in A$$ This is in fact the inverse to the above construction of $\alpha$ from the operations: we have a bijective correspondence.

Monadicity: The adjunction with $\mathbf{Set}^{\mathrm{op}}$ mentioned by Fosco generates the monad $C$, so it leads to a comparison functor $H : \mathbf{Set}^{\mathrm{op}} \to \mathbf{Set}^C$. Let $(A,\alpha) = HX$; we have $A = D^X$ and one can check that each operation $\overline{t}_{D^X}$ (defined from $\alpha$ according to the above recipe) applies $t : D^I \to D$ pointwise.

The monadicity of this adjunction means $H$ is an equivalence of categories. Faithfulness is a trivial consequence of $|D|\geqslant2$, while the items (a) and (b) mentioned earlier correspond respectively to essential surjectivity and to fullness.