1. Trang chủ
  2. » Công Nghệ Thông Tin

sliek môn máy tự động chương 2 finite automata

40 251 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 40
Dung lượng 182,31 KB

Nội dung

DFA NFA NFA and DFA Chapter 2: Finite Automata September 13, 2009 Chapter 2: Finite Automata DFA NFA NFA and DFA Objectives Mastering the following concepts: Deterministic Finite Accepter (DFA) Nondeterministic Finite Accepter (NFA) DFA and NFA Equivalence Chapter 2: Finite Automata DFA NFA NFA and DFA 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 Chapter 2: Finite Automata DFA NFA NFA and 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 Chapter 2: Finite Automata DFA NFA NFA and DFA Example 2.1 M = ({q 0 , q 1 , q 2 }, {0, 1}, δ, q 0 , {q 1 }) δ(q 0 , 0) = q 0 δ(q 1 , 0) = q 0 δ(q 2 , 0) = q 2 δ(q 0 , 1) = q 1 δ(q 1 , 1) = q 2 δ(q 2 , 1) = q 1 q 0 q 1 q 2 0 1 0 1 0 1 Chapter 2: Finite Automata DFA NFA NFA and DFA Example 2.2 1 2 3 letter digit letter or digit letter or digit Chapter 2: Finite Automata DFA NFA NFA and DFA Extended Transition Function Example 2.1: q 0 q 1 q 2 0 1 0 1 0 1 δ(q 0 , 1) = q 1 ∧ δ(q 1 , 1) = q 2 ⇒ δ ∗ (q 0 , 11) = q 2 δ ∗ (q, λ) = q δ ∗ (q, wa) = δ(δ ∗ (q, w), a) Chapter 2: Finite Automata DFA NFA NFA and DFA Languages and DFAs M = (Q,  , δ, q 0 , F) L(M) = {w ∈  ∗ | δ ∗ (q 0 , w) ∈ F } L(M) = {w ∈  ∗ | δ ∗ (q 0 , w) /∈ F } Chapter 2: Finite Automata DFA NFA NFA and DFA Example 2.3 q 0 q 1 q 2 a b a,b a,b M = ({q 0 , q 1 , q 2 }, {a, b}, δ, q 0 , {q 1 }) L(M) = ??? L(M) = {a n b} Chapter 2: Finite Automata DFA NFA NFA and DFA Trap State A state at which the corresponding dfa is unable to escape Can be either final states or not Chapter 2: Finite Automata [...]... states Chapter 2: Finite Automata DFA NFA NFA and DFA Example 2. 5 a,b a b q0 q0 q1 q2 a q0 q2 q2 q1 a,b q2 b q1 q2 q2 Chapter 2: Finite Automata DFA NFA NFA and DFA Example 2. 6 L(M) = {w ∈ {a, b}∗ | w starts with ab} a,b q0 a b q1 b q2 a q3 a,b Chapter 2: Finite Automata DFA NFA NFA and DFA Example 2. 7 L(M) = {w ∈ {0, 1}∗ | w does not contain 001} 1 0,1 0 1 0 λ 0 00 1 0 Chapter 2: Finite Automata 001... walk labelled w from qi to qj Chapter 2: Finite Automata DFA NFA NFA and DFA Example 2. 12 λ q0 a q1 λ q2 δ ∗ (q1 , a) =??? δ ∗ (q1 , a) = {q0 , q1 , q2 } δ ∗ (q2 , λ) =??? δ ∗ (q2 , λ) = {q0 , q2 } Chapter 2: Finite Automata DFA NFA NFA and DFA Example 2. 13 q1 λ λ a q2 q3 a q0 a q4 λ q5 δ ∗ (q0 , a) =??? δ ∗ (q0 , a) = {q0 , q1 , q2 , q3 , q4 , q5 } Chapter 2: Finite Automata DFA NFA NFA and DFA How to... is regular iff L = L(M) for some DFA M Chapter 2: Finite Automata DFA NFA NFA and DFA Example 2. 8 L = {awa | w ∈ {a, b}∗ } a b b q0 a q2 q3 a b q1 a,b Chapter 2: Finite Automata DFA NFA NFA and DFA Example 2. 9 L2 = {aw1 aaw2 a | w1 , w2 ∈ {a, b}∗ } b b b q0 a a b q2 q3 a q4 a q5 a b q1 a,b Chapter 2: Finite Automata DFA NFA NFA and DFA Nondeterministic Finite Accepter (NFA) M = (Q, , δ, q0 , F ) Q:... λ Chapter 2: Finite Automata DFA NFA NFA and DFA NFA and DFA DFA and NFA are equally powerful NFA: δ ∗ (q, w ) = {qi , qj , , qk } → label of one state in DFA Chapter 2: Finite Automata DFA NFA NFA and DFA Example 2. 16 b q0 a q1 λ q2 a δ({q0 }, a) = {q1 , q2 } δ({q1 }, a) = {q1 , q2 } δ({q1 , q2 }, a) = {q1 , q2 } δ({q0 }, b) = ∅ δ({q1 }, b) = ∅ δ({q1 , q2 }, b) = {q0 } Chapter 2: Finite Automata DFA... edges ??? Chapter 2: Finite Automata DFA NFA NFA and DFA Equivalent DFAs Caused by non-finite trap states 1 1 q0 q1 0 q0 q1 0 0 1 q2 0,1 Chapter 2: Finite Automata DFA NFA NFA and DFA NFA and Languages M = (Q, L(M) = {w ∈ ∗ , δ, q0 , F ) | δ ∗ (q0 , w ) ∩ F = ∅} Chapter 2: Finite Automata DFA NFA NFA and DFA Example 2. 14 L(M) = {(10)n | n ≥ 0} 0 q0 q1 0,1 q2 1 λ Chapter 2: Finite Automata DFA NFA NFA... DFA Example 2. 16 δ({q0 }, a) = {q1 , q2 } δ({q1 }, a) = {q1 , q2 } δ({q1 , q2 }, a) = {q1 , q2 } δ({q0 }, b) = ∅ δ({q1 }, b) = ∅ δ({q1 , q2 }, b) = {q0 } b {q0 } a {q1 , q2 } b a ∅ a,b Chapter 2: Finite Automata DFA NFA NFA and DFA Theorem 2. 2 (Linz’s book) Theorem Given MN = (QN , , δN , q0N , FN ), then there exists MD = (QD , , δD , q0D , FD ) such that L(MD ) = L(MN ) Chapter 2: Finite Automata ... states : finite set of symbols - input alphabet δ :Q ×( ∪{λ}) → 2Q transition function q0 ∈ Q: initial state F ⊆ Q: set of final states Chapter 2: Finite Automata DFA NFA NFA and DFA Example 2. 10 q1 a q2 a q3 a q0 a a q4 q5 a δ(q0 , a) = {q1 , q4 } Chapter 2: Finite Automata DFA NFA NFA and DFA Example 2. 11 0 q0 q1 0,1 q2 1 λ Chapter 2: Finite Automata DFA NFA NFA and DFA Extended Transition Function δ... 0,1 q2 1 λ δ ∗ (q0 , 110) =??? δ ∗ (q0 , 110) = δ(q2 , 0) = ∅ Chapter 2: Finite Automata DFA NFA NFA and DFA Extended Transition Function Two automata are equivalent if they accept the same language For a given language, we can usually find unlimited accepters (both deterministic and nondeterministic) Chapter 2: Finite Automata DFA NFA NFA and DFA Example 2. 15 0,1 0 q0 q1 1 q2 1 0 0 q0 q1 0,1 q2 1 λ...DFA NFA NFA and DFA Example 2. 4 a,b a q0 b q1 a,b q2 Chapter 2: Finite Automata DFA NFA NFA and DFA Theorem 2. 1 M = ({q0 , q1 , q2 }, {a, b}, δ, q0 , {q1 }) GM : associated transition graph w∈ + Theorem δ ∗ (qi , w ) = qj iff there is a walk labelled w from qi to qj Chapter 2: Finite Automata DFA NFA NFA and DFA Transition Table A table used to represent an . DFA Example 2. 5 q 0 q 1 q 2 a b a,b a,b a b q 0 q 0 q 1 q 1 q 2 q 2 q 2 q 2 q 2 Chapter 2: Finite Automata DFA NFA NFA and DFA Example 2. 6 L(M) = {w ∈ {a, b} ∗ | w starts with ab} q 0 q 1 q 2 q 3 a b b a a,b a,b Chapter. M Chapter 2: Finite Automata DFA NFA NFA and DFA Example 2. 8 L = {awa | w ∈ {a, b} ∗ } q 0 q 1 q 2 q 3 a b a,b a b b a Chapter 2: Finite Automata DFA NFA NFA and DFA Example 2. 9 L 2 = {aw 1 aaw 2 a. q 2 δ(q 2 , 1) = q 1 q 0 q 1 q 2 0 1 0 1 0 1 Chapter 2: Finite Automata DFA NFA NFA and DFA Example 2. 2 1 2 3 letter digit letter or digit letter or digit Chapter 2: Finite Automata DFA NFA NFA and

Ngày đăng: 23/10/2014, 17:47

TỪ KHÓA LIÊN QUAN

w