NFA with ε-transitions
🧠 What is an NFA with ε-transitions?
An ε-NFA (Epsilon-NFA) is a nondeterministic finite automaton that allows transitions without consuming any input symbol. These transitions are called epsilon (ε) transitions.
💡 Think of ε-transitions as "magical moves" that let the automaton change state spontaneously, without reading any input symbol.
✅ Why ε-transitions are useful
-
They allow the automaton to split computation paths.
-
Help simplify automata construction (especially for regex-like patterns).
-
Useful in Thompson’s Construction of NFAs from regular expressions.
🔍 Example: ε-NFA for the regular expression a(b|c)
Let’s build an ε-NFA that accepts strings like:
-
"ab"
-
"ac"
🔤 Alphabet: Σ = {a, b, c}
🎯 Intuition:
-
First input should be
a
. -
Then either
b
orc
.
🧩 States:
-
: Start
-
: After reading
a
-
: ε-transition to
b
path -
: after reading
b
-
: ε-transition to
c
path -
: Rafter reading
c
-
: Final state
🛣 Transitions (δ):
-
δ(q₀, a) → {q₁}
-
δ(q₁, ε) → {q₂, q₄}
-
δ(q₂, b) → {q₃}
-
δ(q₄, c) → {q₅}
-
δ(q₃, ε) → {q₆}
-
δ(q₅, ε) → {q₆}
✅ Accepting state:
🧠 How does it work?
-
Start at
q0
, reada
→ go toq1
-
From
q1
, make an ε-move to either:-
q2
→ readb
→q3
→ ε-move →q6
(accept) -
or
q4
→ readc
→q5
→ ε-move →q6
(accept)
-
So the NFA accepts either "ab"
or "ac"
.
Comments
Post a Comment