# How do monads arise in mathematics?

I’m familiar with the concept of a monad in computer programming, where it is used as a framework for expressing a variety of different types of computation.

I’ve been learning some basic category theory, and understand the corresponding formulation of a monad as a triple (T,μ,η)(T, \mu, \eta). I’m curious as to how this idea of a monad arises in mathematics? Why are they interesting to mathematicians?

=================

1

Probably a better place to start in mathematics is “why are adjoint functor pairs interesting to mathematicians?”
– Ian
2 days ago

1

@Ian I’ve looked at adjoints a little (the “curry/uncurry” adjunction is particularly interesting from a programming point of view).
– Bob Smith
16 hours ago

1

There is a common generalization of monad and monoid in the framework of bicategories.
– Berci
13 hours ago

=================

1

=================

The first point I’d like to make is that programming and mathematics aren’t different as you might think. A little thought experiment: suppose by “programming” we mean “writing mathematical functions using a not-necessarily-pure-functional programming language.” Under this definition, programming is really just a special case of mathematics; it’s a style of mathematics that involves describing mathematical functions in highly non-expressive languages that have the benefit of being computationally feasible. And of course, you could go on to do further mathematics with such functions, of course – like proving they’re total, that they do or don’t exhibit certain behaviors, etc. So in principle at least, programming is just a tiny slice of mathematics. Of course, this glosses over a lot of details, like the fact that “programming” can involve writing real-time applications, and that programmers often write very complicated programs that are basically impossible to reason about. And, in practice, programmer’s have a very different skillset and tend to use their skills very differently. Anyway, this thought experiment suggests that whatever monads are used for in programming, they’re probably used for that same thing in mathematics, too. You use them to express data structures, right? For example, if you have a type of values XX, and you want to build the type corresponding to lists in XX, you would apply the list monad to XX to obtain a new type X∗X^* whose values are lists of values in XX. Well, in mathematics we do the exact same thing, except that we call XX a set, and we refer to its elements rather than its values, and X↦X∗X \mapsto X^* is called the “word monad,” or better yet, the “free monoid monad.”

This brings me to my second point, which is that monads are used in universal algebra.

I’m certainly not opposed to the idea that programming and mathematics can be viewed as closely related — that’s one of my motivations for studying category theory. I guess I’m curious as to how the notion of a monad arose in mathematics — was it to study lists (the free monoid monad)?
– Bob Smith
16 hours ago

good answer, but not complete yet, so upvote to be continued later … 🙂
– magma
14 hours ago