# The (co)algebra for the (co)monad of a light switch

If we take a light switch to embody an entire category, we could take the light switch to be a set with two elements and the morphisms are all endofunctions. Let's say, for fun, that we define the endofunctor for the monad as:

flip switch up $\rightarrow$ light turns on

flip switch down $\rightarrow$ light turns off

flip switch $\rightarrow$ light toggles

do nothing to switch $\rightarrow$ light does nothing

This looks like the identity endofunctor. Now, this endofunctor, in my mind, is deeply fundamental as it is used to test a causal relation between things like the light and the light-switch. The monad is nothing but the identity monad and so, I think, the algebra is nothing but an identity element. (I already asked at mathematics stack). One normally looks at this kind of thing as passing a signal from one system to another and this then goes up to information theory. If you have read my post correctly, though, you will see that I am trying to lift that whole idea up to where we talk only about morphisms and causal structure as opposed to systems of state and the information that encode them. It was a let down to find that the algebra was this trivial for such an important bit of behaviour, one that every physicist working in a lab will use every day.

Can anyone take this thinking and get the first non-trivial algebra (it should be TINY!!!) and keep the spirit of "behaviours in a laboratory"? The co-algebra is also interesting.

If anyone is wondering where this is coming from, consider the fact that one can construct a TQFT entirely within FDHilb by replacing the usual category of cobordisms with the internal category of comonoids. Thus, the background becomes the internal category of classical structures. The category of internal comonoids is defined with axioms that look like the copying and deleting of information. If you read this post carefully you will see that I am abstracting this idea to replace the category of internal comonoids with just comonads. To me, this then looks like an operationalist view of a topological quantum field theory.

-

I don't have a solution, but I have objections ;)

Lets first consider the category given. You work with one object (lets denote it $X$) which is a set with two elements $X = \{\text{on}, \text{off}\}$.

You have some morphisms (the identity which you call "do nothing" plus the following): $$\text{flip}\colon X\to X$$ So there are two morphisms. But look, we expect $$\text{flip}(\text{on})=\text{off}\quad\mbox{and}\quad \text{flip}(\text{off})=\text{on}$$ In other words, the flip morphism is an automorphism. So you have the collection of morphisms be precisely the cyclic group with two elements!

We can improve the situation by "vertical categorification". This sounds scary, but what happens is we promote $X$ to be a category now, and things get a little better.

How to categorify the situation? First we make "On" and "Off" objects, lets call them $A$ and $B$ respectively. Then we have an invertible morphism which "flips on" the switch: $$\text{flip}\colon A\to B$$ Its inverse would flip off the switch $$\text{flip}^{-1}\colon B\to A$$ If we add another object $\Omega$ which is intuitively a set with two elements (true or false), then we can introduce a morphism that checks if the lights are on. That is, we have one morphism $$f\colon A\to\Omega$$ which checks if the lights are on while the switch is flipped on. We have another morphism $$g\colon B\to\Omega$$ which checks if the lights are on while the switch is flipped off.

If we assume that the wiring is correct, and the light is off when the switch is flipped off, then $g$ factors through a terminal object ($g$ will always have "false" as its output). This might allow us to suggest there is a $g^{-1}$ function. Can we say this? No!

If we can, then we have $B$ be isomorphic to $\Omega$, and the flip morphism is an isomorphism. So that would imply that $\Omega$ is isomorphic to $A$...if we allow this, then flipping the switch on would be "the same" as the lights being on. This may be too much for your model (what if the light burns out?).

-
Hi, There are four morphisms. You neglect the two constant maps. I did not restrict to the functions that form a group. – Ben Sprott Jun 19 '12 at 17:34
Still, excellent work! Let me play with it a bit, though off hand it loses some of the spirit. I was certainly hoping for a monad here. – Ben Sprott Jun 19 '12 at 20:39
Yes, you are correct, the constant maps would correspond to "make sure it's flipped on (resp. off), and if not flip it on (resp. off)". These would be categorified as functors, though :) – Alex Nelson Jun 19 '12 at 21:02
I think that there are two important monads. The first is the one that I described above and that monad indicates that there is a causal connection. The second monad would map every morphism to the identity and it indicates that there is no causal connection. – Ben Sprott Jun 22 '12 at 17:13