Mealy and Moore machines as coalgebras [lcc-0019]
Mealy and Moore machines as coalgebras [lcc-0019]
Let F: \mathcal {C} \to \mathcal {C} be a strong monoidal endofunctor. Then there is a dynamical systems doctrine where the indexed category is the trivial fibration \mathcal {C} \times \mathcal {C} \to \mathcal {C} (so that the category of "lenses" is really the category of adaptors \mathcal {C}^\mathrm {op} \times \mathcal {C}), and where the section is given by T(X) = (F(X), X)
A dynamical system with interface \binom {A}{B} is then an object S \in \mathcal {C} and a pair of maps S \to A, S \otimes B \to F(S). Recall (Moore and Mealy machines in CST) that this is a generalized form of Moore machine.
Conversely, a Mealy machine consists of a single map S \otimes A \to F(S) \otimes B.
Suppose \mathcal {C} is closed. Then a Mealy machine is a coalgebra for the endofunctor of \mathcal {C} given by S \mapsto [A, F(S) \otimes B].
If \mathcal {C} is furthermore Cartesian closed, then a Moore machine (ie, an open dynamical system in the usual sense) is a coalgebra of the functor S \mapsto A \times F(-)^B.
This suggests that Mealy machines are "more coalgebra-like" than Moore machines - we need fewer assumptions on the category \mathcal {C} to make them into coalgebras of a functor.