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

Chapter 7: Pushdown Automata

35 195 0
Tài liệu đã được kiểm tra trùng lặp

Đ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

Tiêu đề Pushdown Automata
Trường học Hochschule Chí Minh City University of Technology (HCMUT)
Chuyên ngành Theoretical Computer Science
Thể loại Lecture notes
Thành phố Ho Chi Minh City
Định dạng
Số trang 35
Dung lượng 143 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Chapter 7: Pushdown AutomataQuan Thanh Tho qttho@cse.hcmut.edu.vn... Pushdown Automata• There are context-free languages that are not regular.. • Finite automata cannot recognize all con

Trang 1

Chapter 7: Pushdown Automata

Quan Thanh Tho qttho@cse.hcmut.edu.vn

Trang 2

Pushdown Automata

• There are context-free languages that are not regular.

• Finite automata cannot recognize all context-free languages.

Trang 3

Example 7.1

• {a, b}* is regular.

• {akbk | k is a constant} is regular.

• {anbn | n ≥ 0} is not regular.

Trang 5

Non-deterministic Pushdown

Automata (NPDA)

M = (Q, ∑ , Γ , δ , q0, 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

q0 ∈ Q: initial state

z ∈ Γ: stack start symbol

F ⊆ Q: set of final states

Trang 6

Transition Function

δ : Q × ( ∑∪ { λ }) × Γ → finite subsets of Q × Γ *

replacement

Trang 7

Example 7.2

δ (q1, a, b) = {(q2, cd), (q3, λ )}

b

d c

q

q 2

q

Trang 9

Instantaneous Description

(q, w, u)

input string

Trang 10

Instantaneous Description Move

move: (q1, a w, b x) | (q2, w, y x)

iff (q2, y) ∈ δ (q1, a, b)

Trang 11

Instantaneous Description Transition

(q1, x, y) |∗Μ (q2, u, v) (q1, x, y) |+Μ (q2, u, v)

Trang 12

Language accepted by NPDA

Let M = (Q, ∑ , Γ , δ , q0, z, F) be an NPDA.

L(M) = {w ∈ Σ * | (q0, w, z) |∗Μ (qf, λ , u), qf ∈ F, u ∈ Γ *}

Trang 15

NPDA and Context-Free Languages

Trang 16

Theorem 7.1

For any context-free language L not containing λ , there exists

an NPDA M such that L = L(M).

Trang 19

Context-Free Grammars for NPDA

M = (Q, ∑ , Γ , δ , q0, z, F)

G = (V, T, S, P) L(G) = L(M)

Trang 20

Context-Free Grammars for NPDA

M = (Q, ∑ , Γ , δ , q0, z, F)

M^: Single final state

Final state entered iff the stack is empty

δ (qi, a, A) = {c1, c2, , cn}

ci = (qj, λ ) ci = (qj, BC)

Trang 21

Context-Free Grammars for NPDA

δ (qi, a, A) = {(qj, λ ), }

At qi erase A and move to qj if receiving a

(qiAqj) → a

Trang 22

Context-Free 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

at qm erase C and move to qk

Trang 23

Context-Free Grammars for NPDA

δ (qi, a, A) = {(qj, BC), }

At qi erase A and move to qk if receiving a and

at qj erase B and move to qm and

at qm erase C and move to qk

Trang 24

Context-Free Grammars for NPDA

Start symbol: (q0zqf)

Trang 30

Theorem 7.2

If L = L(M) for some NPDA M, then L is a context-free

language.

Trang 32

Deterministic Pushdown Automata

A DPDA is a pushdown automaton that never has a

choice in its move:

1 δ (q, a, b) contains at most one element.

2 if δ (q, λ , b) is not empty, then δ (q, a, b) must be empty for

every a ∈ Σ

Trang 33

Deterministic Context-Free

Language

A language L is said to be a DCFL iff there exists a

DPDA M such that L = L(M).

Trang 35

• Exercises: 5, 10, 13 of Section 7.1 - Linz’s book.

• Exercises: 1, 2, 3, 4, 5, 6, 7, 8, 12 of Section 7.2 - Linz’s book.

Ngày đăng: 13/05/2014, 10:21

TỪ KHÓA LIÊN QUAN