Learning Outcomes
• Mahasiswa dpt menunjukkan perbedaan NFA dgn FA dan dapat
menggunakan teori tersebut..
2
Outline Materi:
• Pengertian NFA
• Finite State Transduser
• Contoh aplikasi NFA
3
Review: What is a computational problem?
The input is a finite string of characters from some agreed upon alphabet S.
S* = the set of finite strings composed of characters in S.
Sk = the set of strings of length k.
S0 is the empty string (length 0).
A “language” or “computational problem” L is a subset of S*.
w S* means w=w1, w2, …, wn, where wi Sfor all i.
For any machine M, we write L(M) for the language accepted by M, i.e.,
the set of strings w S* such that if M starts in state q0 and r is the state M is
in after reading wn, then r F.
4
So far: Finite Automata = Deterministic Finite Automata (DFA)
Now, Non-deterministic Finite Automata (NFA)
• Multiple arrows leaving a state for the same symbol,
• No arrows leaving a state for a given symbol,
• Arrows labeled with ∑ leaving a state.
Example:
q0
1
q1
0, 1
q2
1
aq43
0, 1
This accepts {w | w = w1, w2,…,wn-3, 1, wn-1, 1}.
Q: Why?
5
a1
0
1
a1
a1
a1
a1
a1
1
a2
0
1
1
0
1
a2
a3
1
a2
1, 0
a3
------- dies an early death.
1
a4
Look at leaves. A4 (accept state)
is in there, so we accept the string.
What about arrows? Change states before receiving new input
(causes a split on tree).
6
Defn: A non-deterministic finite automaton
1. Q
is a finite set called the states,
2. ∑ is a finite set called the alphabet,
3. q0 is the start state,
4. F Q is the set of accept states (or final states).
5. : Q x (∑ {}) 2Q
(We also write S for ∑ {} and P(Q) = 2Q. )
Note: It's possible to make a transition with out reading
any input. Also, you can go to more than one state.
7
What does it formally mean for an NFA to accept a string?
Defn: An NFA accepts w over ∑ if we can rewrite
w = y1 y2 … ym where each yi ∑ .
and we can find a sequence of states r0, ri,… rm
So that
1. r0 = q0
2. rm F
3. ri+i (ri, yi+1)
8
Every DFA is an NFA. We’ll see the reverse is true too.
Thm: For every NFA M, a DFA D s.t. L(M) = L (D).
Defn: “ - closure of :”
For r Q, let
() = {p Q : a sequence of transitions from state r to p}.
q0
q1
0, 1
q2
1,
aq43
0
Ex:
(q1) = {q1}
(q2) = {q2, q3}
For R Q, (R) = (r), r R.
9
Thm: For every NFA M, a DFA D s.t. L(D) = L(M)
Pf: (sketch) Let M = (Q, ∑, q0, F, ) be any NFA. We will
construct a DFA D where D = (Q´, ∑, q0´, F´, ´):
• Let Q´ = 2Q,
• For R Q,
(i.e., R Q´) and a ∑{}, let
´ (R,a) = {p: q Q, r R s.t. q (r,a) and p (q)},
• q0´ = (q0), where q0 is the start state of M,
• F´(Think
= { Sabout
Q´ :why
S this
F construction
}.
works!)
x
10
Thm: Regular languages are closed under union.
Pf: Let A and B be any two DFAs. We will construct
an NFA C s.t. L(C) = L(A) L(B).
A
B
A
AB
B
(NFA)
11
More formally, given MA = (Q, ∑, , q0, F), MB = (Q´, ∑, ´, q0´, F´)
(DFAs), construct NFA MC = (Q˝, ∑, ˝, q0˝, F˝):
Q˝
= Q Q´ {q0˝},
F˝
= F F´,
˝ (q, ) =
{ (q, ) } if q Q
{ ´ (q, ) } if q Q´
{q0, q0´} if q = q0˝, and = .
If w C=L(MC), then we reached a final state p in F˝ starting
with an transition to q0 or q0´. In the first case w A; in the
second w B. Therefore C A B.
Conversely, if w A, then starting with an transition to q0
leads to a final state in F F˝, and if w B, starting with an
transition to q0´ leads to a state in F´ F˝. So A B C.
x
12
Thm: Regular languages are closed under concatonation.
Pf:
A
B
A•B
A
B
13
Concatonation:
We have MA = (QA, A, q0A, FA, ∑ )
MB = (QB, B, q0B, FB, ∑ )
Construct
M´ = (Q´, ´, q0´, F´, ∑ ) (This is an NFA)
Q´ = QA QB
(Disjoint Union)
q0´ = q0A
F´ = FB
´ (q, a) = A (q,a) if q QA \ FA
B (q,a) if q QB
A (q,a) if q FA and a FA
A (q,a) = {q, q0B} if a = and q FA
L(M´) = L(MA) • L(MB)
= A • B.
x
14
Thm: If A is regular, A* is regular.
Pf: (sketch)
A
15
16
© Copyright 2026 Paperzz