# Uncertainty in all its flavours

*Acknowledgements:*  
*This research began during the SERI MATS program, under the joint mentorship of John Wentworth, Nicholas Kees, and Janus. Thanks also to Davidad, Jack Sagar, and David Jaz Myers for discussion.*

*Abstract:*  
*I think that there is a uniform correspondence between flavours of uncertainty and monads taking state-spaces to belief-state-spaces, for different characterisation of belief. In this essay, I describe this correspondence explicitly and list 15 diverse and well-motivated examples. I explore some applications to model-building and agent foundations. Along the way, I characterise infrabayesianism uncertainty as the minimal way to encompass possibilistic uncertainty, probabilistic uncertainty, and reward.*  
  
*No prerequisites are required beyond a high-school familiarity with sets, functions, real numbers, etc. Feedback welcome.*

Introduction
============

Suppose I'm facing the following problem. There's an upcoming election between $n$ candidates, and *you're* uncertain who will win. How can I model both your belief about the election and the election itself in a coherent way? By "belief" here, I mean your epistemic attitude, your internal model, your opinion, judgement, prediction, etc, etc. Think [map-territory distinction](https://www.lesswrong.com/tag/map-and-territory): the election is the territory, your belief is the map, and I need to model both the map and the territory coherently despite the fact that the map and the territory are (typically speaking) two completely different types of thing.

Well, to model the election itself, I'll use a set $S = \{s_1, s_2, s_3 , \ldots s_n \}$ with an element for each electoral candidate. To represent your belief about the election, I must find another set $\mathcal B(S)$ with an element for each belief that you might have about the election. I'll call $S$ the **state space** and $\mathcal B(S)$ the **belief-state space.** A solution to our problem is given by a mathematical operator $\mathcal B$ sending each state-space $S$ to the matching belief-state space $\mathcal B(S)$.

One may feel prompted to ask: does any operator $\mathcal B$ suffice here? Can the belief-state space be anything whatsoever, or must it carry some extra structure, possibly satisfying some additional constraints? Or, stated more philosophically, can any territory serve as a map for any other? I say no. Roughly speaking, the operator $\mathcal B$ must be a so-called **monad**, which will be the central object of this essay. But more on that later.

The first thing to note is that the appropriate operator $\mathcal B$ will depend on how exactly I wish to characterise a "belief" about the election, and there are multiple options here. For example, I might choose to characterise your belief by the set of candidates that you think have a possibility of winning. In this case, $\mathcal B(S):= \mathcal P^+(S)$, denoting the set of non-empty subsets of $S$. Alternatively, I might choose to characterise your belief by the likelihood that you give each candidate. In this case, $\mathcal B(S):= \Delta (S)$, denoting the set of finite-support probability distributions over $S$, i.e. functions $p : S \to [0,1]$ such that $\{s \in S: p(s) \neq 0\}$ is finite and $\sum\limits_{s \in S}p(s) = 1$.

In the first option, I'm characterising your belief-state by your possibilistic uncertainty, often encountered in [doxastic](https://en.wikipedia.org/wiki/Doxastic_logic) or [epistemic logic](https://en.wikipedia.org/wiki/Epistemic_modal_logic). In the second option, I'm characterising your belief-state by your probabilistic uncertainty, which is a *finer-grained* characterisation of belief because it differentiates between e.g. thinking a coin is fair and thinking a coin is slightly biased.

The second option has its merits. Indeed, many readers will instinctively reach for $\Delta$ as soon as they hear the word "uncertainty", and this instinct would serve them well. There's been a fruitful enterprise (in philosophy, mathematics, computer science, linguistics, etc) of replacing possibilistic uncertainty with probabilistic uncertainty in any model or concept where one finds it. But I want to note that both $\mathcal P^+$ and $\Delta$ would count as a solution to the problem. I'll return to these two examples throughout this essay because they are the flavours of uncertainty which will be most familiar to the reader.

| Flavour of uncertainty | Monad |
| --- | --- |
| Possibilistic | Nonempty-powerset monad $\\mathcal P^+$ |
| Probabilistic | Distribution monad $\\Delta$ |

As we will see, these two operators, $\mathcal P^+$ and $\Delta$, are both monads. The central claim of this essay is that there is a uniform correspondence between flavours of uncertainty and monads. By "flavour of uncertainty" I mean a particular way of characterising someone's potentially uncertain belief about something. Possibilistic and probabilistic are paradigm cases, but in this essay we'll meet fifteen examples.

The forward-implication of this claim, that every flavour of uncertainty is a monad, is perhaps uncontroversial in some circles.[^ncb394vix8n] The backwards-implication, that every monad is a flavour of uncertainty, is worthy of more scepticism.

In this essay —

*   I will describe the correspondence explicitly.
*   I'll present a step-by-step method for formalising different flavours of uncertainty using monads.
*   I'll list fifteen examples of the correspondence, which I hope the reader finds well-motivated.
*   Finally, I'll discuss the relevance to agent foundations, with reference to infrabayesianism in particular.

Don't worry if you don't yet know what monads are. By the end of this essay you'll understand them as well as I do, which is enough to nod along when you hear "monad this" and "monad that".

The correspondence explicitly.
==============================

What's a flavour of uncertainty?
--------------------------------

Recall from the introduction that I'm tasked with representing or modelling both the election itself and your belief about the election. The first step of this task is to settle on a particular flavour of uncertainty to characterise the belief-states — possibilistic, probabilistic, infrabayesian, etc. One might ask, of this flavour of uncertainty, the following four questions —

1.  **Count?**  
    What's counts as a distinct belief about the election? Concretely, if there are $n$ electoral candidates then how many distinct belief-states are there?
2.  **Certainty?**  
    If you're certain that a particular candidate will win the election (and I know which candidate) then how should I determine your  belief-state?
3.  **Collapse?**  
    Suppose a number of forecasters are speculating on the election. If I'm given the belief of each forecaster about the election, and I'm given your belief about the forecasters' beliefs, then how should I determine your belief about the election itself?
4.  **Combine?**  
    Suppose there are two completely unrelated elections happening somewhere. If I'm given your belief about the first election, and your belief about the second election, then how should I determine your belief about the pair of elections?

These four questions — Count? Certainty? Collapse? Combine? — are essentially epistemological questions, and they collectively pin down what I mean by a flavour of uncertainty.[^p7oqifhpuxg] As we will see, a monad corresponds to answers to the first three questions and a commutative monad corresponds to answers to all four questions.

**Exercise 1:** How would you answer these questions for possibilistic uncertainty? Or for probabilistic uncertainty?

**Exercise 2:** As I mentioned before, an answer to Count? is a set $\mathcal B(S)$ for each set $S$. What about for Certainty? Collapse? and Combine?

What's a (commutative) monad?
-----------------------------

Monads were born of category theory — a field of mathematics which many regard as arcane, mystical, or downright kabbalistic — but monads can (I think) be understood by someone lacking any acquaintance with category theory whatsoever. Indeed, my claim in this essay is that monads correspond exactly to Map-Territory-like relations, and such relations will be familiar to anyone who's both got a brain and pondered this predicament.

I'll first write down the mathematical definition of a monad, and then I'll explain how this definition mirrors the four epistemological questions.

> **Definition:** A **monad** $(\mathcal B, \eta, \rhd)$ consists of three operators[^4dzfhbofe8m]:
> 
> *   The **construct** operator$\mathcal B$ which assigns a set $\mathcal B(S)$ to each set $S$.
> *   The **return** operator$\eta$ which assigns a function $\eta_S : S \to \mathcal B(S)$ to each set $S$*.*
> *   The **bind** operator$\rhd$ which assigns a function $\rhd_{W S}  : \mathcal B(W) \times (W\to \mathcal B(S)) \to \mathcal B(S)$ to each pair of sets $W, S$.
> 
> Moreover, a **commutative monad** $(\mathcal B, \eta, \rhd, \otimes)$ is a monad $(\mathcal B, \eta, \rhd)$ equipped with a fourth operator:
> 
> *   The **product** operator $\otimes$ which assigns a function $\otimes_{AB}: \mathcal B(A) \times \mathcal B(B) \to \mathcal B(A\times B)$ to each pair of sets $A, B$.
> 
> These operators must also satisfy some basic algebraic laws to qualify as a (commutative) monad. [See here for details.](https://ncatlab.org/nlab/show/monad)
> 
> *Notation: I'll use variables *$x, x', x''$* for elements of *$X$*, and boldface variables *$\mathbf x, \mathbf x', \mathbf x''$* for elements of *$\mathcal B(X)$*. I may talk loosely of the monad *$\mathcal B$* rather than *$(\mathcal B, \eta, \rhd)$* or of the commutative monad *$\mathcal B$* rather than *$(\mathcal B, \eta, \rhd, \otimes)$*. I may write *$\eta^\mathcal B$*, *$\rhd^\mathcal B$*, or *$\otimes^\mathcal B$* for clarification. I may write *$\mathbf w\rhd f$* instead of *$\mathbf w \rhd_{WS} f$, and $\mathbf a \otimes \mathbf b$ instead of $\mathbf a \otimes_{AB} \mathbf b$.$$

How do they correspond to each other?
-------------------------------------

In short, there is an exact correspondence between the operators of a (commutative) monad and the four epistemological questions. Let's go one-by-one.

> **1\. Count?**  
> What's counts as a distinct belief about the election? Concretely, if there are $n$ electoral candidates then how many distinct belief-states are there?

An answer to this question is the **constructor** operator, assigning a set $\mathcal B(S)$ to each set $S$. If $S$ is the set of potential outcomes of an event then $\mathcal B(S)$ is the set of beliefs about the event.

As we discussed before, for possibilistic uncertainty $\mathcal B(S) := \mathcal P^+(S)$, and for probabilistic uncertainty $\mathcal B (S) :=\Delta(S)$.

> **2\. Certainty?**  
> If you're certain that a particular candidate will win the election (and I know which candidate) then how should I determine your  belief?

Here, an answer will be the **return** operator assigning a function $\eta_S : S \to \mathcal B(S)$ to each set $S$*.* If you're certain that a state $s \in S$ will occur, then $\eta_S(s) \in \mathcal B(S)$ is your belief-state.

For possibilistic uncertainty, $\eta_S (s) := \{s\}\in \mathcal P^+(S)$, the singleton set containing $s$. And for probabilistic uncertainty, $\eta_S (s)  := \delta_s \in \Delta(S)$, the dirac distribution at $s$ given by $\delta_{s}:s' \mapsto \begin{cases}1&\text{if $s' = s$}\\0 &\text{otherwise}\end{cases}$.

