Equivalence of State Machines and Coroutines
250bpm.com
250bpm.com
The following are formally defined mathematical structures:
- Moore Machine
- Mealy Machine
- Deterministic Finite Automata
There are also (multiple) formal semantics for Harel State Charts.But there is no single precise formal definition of what a coroutine is. And when we talk about programming with (finite) state machines, we are often not strictly referring to any of the above formalisms. To claim that two ill-defined notions are equivalent is not particularly meaningful.
(As a metaphore, it's like saying that being green and being a frog is equivalent, because there exists a green frog)
And I bet every other compiler out there does too. In the end (in machine code) you will have pretty much your original state machine.
That said, in practice, often we don't program with FSMs, we program with structures that are FSMs augmented with additional state such as counters and storage (collections/stacks/queues).
Of course you just said "further evidence", not "proof", but naturally this just proves simulability, not bisimulability.
Even if we say that FP = purity, you can have state machines with immutable state.