Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 40 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
40
Dung lượng
171,5 KB
Nội dung
Chapter2:FiniteAutomata Objectives Mastering the following concepts: – Deterministic Finite Accepter (DFA) – Nondeterministic Finite Accepter (NFA) – DFA and NFA Equivalence Deterministic Finite Accepter (DFA) M = (Q, ∑, δ, q 0 , F) Q: finite set of internal states ∑: finite set of symbols - input alphabet δ: Q × ∑ → Q transition function q 0 ∈Q: initial state F⊆Q: set of final states Operational Mechanism Control unit q 0 Input file yes/no Question: What is the difference between a general automaton and a DFA? Transition Graph M = (Q, ∑, δ, q 0 , F) • |Q| vertices (circles) • Edge (q i , q j ) labelled a for δ(q i , a) = q j • Initial vertice q 0 • Final vertices (double circles) in F Example 2.1 M = ({q 0 , q 1 , q 2 }, {0, 1}, δ, q 0 , {q 1 }) δ(q 0 , 0) = q 0 δ(q 0 , 1) = q 1 δ(q 1 , 0) = q 0 δ(q 1 , 1) = q 2 δ(q 2 , 0) = q 2 δ(q 2 , 1) = q 1 q 0 q 1 1 q 2 1 0 0 0 1 Example 2.2 1 2 3 Letter Digit Letter or Digit Letter or Digit 2 Extended Transition Function δ * (q, λ) = q δ * (q, wa) = δ(δ * (q, w), a) Example 2.2: δ(q 0 , a) = q 1 & δ(q 1 , b) = q 2 ⇒ δ * (q 0 , ab) = q 2 Languages and DFAs M = (Q, ∑, δ, q 0 , F) L(M) = {w∈∑ * | δ * (q 0 , w)∈F} L(M) = {w∈∑ * | δ * (q 0 , w)∉F} Example 2.3 M = ({q 0 , q 1 , q 2 }, {a, b}, δ, q 0 , {q 1 }) L(M) = {a n b} q 0 q 1 q 2 a, b a, b a b [...]... b}*} b b a q0 b trap state q1 a, b q2 a q3 a Example 2.9 L2 = {aw1aaw2a | w1, w2∈{a, b}*} b a q0 b q2 b q1 q3 a trap state a, b b a b q4 a q5 a Nondeterministic 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 Example 2.10 a q1 q0 a q2 a a q4 q5... Λ is the number of λ-edges Equivalent DFAs Caused by non -finite trap states 1 1 q0 q1 0 q0 q1 0 0 q2 0,1 1 NFA and Languages M = (Q, ∑, δ, q0, F) L(M) = {w∈∑* | δ*(q0, w) ∩ F ≠ ∅} Example 2.14 L(M) = {(10)n | n ≥ 0} 0 q0 1 q1 λ 0, 1 q2 Dead Configuration δ*(q0, 110) = δ(q2, 0) = ∅ 0 q0 1 q1 λ 0, 1 q2 Equivalence of DFA and NFA Two automata are equivalent if they accept the same language For . Chapter 2: Finite Automata Objectives Mastering the following concepts: – Deterministic Finite Accepter (DFA) – Nondeterministic