The function $\eta_S : S \to \mathcal B(S)$ describes how the state-space $$*embeds* in the belief-state-space. This is related, I think, to the idea that each territory can serve as its own map. (See Borges' [On Exactitude in Science](  https://en.wikipedia.org/wiki/On_Exactitude_in_Science) for an exploration of this theme.) Or in the words of Norbert Wiener, “The best model of a cat is another, or preferably the same, cat.”

> **3\. Collapse?**  
> Suppose a number of forecasters are speculating on the election. If I'm given the belief of each forecaster about the election, and I'm given your belief about the forecasters' beliefs, then how should I determine your belief about the election itself?

Here, an answer will be the **bind** operator assigning a function $\rhd_{W S}  : \mathcal B(W) \times (W\to \mathcal B(S)) \to \mathcal B(S)$ to each pair of sets $W$ and $S$. You should think of the bind operator as collapsing your second-order beliefs to your first-order beliefs — i.e. if each forecaster $w \in W$ has an first-order belief $f(w) \in \mathcal B(S)$, and $\mathbf w \in \mathcal B(S)$ is your second-order belief about which forecaster is correct, then $(\mathbf w \rhd_{WS} f) \in \mathcal B(S)$ should be your first-order belief about the election.

For possibilistic uncertainty, $\mathbf w \rhd f \in \mathcal P^+(S)$ is the union $\bigcup\limits_{w \in \mathbf w} f(w)$. And for probabilistic uncertainty, $\mathbf w \rhd f\in \Delta(S)$ is the summation/integral $s'\mapsto \sum\limits_{w \in \mathbf w} \mathbf w(s)\cdot f(w)(s')$.  
  
This is related to the idea that a map of a map of a territory is a map of that same territory; a depiction of a depiction of person is a depiction of that same person, a representation of a representation of an idea is a representation of that same idea; etc.

One might think of $f : W \to \mathcal B(S)$ as some *parameterisation* of the belief-state $\mathcal B(S)$ using some *parameters *$W$. Then the bind operator gives us the function for finding your $S$-belief from you $W$-belief. Explicitly, this function is$(-\rhd_{WS}f): \mathcal B (W) \to \mathcal B(S), \mathbf w \mapsto \mathbf w \rhd_{WS} f$.

Moreover, the bind operator doesn't just flatten *one* level of "meta". Often we have an entire hierarchy of state-spaces $S_0, S_1, S_2, \ldots , S_n$ where beliefs about $S_i$ are parameterised by some "higher" state-space $S_{i+1}$ via a function $f_i : S _{i+1} \to \mathcal B(S_{i})$. Here, the state-space $S_0$ is the object-level system, the state-space $S_1$ parametrises your first-order beliefs about $S_0$, the state-space $S_2$ parameterises your second-order beliefs about $S_1$, and so on. Then the bind operator says that I can collapse your $n$th-order beliefs all the way to your first-order beliefs via the function $(- \rhd  f_{n-1} \rhd\cdots \rhd  f_{0}): \mathcal B(S_n) \to \mathcal B(S_0)$.[^pocrg830wgo]

> **4\. Combine?**  
> Suppose there are two completely unrelated elections happening somewhere. If I'm given your belief about the first election, and your belief about the second election, then how should I determine your belief about the pair of elections?

An answer will be the **product** operator $\otimes$ assigning a function $\otimes_{AB} : \mathcal B(A) \times \mathcal B(B) \to \mathcal B(A \times B)$ to each pair of sets $A$ and $B$. If $\mathbf a \in \mathcal B(A)$ is your belief about the first election and $\mathbf b \in \mathcal B(B)$ is your belief about an unrelated second election, then $\mathbf a \otimes_{AB} \mathbf b \in \mathcal B(A \times B)$ is your belief about the pair of elections.

For possibilistic uncertainty, $\mathbf a \otimes \mathbf b \in \mathcal P^+(A \times B)$ is the cartesian product $\{(a,b) \in A \times B : a \in \mathbf a, b \in \mathbf b\}$. And for probabilistic uncertainty, $\mathbf a \otimes \mathbf b\in \Delta(A \times B)$ is the joint distribution $ (a,b) \mapsto \mathbf a(a) \cdot \mathbf b(b)$.

Thinking of $S_1 \times \cdots \times S_n$ as a factorisation of the state-space $S$, the product operator implies that your beliefs about each $S_i$ *combine* to yield your overall belief about $S$. That is, a commutative monad $\mathcal B$ corresponds to a flavour of uncertainty that you can have to parts of the world, whereas a non-commutative monad $\mathcal B$ corresponds to a flavour of uncertainty that you can only have to the world in its entirety.

*Historical note: The central thesis of this essay is that there is a uniform correspondence between flavours of uncertainty and monads. I call this Myers' correspondence after* [*David Jaz Myers*](http://davidjaz.com/)*, because I first encountered the idea in his book* [*Categorical Systems Theory*](http://davidjaz.com/Papers/DynamicalBook.pdf)*, where he devotes a chapter to using commutative monads to model various nondeterminism of automata. Nonetheless, he idea did not originate with him, he's never claimed it is true, and I don't know if he agrees with it.*

Examples of Myers' correspondence
=================================

The correspondence between he operators of the (commutative) monad and the epistemological questions also serves as a practical recipe for *formalising* different flavours of uncertainty using monads. I've personally found it useful. First, think about the particular flavour of uncertainty, then answer the Four C's (Count? Certainty? Collapse? Combine?), convert those answers into mathematical operators, and voilà you've got yourself a monad.

I'll now zoom through fifteen examples, beginning (without commentary) with the paradigm examples of $\mathcal P^+$ and $\Delta$.

1 - nonempty powerset monad
---------------------------

| Flavour of uncertainty | Possibilistic |
| --- | --- |
| Monad | Nonempty powerset |
| Construct $\\mathcal B(S)$ | $\\mathcal P^+(S)$ |
| Return $\\eta_S(s)$ | $\\{s\\}$ |
| Bind $\\mathbf w \\rhd_{WS}f$ | $\\bigcup\\limits_{w \\in \\mathbf w}f(w)$ |
| Product $\\mathbf a \\otimes_{AB} \\mathbf b$ | $\\mathbf a \\times \\mathbf b$ |
| Interpretation | $x \\in \\mathbf x$ if you consider the outcome $x \\in X$ to be *possible*. |

2 - distribution monad
----------------------

| Flavour of uncertainty | Probabilistic |
| --- | --- |
| Monad | Distribution |
| Construct $\\mathcal B(S)$ | $\\Delta(S)$ |
| Return $\\eta_S(s)$ | $\\delta_{s}:s' \\mapsto \\begin{cases}1&\\text{if $s' = s$}\\\\0 &\\text{otherwise}\\end{cases}$ |
| Bind $\\mathbf w \\rhd_{WS}f$ | $\\mathbf s : s'\\mapsto \\sum\\limits_{w \\in \\mathbf w} \\mathbf w(s)\\cdot f(w)(s')$ |
| Product $\\mathbf a \\otimes_{AB} \\mathbf b$ | $(a,b) \\mapsto \\mathbf a(a)\\cdot \\mathbf b(b)$ |
| Interpretation | $\\mathbf x (x) \\in [0,1]$ is your subjective credence in the outcome $x\\in X$. |

3 — reader monad from $H$
-------------------------

Okay, now let's deal with a flavour of uncertainty which is sometimes called "indeterminacy"*.* An indeterminate belief is something like "Well, if $h_1$ is true then $x_1$, but if $h_2$ is true then $x_2$, but–", i.e. it's a belief which is uncertain because your best guess depends on some unknown variable. More formally, your belief-state is given by a particular function from $H$ (the possible values of the unknown variable) to $S$ (the state-space).

This is an ordinary usage of the word "uncertain" so, by Myers' correspondence, it must correspond to a monad, and we can discover which monad by answering the four Cs. If $S$ is the state-space then the belief-state-space is given by $S^H$, the set of functions $$$\mathbf s : H \to S$. So our construct operator is $(-)^H$. If you're certain tha tthe outcome is $s \in S$ then your belief-state is the constant function $c_s : h \mapsto s$. The intuitive answers to *Collapse?* and *Combine?* give us our bind and product operators.

Overall, we get what's called the [reader monad from ](https://ncatlab.org/nlab/show/function+monad)$H$.

| Flavour of uncertainty | $H$-indeterminacy |
| --- | --- |
| Monad | Reader monad from $H$ |
| Construct $\\mathcal B(S)$ | $S^H$ |
| Return $\\eta_S(s)$ | $c_{s} : h \\mapsto s$ |
| Bind $\\mathbf w \\rhd_{WS}f$ | $h \\mapsto f(\\mathbf w(h))(h)$ |
| Product $\\mathbf a \\otimes_{AB} \\mathbf b$ | $h \\mapsto (\\mathbf a(h), \\mathbf b(h))$ |
| Interpretation | $\\mathbf x(h) = x$ if $x \\in X$ is your best guess about the outcome conditioned on the information $h \\in H$. |

4 — writer monad to $[0,1]$
---------------------------

Often, people will report their uncertain beliefs like "The coin will land heads (98%)" or "AI will disempower humanity (60%)". That is, their belief is a best guess paired with their confidence, which they offer as a lower-bound on the likelihood of that their guess is correct. A certain belief-state would be something like "The coin will land heads (100%)".

What monad corresponds to this flavour of uncertainty?

If $S$ is the state-space then $S \times [0,1]$ is the belief-state-space, i.e. there's a distinct belief-state for each pair $\mathbf s =(s, q) \in S\times [0,1]$. If you're certain that the outcome is $s \in S$ then your belief-state is $(s, 100\%) \in S \times [0,1]$. Uncertainty is collapsed by multiplying the confidences. Uncertainty is combined also by multiplying the confidences.

