Chapter 2: Finite Automata... Mastering the following concepts: – Deterministic Finite Accepter DFA – Nondeterministic Finite Accepter NFA – DFA and NFA Equivalence... Example 2.23 Let
Trang 1Chapter 2: Finite Automata
Trang 2 Mastering the following concepts:
– Deterministic Finite Accepter (DFA)
– Nondeterministic Finite Accepter (NFA)
– DFA and NFA Equivalence
Trang 3Deterministic Finite Accepter (DFA)
M = (Q, ∑, δ, q0, F)
Q: finite set of internal states
∑: finite set of symbols - input alphabet
δ: Q × ∑ → Q transition function
q0∈Q: initial state
F⊆Q: set of final states
Trang 7Example 2.2
3
Letter Digit
Letter or Digit
Letter or Digit 2
Trang 8Extended Transition Function
δ*(q, λ) = q
δ*(q, wa) = δ(δ*(q, w), a)
Example 2.2: δ(q0, a) = q1 & δ(q1, b) = q2 ⇒ δ*(q0, ab) = q2
Trang 9Languages and DFAs
M = (Q, ∑ , δ , q0, F) L(M) = {w ∈∑* | δ*(q0, w) ∈ F} L(M) = {w ∈∑* | δ*(q0, w) ∉ F}
Trang 10b
Trang 12Example 2.4:
trap state
a, b a
b
Trang 14Transition Table
A table used to represent an automaton
Rows headers: states
Columns headers: input symbols
Entries: next states
Trang 15b
Trang 18Regular Languages
Trang 21Nondeterministic Finite Accepter (NFA)
M = (Q, ∑, δ, q0, F)
Q: finite set of internal states
∑: finite set of symbols - input alphabet
δ: Q × (∑ ∪ {λ}) → 2Q transition function
q0∈Q: initial state
F⊆Q: set of final states
Trang 24Extended Transition Function
δ*(qi, w) = Qj
δ*(qi, w) contains qj iff there is a walk
labelled w from qi to qj
Trang 27How to calculate δ*
Evaluate all walks of length at most Λ + (1 + Λ )|w|; Λ is the
number of λ -edges
) ( )
, (
| { )
q closure T
*(
) 1
|
|, )};
, ( { (
) ,
(
*
b q p
c c b a
c p closure
a
q
δ
δ λ
δ
∈
= +
=
−
=
Trang 280,1
Trang 29NFA and Languages
M = (Q, ∑ , δ , q0, F) L(M) = {w ∈∑* | δ*(q0, w) ∩ F ≠ ∅ }
Trang 32Equivalence of DFA and NFA
Two automata are equivalent if they accept the same language
For a given language, we can usually find unlimited accepters (both deterministic and nondeterministic)
Trang 34NFA and DFA
NFA: δ*(q, w) = {qi, qj, , qk} label of one state in DFA
Trang 37Theorem 2.2
Given MN = (QN, ∑ , δN, q0N, FN)
there exists MD = (QD, ∑ , δD, q0D, FD) such that L(MD) = L(MN)
Trang 383 Every state of GD containing qf ∈ FN is a final vertex.
4 If λ ∈ L(MN) then {q0N} is also a final vertex.
Trang 40• Exercises: 1, 5, 6, 11, 14, 17, 15, 17 of Section 2.1 - Linz’s book
• Exercises: 3, 4, 6, 7, 9, 10 of Section 2.2 - Linz’s book
• Exercises: 3, 8, 11, 12 of Section 2.3 - Linz’s
book