COMS W3261
Computer Science Theory
Lecture 5: September 23, 2009
NFAs with Epsilon-Transitions
1. Outline
- Review
- NFA with epsilon-transitions
2. Review
- Nondeterministic finite automata
- The subset construction
3. NFA with Epsilon-Transitions
- An ε-NFA is an NFA (Q, Σ, δ, q0, F)
whose transition function δ is a mapping from
Σ ∪ {&epsilon} to the subsets of Q.
- The language of an ε-NFA is the set of all strings that
spell out a path from the start state to a final state.
There can be ε-transitions along this path.
4. Epsilon-Closures
- We define ECLOSE(q), the ε-closure of state q in Q,
recursively as follows:
- State q is in ECLOSE(q).
- If state p is in ECLOSE(q), then all states in δ(p, ε)
are also in ECLOSE(q).
- We can compute the ε-closure of a set of states S by taking the
union of the ε-closures of all the individual states in S.
5. Converting an ε-NFA to a DFA
- We can eliminate all ε-transitions from an ε-NFA
by converting it into an equivalent DFA using the subset construction.
- Given an ε-NFA E =
(QE, Σ, δE, q0, FE),
we construct the DFA D =
(QD, Σ, δD, qD, FD)
as follows:
- QD = P(QE).
- δD is computed as follows:
- Let S = {p1, p2,..., pk} and let
{r1, r2,..., rm} be the union of
δE(pi, a) for
i = 1, 2, ..., k and all a in Σ.
- Then, δD(S, a) =
ECLOSE({r1, r2,..., rm}).
- qD = ECLOSE(q0).
- FD = { S | S is in QD and S contains a state in
FE }.
- As with the subset construction, we can prove by induction that
L(D) = L(E).
6. Practice Problems
- HMU, Exercise 2.5.1.
- HMU, Exercise 2.5.3.
- (Hard)If L is a language, let FirstHalf(L) = { x | xy is in L and
length(x) = length(y)}. Let D be a DFA that accepts L. From D construct an
NFA that accepts FirstHalf(L).
7. Reading Assignment
aho@cs.columbia.edu