Ta-da! The [writer to](https://ncatlab.org/nlab/show/action+monad)$[0,1]$[ monad](https://ncatlab.org/nlab/show/action+monad)..

| Flavour of uncertainty | Confidence-marked guess |
| --- | --- |
| Monad | Writer to $[0,1]$ monad |
| Construct $\\mathcal B(S)$ | $S \\times [0,1]$ |
| Return $\\eta_S(s)$ | $(s, 1.00)$ |
| Bind $\\mathbf w \\rhd_{WS}f$ | $(s, p \\cdot q)$ where $\\mathbf w = (w, p)$ and$f(w) = (s, q)$ |
| Product $\\mathbf a \\otimes_{AB} \\mathbf b$ | $((a, b), p \\cdot q)$ where $\\mathbf a =(a, p)$ and $\\mathbf b = (b,q)$. |
| Interpretation | $\\mathbf x = (x, p)$ if $p \\in [0,1]$ is your confidence in the outcome$x\\in X$, i.e. you think that the likelihood of $x \\in X$ is at least $p $. |

Using the writer to $[0,1]$ monad, we've characterised a belief-state as an outcome marked with some additional metadata, namely a confidence $p \in [0,1]$. What properties of the interval $[0,1]$ did we appeal to in this definition? Well, firstly that we can multiply different elements (see bind and product operators). And secondly, that there's a fixed element such that multiplying with this element does nothing (see return operator).

Hence we can generalise: given any monoid $(M, e, \odot)$ we have a monad $\mathcal B(S) = S \times M$ called the writer-to-$M$ monad.[^5f23gu6req4] By using different monoids, we can model different flavours of uncertainty, but note that this is only a commutative monad when $(M, e, \odot)$ is a commutative monoid.

There's another ordinary usage of the word "uncertainty" where an uncertain belief would be something like "AGI arrives before 2040 unless there's a nuclear war" and a certain belief would be something like "AI will arrive before 2040." At least, with regards to teh binary question of whether AGI arrives before 2040. That is, an uncertain belief is one with an "unless..." clause.

Formalising this, we have a fixed set of events $\mathcal F$, and a belief-state is a pair $(s, E)\in S \times \mathcal F $. Your belief-state is $(s, E)$ when you commit to the state $s \in S$ occurring unless the event $E \in \mathcal F$ occurs. This flavour of uncertainty corresponds to the writer monad $\mathcal B(S) = S \times \mathcal F$, where $\mathcal F$ is a monoid when equipped with union $\cup : \mathcal F \times \mathcal F \to \mathcal F$ and the empty set $\emptyset \in \mathcal F$.

One might use this flavour of uncertainty to models various kinds of [defeasible reasoning](https://plato.stanford.edu/entries/reasoning-defeasible), where a belief-state $(s, E)$ is characterised by the precondition $E$ under which the belief would be defeated or disavowed.

| Flavour of uncertainty | Unless-claused guess |
| --- | --- |
| Monad | Writer monad to $\\mathcal F$ |
| Construct $\\mathcal B(S)$ | $S \\times \\mathcal F$ |
| Return $\\eta_S(s)$ | $(s, \\emptyset)$ |
| Bind $\\mathbf w \\rhd_{WS}f$ | $(s, E_1 \\cup E_2)$ where $\\mathbf w = (w, E_1)$ and$f(w) = (s, E_2)$ |
| Product $\\mathbf a \\otimes_{AB} \\mathbf b$ | $((a, b), E_1 \\cup E_2)$ where $\\mathbf a =(a, E_1)$ and $\\mathbf b = (b,E_2)$. |
| Interpretation | $\\mathbf x = (x, E)$ if you think $x$ will occur unless event $E$ occurs. |

Or maybe an uncertain belief is a one full of amendments, clarifications, conditions, disclaimers, excuses, hedges, limitations, qualification, refinements, reservations, restrictions, stipulations, temperings, etc. By contrast, a certain belief is made "with no ifs or buts", bare and direct.

Formalising this, we have a fixed set of clarifications $C$, and a belief-state is a pair $(s, l)\in S \times \text{List}(C)$. Here, $\text{List}(C)$ is the [free monoid](https://ncatlab.org/nlab/show/free+monoid) over the set of clarifications $C$ equipped with concatenation $+ : \text{List}(C) \times \text{List}(C) \to \text{List}(C)$ and the empty list $[] \in \text{List}(C)$.

| Flavour of uncertainty | Clarified guess |
| --- | --- |
| Monad | Writer to $\\text{List}(C)$ monad |
| Construct $\\mathcal B(S)$ | $S \\times \\text{List}(C)$ |
| Return $\\eta_S(s)$ | $(s, [])$ |
| Bind $\\mathbf w \\rhd_{WS}f$ | $(s, l_1 + l_2)$ where $\\mathbf w = (w, l_1)$ and$f(w) = (s, l_1 + l_2)$ |
| Product $\\mathbf a \\otimes_{AB} \\mathbf b$ | N/A (See below.) |
| Interpretation | $\\mathbf x = (x, l)$ if you think $x$ will occur and $l$ is a list of your clarifications. |

Now, the writer to $\text{List}(C)$ monad *isn't* a commutative monad. Or interpreted philosophically, a clarified guess isn't the kind of uncertainty you can have to *parts* of the world. Suppose "I think Alice is happy but I don't know her very well" is my belief-state about Alice, and "I think Bob is happy but he's difficult to read" is my belief-state about Bob. What's my belief-state about both Alice and Bob? Is it (1) "Alice and Bob are both happy, but I don't know Alice very well and Bob is difficult to read" or (2) "Alice and Bob are both happy, but Bob is difficult to read and I don't know Alice very well". That is, in which *order* should we combine the clarifications?

The instinctive trick is to declare that two belief-states are equal if the lists of clarifications are *equal* *up-to-permutation —* this implies that (1) and (2) are the same belief-state, which does seem intuitive to me. If we play this trick, then the resulting flavour of uncertainty is captured by the writer-to-$\mathbb N[C]$ monad, where $\mathbb N[C]$ is the [free commutative monoid](https://ncatlab.org/nlab/show/free+commutative+monoid). This does indeed give a commutative monad!

| Flavour of uncertainty | Unordered clarified guess |
| --- | --- |
| Monad | Writer monad to $\\mathbb N[C]$ |
| Construct $\\mathcal B(S)$ | $S \\times \\mathbb N[C]$ |
| Return $\\eta_S(s)$ | $(s, 0)$ |
| Bind $\\mathbf w \\rhd_{WS}f$ | $(s, l_1 + l_2)$ where $\\mathbf w = (w, l_1)$ and$f(w) = (s, l_1 + l_2)$ |
| Product $\\mathbf a \\otimes_{AB} \\mathbf b$ | $((a, b), l_1 + l_2)$ where $\\mathbf a =(a, l_1)$ and $\\mathbf b = (b,l_2)$. |
| Interpretation | $\\mathbf x = (x, l)$ if you think $x$ will occur and $l$ is an unordered list of your clarifications. |

5 — identity monad
------------------

If we've anticipating an election between $n$ candidates, then the simplest way to characterise your belief about the election by your *best guess* with no additional information about how unsure you are. If $S$ is the state-space then $S$ is also the belief-state-space, i.e. there's a distinct belief-state for each $s \in S$. The set of belief-states is therefore equal (up to bijection) to $$the set of outcomes itself.

I'll admit that this flavour of uncertainty is somewhat degenerate — e.g. every belief-state is a certainty in some particular state — but it's worth including nonetheless. On some readings of Wittgenstein's Tractatus, this is his model of how language represents the world, our utterances stand in direct isomorphism with the state-of-affairs.

Anyway, answering the four Cs would give the [identity monad](https://downloads.haskell.org/ghc/latest/docs/libraries/mtl-2.3.1-a8c6/Control-Monad-Identity.html)! 

| Flavour of uncertainty | Best guess |
| --- | --- |
| Monad | identity monad |
| Construct $\\mathcal B(S)$ | $S$ |
| Return $\\eta_S(s)$ | $s$ |
| Bind $\\mathbf w \\rhd_{WS}f$ | $f(\\mathbf w)$ |
| Product $\\mathbf a \\otimes_{AB} \\mathbf b$ | $(\\mathbf a, \\mathbf b)$ |
| Interpretation | $\\mathbf x = x$ if $x \\in X$ is your best guess about the outcome |

6 — maybe monad
---------------

The last example was a bit silly, so how about this instead..?

If we've anticipating an election between $n$ candidates, then I'll characterise your belief about the election either by your best guess *(*with no additional information) or an "I don't know" response. This is an *very* coarse-grained flavour of uncertainty — the only belief-state about the election (other than certainty in a particular candidate) is the belief-state of utter cluelessness, or shrugging one's shoulders!

Despite the coarse-grained-ness, it's pretty commonly encountered in the wild. For example, it's the typical flavour of uncertainty encountered in surveys/questionnaires, where $\bot$ is read as "no opinion/don't know". It's also encountered in voting, where $\bot$ is read as "abstention". 

Formally speaking, if $S$ is the state-space then there's a distinct belief-state for each state $s \in S$ plus an additional option denoted $\bot$. The belief-state-space is therefore $S+ 1$, denoting the disjoint union of $S$ with the singleton set $\{\bot\}$. If you're certain that the outcome is $s \in S$ then your belief-state is $s \in S$. This flavour of uncertainty corresponds to the famous [maybe monad](https://ncatlab.org/nlab/show/maybe+monad).

| Flavour of uncertainty | guess-or-shrug |
| --- | --- |
| Monad | maybe monad |
| Construct $\\mathcal B(S)$ | $S+1$ |
| Return $\\eta_S(s)$ | $s$ |
| Bind $\\mathbf w \\rhd_{WS}f$ | $\\begin{cases}\\bot&\\text{if $\\mathbf w= \\bot$}\\\\f(\\mathbf w)&\\text{otherwise}\\end{cases}$ |
| Product $\\mathbf a \\otimes_{AB} \\mathbf b$ | $\\begin{cases}\\bot&\\text{if $\\mathbf a= \\bot$ or $\\mathbf b = \\bot$}\\(a,b)&\\text{otherwise}\\end{cases}$ |
| Interpretation | $\\mathbf x = x$ if $x \\in X$ is your best guess for the outcome, and $\\mathbf x = \\bot$ if you offer no best guess. |

7 — $K$-distribution monad
--------------------------

You might, at this point, feel short-changed. I've discussed so far a range of flavours of uncertainty which are all coarser-grained than probabilistic knowledge, so why not stick to $$$\Delta$? Let's consider then a more fined-grained characterisation of belief-state, one that tracks *infinitesimal* differences between probability assignments.  

The Levi-Civita Field is an extension of the real numbers which contains infinitesimal values like $\epsilon, \epsilon^2, 2 \epsilon + \epsilon^2, \pi^2\sqrt \epsilon$ and infinite values like $\epsilon^{-1}, \epsilon^{-2},  \epsilon^{1/3} + \epsilon^{-1/3}+2$. We can replace $[0,1]$ in the definition of $\Delta$ with $\text{LCF}$ to obtain a monad $\Delta_\text{LCF}$ corresponding this flavour of uncertainty. On this account, a belief-state $\mathbf x \in \Delta_{\text{LCF}}(X)$ is something which tracks the *potentially* *infinitesimal* likelihood $\mathbf x(x) \in \text{LCF}$ of each outcome $x \in X$. This flavour of uncertainty has applications in [infinite ethics](https://www.lesswrong.com/tag/infinities-in-ethics) and [cooperation in large worlds](https://www.lesswrong.com/posts/mKnbHwRc7mXtENNEm/report-on-modeling-evidential-cooperation-in-large-worlds).

For example, in a universe with infinite radius $\epsilon^{-1}$, what's your prior likelihood that you occupy the most central galaxy? Presumably, the likelihood should be $\epsilon^3/\rho \in \text{LCF}$, where $\rho \in \mathbb R^+$ is the density of galaxies.

Now suppose you were offered a lottery which promises to benefit everyone by $\delta$ if you indeed occupy the most central galaxy but otherwise benefits no one. What's this lottery worth? Presumably, it's worth $\delta$, because the infinitary stakes $\delta \cdot \rho\cdot \epsilon^{-3}$ are cancelled out by the infinitesimal chance of winning $\epsilon^3/\rho$.

Note that because $\text{LCF}$ is totally-ordered, once we assign $\text{LCF}$ values to different lotties, we can perform expected utility maximisation as usual, and get sensible results. I think that infinitesimal probabilities resolves some (but not all) problems in infinite ethics. I'm particularly lured by the hope that, in an infinite cosmos, the infinitary stakes might somehow cancel out with infinitesimal probabilities to yield finite values. See Joe Carlsmith's essay [On Infinite Ethics](https://www.lesswrong.com/posts/5iZTwGHv2tNfFmeDa/on-infinite-ethics) for further discussion.

| Flavour of uncertainty | infinitesimal probabilistic |
| --- | --- |
| Monad | $\\text{LCF}$-distribution monad |
| Construct $\\mathcal B(S)$ | $\\Delta_\\text{LCF}(S)$ |
| Return $\\eta_S(s)$ | $\\delta_{s}:s' \\mapsto \\begin{cases}1&\\text{if $s' = s$}\\\\0 &\\text{otherwise}\\end{cases}$ |
| Bind $\\mathbf w \\rhd_{WS}f$ | $\\mathbf s : s'\\mapsto \\sum\\limits_{w \\in \\mathbf w} \\mathbf w(s)\\cdot f(w)(s')$ |
| Product $\\mathbf a \\otimes_{AB} \\mathbf b$ | $(a,b) \\mapsto \\mathbf a(a)\\cdot \\mathbf b(b)$ |
| Interpretation | $\\mathbf x (x) \\in \\text{LCF}$ is your potentially infinitesimal subjective credence in the outcome $x\\in X$ |

How far can one generalise the kind of entity that a "probability" must be, before our definition breaks? Well, so long as we have some rig $K$, we can define a monad $\Delta_K$ by replacing $[0,1]$ with $K$. A rig is a set $K$ equipped with a zero element $\mathbf 0\in K$, a unit element $\mathbf 1\in K$, an addition function $\oplus : K\times K \to K$, and a multiplication function $\otimes: K \times K \to K$, satisfying certain algebraic laws. By choosing different rigs $K$ then we  obtain different monads $\Delta_K$ corresponding to different flavours of uncertainty.

When $K:=[0,1]$ we obtain the ordinary probability distributions, and when $K := \mathbb Q\cap [0,1]$ we obtain the rational probability distributions, etc. [Toby Fritz suggests](https://golem.ph.utexas.edu/category/2009/04/convex_spaces.html#c023796) that by using similar tricks we might obtain quantum uncertainty, [fuzzy uncertainty](https://en.wikipedia.org/wiki/Possibility_theory), and [Dempster–Shafer uncertainty](https://en.wikipedia.org/wiki/Dempster%E2%80%93Shafer_theory), but I haven't checked whether this is true.

| Flavour of uncertainty | $K$-probabilistic |
| --- | --- |
| Monad | $K$-distribution monad |
| Construct $\\mathcal B(S)$ | $\\Delta_K(S)$ |
| Return $\\eta_S(s)$ | $\\delta_{s}:s' \\mapsto \\begin{cases}1&\\text{if $s' = s$}\\\\0 &\\text{otherwise}\\end{cases}$ |
| Bind $\\mathbf w \\rhd_{WS}f$ | $\\mathbf s : s'\\mapsto \\sum\\limits_{w \\in \\mathbf w} \\mathbf w(s)\\cdot f(w)(s')$ |
| Product $\\mathbf a \\otimes_{AB} \\mathbf b$ | $(a,b) \\mapsto \\mathbf a(a)\\cdot \\mathbf b(b)$ |
| Interpretation | $\\mathbf x (x) \\in K$ is your subjective credence in the outcome $x\\in X$, where $K$ is whatever rig of exotic probabilities |

8 — quantum monad
-----------------

For sure, quantum mechanics is endowed with its own flavour of uncertainty, hence the term Heisenberg's *Uncertainty* Principle. It's not impossible to catch a physicist saying "it's uncertain whether the qubit is 0 or 1" or "it's uncertain whether the cat is alive or dead", regardless of whether they consider quantum uncertainty as strictly speaking epistemic. By Myers' correspondence, this flavour of uncertainty must correspond to a monad.

**Exercise 3:** Which?[^s9mgrw8wq2]

9 — smooth state monad
----------------------

The position of the North Star in the night sky is constant, static, immutable, *certain;* the position of Mercury, by contrast, is variable, dynamic, mutable, *uncertain*. Is this not a common sense of the word? Might one not say that my belief-state about Mercury's position will forever be uncertain, no matter how accurate my telescope or exhaustive my calculations, because my belief is always revised? If so, then by Myers' correspondence this flavour of uncertainty corresponds to a monad.

To formalise this, let's fix a differentiable manifold $\Theta$ parameterising your internal mental state as you think about a question. Note that because $\Theta$ is a differentiable manifold, it's equipped with tangent space $T_\theta$ at every $\theta \in \Theta$.

If $S$ is the state-space, then $\prod_{\theta \in \Theta}(S\times T_\theta)$ is your belief-state-space. In other words, we have a distinct belief-state for each smooth transition function $\mathbf s \in  \prod_{\theta \in \Theta}(S\times T_\theta)$. A belief-state $\mathbf s$ is characterised by a pair $\mathbf s (\theta ) = (s, v)$ for each $\theta \in \Theta$, where $s \in S$ is your current guess and $v \in T_\theta$ is the tangent vector describing how your mental state is evolving. If you're certain that the winner is $s \in S$ then your belief-state is the static transition function $\eta(s) : \theta \mapsto (s, 0)$ where $0\in T_\theta$ is the zero vector.

This is the smooth state monad — it's a differentiable version of the discrete-time [state monad](https://ncatlab.org/nlab/show/state+monad), with the additional benefit that it's commutative monad.

| Flavour of uncertainty | evolving guess |
| --- | --- |
| Monad | smooth state monad |
| Construct $\\mathcal B(S)$ | $\\prod_{\\theta \\in \\Theta}(S\\times T_\\theta)$ |
| Return $\\eta_S(s)$ | $\\theta \\mapsto (s, 0)$ |
| Bind $\\mathbf w \\rhd_{WS}f$ | $\\theta \\mapsto (s, v_1 + v_2)$ where $\\mathbf w(\\theta) = (w, v_1)$ and $f(w)(\\theta) = (s, v_2)$ |
| Product $\\mathbf a \\otimes_{AB} \\mathbf b$ | $\\theta\\mapsto ((a,b), v_1+v_2)$ where $\\mathbf a(\\theta) = (a,v_1)$ and $\\mathbf b(\\theta) = (b, v_2)$. |
| Interpretation | The transition function $\\mathbf x:\\prod_{\\theta \\in \\Theta}(X \\times T_\\theta)$ describes how your internal mental state evolves over time and produces guesses. |

10 — continuation monad
-----------------------

What are belief-states actually *for* anyway? What purpose do they play in rational decision-making? According to one school of thought, belief-states are simply gadgets for taking expected values, and chiefly for taking expected *utility* values.$$

Let's say $S$ is the set of candidates running in the election, and $v : S \to \mathbb R$ is your utility function, i.e. $v(s) \in \mathbb R$ measures how happy you'd be to hear that the candidate $s \in S$ has won. Then your ex-ante utility is some $r \in \mathbb R$ measuring how happy you are *now* in anticipation of the outcome. Given your belief-state, I should be able to determine $r \in \mathbb R$ from $v : S\to \mathbb R$, which implies that I can just *characterise* your belief-state about the election by how $r \in \mathbb R$ is determined from $v : S \to \mathbb R$. Neat.

This is formalised by the so-called [continuation to ](https://ncatlab.org/nlab/show/continuation+monad)$\mathbb R$[ monad](https://ncatlab.org/nlab/show/continuation+monad). If $S$ is the state-space then $\mathcal K(S, \mathbb R)$ is the belief-state-space, where $\mathcal K(S, \mathbb R)$ is the set of functionals $\mathbf s : (S \to \mathbb R) \to \mathbb R$. And a belief-state $\mathbf s :(S \to \mathbb R) \to \mathbb R$ is *certain* in the outcome $s \in S$ if $\mathbf s$ determines your ex-ante utility simply by evaluating your utility function at $s$, i.e. $\mathbf s= \lambda^{v : S \to \mathbb R}.v(s)$.

The [continuation monad](https://ncatlab.org/nlab/show/continuation+monad) encompasses both possibilistic uncertainty and probabilistic uncertainty. If the nonempty subset $A\in \mathcal P^+(X)$ models your possibilistic uncertainty then the associated functional $\mathbf x \in \mathcal K(X, \mathbb R)$ is given by $\lambda^{v : X\to \mathbb R}.\min\{v(x) : x \in A\}$. If the distribution $\mu \in \Delta(X)$ models your probabilistic uncertainty then the associated functional $\mathbf x \in \mathcal K(X, \mathbb R)$ is given by $\lambda^{v : X\to \mathbb R}.\mathbb E_{x \sim \mu}[v(x)]$.

| Flavour of uncertainty | ex-ante utility |
| --- | --- |
| Monad | Continuation monad |
| Construct $\\mathcal B(S)$ | $\\mathcal K(S, R)$ |
| Return $\\eta_S(s)$ | $v \\mapsto v(s)$ |
| Bind $\\mathbf w \\rhd_{WS}f$ | $\\mathbf w\\big(\\lambda^{w \\in W}.f(w)(v)\\big)$ |
| Product $\\mathbf a \\otimes_{AB} \\mathbf b$ | Unfortunately, $\\mathcal K(-, R)$ is not a commutative monad.[^9jzx95mu5ug] |
| Interpretation | If $v : X \\to R$ assigns your ex-post utility $v(x) \\in R$ to each outcome $x \\in X$, then $\\mathbf x(v)\\in R$ is your ex-ante utility. |

**Exercise 4:** (Beginner) Prove that the two maps $\mathcal P^+(X) \to \mathcal K(X, \mathbb R)$ and $\Delta(X) \to \mathcal K(X, \mathbb R)$ are injections. (Advanced) Prove these injections are [monad transformers](https://ncatlab.org/nlab/show/monad+transformer).[^68o6vco2o3]

11 — signature monad 
---------------------

Maybe I should characterise your belief-state about something by the sentence that you'd utter about the outcome. This will result in a more syntactic or linguistic account of belief. You might imagine here a shared language, like English or Python, with which a speaker may report their beliefs to a friend. Or you might imagine a [private mental language](https://plato.stanford.edu/entries/language-thought/) in which a brain/AI will store their knowledge about the world.

To make this rigorous, I must introduce a language containing all the sentences that you might utter about the outcome. Our language will include an atomic sentence $\ulcorner s \urcorner$ for every outcome $s \in S$, along with certain connectives for combining sentences. For example, suppose we have a language with two symbols, a binary connective $\vee$ called disjunction and a unary connective $\neg$ called negation. If $S:=\{s_1, \ldots, s_n\}$ are the candidates in an election, then a belief-state about the electoral outcome is a sentence like $\ulcorner s_5 \urcorner$ or $\ulcorner (s_2 \vee \neg s_3)\vee \neg(s_4\vee s_6)\urcorner$.

The logical connectives can be specified by a [signature](https://ncatlab.org/nlab/show/signature+%28in+logic%29)$(\Sigma, \text{arity}: \Sigma \to \mathbb N\}$. A signature is a set $\Sigma$ equipped with a map $\text{arity} : \Sigma \to \mathbb N$ sending each connective to its [*arity*](https://ncatlab.org/nlab/show/arity)*.* So the aforementioned language has the signature $\Sigma=\{\vee, \neg\}$ with $$$\text{arity}(\vee) =2$ and $\text{arity}(\neg) = 1$. 

We denote the resulting set of sentences by $\mathcal L(\Sigma, S)$. This is a set containing all the sentences freely generated from $S$ using the connectives in $\Sigma$. Explicitly, $\mathcal L(\Sigma, S)$ is the smallest set such that $\ulcorner s \urcorner\in \mathcal L(\Sigma, S)$ for every $s \in S$ and $\ulcorner \sigma (\phi_1 , \ldots, \phi_k)\urcorner \in \mathcal L(\Sigma, S)$ for every $\sigma \in \Sigma$, $\text{arity}(\sigma ) =k$, and $\ulcorner \phi_i\urcorner \in \mathcal L(\Sigma, S)$.

With this machinery in place, we can answer the Four C's, and thereby find the corresponding monad.

1.  If $S$ is the state-space then there's a distinct belief-state for each sentence $\mathbf s \in \mathcal L(\Sigma, S)$.
2.  If you're certain that the winner of the election is $s \in S$, then your belief-state is the sentence $\ulcorner s \urcorner$.
3.  Let $f : W \to \mathcal L(\Sigma, S)$ be the function assigning to each forecaster $w \in W$ their belief-state $f(w) \in \mathcal L(\Sigma, S)$ about the election. And let $\mathbf w \in \mathcal L(\Sigma, W)$ be your belief-state about the forecasters. Then your belief $\mathbf s \in \mathcal L(\Sigma, S)$ about the election itself is given by *uniform substitution:* loop through the sentence $\mathbf w\in \mathcal L(\Sigma, W)$ and, every time you come across an atomic letter $w \in W$, replace it with the sentence $f(w) \in \mathcal L(\Sigma, W)$. This results in a sentence $\mathbf s \in \mathcal L(\Sigma, S)$.[^fmpulwnuvmq]
4.  Unfortunately, $\mathcal L(\Sigma, -)$ isn't generally a commutative monad.[^tbkr3jjqnas]

| Flavour of uncertainty | utterance in a language |
| --- | --- |
| Monad | signature monad $\\mathcal L(\\Sigma, -)$ |
| Construct $\\mathcal B(S)$ | $\\mathcal L(\\Sigma, S)$ |
| Return $\\eta_S(s)$ | $\\ulcorner s\\urcorner$ |
| Bind $\\mathbf w \\rhd_{WS}f$ | Uniform substitution of every$w \\in W$ with $f(w) \\in \\mathcal L(\\Sigma, S)$ in the sentence $\\mathbf w$ |
| Product $\\mathbf a \\otimes_{AB} \\mathbf b$ | N/A |
| Interpretation | $\\mathbf x \\in \\mathcal L(\\Sigma, X)$ is the sentence that you would utter about the outcome, in a language which contains an atomic letter for each outcome $x \\in X$ and a logical connective for each $\\sigma \\in \\Sigma$. |

Many monads are equivalent to $\mathcal L(\Sigma, -)$ for some signature $\Sigma$, including many monads we've already encountered.

*   When $\Sigma = \emptyset$, then $\mathcal L(\Sigma, -)$ is equivalent to the identity monad. This is intuitive. If there's no connectives in the language, then every utterance is a single atomic sentence positing one of the outcomes.
*   When $$$\Sigma = \{\bot\}$ consists of one constant symbol (i.e. zero-arity connective) then $\mathcal L(\Sigma, X)$ will contain the atomic sentences $\ulcorner x\urcorner$ plus one additional sentence $\ulcorner \bot\urcorner$. So $\mathcal L(\Sigma, -)$ is equivalent to the maybe monad. We encountered this before as modelling the *guess-or-shrug* flavour of uncertainty*.*
*   When $\Sigma = \{\bot, \bot ', \bot'', \ldots \}$ consists of many constant symbols, then $\mathcal L(\Sigma, X)$ will contain atomic sentences $\ulcorner x\urcorner$ plus additional sentences $\ulcorner \bot^{(k)}\urcorner$ for every $\bot^{(k)}\in \Sigma$. So $\mathcal L(\Sigma, -)$ is equivalent to what's called the [exception monad](https://ncatlab.org/nlab/show/exception+monad) $(- + \Sigma)$. This is like the *guess-or-shrug*, except there are multiple ways to shrug one's shoulders.
*   When $\Sigma=\{\neg\}$ consists of one unary connective, then $\mathcal L(\Sigma, X)$ will contain sentences like $\ulcorner \neg \neg \neg \neg x\urcorner$. So $\mathcal L(\Sigma, -)$ is equivalent to the writer monad to the monoid $(\mathbb N, +,0)$. If $\Sigma$ consists of many unary connectives, then $\mathcal L(\Sigma, -)$ is equivalent to the writer monad to $\text{List}(\Sigma)$. We encountered this before as modelling the *clarified guess*.
*   When $\Sigma=\{\vee\}$ consists of one a binary connective, then $\mathcal L(\Sigma, X)$ will consist of sentences like  $\ulcorner (x_1 \vee ((x_2\vee x_2) \vee x_3))\vee (x_5 \vee x_8))\urcorner$. So $\mathcal L(\Sigma, -)$ is equivalent to the set of full binary trees over $X$. As Vanessa Kosoy notes, "we think of such a tree as a way to select an element of $X$ by reading a stream of bits." ([See here.]( https://www.alignmentforum.org/posts/jxE47v3aezEYaydg9/compositional-language-for-hypotheses-about-computations#:~:text=We%20think%20of,stream%20of%20bits.))  
      
    *Isn't the archetypal symbol of uncertainty... a fork in the road? Imagine a traveller facing two paths, left and right, each forking further ahead, and so on unboundedly, forming a fractal canopy of binary choices.*

12 — algebraic theory
---------------------

There's something a bit perverse about characterising your belief-state with a single utterance about the outcome. Namely, some utterances will be logically equivalent to each other, such as $\ulcorner \phi\urcorner$ and $\ulcorner (\phi\vee \phi)\urcorner$, and therefore the belief-state in which you're willing to utter $\ulcorner \phi \urcorner$ is *the exact same* as the belief-state in which you're willing to utter $\ulcorner (\phi\vee \phi)\urcorner$, assuming that you're both rational and honest. Therefore, our previous characterisation was overcounting the belief-states by distinguishing logically-equivalent sentences. Bizarrely, there would be infinitely-many belief-states about a single coin flip — i.e. $\ulcorner H\urcorner$, $\ulcorner(H \vee H)\urcorner$, $\ulcorner(H \vee (H \vee H))\urcorner$, and so on.

To fix this, what we need isn't just a signature $\Sigma$, but rather a signature $\Sigma$ paired with a set $E$ of equational axioms, which is called an **algebraic theory.** An equational axiom is a pair of sentences built using the connectives in $\Sigma$ and some placeholder sentence variables $\{a,b,c,\ldots\}$. We use $E$ to define an equivalence relation $\sim_E$ on $\mathcal L(\Sigma, X)$ by taking the deductive closure of the axioms, and then the *equivalence classes* of the sentences will be our belief-states.

For example, if our signature is $ \{\vee\}$ and we intend to interpret the $\vee$ connective as disjunction, then $E$ should consist of three axioms:

1.  Idempotency, $(a \vee a) = a$
2.  Commutativity, $(a \vee b) = (b \vee a)$
3.  Associativity,$((a \vee b) \vee c) = (a \vee (b \vee c))$

Furnished with the concept of an algebraic theory, we can now improve our answers:

1.  If $S$ is the state-space then there is a distinct belief-state for each equivalence class of sentences $[\phi]^E := \{\ulcorner \psi\urcorner \in \mathcal L(\Sigma, Y) : \ulcorner \phi\urcorner  \sim_E \ulcorner \psi\urcorner \}$. This set is denoted $\mathcal L(\Sigma, E, Y):=\{[\phi]^E : \phi \in \mathcal L(\Sigma, Y)\}$.
2.  If you're certain that the winner is $s \in S$, then your belief-state is the sentence $[s]^E\in \mathcal L(\Sigma, E, S)$.
3.  Let $f : W \to \mathcal L(\Sigma, E,S)$ be the function assigning to each forecaster $w \in W$ their belief-state $f(w) \in \mathcal L(\Sigma, E,S)$ about the election. And let $\mathbf w \in \mathcal L(\Sigma,E, W)$ be your belief-state about the forecasters. Then your belief $\mathbf s \in \mathcal L(\Sigma, E,S)$ about the election itself is given by *uniform substitution modulo equivalence.* We know $\mathbf w = [\phi]^E$ for some $\ulcorner \phi  \urcorner \in \mathcal L(\Sigma, W)$ and that $f(w) = [F(w)]^E$ for some $F : W \to \mathcal L(\Sigma, S) $. Then $\mathbf w \rhd f = [\phi \rhd^{\mathcal L(\Sigma , -)}_{WS} F]^E$ where $\rhd^{\mathcal L(\Sigma , -)}_{WS}$ is the bind operator for the signature monad. This is operation is well-defined because the deductive system satisfies [referential transparency](https://en.wikipedia.org/wiki/Referential_transparency) — i.e. if $\ulcorner\phi_i \urcorner\sim_E \ulcorner\phi_i'\urcorner$ then $\ulcorner\sigma(\phi_1, \ldots, \phi_n)\urcorner \sim_E \ulcorner\sigma(\phi'_1, \ldots, \phi'_n)\urcorner$.
4.  Again, $\mathcal L(\Sigma, E, -)$ isn't generally a commutative monad.

| Flavour of uncertainty | equivalence class of utterances |
| --- | --- |
| Monad | utterances-modulo-equivalence |
| Construct $\\mathcal B(S)$ | $\\mathcal L(\\Sigma, E,S)$ |
| Return $\\eta_S(s)$ | $[s]^E$ |
| Bind $\\mathbf w \\rhd_{WS}f$ | $[\\phi \\rhd^{\\mathcal L(\\Sigma, -)}_{WS} F]^E$ where $\\mathbf w = [\\phi]^E$ and $\\forall w \\in W.f (w) = [F(w)]^E$ |
| Product $\\mathbf a \\otimes_{AB} \\mathbf b$ | N/A |
| Interpretation | $\\mathbf x \\in \\mathcal L(\\Sigma,E, X)$ is the *set* of sentence that you would assert about the outcome, in a language which contains an atomic letter for each outcome $x \\in X$, a logical connective for each $\\sigma \\in \\Sigma$, and where $E$ is the set of equational axioms governing the connectives of $\\Sigma$. |

If a monad $\mathcal B$ is equivalent to $\mathcal L(\Sigma, E,-)$ for some algebraic theory $(\Sigma, E)$ then we call $(\Sigma, E)$ a **presentation** of the monad.[^lq3pmfj3gzg] A presentation of a monad is a rather nice description of a flavour of uncertainty via some operators for defining belief-states in terms of other belief-states and some rules governing those operators.

*   When $E$ is empty, then $\mathcal L(\Sigma, E,-)$ is obviously just the signature monad $\mathcal L(\Sigma, -)$.
*   When $\Sigma = \{\Box_p : p\in [0,1] \}$ contains a unary connective for every $p \in [0,1]$ and $E$ contains the axioms $\Box_p \Box_q \;a=\Box_{p \cdot q} \;a$ , then $\mathcal L(\Sigma, E, X)$ is equivalent to the writer monad to the monoid $[0,1]$. We encountered this before as the *confidence-marked guess.* In general, we can give a similar presentation for the writer monad to any monoid $(M, e, \odot)$. So the unless-claused guess has a similar presentation.
*   When $\Sigma = \{\vee\}$ and$$ $E$ is idempotency, commutativity, and associativity (shown above), then there is a distinct class $$$[ \phi ]^E \in \mathcal L (\Sigma, E, X)$ for each non-empty finite subset of $X$. So $\mathcal L(\Sigma, E, -)$ is equivalent to the nonempty finite powerset monad $\mathcal P^+_f$. This is a finitary version of the monad $\mathcal P^+$ which we've encountered as modelling possibilistic uncertainty*.* This algebraic theory is also called the [theory of semilattices](https://ncatlab.org/nlab/show/semilattice).
*   Let's find a presentation for $\Delta$ the distribution monad. The signature $\{+_p : p \in (0,1)\}$ will contain a binary connective for every $p \in (0,1)$. Our axioms will be $a +_p a = a$ (skew-idempotency), $a +_p b = b +_{1-p} a$ (skew-commutativity), and $((a+_p b) +_q c)=(a+_{p \cdot q} (b+_{\tiny{{\dfrac{(1-p)\cdot q}{1-p\cdot q}}}} c ))$ for (skew-associativity). You should think of $\ulcorner\phi +_p \psi \urcorner$ as $p$ units of $\ulcorner \phi \urcorner$ and $(1-p)$ units of $\ulcorner \psi \urcorner$, which explains the ghastly expression for skew-associativity. This algebraic theory is called the [*theory of convex algebras*](https://ncatlab.org/nlab/show/convex+space).

**Exercise 5:** Find a presentation for $\Delta_K$ for an arbitrary rig $K$.$$$$

13 — convex powerset of distributions monad
-------------------------------------------

As we saw before, the continuation monad $\mathcal K(-, \mathbb R)$ encompasses both possibilistic and probabilistic uncertainty. Unfortunately $\mathcal K(-,\mathbb R)$ lacks any presentation, even if we allow connectives with infinite arity![^5k2ls5xxsvm] Fortunately, there exists a monad encompassing both possibilistic and probabilistic uncertainty which is presentable.

Recall that the nonempty finite powerset monad $\mathcal P^+_f$, which corresponds to possibilistic uncertainty, is presented by the theory of semilattices $(\Sigma_1, E_1)$. And the distribution monad $\Delta$, which corresponds to probabilistic uncertainty, is presented by the theory of convex algebras $(\Sigma_2, E_2)$. Consider the theory $(\Sigma_1 \cup \Sigma_2, E_1\cup E_2 \cup D)$ where $D = \{a+_p(b \vee c) = (a+_p b)\vee (a+_p c)\}$ is an additional axiom of describing how the $+_p$ connectives distribute over the $\vee$ connective.

This new theory is a presentation the [convex powerset of distributions monad](https://ncatlab.org/nlab/show/convex+powerset+of+distributions+monad). This monad, denoted by $\mathcal C$, corresponds to a flavour of uncertainty wherein a belief-state is a convex set of distributions, e.g. "The coin lands either heads (20-30%) or tails (70-80%)." (See [credal sets](https://en.wikipedia.org/wiki/Credal_set).)

Now, we could have defined $\mathcal C$ in an entirely non-syntactic way, i.e. "$\mathcal C(X)$ is the set of nonempty finitely-generated convex-closed sets of finite-support distributions over $X$." But I think the syntactic definition, in terms of the algebraic theories for $\mathcal P^+$ and $\Delta$, elucidates why $\mathcal C$ is a well-motivated unification of probabilistic and possibilistic uncertainty. We will employ a similar strategy for motivating infrabayesianism — roughly speaking, infrabayesianism is exactly what you get when you combine probabilistic and possibilistic uncertainty with *reward*.

| Flavour of uncertainty | imprecise probability |
| --- | --- |
| Monad $\\mathcal L(\\Sigma, E, -)$ | convex powerset of distributions monad |
| Signature $\\Sigma$ | $\\{\\vee\\} \\cup \\{+_p : p \\in (0,1)\\}$ |
| Axioms $E$ | $$$\\vee$ is semilattice, i.e. $a \\vee a = a$ $a \\vee b = b \\vee a$ $a \\vee (b \\vee c) = (a \\vee b) \\vee c$ $\\{+_p: p \\in (0,1)\\}$ is convex algebra, i.e. $a +_p a = a$ $a +_p b = b +_{1-p} a$ $((a+_p b) +_q c)=(a+_{p \\cdot q} (b+_{\\tiny{{\\dfrac{(1-p)\\cdot q}{1-p\\cdot q}}}} c ))$ $+_p$ distributes over $\\vee$, i.e. $a+_p (b \\vee c) = (a+_p b)\\vee (a+_p c)$ |
| Interpretation | $\\ulcorner x \\urcorner $ is certainty in an outcome $x \\in X$. $\\ulcorner \\phi_1 \\vee \\phi_2\\urcorner$ is possibilistic uncertainty between $\\ulcorner \\phi_1 \\urcorner$ and $\\ulcorner \\phi_2 \\urcorner$. $\\ulcorner \\phi_1+_p \\phi_2\\urcorner$ is probabilistic uncertainty between $\\ulcorner \\phi_1 \\urcorner $ (with chance $p$) and $\\ulcorner \\phi_2 \\urcorner$ (with chance $1-p$). |

14 — free convex lattice monad
------------------------------

There's a common usage of the word "uncertainty", where the uncertainty is modulo strategic choice. For example, you might hear "Black is certain to win" from a chess commentator if Black can force a checkmate, or hear "the winner is still uncertain" from a poker commentator during the [flop](https://en.wikipedia.org/wiki/Glossary_of_poker_terms#F:~:text=other%20casino%20service.-,flop,-The%20dealing%20of). By Myers' correspondence, this flavour of uncertainty — call it "ludic uncertainty" — must correspond to some monad, but which?

Consider the theory of convex lattices — with signature $\Sigma_G=\{\vee,\land,  0, 1\} \cup \{+_p : p \in (0,1)\}$ and the following axioms:

*   $(\vee, \land, 0, 1)$ is a [lattice](https://ncatlab.org/nlab/show/lattice).[^c24acr58ji]
*   $\{+_p : p \in (0,1)\}$ is a convex algebra.
*   $+_p$ distributes over $\vee$ and $\land$, i.e. $a +_p (b \vee c) = (a+_p b) \vee (a +_pc)$ and $a +_p (b \land c) = (a+_p b) \land (a +_pc)$.

Then $\mathcal G : =\mathcal L (\Sigma _\mathcal G, E_\mathcal G, -)$ is a monad corresponding, I think, to the aforementioned flavour of uncertainty. It sends a set $X$ to the set $\mathcal G(X)$, the free convex lattices over $X$. An element of $\mathcal G(X)$ should be read as a game-tree whose non-leaf nodes are either a free binary choice by White, a free binary choice by Black, or a biased coin flip. The leaf nodes may be either wins for White, wins for Black, or an element of the set $X$.

We treat game-trees $g, g'\in \mathcal G(X)$ as equivalent if the same outcome would result from $g$ and $g'$ regardless of the player's preferences over the elements of $X$. For example, the lattice axioms $\phi \vee 0 = \phi$ and $\phi \land 1 = \phi$ will hold because no player would willingly choose to loose, and the axioms $\phi \vee (\phi \land \psi ) = \phi$ and $\phi\land (\phi \vee \psi) =\phi$ establish that the players are adversarial, i.e. would never willingly empower one another.

**Exercise 7:** Consider the game$\ulcorner ((1 \vee x_2) \land ((x_2 +_{0.8}0)\vee (x_2 \land 1 )))\land (x_2 \vee (x_5 +_{0.5}(x_3 \land x_4)))\urcorner$ shown below. Which outcome is (ludically) certain?

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/9d0b983201ba0184883bbfeb08f39a23518deb350cdd9967.png)

The outcome of the game $\ulcorner ((1 \vee x_2) \land ((x_2 +_{0.8}0)\vee (x_2 \land 1 )))\land (x_2 \vee (x_5 +_{0.5}(x_3 \land x_4)))\urcorner$ is certain.

Note that $\mathcal G(X)$ aren't really *games* in the usual sense, because leaf nodes might be elements of $X$, and we treat these elements are pairwise incomparable to both players. So you should think of $\mathcal G(X)$ as a set of *partially-specified* game trees. A fully-specified game tree would be an element of $\mathcal G([0,1])$, which is a game tree where each leaf-node returns some $[0,1]$-valued utility to Black and disutility to White. You may notice that $[0,1]$ can itself be equipped with the structure of a convex lattice, which just means there exists a $\mathcal G$-algebra $V:\mathcal G([0,1])\to [0,1]$.[^54nabd4r4n] This $\mathcal G$-algebra is exactly the well-known used in combinatorial game theory.

| Flavour of uncertainty | ludic |
| --- | --- |
| Monad $\\mathcal L(\\Sigma, E, -)$ | free convex lattices |
| Signature $\\Sigma$ | $\\{\\land, \\vee, 0, 1\\} \\cup \\{+_p : p \\in (0,1)\\}$ |
| Axioms $E$ | $$$\\{\\land, \\vee, 0, 1\\}$ is a lattice. $\\{+_p: p \\in (0,1)\\}$ is convex algebra. $+_p$ distributes over both $\\land$ and $\\vee$, i.e. $a+_p (b \\vee c) = (a+_p b)\\vee (a+_p c)$ |
| Interpretation | $\\ulcorner x \\urcorner$ is a game which will certainly result in outcome $x \\in X$. $$$\\ulcorner 0\\urcorner$ is a game where White wins and $\\ulcorner 1 \\urcorner$ is a game where Black wins. $\\ulcorner\\phi \\wedge \\psi\\urcorner$ is a game where White can choose to play $\\phi$ or to play $\\psi$. $\\ulcorner\\phi \\vee \\psi\\urcorner$ is a game where Black can choose to play $\\phi$ or to play $\\psi$. $\\ulcorner\\phi+_p \\psi\\urcorner$ is a game where $\\phi$ is played with chance $p$ and $\\psi$ with chance $1-p$. |

15 — infrabayesianism
---------------------

When agents have beliefs about the same environment that they're embedded in, weird [things can happen](https://www.lesswrong.com/posts/i3BTagvt3HbPMx6PN/embedded-agency-full-text-version). Over the past few years, Vanessa Kosoy and Alex Appell have been exploring a novel flavour of uncertainty — [*infrabayesian uncertainty*](https://www.lesswrong.com/tag/infra-bayesianism) *—* which they claim more fruitfully characterises the belief-states of embedded agents. In particular, it characterises belief-states concerning Newcomb-like environments, where the state of the environment is correlated with the agent's choice under consideration. Their flavour of uncertainty corresponds to the infrabayesian monad $\Box$.

Roughly speaking, $\Box$ is the same as $\mathcal G$ above except without the $\land$ connective. Consider $(\Sigma, E)$ the theory of convex semilattices with top and bottom, which is a presentation of the composite monad $\mathcal P^+_f \circ \Delta \circ (-+2)$.[^tkie02uhrx] From what I understand, this monad $\mathcal P^+_f \circ \Delta \circ (-+2)$ is Kosoy's infrabayesian monad $\Box$.[^cv3p8o117wd] This justifies the claim that infrabayesianism is the flavour of uncertainty that *minimally* encompasses both possibilistic uncertainty (via the $$$\mathcal P^+_f$ monad), probabilistic uncertainty (via the $\Delta$ monad), and reward (via the $(-+\{0, 1\})$ monad). I think that this motivates infrabayesianism as a characterisation of an agent's belief-state about their environment.

| Flavour of uncertainty | infrabayesian |
| --- | --- |
| Monad $\\mathcal L(\\Sigma, E, -)$ | infrabayesian monad |
| Signature $\\Sigma$ | $\\{ \\vee, 0, 1\\} \\cup \\{+_p : p \\in (0,1)\\}$ |
| Axioms $E$ | $$$\\vee$ is a semilattice with $a \\vee0 =a$ and $a \\vee 1 = 1$. $\\{+_p: p \\in (0,1)\\}$ is convex algebra. $+_p$ distributes over $\\vee$, i.e. $a+_p (b \\vee c) = (a+_p b)\\vee (a+_p c)$ |
| Interpretation | $\\ulcorner x \\urcorner$ is an environment which certainly results in outcome $x \\in X$. $$$0$ is an impossible/contradictory environment where the agent achieves no disutility, called Nirvana. $1$ is an environment where the agent suffers maximal disutility. $(\\phi \\vee \\psi)$ is a environment which is either like $\\phi$ or like $\\psi$, and our agent should be pessimistic here. $(\\phi+_p \\psi)$ is an environment which is like $\\phi$ with chance $p$ and $\\psi$ with chance $1-p$. |

Unfortunately, $\Box$ isn't a commutative monad, which means it's not a flavour of uncertainty that you can have to *parts* of the world, but only to the world in its entirety. Put starkly, there's no way to combine my infrabayesian belief-states about two coin toss to yield a single infrabayesian belief-state about the pair of coin tosses, even when the coin tosses are completely unrelated.[^om8tyqx2iun] This, I think, limits both the theoretical appeal of infrabayesianism and its tractability.

Theoretically speaking, the fact that $\Box$ isn't a commutative monad weakens the analogy between infrabayesian uncertainty and possibilistic or probabilistic uncertainty. Many concepts are built upon possibilistic or probabilistic uncertainty which appeal, in an essential way, to the product operators $\otimes^{\mathcal P+}$ or $\otimes^\Delta$. And infrabayesianism, lacking such an operator, is not guaranteed the analogous concept.

Practically speaking, the lack of an infrabayesian product operator is an obstacle to parallelising algorithms which assume infrabayesian belief-states. There is no way to decompose the environment into separate components, discover an infrabayesian belief-state for each component, and then combine those belief-states into a single belief-state about the environment as a whole.

Implications for AI safety 
===========================

Does this essay have any practical significance, or is it all just abstract nonsense? How does this help us solve the Big Problem? To be perfectly frank, I have no idea. Timelines are probably too short agent foundations, and this essay is maybe agent foundations foundations or something like that. But I feel compelled to offer some practical implications for AI safety to validate my decision to write this essay and your decision to read it.

1.  One lesson is that uncertainty comes in many flavours, and formalisating different flavours of uncertainty isn't mathematically challenging. Just ask yourself the Four C's (Count? Certainty? Collapse? Combine?) and you've got yourself a monad.
2.  Often, you can replace one monad in a formalism with another and everything will still type-check. For example, the stochastic Markov decision processes are transition functions $\tau : A \times S\to \Delta( O \times S)$. One can generalise this to  $\tau : A \times S \to \mathcal B( O \times S)$ for any monad $\mathcal B$ we've met so far.
3.  If you're conducting active research into agent foundations, then instead of assuming a fixed flavour of uncertainty (e.g. possibilistic, probabilistic, infrabayesian, etc), perhaps see if you can generalise the theory to an arbitrary monad, or at least an arbitrary *commutative* monad. I call such theories **"parametric in the monad".** If you're gonna do foundational work, it often pays to make it highly parametric, even if you only care about a specific case.
    1.  The theory will be robust to errors about the appropriate flavour of uncertainty.
    2.  If you want to account for another flavour of uncertainty, you'll have saved yourself time, effort, and ink.
    3.  You've got more data points to sanity-check the theory — do you get sensible answers when you plug in different monads, e.g. $\mathcal P^+_f, \text{id}, \Delta, \Box, ( -  \times [0,1])$ etc?
4.  If your solution to AI safety involves, at some step, building a formal model of the environment (c.f. Davidad's [Open Agency Architecture](https://www.alignmentforum.org/posts/pKSmEkSQJsCSTK6nH/an-open-agency-architecture-for-safe-transformative-ai).) or of a human (c.f. [imitative amplification](https://www.lesswrong.com/posts/fRsjBseRuvRhMPPE5/an-overview-of-11-proposals-for-building-safe-advanced-ai#2__Imitative_amplification___intermittent_oversight)), then this model should carry all the flavours of uncertainty that actually characterise your belief-state about the system. And you shouldn't feel compelled to shoe-horn all your uncertainties into a probability distribution. For example, *unless-claused uncertainty* seems pretty fundamental — we commit to our stochastic models of the environment and/or a human only within a narrow range of situations — and this flavour of uncertainty seems irreducible to probabilistic uncertainty.

Further questions
=================

In so far as "flavours of uncertainty" is an informal term, there's little we can do to test the correspondence other than enumerating well-known flavours of uncertainty and checking that they do in fact correspond to monads, and vice-versa, enumerating the well-known monads and giving them natural doxastic interpretations. I think my own attempt has been positive, but this result is open to revision.

Secondly, the the biggest asterisks of my essay: my treatment of belief-states has been silent on their most important property, namely that they are *learned.* For example, a probability distribution can be *conditioned* on new evidence, and possibilistic uncertainty also carries an analogous notion of conditioning. Perhaps any characterisation of belief should answer additional questions about how those belief-state revised in light of new evidence/observations/considerations, etc. Perhaps we should append to *Count? Certainty? Collapse? Combine?* a fifth question, *Condition?* I'm sympathetic to this worry.

And if indeed learning is a phenomenon which must be modelled by any characterisation of belief, then monads do not themselves carry enough structure to characterise beliefs. Rather, we would need to equip the monad $\mathcal B$ with some additional structure, perhaps a family of maps $\text {learn}_S: \mathcal O(S)\times\mathcal B(S) \to \mathcal B(S)$ for some spce of observations $\mathcal O(S)$, possibly satisfying some additional constraints such as $\text{learn}_S(o,-)\circ \eta_S = \eta_S$ and $\text{learn}_S(o_1\cdot o_2,-) = \text{learn}_S(o_2,-) \circ \text{learn}_S(o_1,-)$. I'm just improvising here.

This is best left to future work, if the need arises.

* * *

| Flavour of uncertainty | Monad |
| --- | --- |
| possibilistic | nonempty powerset monad |
| probabilistic | distribution monad |
| indeterminate | reader from $H$ monad |
| confidence-marked | writer to $[0,1]$ monad |
| unless-claused | writer to $\\mathcal F$ monad |
| ordered clarifications | writer to $\\text{List}(C)$ monad |
| unordered clarifications | writer to $\\mathbb N[C]$ monad |
| best guess | identity monad |
| guess-or-shrug | maybe monad |
| infinitesimal probabilistic | $$$\\text{LCF}$-distribution monad |
| generalised probabilistic | $K$-distribution monad |
| quantum | quantum monad |
| evolving | smooth state monad |
| ex-ante utility | continuation to $\\mathbb R$ monad |
| utterance in a language | guess-or-many-shrugs |
| guess-or-different-shrugs | exception monad |
| path through forking road | full binary trees monad |
| utterance modulo equivalence | algebraic theory |
| imprecise probability | convex powerset of distributions monad |
| ludic | free convex lattice monad |
| infrabayesian | infrabayesian monad |

* * *

[^ncb394vix8n]: In particular, I'm thinking of the applied category theory community. 

[^p7oqifhpuxg]: Traditionally, the field of analytic epistemology has been concerned with defining epistemological concepts — i.e. constructing definitions for the concepts of knowledge, belief, evidence, learning, testimony, justification, etc. However, in recent years analytic epistemology has reorientated itself, chiefly under the influence of Timothy Williamson, towards modelling epistemological phenomena — i.e. constructing mathematical models for phenomena relating knowledge, belief, evidence, learning, testimony, justification, etc. This reorientation in epistemology, from concept-defining to model-building, was inspired by the natural sciences.\(\) 

[^4dzfhbofe8m]: An operator \(F\) assigns, to every set \(X\), another set/function \(F(X)\).\(\)For example, \(\mathcal P\) is the powerset operator, which assigns to every set \(X\) another set \(\mathcal P(X)\). You can informally think of an operator as a function — but strictly speaking, an operator can't be a function because its domain would be the "set of all sets" (which doesn't exist).Formally, the domain of an operator is something called a category. Categories can be larger than sets — in particular there is a category containing all the sets and the functions between them. For pedagogical purposes, I've framed everything in this article in terms of sets and functions, but most of the content of this article can applied to any category with enough structure. 

[^pocrg830wgo]: And I suppose, by "generalising backwards", that my zeroth-order belief about the coin toss is the actual result of the coin toss..? 

[^5f23gu6req4]: \((M , e, \odot)\) is a monoid if \((a \odot b) \odot c = a \odot(b \odot c)\) and \(e \odot a = a = a \odot e\).A monoid is like a group except the elements might not have inverses, e.g. \((\mathbb Z, 0, +)\) is a group but \((\mathbb N, 0, +)\) is only a monoid.\((M, e, \odot)\) is a commutative monoid if also \(a \odot b = b \odot a\).The writer monad for \((M, e, \odot)\) is given by the data \(\mathcal B(X) = X \times M\),\(\eta^\mathcal B_X(x) = (x, e)\), and \(\mathbf x\rhd^\mathcal B_{XY} f = (y, a\odot b)\) where \(\mathbf x= (x,a)\) and \(f(x) = (y, b)\). 

[^s9mgrw8wq2]: Solution: I think \(\mathcal B(X)\) is the \(X\)-dimensional hilbert space, but this isn't my expertise. 

[^9jzx95mu5ug]: Suppose \(R\) has two distinct elements \(r_1\) and \(r_2\). Let \(\mathbf a = \lambda^{v : A \to R}. r_1\in \mathcal K(A,  R)\) and \(\mathbf b =\lambda^{v : B \to R}.r_2\in \mathcal K(B,  R)\). Then there are two ways to combine \(\mathbf a\) and \(\mathbf b\) into a single belief in \(\mathcal K(A \times B,  R)\), i.e. \(\lambda^{ v: A \times B\to R}.r_1\in \mathcal K(A \times B, R)\) and \(\)\(\lambda^{ v: A \times B\to  R}.r_2\in \mathcal K(A\times B,  R)\). But these differ so \(\mathcal K(-,  R)\) is not a commutative monad for \(|R| \ge2\). 

[^68o6vco2o3]: In fact, \(\mathcal K(-,  R)\) encompasses every other monad \(T\) such that \(\alpha: T(R) \to R\) is a \(T\)-algebra. This explains why \(\mathcal K(-, \mathbb R)\) encompasses both possibilistic and probabilistic uncertainty — specifically, it's because \(\min : \mathcal P^+(\mathbb R) \to \mathbb R\) is a \(\mathcal P^+\)-algebra and \(\mathbb E: \Delta(\mathbb R) \to \mathbb R\) is a \(\Delta\)-algebra.Moreover, \(\mathcal K(-, R)\) is the smallest monad with this property, because there's a bijection between \(T\)-algebras \(\alpha: T(R) \to R\) and monad morphisms \(T \Rightarrow \mathcal K(-,  R)\). See here for details.That being said, \(\mathcal K(-, \mathbb R)\) isn't the smallest monad encompassing both \(\mathcal P^+\) and \(\Delta\) in particular. If you only need to encompass \(\mathcal P^+\) and \(\Delta\) then Vanessa Kosoy's infrabayesian monad \(\Box\) will suffice, but \(\Box\) is strictly contained within \(\mathcal K(-,\mathbb R)\). 

[^fmpulwnuvmq]: For example, suppose \(\mathbf w = \ulcorner ((w_1 \vee w_2)\land \neg w_2) \urcorner \in \mathcal L(\Sigma, W)\) and \(f : W \to \mathcal L(\Sigma, S)\) satisfies \(f(w_1) = \ulcorner ( s_3 \to \neg s_1) \urcorner\)\(\)\(\) and \(f(w_2) = \ulcorner \neg s_5\urcorner\). Then we find \(\mathbf s\) via uniform substitution.\(\begin{aligned} \mathbf s &= \mathbf w \rhd_{WS} f \\ &= \ulcorner ((f(w_1) \vee f(w_2) ) \wedge \neg f(w_2)\urcorner \\  &= \ulcorner(((s_3 \to \neg s_1)\vee \neg s_5)\land \neg \neg s_5)\urcorner\in \mathcal L(\Sigma, S) \end{aligned}\)In pythonese, S_string = ''.join(t if t in Sigma else f(t) for t in W_string)Equivalently, we can define the bind operator recursively on the depth of \(\mathbf w\). For atomic sentences, \(\ulcorner w \urcorner \rhd_{WS} f = \ulcorner f(w)\urcorner\), and for compound sentences, \(\ulcorner \sigma(\phi_1 , \ldots, \phi_n)\urcorner \rhd_{WS}f = \ulcorner \sigma (f(\phi_1), \ldots, f(\phi_k))\urcorner\). 

[^tbkr3jjqnas]: In particular, suppose \(\Sigma=\{\neg, !\}\) contains two unary connectives. Suppose \(\mathbf a = \ulcorner \neg a\urcorner \in \mathcal L(\Sigma, A)\) is my belief-state about \(A\) and \(\mathbf b =\ulcorner ! b\urcorner \in \mathcal L(\Sigma, B)\) is my belief-state about \(B\). Then there are two ways to combine these two beliefs into a single belief in \(\mathcal L(\Sigma, A \times B)\), i.e. \(\ulcorner \neg !\langle a , b\rangle \urcorner\) and \(\)\(\ulcorner !\neg \langle a , b\rangle \urcorner\). But these differ so \(\mathcal L(\Sigma, -)\) is not a commutative monad. 

[^lq3pmfj3gzg]: Note that a monad might have many distinct presentations, and this non-uniqueness is rather distasteful. The more elegant treatment of monads is with Lawvere theories, where both atomic connectives and compound connectives are treated on par. 

[^5k2ls5xxsvm]: For any cardinality \(\kappa\), we say that a monad has rank \(\kappa\) if it has a presentation with operations of arity at most \(\kappa\). The continuation monad has no rank (not even an infinitary one) which is a somewhat perverse property for a monad. A rankless monad isn't generated by any algebraic theory, even if we allow infinitary operators.We can see that \(\mathcal K(-, R)\) is rankless monad because it contains \(\mathcal P\) as a submonad for every \(|R| \ge 2\), but \(\mathcal P\) is a monad without rank. 

[^c24acr58ji]: The lattice axioms for the signature \((\vee, \wedge, 0, 1)\) consists of the semilattice axioms for \(\vee\), the semilattice axioms for \(\land\), the boundary axioms \(a \vee 0 = a\) and \(a \land 1 = a\), and the absorption laws \(a \vee (a \wedge b) = a\) and \(a \wedge (a \vee b) = a\). 

[^54nabd4r4n]: The position evaluation function \(V : \mathcal G([0,1]) \to [0,1]\) is defined inductively:\(V(\ulcorner r \urcorner) = r\)\(V(\ulcorner 0 \urcorner) = 0\)\(V(\ulcorner 1 \urcorner ) = 1\)\(V(\ulcorner \phi_1 \vee \phi_2\urcorner ) = \max\{V(\ulcorner \phi_1\urcorner), V(\ulcorner \phi_2\urcorner)\}\)\(V(\ulcorner \phi_1 \land \phi_2\urcorner ) = \min\{V(\ulcorner \phi_1\urcorner), V(\ulcorner \phi_2\urcorner)\}\)\(V(\ulcorner \phi_1 +_p \phi_2\urcorner ) = p \cdot V(\ulcorner \phi_1\urcorner) + (1-p) \cdot V(\ulcorner \phi_2\urcorner)\) 

[^tkie02uhrx]: That is, the signature \(\Sigma\) consists of the connectives \(\{ \vee, 0, 1\} \cup \{ +_p : p \in (0,1)\}\), and \(E\) contains the axioms: \(a \vee a = a\), \(a \vee b= b \vee a\), \(a \vee (b \vee c) = (a \vee b) \vee c\), \(a \vee 0 = a\), \(a \vee 1 = 1\), \(a +_p (b \vee c) = (a +_p b) \vee (a +_p c)\).Strictly speaking, it's improper to speak of composing monads \(S\) and \(T\) unless you provide a distributive law of \(S\) over \(T\), i.e. \(\lambda : S\circ T \to T \circ S\). But \(\mathcal P \circ \Delta\) yields a monad \(\mathcal C\) given by the convex powerset of distributions monad, and the exception monad \((- + A)\) distributes over any monad, so no worries here. 

[^cv3p8o117wd]: A technical caveat:Kosoy's infrabayesian monad \(\Box\) is actually given by \(\mathcal P^+ \circ \Delta \circ (-+2)\) rather than \(\mathcal P^+_f\circ \Delta\circ (-+2)\) — that is, \(\Box\) contains sets of distributions with arbitrary cardinality. A least, this is my reading from Diffractor's Infra-Miscellanea Section 2.Unfortunately, \(\Box\) is a rankless monad, i.e. it isn't generated by any algebraic theory even if we allow infinitary operators.Fortunately, we may approximate \(\Box\) with a monad of rank \(\kappa\) for any cardinality \(\kappa\). Let's define \(\Box_\kappa :=\mathcal P^+_\kappa \circ \Delta \circ (-+2)\), where \(\mathcal P^+_\kappa(X)\) is the set of non-empty subsets of \(X\) of cardinality no greater than \(\kappa\). Algebraically, we obtain \(\Box_\kappa\) by adding the \(\kappa\)-ary disjunction connective \(\bigvee_\kappa\) to the signature for \(\Delta \circ (- + 2)\).This leaves the open question, for which cardinality \(\kappa\) is \(\Box_\kappa\) an adequate and tractable approximation, if indeed any? I suspect \(\kappa = 2^{\aleph_0}\) suffices for all theoretical purposes, and that \(\kappa = 2\) suffices for all practical purposes. 

[^om8tyqx2iun]: This also applies to imprecise probability \(\mathcal C\) and to strategic uncertainty \(\mathcal G\).For example, given a series of two-player games \(g_1, \ldots, g_n \in \mathcal G([0,1])\), there's no natural way to combine them into a single two-player game \(g_1 \otimes\cdots \otimes g_n \in \mathcal G([0,1]^n)\) because \(\mathcal G\) isn't a commutative monad.More generally, there's no commutative monad which contains both a \(\vee\) operator and a \(+_{0.5}\) operator without conflating them. See here for details.