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

sliek môn máy tự động chương 7 pushdown automata

41 243 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 41
Dung lượng 157 KB

Nội dung

1 Pushdown Automata • There are context-free languages that are not regular. • Finite automata cannot recognize all context-free languages. 2 Pushdown Automata • {a, b}* is regular. • {a k b k | k is a constant} is regular. • {a n b n | n ≥ 0} is not regular. 3 Finite Automata Control unit q 0 Input file yes/no 4 Pushdown Automata Control unit q 0 Input file yes/no Stack 5 Non-deterministic Pushdown Automata (NPDA) M = (Q, ∑, Γ, δ, q 0 , z, F) Q: finite set of internal states ∑: finite set of symbols - input alphabet Γ: finite set of symbols - stack alphabet δ: Q × (∑∪{λ}) × Γ → finite subsets of Q × Γ* transition function q 0 ∈ Q: initial state z ∈ Γ: stack start symbol F ⊆ Q: set of final states 6 Non-deterministic Pushdown Automata (NPDA) δ: Q × (∑∪{λ}) × Γ → finite subsets of Q × Γ* stack top stack top replacement 7 Example δ(q 1 , a, b) = {(q 2 , cd), (q 3 , λ)} b d c q 1 q 2 q 3 8 Example M = (Q, ∑, Γ, δ, q 0 , z, F) Q = {q 0 , q 1 , q 2 , q 3 } δ(q 0 , a, 0) = {(q 1 , 10), (q 3 , λ)} ∑ = {a, b} δ(q 0 , λ, 0) = {(q 3 , λ)} Γ = {0, 1} δ(q 1 , a, 1) = {(q 1 , 11)} z = 0 δ(q 1 , b, 1) = {(q 2 , λ)} F = {q 3 } δ(q 2 , b, 1) = {(q 2 , λ)} δ(q 2 , λ, 0) = {(q 3 , λ)} 9 Instantaneous Description (q, w, u) current state unread part of stack contents input string 10 Instantaneous Description move: (q 1 , aw, bx) | (q 2 , w, yx) iff (q 2 , y) ∈ δ(q 1 , a, b) [...]... z)} NPDA and Context-Free Languages Greibach NF δ(q0, λ, z) = {(q1, Sz)} S → aSA | a δ(q1, a, S) = {(q1, SA), (q0, λ)} A → bB δ(q1, b, A) = {(q1, B)} B→b δ(q1, b, B) = {(q1, λ)} δ(q1, λ, z) = {(q2, λ)} 17 Theorem For any context-free language L not containing λ, there exists an NPDA M such that L = L(M) 18 Theorem Proof: G = (V, T, S, P) M = ({q0, q1, qf}, T, V∪{z}, δ, q0, z, {qf}) z ∉ V δ(q0, λ, z) =... Grammars for NPDA δ(qi, a, A) = {(qj, BC), } ? At qi erase A and move to qk if receiving a and at qj erase BC and move to qk At qi erase A and move to qk if receiving a and at qj erase B and move to qm and 27 Context-Free Grammars for NPDA δ(qi, a, A) = {(qj, λ), } At qi erase A and move to qj if receiving a (qiAqj) → a 28 Context-Free Grammars for NPDA δ(qi, a, A) = {(qj, BC), } At qi erase A and move . 1 Pushdown Automata • There are context-free languages that are not regular. • Finite automata cannot recognize all context-free languages. 2 Pushdown Automata • {a, b}* is. 0} is not regular. 3 Finite Automata Control unit q 0 Input file yes/no 4 Pushdown Automata Control unit q 0 Input file yes/no Stack 5 Non-deterministic Pushdown Automata (NPDA) M = (Q, ∑, Γ,. Q: set of final states 6 Non-deterministic Pushdown Automata (NPDA) δ: Q × (∑∪{λ}) × Γ → finite subsets of Q × Γ* stack top stack top replacement 7 Example δ(q 1 , a, b) = {(q 2 , cd), (q 3 ,

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

w