You're reading the public-facing archive of the Category Theory Zulip server.
To join the server you need an invite. Anybody can get an invite by contacting Matteo Capucci at name dot surname at gmail dot com.
For all things related to this archive refer to the same person.
The list functor is often considered in computer science, it sends a set to the set of lists on .
A list on can also be thought of as a linearly ordered multiset with elements in .
That functor can be made a monad with multiplication as list concatentation.
Can we also have a functor that sends to the set of partially ordered (or preordered) multisets with elements in , and would it also be a monad?
I feel that it should be, but I can't find any mention about it which makes me doubt.
The multisets on a set do form a monad, with unit sending an element to the multiset containing one occurence of and multiplication sending a multiset of multiset of to the multiset (where I'm writing a multiset as a formal sum of its elements).
Thanks @Kenji Maillard . What do you think about a partially/pre-ordered multiset monad, do you think there's any problem with it? It seems if we had a preorder of preorders we could "squash" it into just a preorder (sorry I can't think how to express that properly & concisely), the unit sending to the singleton preorder with .
Nasos Evangelou-Oost said:
sorry I can't think how to express that properly & concisely
"Compare by the outer partial order and then by the inner one"?
@Oscar Cunningham yes that's what I mean :) By the way partially ordered multisets are sometimes called "pomsets", so maybe it should be called the pomset monad if indeed it is one.
In category theory (by opposition to computer science here), a monad is an endofunctor, so if it takes sets as input it should spit out sets as well, not a preorder. If you really want to insist on the fact that the result has a preorder structure, I would forward you to the notion of relative monad (in the case at hand, relative to the functor sending a set to the preorder with the same underlying set and the trivial/discrete order)
My understanding is it takes a set to the set of pomsets on it
Wait, do you assume that is ordered ?
It looks like a monad to me. I wonder what its algebras are? They have quite a lot of structure. You can get a commutative monoid structure on them by looking at the unordered pomsets, and a different (?) monoid structure by looking at the totally ordered pomsets.
Kenji Maillard said:
Wait, do you assume that is ordered ?
No. And yes I was thinking of this as an endofunctor on , since it takes a set to the set of pomsets on it as @Oscar Cunningham said.
@Nasos Evangelou-Oost You have to be a little careful.
There's the "free monoid" monad that takes a set to the underlying set of the free monoid on the set. The words of the free monoid are finite lists, so while they are linearly ordered multisets, they are also finite.
There's also the List algebraic data type where the sum of cons () and nil (). (I used the variable as a mnemonic for "recursion point".) Then the initial algebra of the functor happens to be the same as the free monoid on , but the terminal coalgebra of the functor gives "streams", potentially infinite lists of elements of . These are also linearly ordered multisets, but they're at most countably infinite.
As @Kenji Maillard pointed out, you can get all multisets on as a monad. You want all partially ordered multisets, which is extra structure. If you're willing to restrict to finite or countably infinite structures, you could use a rooted directed acyclic graph (r-dag) labeled by elements of In an r-dag of r-dags of Xs, each node in the larger structure contains an r-dag. You can define flattening to make the parents of the root of the contained r-dag be the union of the sets of tips of the r-dags contained in the parent nodes of The unit takes each element of to the r-dag whose root is labeled by
That assumes a least element. If you want arbitrary partial orders, then you simply use a labeled dag; you can define concatenation in a similar way, where the parents of each "root" are as above.
@Mike Stay in what I had in mind restricting to finite or countably infinite is not a problem, but I'm not sure I see what you mean about DAGs-- why do I need this, I mean why can't I simply define the endofunctor on , the set of partially ordered multisets on ?
(I'm not sure exactly what you mean by "extra-structure" either... isn't a labelled DAG also extra structure? And then I should also take the transitive closure to recover the partial order? But I'm not sure what problem this solves.)
Every dag has an induced partial order on its set of vertices and every partially ordered finite set has a corresponding dag where is a parent of if and there does not exist such that . So if you're ok to use finite or countably infinite structures, dags are the obvious way to tell a computer about it.
But yes, you can just use that endofunctor on Set and the concatenation operation I described.
Oh I'm not really worried at this point in encoding it in a computer, I was just wanting to know whether there was any mathematical problem with defining a pomset (or preorder) monad.
No, that's a perfectly good monad assuming I didn't miss something in defining concatenation. You should check the associativity and unit laws for the definition I gave (which I made up on the spot).
It has a distributive law!
image.png
Actually that diagram is wrong. The right hand side should look like . Hmmm.
@Mike Stay ok, I will check them. So to clarify, would you say there is no real difference whether I define it in terms of labelled dags or pomsets? With the dag I have to have the extra assumption that "there does not exist such that ". Also I'm not 100% clear on what the finite/countably-infinite assumption is for. Actually the pomsets I'm interested in are the ones which are interval-finite, i.e. is finite (https://ncatlab.org/nlab/show/causet#definition), I'm not sure whether this implies countably-infiniteness?
I thought you were coming at the question from a programmer's perspective. If you're not interested in implementing it on a computer, then you can ignore all that stuff; it's all implementation details. The finite/countably infinite stuff is a side-effect of using algebraic data types and the fact that all computable sets are at most countably infinite. The stuff is because you need to know the set of parents of a vertex, not just its ancestors, to construct the dag.
Since you're more of a mathematician, you just have to figure out a multiplication and a unit for the monad; I gave a suggestion which you should check.
@Mike Stay got it! Thanks for your comments. Thank you @Kenji Maillard & @Oscar Cunningham as well.
@Oscar Cunningham I'm curious about what you're trying to show with that picture. What do you mean it has a distributive law? I only knew about distributive laws between two different monads.
Do you know about algebras of monads?
@Oscar Cunningham I know about F-algebras for ordinary functors, I'm not sure what the extra monad structure does for it
Algebras for a monad are the same thing, except they have to obey some laws involving the unit and multiplication of the monad.
In particular it turns out that algebras of the List monad are precisely monoids, and algebras of the multiset monad are precisely commutative monoids (because a monoid is a place where it makes sense to multiply together a list of elements, whereas in a commutative monoid order doesn't matter so you can multiply together a multiset of elements).
Since your monad combines both, you have a monoid structure and a commutative monoid structure on the algebras, which you could think of as and . They're defined by being the image under the map defining the algebra of the pomset , and likewise corresponding to the pomset where a and b are incomparable. Then I thought we had the distributive law , but in fact it's more complicated than that.
I see, this is very interesting!
@Mike Stay How do you ensure that the result of your concatenation will again by acyclic? E.g., if the outer r-dag is the walking arrow , the label of is and that of is , don't you get a loop around and ?
@Tom Hirschowitz A similar problem arises in the list case, thinking of it as a linear order: [a,b]++[a] makes a ≤ b ≤ a, which is no longer linearly ordered. I assumed that the linear order/partial order was on the vertices, and the "multiset" aspect was the function from the vertex set to the label set.
Ah, right, it's about occurences of letters, not letters themselves. Thanks!
@Mike Stay Hi Mike, since you are here, can you field this question I've had for a while? It's related. I was trying for a while to construct the DCPO (co)monad. It has a functor that takes a set X to the set of all DCPOs on X. I wanted to squash a DCPO of DCPO's to form the product of the monad and then create "histories" of a DCPO to form the co-product of the comonad.
Sorry, I've never learned what a DCPO is.
For anyone reading, a DCPO is a directed complete partial order. They are also known as domains.