计算理论复习
正则语言与有穷自动机
- 可数无穷
- 正则表达式(注意+不是正则,*是正则; L∅=∅L=∅ )
Σ⋃{ (,),∅,⋃,∗} - DFA
- M = (
K , Σ , δ , s ,F ) where
K is a finite set of states,
Σ is an alphabet,
s∈K is the initial state,
F⊆K is the set of final states,
δ is the transition function form K×Σ to K
- M = (
- NFA
-
M = ( K ,Σ , Δ , s ,F ) where
K is a finite set of states,
Σ is an alphabet,
s∈K is the initial state,
F⊆K is the set of final states,
Δ is the transition relation form K×(Σ⋃{ e})×K to K
- for each NFA, there is an equivalent DFA
(将NFA的状态的集合变为DFA中的点)
- for each NFA, there is an equivalent DFA
-
- closure 和 pumping theory
- The class of languages accepted vy finite automata is closed under:
- union
- concatentenation
- Kleene star
- complementation
- intersection
- A language is regular if and only if it is accepted by finite automaton
正则表达式和DFA, NFA的相互转化按照步骤生成
- Pumping Theory: Let
L be a regular language. There is an integer n≥1 such that any string w∈L with |w|≥n can be rewritten as w=xyz such that y≠e,|xy|≤n , and xyiz∈L for each i≥0
- The class of languages accepted vy finite automata is closed under:
Give DFA or NFA write Regular Expression
Give regular expression, write DFA or NFA
Show a given language is (construct) or is not regular (pumping)context-free and pushdown自动机
- context-free grammar
- G = (
V , Σ , R ,S ) where
V is an alphabet
Σ is the set of terminals, is a subset of V
R is the set of rules (V−Σ)×V∗
S is the start Symbol, is an element ofV−Σ - all regular languages are context-free
- parse tree, leftmost derivation, rightmost derivation
Grammars with strings that have two or more distinct parse trees are called ambiguous
- G = (
PDA
M = (
K , Σ ,
- context-free grammar