constructive mathematics,realizability,computability
propositions as types,proofs as programs,computational trinitarianism
AMealy machine (named afterMealy 1955) – traditionally understood as a particular type offinite state automaton – is amap (traditionally thought of as apair of maps, see Def. below) which takes input dataand a given “state” to output dataand an update of that “state”. In modern language ofmonadic computational effects this just means that a Mealy machine is astateful-map, namely aKleisli morphisms for astate monad (see Rem. below).
(traditional component definition)
A (finite)Mealy machine consists of (finite)sets
, ofstates;
, theinput alphabet;
, theoutput alphabet;
andfunctions
, atransition function;
, anoutput function
and often anelement
(Mealy machines as effectful maps)
More concisely, a Mealy machine as in Def. is (except for the specification of the initial state) just amap betweenCartesian products of this form:
As such this makes sensein anycartesian monoidal category other thanSets.
In aclosed cartesian monoidal category (such asSets) withinternal hom, such a map(1) is equivalent to (namely: is the “curried”internal hom-adjunct of) a map of the form
In this form Mealy machines are discussed ascoalgebras of an endofunctor, for instance in [Pattinson 2003, 1.1.3], [Bonsangue, Rutten & Silva 2008, p. 1], [Ghica, Kaye & Sprunger 2022, Def. 25].
But of course, by the same token(1) is alsoadjunct to a map of the form
which makes more manifest how a Mealy machine is a map sending input to output after also reading out a stated and then also updating that state.
In fact, in this form(2) Mealy machines are exactly the-effectful maps in these sense ofmonadic computational effects, namely theKleisli morphisms for the-state monad (mentioned as such for instance inOliveira & Miraldo 2016, p. 462). For discussion of this perspective inHaskell: [github.com/orakaro/MonadicMealyMachine], [Perone & Karachalias 2023, p. 3].
Instead of regarding the pair given by the transition- and output function of a Mealy machine (Def.) as a single map from into theCartesian product(1), one may, of course, regard them as aspan:
In this form, aCartesian product is not needed to pair these two operations, and hence it is tempting to consider a generalized notion of Mealy machines in (not-necessarilycartesian)symmetric monoidal categories, given byspans of the above form, but using the givenmonoidal product to pair what are now-objects and:
This definition is considered for instance inBLLL23a, Def. 2.1.
An evident notion ofhomomorphisms between such spans are maps such that the followingdiagram commutes (BLLL23a, Rem. 2.2):
The authors of [BLLL23a, Prop. 3.5] [BLLL23b, Def. 2.1] find it useful to rephrase this as follows:
A Mealy machine internal to asymmetric monoidal category for
input alphabet object
output alphabet object
is an object of the followingpullback inCat:
where:
is the category ofalgebras over theendofunctor
is the forgetful functor,
is thecomma category of morphisms,
is the forgetful functor.
If hascountablecoproducts, a semiautomaton consists of anaction of thefree monoid on,; this is well-explainedibi.
Concisely, there is anequivalence of categories
between-semiautomata and theEilenberg-Moore category of the monadinduced by the monoid.
Then, a Mealy machine as in Def. consists indeed of aspan
The notion is due to:
For discussion in the context offinite state automata see:
Discussion viacategory theory and ascoalgebras of an endofunctor
Dirk Pattinson, Section 1.1.3 in:An Introduction to the Theory of Coalgebras (2003) [pdf,pdf]
M. M. Bonsangue, Jan Rutten & Alexandra Silva ,Coalgebraic Logic and Synthesis of Mealy Machines, in:Foundations of Software Science and Computational Structures. FoSSaCS 2008, Lecture Notes in Computer Science,4962 (2008) [doi:10.1007/978-3-540-78499-9_17]
H. Hansen, Jan Rutten,Symbolic synthesis of Mealy machines from arithmetic bitstream functions, Scientific Annals of Computer Science20 (2010) 97–130 [pub:16639,pdf]
Dan R. Ghica, George Kaye, David Sprunger, Def. 25 in:A compositional theory of digital circuits [arXiv:2201.10456]
Discussion asstateful-maps:
José Nuno Oliveira, Victor Cacciari Miraldo,A practical approach to state-based system calculi, Journal of Logical and Algebraic Methods in Programming85 4 (2016) 449-474 [doi:10.1016/j.jlamp.2015.11.007]
Marco Perone, Georgios Karachalias,Composable Representable Executable Machines [arXiv:2307.09090]
Discussion in symmetric monoidal categories:
Guido Boccali, Andrea Laretto,Fosco Loregian, Stefano Luneia,Completeness for categories of generalized automata [arXiv:2303.03867]
Guido Boccali, Bojana Femić, Andrea Laretto,Fosco Loregian, Stefano Luneia,The semibicategory of Moore automata [arXiv:2305.00272]
Last revised on August 26, 2023 at 13:51:01. See thehistory of this page for a list of all contributions to it.