CSC262 · 2081 · 5 marks
Define ε\varepsilonε-closure of a state. Differentiate between Moore and Mealy machine.
Define ε\varepsilonε-closure of a state. Differentiate between Moore and Mealy machine. [5]
Quick answer
If state A has ε-transitions to B, and B has an ε-transition to C, then: Every state is always in its own ε-closure; ε-closure is used when converting ε-NFA to DFA, where the start state of the DFA is taken as ε-closure of the start state of the ε-NFA; ε-closure captures all states reachable via epsilon moves alone...
ε-closure of a State and Difference Between Moore and Mealy Machine
Part 1: ε-closure of a State
Definition:
ε-closure of a state is the set of all states that can be reached from a particular state without reading any input symbol, i.e., by reading only ε (epsilon) transitions.
Formally, for a state q, the ε-closure(q) includes:
- The state
qitself - All states reachable from
qby following one or more ε-transitions
Example:
If state A has ε-transitions to B, and B has an ε-transition to C, then:
ε-closure(A) = {A, B, C}
Key Points:
- Every state is always in its own ε-closure.
- ε-closure is used when converting ε-NFA to DFA, where the start state of the DFA is taken as ε-closure of the start state of the ε-NFA.
Part 2: Difference Between Moore Machine and Mealy Machine
Both are finite state machines (FSMs) that produce output, but they differ in how output is generated.
| Basis | Mealy Machine | Moore Machine |
|---|---|---|
| Output depends on | Both present state and present input | Only the present state |
| Number of states | Generally fewer states | Generally more states |
| Number of outputs | For n inputs, there are n outputs | For n inputs, there are n+1 outputs |
| Output function | Function of transitions; changes when input logic on present state changes | Function of current state; changes at clock edges when state changes occur |
| Reaction speed | Reacts faster to inputs (same number of clock cycles) | Reacts slower to inputs (generally one clock cycle later) |
| Final states | No final states in Mealy machine | Final states are present in Moore machine |
| Output placement | Output is placed on transitions | Output is placed on states |
Summary
- ε-closure captures all states reachable via epsilon moves alone, and is fundamental to converting ε-NFA to DFA.
- Mealy machine produces output based on both state and input (faster, fewer states), while Moore machine produces output based only on the current state (slower, more states).
Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.