Moore Machine

A finite state transducer where output depends only on the current state. A 6-tuple.

M=(Q,Σ,Δ,q0,δ,λ)M = (Q, \Sigma, \Delta, q_0, \delta, \lambda) where:

  • QQ is a finite set of states
  • Σ\Sigma is the input alphabet
  • Δ\Delta is the output alphabet
  • q0Qq_0 \in Q is the initial state
  • δ:Q×ΣQ\delta : Q \times \Sigma \rightarrow Q is the transition function
  • λ:QΔ\lambda : Q \rightarrow \Delta is the output function (state \to output symbol)

Output is associated with states, not transitions. On input of length nn, the output sequence has length n+1n + 1 (one output per state visited, including the initial state).

Example

A Moore machine that outputs EE when the number of aas seen is even and OO when odd:

  • The states are {q0,q1}\{q_0, q_1\} with λ(q0)=E\lambda(q_0) = E, λ(q1)=O\lambda(q_1) = O
  • δ(q0,a)=q1\delta(q_0, a) = q_1, δ(q1,a)=q0\delta(q_1, a) = q_0

Starting in q0q_0, input aaa visits q0,q1,q0,q1q_0, q_1, q_0, q_1 and outputs EOEO.

Conversion from FA

Every FA has an equivalent Moore machine recognizing the same language.

For FA M=(Q,Σ,q0,A,δ)M = (Q, \Sigma, q_0, A, \delta), construct Moore machine M=(Q,Σ,{0,1},q0,δ,λ)M' = (Q, \Sigma, \{0,1\}, q_0, \delta, \lambda) where:

  • λ(q)=1\lambda(q) = 1 if qAq \in A, else λ(q)=0\lambda(q) = 0

Conversion to Mealy Machine

Every Moore machine has an equivalent Mealy machine. For each transition δ(q,a)=p\delta(q, a) = p, create a Mealy output λM(q,a)=λ(p)\lambda_M(q, a) = \lambda(p) (copy the Moore output of the destination state onto the transition).

The resulting Mealy machine has the same states but produces output on transitions instead of states.

Written by September 13, 2026 2 min read
Was this helpful?