Docsity

Finite Automata - RE, Study notes of Theory of Automata

Partial preview of the text

Download Finite Automata - RE and more Study notes Theory of Automata in PDF only on Docsity!

Formal Languages & Automata

Theory (FAT-330) (L:3, P:0)

B.Tech. IIIrd^ Semester

By

Muneendra Ojha

Fix an Alphabet Σ, e.g. {0,1}, {a,b}…

Operands: ε, Φ, and any a belonging to Σ Operators:  (^) + (Union)  (^). (Concatenation)  (^) * (Closure) Notation: For all Regular Expressions R, constructed from above, L(R) will denote the Language R defined

Algebra of Regular Expressions

Concatenation: if R, S are Regular expressions  R.S is a regular expression where, L(R.S) = L(R).L(S) Recall for languages L 1 , L 2 L 1 .L 2 = {w = xy | x L 1 , y L 2 } Examples:  (^) R = ε + 1  L(R) = {ε,1}  (^) S = ε + 0 + 1  L(S) = {ε,0,1}  (^) T = RS or R.S  L(T) = {ε,0,1,10,11}

Operations on Regular

Expressions

 (^) 

Language Powers: L 0 = {ε} L 1 = L L 2 = L.L or LL L 3 = L.L.L or LLL . . . Here Lk = { w | w = x 1 x 2 x 3 …xk, and }

Operations on Regular

Expressions

i x L i

Positive Closure

L+^ = L^1 U L^2 U L^3 U……

If R is an RE  R+^ is an RE Where, L(R+) = L(R) U L(R^1 ) U L(R^2 ) …… = L(R) U L(R)^1 U L(R)^2 …… Easy facts: R+ (^) = R. R* = R. R R = ε + R+ (R) = R*

Operations on Regular

Expressions

Easy facts continued…

Φ + R = R

ΦR = RΦ = Φ (Annihilator)(page no 109 of book)

εR = Rε =R

ε* = ε and Φ* = ε

R + R =R

RR = R*

(PQ)P = P(QP)

Homework: Read your book from page no 97 to 103 and try exercises on 103.

Operations on Regular

Expressions

Precedence of operators

Highest *

Lowest +

Thus R+S.T* = R + (S.(T)*)

Associativity

(RS)T = R(ST) = RST

(R+S)+T = R+(S+T) = R+S+T

Distribuitivity

R(S+T) = RS + RT & (R+S)T = RT + ST

Operations on Regular

Expressions

Formal Recursive definition of Regular Expressions 1.Any terminal symbol (i.e. an element of Σ), ε, Φ are RE 2.Union of two regular expressions R1 and R2 written as R1+R2 is also an RE 3.Concatenation of two regular expressions R1 and R written as R1.R2 is also an RE 4.Iteration (or closure) of a regular expression R written as R* is also an RE 5.If R is a regular expression then (R) is also an RE 6.Regular expressions over Σ are precisely those obtained recursively by applying rules 1-5 once or several times.

Operations on Regular

Expressions

Compact description of a regular language Start with some “non-terminal” symbol, S. Expand that symbol, using some substitution rules. ...keep applying rules until all non-terminals are expanded to terminals. The string of terminals is in the sentence.

Regular Languages

Strings in and out of the example Regular Language: In the language? “ba!”, “baa!”, “baaaaa!”, “aaaaaa” Not in the language? “ba”, “b!”, “ab!”, “bbaaa!”, “alibaba!” Finite-state Automata a Regular Expression

baa*

Regular Language

Regular Languages

Accepted Language Strings Finite-State Automata Regular Expressions Recognize the Regular Language Generate the Regular Language

Regular Language: Related

Concepts

Recall the definition: Languages generated by R.E. are called Regular Languages Have you seen? ε-NFA to NFA (Assumed to be done) NFA to DFA (Assumed to be done) DFA to R.E. R.E. to ε-NFA

Relation to machines

Kleene’s Theorem: (RE  ε-NFA) For any regular language L(R) defined by regular expression R, there exists an ε-NFA N such that L(R) = L(N) Proof: We use principle of Induction on total no of operators in R P = c has 0 operators; #P= Q = (a+b)* has 2 operators; #Q= R = (a+b)*c has 3 operators; #R=

Note: #R = #P + #Q + 1

Relation to machines

Basis: For #R = 0 Clearly R = ε, Φ, or some a belonging to Σ N(ε): N(Φ): N(a): Induction Hypothesis: Assume induction hypothesis for any regular expression R, where #R ≤ n, there exists an ε-NFA N, such that L(R)=L(N)

Relation to machines