Operations : union , concatenation , Kleene closure, positive closure
Non-empty finite set of symbols
Σ Sigma Σ
finite sequence of symbols of Σ Sigma Σ
(word)
empty string : ε varepsilon ε
Σ ∗ Sigma^* Σ∗ : the set of all strings over alphabet Σ Sigma Σ (including ε varepsilon ε)
Σ ∗ Sigma^* Σ∗ is monoid with respect to concatenation
A language over alphabet Σ Sigma Σ is a subset (which can be infinite) of Σ ∗ Sigma^* Σ∗
(personally, similar to vocabulary)
Kleene star or Kleene closure of a language L L L
L ∗ = ∪ n ≥ 0 L n L^* = cup_{ngeq 0}L^n L∗=∪n≥0Ln
which is consistent with the notation of Σ ∗ Sigma^* Σ∗ by considering Σ Sigma Σ as a language over alphabet Σ Sigma Σ
Positive closure of a language L L L
L + = ∪ n ≥ 1 L n L^+ = cup_{ngeq 1} L^n L+=∪n≥1Ln
P1 Concatenation is associative
P2 Concatenation is not commutative
P3 L { ε } = { ε } L = L L{varepsilon}={varepsilon}L=L L{ε}={ε}L=L
P4 L ∅ = ∅ L = ∅ Lvarnothing=varnothing L= varnothing L∅=∅L=∅
P5 Distributive properties
P6 if L 1 ⊆ L 2 L_1subseteq L_2 L1⊆L2 and L 3 ⊆ L 4 L_3subseteq L_4 L3⊆L4, then L 1 L 3 ⊆ L 2 L 4 L_1L_3 subseteq L_2L_4 L1L3⊆L2L4
P7 ∅ ∗ = { ε } varnothing^*={varepsilon} ∅∗={ε}
P8 { ε } ∗ = { ε } {varepsilon}^*={varepsilon} {ε}∗={ε}
P9 if ε ∈ L varepsilon in L ε∈L, then L ∗ = L + L^*=L^+ L∗=L+
P10 L L ∗ = L ∗ L = L + LL^*=L^*L=L^+ LL∗=L∗L=L+
P11 ( L ∗ ) ∗ = L ∗ (L^*)^*=L^* (L∗)∗=L∗
P12 L ∗ L ∗ = L ∗ L^*L^*=L^* L∗L∗=L∗
P13 ( L 1 L 2 ) ∗ L 1 = L 1 ( L 2 L 1 ) ∗ (L_1L_2)^*L_1=L_1(L_2L_1)^* (L1L2)∗L1=L1(L2L1)∗
P14 ( L 1 ∪ L 2 ) ∗ = ( L 1 ∗ L 2 ∗ ) ∗ (L_1cup L_2)^*=(L_1^*L_2^*)^* (L1∪L2)∗=(L1∗L2∗)∗
(keep minimum possible number of parenthesis in writing)
regular language L ( r ) L(r) L(r) represented by regular expression r r r
sometimes just use r r r instead of L ( r ) L(r) L(r) to indicate the regular language L L L
Equivalent
expressions r 1 r_1 r1 and r 2 r_2 r2 representing the same language
we write r 1 ≈ r 2 r_1 approx r_2 r1≈r2 ( r 1 = r 2 r_1=r_2 r1=r2 is also reasonable)
A grammar is a quadruple
G = ( V , T , S , P ) mathcal{G}=(V, T, S, P) G=(V,T,S,P)
where
Production rules A → α Arightarrow alpha A→α is independent of neighbouring symbols, i.e. context free.
Thus the grammar defined here is known as context free grammar, simply CFG.
also known as parse trees
the yield α alpha α of derivation A ⇒ ∗ α ARightarrow^*alpha A⇒∗α can be identified in the derivation tree by juxtaposing the lables of leaf nodes from left to right.
ambiguous grammar/unambiguous grammar
inherently ambiguous language
linear grammar : every production rule has at most one nonterminal symbol
left-linear (right-linear) grammar : the nonterminal symbol is at the left end (right end)
The language generated by a right linear grammar is regular.
For every regular language L L L, there exists a right linear grammar that generates L L L
Right linear grammars are also called regular grammars
Things also hold for left linear grammar.
Directed graph (short for digraph)
All productions are of the form A → B C Arightarrow BC A→BC or A → a Arightarrow a A→a, where A , B , C A,B,C A,B,C are variables, and a a a is terminal symbol.
All productions are shown as the following form :
A → a X , w h e r e a ∈ T , X ∈ V ∗ A rightarrow aX, where ain T, Xin V^* A→aX, where a∈T,X∈V∗
“3R”
A (deterministic) finite automaton A = ( Q , Σ , q 0 , δ , F ) mathscr{A}=(Q,Sigma,q_0,delta,F) A=(Q,Σ,q0,δ,F)
Q Q Q is a finite set called the set of states
Σ Sigma Σ is a finite set called the input alphabet
q 0 ∈ Q q_0 in Q q0∈Q, called the initial/start state
δ : Q × Σ → Q delta : Q times Sigma rightarrow Q δ:Q×Σ→Q is a function called transition function or next-state function (which can be extended, say δ ^ : Q × Σ ∗ → Q hatdelta : Q times Sigma^*rightarrow Q δ^:Q×Σ∗→Q)
F ⊆ Q F subseteq Q F⊆Q, called the set of final/accept states
Useful graphical representation : Transition Diagram
which can be constructed as follows:
“accepted by”
Language of a DFA : L ( A ) L(mathscr{A}) L(A)
Configurations
C ∈ Q × Σ ∗ C in Qtimes Sigma^* C∈Q×Σ∗
the computation of A mathscr{A} A on the input x x x
A nondeterministic finite automaton N = ( Q , Σ , q 0 , δ , F ) mathscr{N}=(Q,Sigma,q_0,delta,F) N=(Q,Σ,q0,δ,F), where Q , Σ , q 0 , F Q,Sigma,q_0,F Q,Σ,q0,F are as in a DFA; whereas, the transition function δ delta δ is as below:
δ : Q × ( Σ ∪ { ε } ) → ℘ ( Q ) delta : Q times (Sigma cup {varepsilon}) rightarrow wp(Q) δ:Q×(Σ∪{ε})→℘(Q)
is a function so that, for a given state an a input symbol (possibly ε varepsilon ε), δ delta δ assigns a set of next states, possibly empty set.
δ delta δ can also be extended to δ ^ hatdelta δ^
Every DFA can be treated as an NFA.
L ( N ) = { x ∈ Σ ∗ ∣ δ ^ ( q 0 , x ) ∩ F ≠ ∅ } L(mathscr{N})={x in Sigma^* | hatdelta(q_0,x) cap F neq varnothing } L(N)={x∈Σ∗∣δ^(q0,x)∩F=∅}
P = ( Q , Σ , Γ , δ , q 0 , Z 0 , F ) P = (Q,Sigma,Gamma,delta,q_0,Z_0,F) P=(Q,Σ,Γ,δ,q0,Z0,F)
Γ Gamma Γ : A finite stack alphabet.
Z 0 Z_0 Z0 : The start symbol in the stack.
Can be recognized by “A modified PDA with 2 stacks” - an variation of TM
TM is a seven-tuple P = ( Q , Σ , Γ , δ , q 0 , B , F ) P=(Q, Sigma, Gamma, delta, q_0, B, F) P=(Q,Σ,Γ,δ,q0,B,F)
How to describe the configuration of TM
{ w ∣ q 0 w − > α p β , p ∈ F , α , β ∈ Γ ∗ } {w|q_0w -> alpha pbeta , pin F, alpha,beta in Gamma^*} {w∣q0w−>αpβ,p∈F,α,β∈Γ∗}
The kind of languages accepted by TM is called recursively enumerable(RE) language. (递归可枚举语言)
本文发布于:2024-01-30 18:29:07,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170661054821972.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |