In the previous post, we introduced preorders, posets and monotone maps between them. We then investigated a small number of monads on these categories of ordered structures. The additional order relations enable interesting new structure on -monads that we hadn’t encountered before with our main example of -monads.
In this post, we will sketch how the algebraic perspective that is so instructive with monads can be generalised to monads on . Our discussions will be relatively informal, aiming to highlight the additional aspects of algebra in the land of ordered structures that are of interest. The details involve some fairly technical ideas, which are beyond the scope of what we have covered so far. Interested readers will find some pointers at the end of the post.
Relatives of the Maybe Monad
In the previous post, we introduced the “obvious” generalisation of the maybe monad from sets to posets, with functor component:
To do so, we mimicked the construction used in in terms of binary coproducts and terminal objects. Our current aim to try and understand such constructions from an algebraic perspective, whatever that means now we’ve moved from sets to posets.
To try and get an algebraic handle on -monads, we are going to assume we need a collection of operations , and a collection of equations , as was the case for ordinary algebra.
In fact, for the maybe monad, this is already sufficient, so we don’t need anything new. We assume consists of a single new constant element , and we require no equations. As we only have a constant element, the only terms we can form over are either:
- Variables from .
- The constant symbol .
As there are no equations, we don’t need to worry about forming equivalence classes. If we assume variables inherit an ordering from , and no other non-trivial order relations hold, the resulting poset is isomorphic to
which is exactly what we hoped for. So far, so easy. A small additional step will take us into less familiar territory. Rather than generalising the maybe monad, instead we can consider the exception monad induced by some poset . This will have functor action:
Recall that the coproduct of posets inherits the order from the two components, and no other non-trivial order relations hold.
Algebraically, the exception monad corresponded to adding a set of new constant symbols. If we do this is , and form terms over as we did above for the maybe monad, we will get a poset with an underlying set consisting of:
- Variables from .
- Constant symbols .
The only non-trivial order relations will be those between the variables inherited from . This isn’t quite general enough for what we want, as we want to allow to be a poset, not just a mere set. It is reasonably clear we cannot achieve the desired effect, even if we add in some equations. So we shall need the first new feature of algebra on posets:
Operation symbols of the same arity form a poset.
If we were to provide some formal syntax, in our example, we are allowing ourselves to introduce relations
between the constant symbols representing exceptions. More generally, if we have two operation symbols of the same arity, and , then we have the following axiom between terms:
Last time, we introduced another relative of the maybe monad, the lift monad. Here, we map a poset to a poset with a new element added below all of the elements of . It doesn’t seem we can achieve the desired effect by ordering our operation symbols, as we need to add an inequation of the form:
between an operation symbol and a bare variable. It is tempting to conclude that for algebra between posets, we need to permit inequations rather than mere equations between terms. In fact, this seems mathematically very natural, but lets not be too hasty.
We can’t achieve the desired effect directly by ordering our operation symbols, as we currently only have the constant symbol . Nobody said we can’t add additional operation symbols, so lets be a bit more creative, and add two unary symbols (for left hand side) and (for right hand side), and require that . Finally, we require the equations:
Then we can conclude that:
If we form equivalence classes of terms, ordering them according to these axioms, the resulting construction yields the lift monad. The upshot of this procedure is that
We can use inequations between terms in poset algebra, but this is achieved using ordering between operation symbols, and equations between terms.
So from this perspective, poset algebra is still fundamentally about equations, not inequations, which is possibly a bit of a surprise.
Relatives of the List Monad
Previously, in the case of -monads, we have seen that the list monad is the free monoid monad. That is, we have a constant symbol , and a binary operation symbol , such that the following three equations hold:
We don’t need to consider ordering between our operation symbols, as they are of different arities. We can form equivalence classes of terms, as we would for the set theoretic construction, which correspond to the lists of variables symbols that appear in the terms. The key question is what non-trivial order relations should we add between terms. As we’ve seen before, for terms over poset , we should always inherit the order relations between variables. Now we have a non-constant operation symbol , we have two obvious choices about how this operation interacts with the order structure of its arguments:
- Consider the multiplication operation to be monotone.
- Consider the multiplication operation to be an arbitrary function.
If we take the first option, the resulting monad is the list monad, with lists of the same length ordered pointwise. This is the monad of the previous post. If on the other hand we take the less restrictive route of the second option, we get a different list monad, in which only the singleton lists are ordered with respect to each other if their contained elements are. This is the monad we called in the previous post. These observations apply in full generality, and lead us to our second observation about poset algebra:
We have the right, but the not obligation, to require that every operation is monotone.
So in fact, there are two different notions of poset algebra we can consider, depending on this choice. It is perhaps slightly surprising at first glance that allowing non-monotone operations is a viable option. One choice corresponds to -enriched monad theory, and the other to -enriched monad theory, but that will take us further into technically challenging material than is appropriate with what we know so far.
Obviously, we can impose other relations such as:
using the ability to encode inequations as axioms discussed above. These additional inequations yield two more of the list monad variants from the previous post. We also note that in general, our ability to encode inequations lets us require that some, but not all of our operations are monotone.
Finally, we need to consider the ordered list monads that we discussed last time. Recall, these were monads in which we only allow rising lists of the form:
where each consecutive pair of elements are ordered, that is .
These monads seem to involve some sort of phenomenon that we’ve not encountered so far. It doesn’t seem possible to encode such a monad using the features we’ve introduced previously. We need something new. This leads us to possibly the most exotic feature of poset algebra.
Intuitively, the problem we have is that if we consider a binary operation , there’s no restriction on the arguments we can apply it to, for example we can form
where is strictly greater than . This is because for ordinary set algebra, an operation is a map:
and we have so far continued with this approach to operation arities in the order theoretic context. To generalise things, we observe that if we write for the set , this is equivalent to a function:
where is the exponential, the set of all functions from to . In fact, such an operation is equivalent to one of the form:
where is any -element set. So operations in set can be seen as having arities finite sets. If we generalise this point of view to posets, an operation should be a map:
where is a finite poset. This gives us more freedom than before, as finite posets can specify non-trivial ordering between arguments, as the exponential contains only monotone maps. For our list based construction, we can require a operation with arity the two element poset . This is an operation that maps ordered pairs to a new element.
In terms of syntax, this means we should only be able to form the term if we have established that .
Combining these general arities with some of the previous tricks allows us to specify monads that deal with ordered lists. This leads us to our third and final observation about poset algebra:
Operations have arities which are finite posets.
This is a feature we might not have anticipated in advance, but in fact is does fall out of some (rather technical) general categorical arguments, involving locally finite presentable categories.
We have sketched some features we might encounter when dealing with monads and algebra in the context of posets. We encountered three new features beyond what we see in the setting of ordinary universal algebra.
- Operation symbols of the same arity can be ordered with respect to each other.
- We have the option to require that all our operations are monotone, but this is not compulsary.
- The arities of operations that we can consider are not mere numbers. Instead they are specified by finite posets imposing constraints on how the arguments are ordered.
We also discovered we didn’t need to impose inequations between terms as a new feature, as these can be simulated using the features above.
These generalisations follow a pattern that continues for appropriate notions of algebra in other categorical settings. A good starting point for further background is Robinsons “Variations on Algebra”, which is written in an enjoyable expository style, whilst being much more precise on the details than this post. Important technical background can be found in Kelly and Power’s “Adjunctions whose counits are coequalizers, and presentations of finitary enriched monads”. A lot more detail about the right notion of algebra in these generalised settings can be found in the many papers on Lawvere theories of Power and co-authors. The papers “Presentations and algebraic colimits of enriched monads for a subcategory of arities” and “Diagrammatic presentations of enriched monads and varieties for a subcategory of arities” by Lucyshyn-Wright and Parker may also be of interest.
Although there is a great deal of literature about generalised algebra, particularly at the level of Lawvere theories, there is a bit of a gap in the literature. Developing precise syntax and proof systems for these generalised equational logics in specific cases of interest is rarely worked out in detail, particularly when generalised arities are involved. This is a shame, as the concrete tools of equational presentations and equational logic are tremendously useful tools in the set theoretic setting. Detailed meta-theoretic results for such systems, at a high level of abstraction, can be found in the work of Fiore and co-authors, but applying these methods to a specific setting is still challenging.
Acknowledgements: Thanks to Jason Parker for pointing out the two Lucyshyn-Wright and Parker papers as interesting references.