Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Theory of Computation Unit 2
1. UNIT II
REGULAR EXPRESSIONS AND
LANGUAGES
Mrs.D.Jena Catherine Bel,
Assistant Professor, CSE,
Velammal Engineering College
Mrs.D.Jena
Catherine
Bel,
AP/CSE,
VEC
1
2. UNIT II
REGULAR EXPRESSIONS AND LANGUAGES
Regular Expressions – FA and Regular Expressions – Proving
Languages not to be regular – Closure Properties of Regular
Languages – Equivalence and Minimization of Automata.
Mrs.D.Jena
Catherine
Bel,
AP/CSE,
VEC
2
5. Regular Expressions
• The algebraic notations describes exactly the same language
as finite automata
• The language described by regular expression or a finite
automata is known as regular languages
• The regular expression operators are union, concatenation
and closure
Mrs.D.Jena
Catherine
Bel,
AP/CSE,
VEC
5
6. Let Regular expression R, then Regular language L(R) defined as
follows:
• L(Φ)= Φ
• L()={}
Let Alphabet ∑={a,b}
• If R=a then L(a)={a}
• If R=b then L(b)={b}
Mrs.D.Jena
Catherine
Bel,
AP/CSE,
VEC
6
7. Example
RE Representation RL
a+b L(a)U L(b) -> {a} U {b} {a,b}
ab+bc L(ab)U L(bc) -> {ab} U {bc} {ab,bc}
(a+b).c L(a+b).L(c) -> {a,b}.{c} {ac,bc}
a(0+1)b L(a).L(0+1).L(b)
{a}.{0,1}.{b}
{a0b,a1b}
(a+b)(0+1) L(a+b).L(0+1) ->{a,b}.{0,1} {a0,a1,b0,b1}
Mrs.D.Jena
Catherine
Bel,
AP/CSE,
VEC
7
8. Operators of Regular expression
• Union
• L = {01 , 10}
• M = {ε ,00, 11}
• L U M = {ε ,00, 11,01,10}
• Concatenation
• L = {01 , 10}
• M = {ε ,00, 11}
• L M = {01, 10, 0100, 1000, 0111, 1011}
Mrs.D.Jena
Catherine
Bel,
AP/CSE,
VEC
8
10. Example
• Give the regular expression for set of all strings starting with
0.
• Give the regular expression for set of all strings ending with 0.
•
Mrs.D.Jena
Catherine
Bel,
AP/CSE,
VEC
10
11. Example
• Give the regular expression for set of all strings ending with
00.
• Give the regular expression for set of all strings starting with 0
and ending with 1
Mrs.D.Jena
Catherine
Bel,
AP/CSE,
VEC
11
18. FA to RE - Methods
1.Using Rij formula
(Transitive closure method)
2. State Elimination Method
3. Arden’s Method
Mrs.D.Jena
Catherine
Bel,
AP/CSE,
VEC
18
19. Rij Method
• DFA states are defined as {1,2,3,4,. . . n}
• k={0,1,2,3,4,. . . n}
• Rij Formula : 𝐑𝐢𝐣
(𝐤)
= 𝐑𝐢𝐣
(𝐤−𝟏)
+
𝐑𝐢𝐤
𝐤−𝟏
𝐑𝐤𝐤
𝐤−𝟏 ∗
𝐑𝐤𝐣
(𝐤−𝟏)
• i is the initial state (1) , j is the final state ꞓ F
• The required RE is sum of union of 𝑹𝒊𝒋
(𝒏)
such that j is the
accepting state
𝑹𝒊𝒋
(𝒏)
is computed by,
𝑹𝒊𝒋
(𝒌=𝟎)
, 𝑹𝒊𝒋
(𝒌=𝟏)
. . . 𝑹𝒊𝒋
(𝒌=𝒏)
Mrs.D.Jena
Catherine
Bel,
AP/CSE,
VEC
19
35. Arden’s Theorem
• Let P and Q be two regular expressions.
• If P does not contain null string, then R = Q + RP has a unique
solution that is R = QP*
Mrs.D.Jena
Catherine
Bel,
AP/CSE,
VEC
35
40. Proving Languages not to be
regular
• Pumping Lemma
Mrs.D.Jena
Catherine
Bel,
AP/CSE,
VEC
40
41. Applications of Pumping Lemma
Pumping Lemma is to be applied to show that certain languages
are not regular. It should never be used to show a language is
regular.
If L is regular, it satisfies Pumping Lemma.
If L does not satisfy Pumping Lemma, it is non-regular.
Mrs.D.Jena
Catherine
Bel,
AP/CSE,
VEC
41
42. Prove that L={anbn | n>=1} is
not regular
• L={ab,aabb,aaabbb,aaaabbbb,….}
• RE : aa*bb*
• FA:
• L={ab,aaaabb,abbbbb,….}
a
a
b
b
Proof by contradiction
Let L is regular with n states,
then,
w=“aaabbb” ꞓ L
According pumping lemma,
w divided into xyz,
Let
X=aa : y=abb : z= b
For k=2, compute xyk
z
=aa(abb)2b
=aaabbabbb not
belongs to L
So that L is not regular
Mrs.D.Jena
Catherine
Bel,
AP/CSE,
VEC
42