Tải bản đầy đủ (.pdf) (28 trang)

slike bài giảng môn automata and formal language

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (184.77 KB, 28 trang )

Languages
Grammars
Automata
Automata and Formal language
Huynh Viet Linh

Ngày 13 tháng 9 năm 2009
Huynh Viet Linh Automata and Formal language
Languages
Grammars
Automata
Course Overview
An introduction to the fundamental theories and algorithms
for computing on digital computer.
Automation: A model producing output from acceptable input
based on self-made decision
Formal Language: An abstraction of programming language
syntax.
Huynh Viet Linh Automata and Formal language
Languages
Grammars
Automata
Course Outline
Chapter 1: Introduction
Chapter 2: Finite Automata
Chapter 3: Regular Language and Regular Grammar
Chapter 4: Properties of Regular Language
Chapter 5: Context-Free Grammar
Chapter 6: Simplification of Context-Free Grammar
Chapter 7: Pushdown Automata
Huynh Viet Linh Automata and Formal language


Languages
Grammars
Automata
Reading Materials
Hồ Văn Quân, Giáo trình lý thuyết automat và ngôn ngữ hình
thức.
Peter Linz, An introduction to formal languages and
automata.
John Hopcroft and Jeffrey Ullman, Introduction to automata
theory, languages, and computation.
Course website: 505012-CSE-06-Fall 2009
Huynh Viet Linh Automata and Formal language
Languages
Grammars
Automata
Assessment
Mid term: ???
Final exam: ???
Presentation
Huynh Viet Linh Automata and Formal language
Languages
Grammars
Automata
Related Issues
Digital Circuit Design
Compiler
Programming Languages
Huynh Viet Linh Automata and Formal language
Languages
Grammars

Automata
Required Background
Set and Graph Theory
Induction and Contradiction-based Methods
Huynh Viet Linh Automata and Formal language
Languages
Grammars
Automata
Three Basic Concepts
Languages
Grammars
Automata
Huynh Viet Linh Automata and Formal language
Languages
Grammars
Automata
Languages
Alphabet: a finite and nonempty set of symbols, denoted by

Example 1:

= {a,b}

= {0,1}
Roman alphabet

= {A,B, ,Z}
Greek alphabet

= {α, β, }

Huynh Viet Linh Automata and Formal language
Languages
Grammars
Automata
Languages
String: finite sequence of symbols from

λ: empty string


: the set of all strings on

(

+
=


−{λ})
Example 2:

= {a,b}


= {λ,a,b,aa,ab,aaa,abb, }
w = abaaabba is a string of

Huynh Viet Linh Automata and Formal language
Languages
Grammars

Automata
Language
Language: a subset L of


Sentence: a string in L
Example 3:
L = {a
n
b
n
: n ∈ N} is a language on

= {a,b}
w = aabba is a string of

but not a sentence of L.
Huynh Viet Linh Automata and Formal language
Languages
Grammars
Automata
Language concatenation
L
1
L
2
= {xy : x ∈ L
1
, y ∈ L
2

}
L
n
= LL L (n times)
L
0
= {λ}
Huynh Viet Linh Automata and Formal language
Languages
Grammars
Automata
Language concatenation
L = {a
n
b
n
: n ∈ N}
L
2
= {a
n
b
n
a
m
b
m
: m, n ∈ N}
L
1

= {a
n
b
2n
} and L
2
= {b
n
a
2n
} → L
1
L
2
=?
Huynh Viet Linh Automata and Formal language
Languages
Grammars
Automata
Closure Operators
Star-Closure: L

= L
0
∪ L
1
∪ L
2

Positive-Closure: L

+
= L
1
∪ L
2

Huynh Viet Linh Automata and Formal language
Languages
Grammars
Automata
Grammar
Grammar for a natural language: a set of rules to construct
vocabulary and sentences
Example 4: A simple English grammar
<sentence> → <noun-phrase><predicate>
<noun-phrase> → <article><noun>
<predicate> → <verb>
<article> → a | the
<noun> → boy | dog
<verb> → runs | walks
Huynh Viet Linh Automata and Formal language
Languages
Grammars
Automata
Formal Grammar
Formal grammar:
G = (V , T , S, P)
V: finite set of variables
T: finite set of terminal symbols
S ∈ V: start variable

P: finite set of productions
Huynh Viet Linh Automata and Formal language
Languages
Grammars
Automata
Formal Grammar
Productions: x → y, x ∈ (V ∪ T )
+
, y ∈ (V ∪ T )

Example 5:
G = ({S}, {a,b},S,P)
P:
S → aSb
S → λ
Huynh Viet Linh Automata and Formal language
Languages
Grammars
Automata
Directly Derive
w =uxv derives z = uyv if x → y is a production.
w ⇒ z
w
1


w
n
w
1


+
w
n
Huynh Viet Linh Automata and Formal language
Languages
Grammars
Automata
Directly Derive
Example 6: For the grammar given in example 5
S ⇒ aSb ⇒ aaSbb ⇒ aabb
S ⇒

aabb
Huynh Viet Linh Automata and Formal language
Languages
Grammars
Automata
Generated Language
G = (V,T,S,P)
L(G) = {w ∈ T

: S ⇒

w}
Example 7:
For the grammar G in example 5,
L(G ) = {a
n
b

n
: n ∈ N}
Huynh Viet Linh Automata and Formal language
Languages
Grammars
Automata
Derivation
S ⇒ w
1
⇒ w
2
⇒ ⇒ w
n
⇒ w ∈ L(G)
Example 8:
S ⇒ aSb ⇒ aaSbb ⇒ aabb is a derivation
Huynh Viet Linh Automata and Formal language
Languages
Grammars
Automata
Automata
"An automaton (plural: automata) is a self-operating
machine. The word is sometimes used to describe a robot,
more specifically an autonomous robot. Used colloquially, it
refers to a mindless follower." (Wiki)
An abstract model of digital computer
Huynh Viet Linh Automata and Formal language
Languages
Grammars
Automata

Automaton Structure
Huynh Viet Linh Automata and Formal language
Languages
Grammars
Automata
Input File
Input file: is
Divided into squares or cells, each of which holds a symbol of
the alphabet.
The symbols are to be read from left to right.
The end of input file is detectable.
The automaton cannot change the contents of the input file.
Huynh Viet Linh Automata and Formal language
Languages
Grammars
Automata
Storage
A device consisting of unlimited cells.
Each cell hold a symbol from an alphabet (it is not necessary
to be the same alphabet as the input one)
The automaton can read and change the storage cells
Huynh Viet Linh Automata and Formal language

×