--- id: 20251223165340 title: Mealy Machines type: permanent created: 2025-12-23T21:53:40Z modified: 2025-12-23T22:38:18Z tags: [] --- # Mealy Machines Mealy machines are a formalization of a system that has states drawn as nodes and transitions drawn from state to state. From Wikipedia: ``` A mealy machine is a finite state machine whose output values are determined by both its current state, and the current inputs. ``` Mealy machines can also be defined as a six-tuple: $$(S, S_0, \Sigma, \Lambda, T, G)$$ where - S is the finite set of states - S_0 is the start state - $\Sigma$ is the input alphabet - $\Lambda$ is the output alphabet - $T : S \times \Sigma \rightarrow S$ is the state transition function - $G : S \times \Sigma \rightarrow \Lambda$ is the output function Mealy machines have the advantage that they generally can produce smaller sized automata (aka less states). This is because transitions themselves in a Mealy machine are states in a Moore machine. The state of 'opening' in a Moore machine is the transition itself in a Mealy machine. Outputs aren't just based on state, so it isn't necesary to create a state to produce an output like a Moore machine. An output action can be created with the current state AND the input together. ## Related [[Finite State Machines]]