SlideShare una empresa de Scribd logo
1 de 35
THEORY OF AUTOMATAAND
FORMAL LANGUAGES
UNIT-2
ABHIMANYU MISHRA
ASSISTANT PROF.(CSE)
JETGI
Abhimanyu Mishra(CSE) JETGI12/31/2016 1
A regular expression (sometimes called a rational expression)is,
in computer science and formal languages theory, a sequence
of characters that define a search pattern. usually this pattern is then used
by in string searching algorithm "find" or "find and replace" operations on
strings.
2. REGULAR EXPRESSION AND LANGUAGES
Abhimanyu Mishra(CSE) JETGI12/31/2016 2
2.1 Definition of Regular Expression:
The set of regular expression of defined by the following rules:
(i) Every letter of ∑ can be made into regular expression, null string,€ itself is
a regular expression.
(ii) If r1 and r2 are regular expression, then
(a) (r1) (b) r1r2
(c) r1+r2 (d) r1
*
(e) r1
+ are also regular expression
(iii) Nothing else is regular expression.
12/31/2016 Abhimanyu Mishra(CSE) JETGI 3
2.1.1 Building Regular Expression
(i) The constants ϵ(null string) and ɸ(empty set) are regular expression,
denote the languages {ϵ} and ɸ, respectively.
That is, L(ϵ) = {ϵ} , and L(ɸ)= ɸ.
(ii) If a is any symbol, then a is regular expression. This expression denotes
the language {a}. That is L(a)={a}.
(iii) A variable, usually capitalized and such as L is a variable, representing
any language.
12/31/2016 Abhimanyu Mishra(CSE) JETGI 4
2.2 Construction of FA for Regular Expression
• The Expression is r+s for some smaller expression r and s. The following
automation serves, where R is automation for r and S is automation for s.
That is, starting at the new start state, We can go to the start state of either
the automation for r or the automation for S
So L(r) and L(s)
ϵ ϵ
Start
ϵ ϵ
12/31/2016 Abhimanyu Mishra(CSE) JETGI 5
R
S
2.The expression rs for some smaller expression r and s. The
automation for the concatenation is ………….
Start ϵ ϵ ϵ
3. The expression is r* for some smaller expression r. Then we use
automation of ……….
ϵ
Start ϵ ϵ
ϵ
12/31/2016 Abhimanyu Mishra(CSE) JETGI 6
R S
R
Example 1: Find the automation for regular expression a.(a+b)*.b.b
Solution:
The basic regular expression involved are a and b,we start with automation for
a and automation for b. Since brackets are evaluated first.(a+b).
ϵ a ϵ
Start
ϵ ϵ
b
12/31/2016 Abhimanyu Mishra(CSE) JETGI 7
Step 2: Since closure is required to take next, we construct automation for (a+b)*
using automation for (a+b) ……..
ϵ
a
ϵ ϵ
Start ϵ ϵ
ϵ b ϵ
ϵ
12/31/2016 Abhimanyu Mishra(CSE) JETGI 8
Step 3: Next we construct the automation for a.(a+b)* as………
ϵ a ϵ ϵ
Star a ϵ ϵ
ϵ b ϵ ϵ
12/31/2016 Abhimanyu Mishra(CSE) JETGI 9
Step 4: Next we construct the automation for a.(a+b)*.b by using automation
ϵ ϵ a ϵ
Start a ϵ ϵ b
ϵ b ϵ
ϵ
12/31/2016 Abhimanyu Mishra(CSE) JETGI 10
Step 5: Now finally we can construct automation for a.(a+b)*.b.b
ϵ ϵ a ϵ
Start a ϵ b b
ϵ ϵ
ϵ b ϵ
12/31/2016 Abhimanyu Mishra(CSE) JETGI 11
Arden's Theorem
In order to find out a regular expression of a Finite Automaton, we use Arden’s
Theorem along with the properties of regular expressions.
Statement −
• Let P and Q be two regular expressions.
• If P does not contain null string
(I) R = Q + RP has a unique solution,
(ii) R = QP*
12/31/2016 Abhimanyu Mishra(CSE) JETGI 12
Proof −
R = Q + (Q + RP)P [After putting the value R = Q + RP]
= Q + QP + RPP
When we put the value of R recursively again and again, we get the following
equation −
R = Q + QP + QP2 + QP3…..
R = Q (ϵ + P + P2 + P3 + …. )
R = QP* [As P* represents (ϵ + P + P2 + P3 + ….) ]
proved.
12/31/2016 Abhimanyu Mishra(CSE) JETGI 13
Assumptions for Applying Arden’s Theorem −
The transition diagram must not have NULL transitions
It must have only one initial state:
Method
Step 1 − Create equations as the following form for all the states of the DFA
having n states with initial state q1.
q1 = q1R11 + q2R21 + … + qnRn1 + ϵ
q2 = q1R12 + q2R22 + … + qnRn2
…………………………………………………………….
…………………………………………………………….
qn = q1R1n + q2R2n + … + qnRnn
Rij represents the set of labels of edges from qi to qj, if no such edge exists,
then Rij = ɸ
Step 2 − Solve these equations to get the equation for the final state in terms of
Rij
12/31/2016 Abhimanyu Mishra(CSE) JETGI 14
Example 1: Construct a regular expression corresponding to the
automata given below −
b
a
b
b a
a
12/31/2016 Abhimanyu Mishra(CSE) JETGI 15
q2
q1
q3
Solution:
Here the initial state is q2 and the final state is q1.
The equations for the three states q1, q2, q3
q1 = q1a + q3a + ϵ (ϵ move is because q1 is the initial state)
q2 = q1b + q2b + q3b
q3 = q2a
Now, we will solve these three equations −
q2 = q1b + q2b + q3b
= q1b + q2b + (q2a)b (Substituting value of q3)
= q1b + q2(b + ab)
= q1b (b + ab)* (Applying Arden’s Theorem)
12/31/2016 Abhimanyu Mishra(CSE) JETGI 16
q1 = q1a + q3a + ϵ
= q1a + q2aa + ϵ (Substituting value of q3)
= q1a + q1b(b + ab*)aa + ϵ (Substituting value of q2)
= q1(a + b(b + ab)*aa) + ϵ
= ϵ (a+ b(b + ab)*aa)*
= (a + b(b + ab)*aa)*
Hence, the regular expression is (a + b(b + ab)*aa)*.
12/31/2016 Abhimanyu Mishra(CSE) JETGI 17
Solve This Problem? Construct the regular expression
0 0,1
1 1
0
12/31/2016 Abhimanyu Mishra(CSE) JETGI 18
q1
q2
q3
Construction of an FA from an RE
We can use Thompson's Construction to find out a Finite Automaton from a
Regular Expression. We will moderate the regular expression into minimum
regular expressions and converting these to NFA and finally to DFA.
Case 1 − For a regular expression ‘a’, we can construct the following FA
Finite Automata for RE = a
Start a
12/31/2016 Abhimanyu Mishra(CSE) JETGI 19
q1 qf
Case 2 − For a regular expression ‘ab’, we can construct the following FA −
Start a b
Case 3 − For a regular expression (a+b), we can construct the following FA −
Start a
b
Case 4 − For a regular expression (a+b)*, we can construct the following FA −
a,b
Start
12/31/2016 Abhimanyu Mishra(CSE) JETGI 20
qfq1 q2
q1 qf
qf
Example:-Convert the following RE into its equivalent DFA − 1 (0 + 1)* 0
0,1
start 1 ϵ ϵ 0
12/31/2016 Abhimanyu Mishra(CSE) JETGI 21
q0 q1 q2 q3 qf
Pumping Lemma for Regular Languages
Theorem
Let L be a regular language. Then there exists a constant ‘c’ such that
for every string w in L −
|w| ≥ c
We can break w into three strings, w = xyz, such that −
|y| > 0
|xy| ≤ c
For all k ≥ 0, the string xykz is also in L.
12/31/2016 Abhimanyu Mishra(CSE) JETGI 22
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 is non-regular, it does not satisfy Pumping Lemma.
Method to prove that a language L is not regular
At first, we have to assume that L is regular.
So, the pumping lemma should hold for L.
Use the pumping lemma to obtain a contradiction −
12/31/2016 Abhimanyu Mishra(CSE) JETGI 23
Use the pumping lemma to obtain a contradiction −
Select w such that |w| ≥ c
Select y such that |y| ≥ 1
Select x such that |xy| ≤ c
Assign the remaining string to z.
Select k such that the resulting string is not in L.
Hence L is not regular.
12/31/2016 Abhimanyu Mishra(CSE) JETGI 24
Application of the Pumping Lemma
(i) Select the language L ,You wish to prove non-regular.
(ii) The “adversary” pinks n, the constant mentioned in the pumping lemma,
Once the adversary has picked n, he may not change it.
(iii) Select a string z in L. Your choice may depend implicitly on the of n
chosen.
(iv) The adversary breaks z into u, v and w, subject to the constants that
|uv|<=n and |v|>=1
(v) You achieve a contradiction to the pumping leema by showing, for any
u,v and determined by the adversary that there exit i for which uviw is not
in L.it May then concluded and L is not regular. Your selection of
pumping leema on n,u,v and w.
12/31/2016 Abhimanyu Mishra(CSE) JETGI 25
Example: Prove that language L =(anbn for n= 0,1,2,3……} is not regular
Solution:
Case 1 If middle part y is made off entirely of a’s,as
x aaaaaaa….z
If we jump it as xyyz,xyyyz,then number of a”s increases,but in language {(anbn for n=
0,1,2,3,……} a’s and b’s are equal so it os not allowed.
Case 2 If middle part y is made off entirely of b’s as
x bbbbbbb……z
For the same reason, it is also not allowed.
Case 3 y part is made of some positive number of a’s and some number of b’s. This would
mean that y contain the substring ab
x……aaaaaaaabbbbbbbbbbb…………..z
Then xyyz would have two copies of the substring ab.But every world in L contains
substring ab exactly once.
This proves that the pumping lemma cannot apply to L and therefore L is not regular
12/31/2016 Abhimanyu Mishra(CSE) JETGI 26
Q1.Prove That L={0n1m2n , n,m>=0} is not regular.
Q2. Prove that language L ={0n |n is perfect square} is not regular.
Q3. Prove that language L ={0n |n is perfect cube} is not regular.
12/31/2016 Abhimanyu Mishra(CSE) JETGI 27
AUTOMATA WITH OUTPUT
Here we are using two Machines for finding the Finite Automata Output
(i) Moore Machine
(ii) Mealy Machine
12/31/2016 Abhimanyu Mishra(CSE) JETGI 28
Moore Machine
(i) Moore Machine
Moore machine is an FSM whose outputs depend on only the present
state.
A Moore machine can be described by a 6 tuple (Q, ∑, ∆, δ, ƛ’, q0)
where −
Q is a finite set of states.
∑ is a finite set of symbols called the input alphabet.
∆ is a finite set of symbols called the output alphabet.
δ is the input transition function where δ: Q × Σ → Q
ƛ’ is the output transition function where ƛ’ : Q × Σ → ∆
q0 is the initial state from where any input is processed (q0 ∈ Q).
12/31/2016 Abhimanyu Mishra(CSE) JETGI 29
Representation of Moore Machine:( Transition Table)
Present State Next state at input Output
a=0 a=1
q0 q3 q1 0
q1 q1 q2 1
q2 q2 q3 0
q3 q3 q0 0
12/31/2016 Abhimanyu Mishra(CSE) JETGI 30
Representation of Moore Machine:( Transition Diagram)
0
0
Start 1 1
0
1
0 1 0
0 1 0
12/31/2016 Abhimanyu Mishra(CSE) JETGI 31
q3
q0
q2
q1
Mealy Machine
A Mealy Machine is an FSM whose output depends on the present state as
well as the present input.
It can be described by a 6 tuple (Q, ∑, ∆, δ, ƛ’, q0) where −
Q is a finite set of states.
∑ is a finite set of symbols called the input alphabet.
∆ is a finite set of symbols called the output alphabet.
δ is the input transition function where δ: Q × ∑ → Q
ƛ’ is the output transition function where X: Q → ƛ’,
q0 is the initial state from where any input is processed (q0 ∈ Q).
12/31/2016 Abhimanyu Mishra(CSE) JETGI 32
Representation of Mealy Machine:( Transition Table)
Present State For input a=0 for input a=1
State Output State Output
q1 q3 0 q2 0
q2 q1 1 q4 0
q3 q2 1 q1 1
q4 q4 1 q3 0
12/31/2016 Abhimanyu Mishra(CSE) JETGI 33
Representation of Mealy Machine:( Transition Diagram)
Start 0/1
1/0
1/1 0/0 0/1 1/0
0/1
1/0
12/31/2016 Abhimanyu Mishra(CSE) JETGI 34
q1
q3 q4
q2
Mealy Machine vs. Moore Machine
12/31/2016 Abhimanyu Mishra(CSE) JETGI 35
Mealy Machine Moore Machine
Output depends both upon present
state and present input.
Output depends only upon the
present state.
Generally, it has fewer states than
Moore Machine.
Generally, it has more states than
Mealy Machine.
Output changes at the clock edges. Input change can cause change in
output change as soon as logic is
done.
Mealy machines react faster to
inputs.
In Moore machines, more logic is
needed to decode the outputs since
it has more circuit delays.

Más contenido relacionado

La actualidad más candente

Regular Languages
Regular LanguagesRegular Languages
Regular Languagesparmeet834
 
Theory of Automata and formal languages unit 1
Theory of Automata and formal languages unit 1Theory of Automata and formal languages unit 1
Theory of Automata and formal languages unit 1Abhimanyu Mishra
 
Pumping lemma Theory Of Automata
Pumping lemma Theory Of AutomataPumping lemma Theory Of Automata
Pumping lemma Theory Of Automatahafizhamza0322
 
LINEAR BOUNDED AUTOMATA (LBA).pptx
LINEAR BOUNDED AUTOMATA (LBA).pptxLINEAR BOUNDED AUTOMATA (LBA).pptx
LINEAR BOUNDED AUTOMATA (LBA).pptxAkhilJoseph63
 
Regular expressions-Theory of computation
Regular expressions-Theory of computationRegular expressions-Theory of computation
Regular expressions-Theory of computationBipul Roy Bpl
 
Deterministic Finite Automata (DFA)
Deterministic Finite Automata (DFA)Deterministic Finite Automata (DFA)
Deterministic Finite Automata (DFA)Animesh Chaturvedi
 
Lecture: Regular Expressions and Regular Languages
Lecture: Regular Expressions and Regular LanguagesLecture: Regular Expressions and Regular Languages
Lecture: Regular Expressions and Regular LanguagesMarina Santini
 
TOC 4 | Non-deterministic Finite Automata
TOC 4 | Non-deterministic Finite AutomataTOC 4 | Non-deterministic Finite Automata
TOC 4 | Non-deterministic Finite AutomataMohammad Imam Hossain
 
Minimization of DFA
Minimization of DFAMinimization of DFA
Minimization of DFAkunj desai
 
AUTOMATA THEORY - SHORT NOTES
AUTOMATA THEORY - SHORT NOTESAUTOMATA THEORY - SHORT NOTES
AUTOMATA THEORY - SHORT NOTESsuthi
 
Automata
AutomataAutomata
AutomataGaditek
 
Theory of automata and formal languages Unit 4
Theory of automata and formal languages Unit 4Theory of automata and formal languages Unit 4
Theory of automata and formal languages Unit 4Abhimanyu Mishra
 
Push Down Automata (PDA) | TOC (Theory of Computation) | NPDA | DPDA
Push Down Automata (PDA) | TOC  (Theory of Computation) | NPDA | DPDAPush Down Automata (PDA) | TOC  (Theory of Computation) | NPDA | DPDA
Push Down Automata (PDA) | TOC (Theory of Computation) | NPDA | DPDAAshish Duggal
 
NFA Converted to DFA , Minimization of DFA , Transition Diagram
NFA Converted to DFA , Minimization of DFA , Transition DiagramNFA Converted to DFA , Minimization of DFA , Transition Diagram
NFA Converted to DFA , Minimization of DFA , Transition DiagramAbdullah Jan
 

La actualidad más candente (20)

Regular Languages
Regular LanguagesRegular Languages
Regular Languages
 
Theory of Automata and formal languages unit 1
Theory of Automata and formal languages unit 1Theory of Automata and formal languages unit 1
Theory of Automata and formal languages unit 1
 
Pumping lemma Theory Of Automata
Pumping lemma Theory Of AutomataPumping lemma Theory Of Automata
Pumping lemma Theory Of Automata
 
NFA to DFA
NFA to DFANFA to DFA
NFA to DFA
 
LINEAR BOUNDED AUTOMATA (LBA).pptx
LINEAR BOUNDED AUTOMATA (LBA).pptxLINEAR BOUNDED AUTOMATA (LBA).pptx
LINEAR BOUNDED AUTOMATA (LBA).pptx
 
Regular expressions-Theory of computation
Regular expressions-Theory of computationRegular expressions-Theory of computation
Regular expressions-Theory of computation
 
Deterministic Finite Automata (DFA)
Deterministic Finite Automata (DFA)Deterministic Finite Automata (DFA)
Deterministic Finite Automata (DFA)
 
Lecture: Regular Expressions and Regular Languages
Lecture: Regular Expressions and Regular LanguagesLecture: Regular Expressions and Regular Languages
Lecture: Regular Expressions and Regular Languages
 
TOC 4 | Non-deterministic Finite Automata
TOC 4 | Non-deterministic Finite AutomataTOC 4 | Non-deterministic Finite Automata
TOC 4 | Non-deterministic Finite Automata
 
Finite Automata
Finite AutomataFinite Automata
Finite Automata
 
Minimization of DFA
Minimization of DFAMinimization of DFA
Minimization of DFA
 
AUTOMATA THEORY - SHORT NOTES
AUTOMATA THEORY - SHORT NOTESAUTOMATA THEORY - SHORT NOTES
AUTOMATA THEORY - SHORT NOTES
 
CFG to CNF
CFG to CNFCFG to CNF
CFG to CNF
 
Pumping lemma for cfl
Pumping lemma for cflPumping lemma for cfl
Pumping lemma for cfl
 
Regular Grammar
Regular GrammarRegular Grammar
Regular Grammar
 
NFA & DFA
NFA & DFANFA & DFA
NFA & DFA
 
Automata
AutomataAutomata
Automata
 
Theory of automata and formal languages Unit 4
Theory of automata and formal languages Unit 4Theory of automata and formal languages Unit 4
Theory of automata and formal languages Unit 4
 
Push Down Automata (PDA) | TOC (Theory of Computation) | NPDA | DPDA
Push Down Automata (PDA) | TOC  (Theory of Computation) | NPDA | DPDAPush Down Automata (PDA) | TOC  (Theory of Computation) | NPDA | DPDA
Push Down Automata (PDA) | TOC (Theory of Computation) | NPDA | DPDA
 
NFA Converted to DFA , Minimization of DFA , Transition Diagram
NFA Converted to DFA , Minimization of DFA , Transition DiagramNFA Converted to DFA , Minimization of DFA , Transition Diagram
NFA Converted to DFA , Minimization of DFA , Transition Diagram
 

Destacado

Context free langauges
Context free langaugesContext free langauges
Context free langaugessudhir sharma
 
Normal forms cfg
Normal forms   cfgNormal forms   cfg
Normal forms cfgRajendran
 
Context free grammars
Context free grammarsContext free grammars
Context free grammarsShiraz316
 
Context free languages
Context free languagesContext free languages
Context free languagesJahurul Islam
 
Context free grammars
Context free grammarsContext free grammars
Context free grammarsRonak Thakkar
 
Lect 5 2d clipping
Lect 5 2d clippingLect 5 2d clipping
Lect 5 2d clippingmajicyoung
 
CNF & Leftmost Derivation - Theory of Computation
CNF & Leftmost Derivation - Theory of ComputationCNF & Leftmost Derivation - Theory of Computation
CNF & Leftmost Derivation - Theory of ComputationDrishti Bhalla
 
Formal language & automata theory
Formal language & automata theoryFormal language & automata theory
Formal language & automata theoryNYversity
 
Os5 2
Os5 2Os5 2
Os5 2issbp
 
Os6 2
Os6 2Os6 2
Os6 2issbp
 
Lecture 7: Definite Clause Grammars
Lecture 7: Definite Clause GrammarsLecture 7: Definite Clause Grammars
Lecture 7: Definite Clause GrammarsCS, NcState
 
Os4 2
Os4 2Os4 2
Os4 2issbp
 
Ch11 input output systems
Ch11 input output systemsCh11 input output systems
Ch11 input output systemsissbp
 
Class5
 Class5 Class5
Class5issbp
 

Destacado (20)

Context free langauges
Context free langaugesContext free langauges
Context free langauges
 
Normal forms cfg
Normal forms   cfgNormal forms   cfg
Normal forms cfg
 
Context free grammars
Context free grammarsContext free grammars
Context free grammars
 
L3 cfg
L3 cfgL3 cfg
L3 cfg
 
Context free languages
Context free languagesContext free languages
Context free languages
 
Context free grammars
Context free grammarsContext free grammars
Context free grammars
 
Lect 5 2d clipping
Lect 5 2d clippingLect 5 2d clipping
Lect 5 2d clipping
 
CNF & Leftmost Derivation - Theory of Computation
CNF & Leftmost Derivation - Theory of ComputationCNF & Leftmost Derivation - Theory of Computation
CNF & Leftmost Derivation - Theory of Computation
 
06 clipping
06 clipping06 clipping
06 clipping
 
Formal language & automata theory
Formal language & automata theoryFormal language & automata theory
Formal language & automata theory
 
Fafl notes [2010] (sjbit)
Fafl notes [2010] (sjbit)Fafl notes [2010] (sjbit)
Fafl notes [2010] (sjbit)
 
Os6
Os6Os6
Os6
 
Os4
Os4Os4
Os4
 
Os5 2
Os5 2Os5 2
Os5 2
 
Os2
Os2Os2
Os2
 
Os6 2
Os6 2Os6 2
Os6 2
 
Lecture 7: Definite Clause Grammars
Lecture 7: Definite Clause GrammarsLecture 7: Definite Clause Grammars
Lecture 7: Definite Clause Grammars
 
Os4 2
Os4 2Os4 2
Os4 2
 
Ch11 input output systems
Ch11 input output systemsCh11 input output systems
Ch11 input output systems
 
Class5
 Class5 Class5
Class5
 

Similar a Theory of Automata and formal languages unit 2

theoryofautomataandformallanguagesunit21-161231042659.pptx
theoryofautomataandformallanguagesunit21-161231042659.pptxtheoryofautomataandformallanguagesunit21-161231042659.pptx
theoryofautomataandformallanguagesunit21-161231042659.pptxSubhamJha26
 
Complex differentiation contains analytic function.pptx
Complex differentiation contains analytic function.pptxComplex differentiation contains analytic function.pptx
Complex differentiation contains analytic function.pptxjyotidighole2
 
DSP_FOEHU - MATLAB 03 - The z-Transform
DSP_FOEHU - MATLAB 03 - The z-TransformDSP_FOEHU - MATLAB 03 - The z-Transform
DSP_FOEHU - MATLAB 03 - The z-TransformAmr E. Mohamed
 
Chapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdfChapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdfdawod yimer
 
2 random variables notes 2p3
2 random variables notes 2p32 random variables notes 2p3
2 random variables notes 2p3MuhannadSaleh
 
Automata
AutomataAutomata
AutomataGaditek
 
Unit-1 Basic Concept of Algorithm.pptx
Unit-1 Basic Concept of Algorithm.pptxUnit-1 Basic Concept of Algorithm.pptx
Unit-1 Basic Concept of Algorithm.pptxssuser01e301
 
Mid semexam | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
Mid semexam | Theory of Computation | Akash Anand | MTH 401A | IIT KanpurMid semexam | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
Mid semexam | Theory of Computation | Akash Anand | MTH 401A | IIT KanpurVivekananda Samiti
 
ObjectiveQuestionsonEngineeringMathematicsForGATE2022.pdf
ObjectiveQuestionsonEngineeringMathematicsForGATE2022.pdfObjectiveQuestionsonEngineeringMathematicsForGATE2022.pdf
ObjectiveQuestionsonEngineeringMathematicsForGATE2022.pdfMohammedArish6
 

Similar a Theory of Automata and formal languages unit 2 (20)

theoryofautomataandformallanguagesunit21-161231042659.pptx
theoryofautomataandformallanguagesunit21-161231042659.pptxtheoryofautomataandformallanguagesunit21-161231042659.pptx
theoryofautomataandformallanguagesunit21-161231042659.pptx
 
UNIT_-_II.docx
UNIT_-_II.docxUNIT_-_II.docx
UNIT_-_II.docx
 
Complex differentiation contains analytic function.pptx
Complex differentiation contains analytic function.pptxComplex differentiation contains analytic function.pptx
Complex differentiation contains analytic function.pptx
 
Netautomata1
Netautomata1Netautomata1
Netautomata1
 
DSP_FOEHU - MATLAB 03 - The z-Transform
DSP_FOEHU - MATLAB 03 - The z-TransformDSP_FOEHU - MATLAB 03 - The z-Transform
DSP_FOEHU - MATLAB 03 - The z-Transform
 
Daa unit 4
Daa unit 4Daa unit 4
Daa unit 4
 
Chapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdfChapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdf
 
MOD2-DBMS.pdf
MOD2-DBMS.pdfMOD2-DBMS.pdf
MOD2-DBMS.pdf
 
2 random variables notes 2p3
2 random variables notes 2p32 random variables notes 2p3
2 random variables notes 2p3
 
01 FUNCTIONS.pptx
01 FUNCTIONS.pptx01 FUNCTIONS.pptx
01 FUNCTIONS.pptx
 
Automata
AutomataAutomata
Automata
 
unit 2 part b.docx
unit 2 part b.docxunit 2 part b.docx
unit 2 part b.docx
 
maths 12th.pdf
maths 12th.pdfmaths 12th.pdf
maths 12th.pdf
 
Dfa h11
Dfa h11Dfa h11
Dfa h11
 
Unit-1 Basic Concept of Algorithm.pptx
Unit-1 Basic Concept of Algorithm.pptxUnit-1 Basic Concept of Algorithm.pptx
Unit-1 Basic Concept of Algorithm.pptx
 
Ch03
Ch03Ch03
Ch03
 
Mid semexam | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
Mid semexam | Theory of Computation | Akash Anand | MTH 401A | IIT KanpurMid semexam | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
Mid semexam | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
 
ObjectiveQuestionsonEngineeringMathematicsForGATE2022.pdf
ObjectiveQuestionsonEngineeringMathematicsForGATE2022.pdfObjectiveQuestionsonEngineeringMathematicsForGATE2022.pdf
ObjectiveQuestionsonEngineeringMathematicsForGATE2022.pdf
 
D026017036
D026017036D026017036
D026017036
 
201977 1-1-1-pb
201977 1-1-1-pb201977 1-1-1-pb
201977 1-1-1-pb
 

Más de Abhimanyu Mishra (18)

Cd unit i
Cd unit iCd unit i
Cd unit i
 
Presentation1(JIT gnomio)
Presentation1(JIT gnomio)Presentation1(JIT gnomio)
Presentation1(JIT gnomio)
 
Sta unit 5(abimanyu)
Sta unit 5(abimanyu)Sta unit 5(abimanyu)
Sta unit 5(abimanyu)
 
Sta unit 3(abimanyu)
Sta unit 3(abimanyu)Sta unit 3(abimanyu)
Sta unit 3(abimanyu)
 
Sta unit 4(abimanyu)
Sta unit 4(abimanyu)Sta unit 4(abimanyu)
Sta unit 4(abimanyu)
 
Sta unit 3(abimanyu)
Sta unit 3(abimanyu)Sta unit 3(abimanyu)
Sta unit 3(abimanyu)
 
Sta unit 2(abimanyu)
Sta unit 2(abimanyu)Sta unit 2(abimanyu)
Sta unit 2(abimanyu)
 
Unit1
Unit1Unit1
Unit1
 
Daa unit 5
Daa unit 5Daa unit 5
Daa unit 5
 
Daa unit 3
Daa unit 3Daa unit 3
Daa unit 3
 
Daa unit 2
Daa unit 2Daa unit 2
Daa unit 2
 
Daa unit 1
Daa unit 1Daa unit 1
Daa unit 1
 
Software Engineering unit 5
Software Engineering unit 5Software Engineering unit 5
Software Engineering unit 5
 
Software Engineering unit 4
Software Engineering unit 4Software Engineering unit 4
Software Engineering unit 4
 
Software Engineering unit 3
Software Engineering unit 3Software Engineering unit 3
Software Engineering unit 3
 
Software Engineering unit 2
Software Engineering unit 2Software Engineering unit 2
Software Engineering unit 2
 
Software Engineering Unit 1
Software Engineering Unit 1Software Engineering Unit 1
Software Engineering Unit 1
 
Theory of Automata and formal languages Unit 5
Theory of Automata and formal languages Unit 5Theory of Automata and formal languages Unit 5
Theory of Automata and formal languages Unit 5
 

Último

AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsvanyagupta248
 
Learn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic MarksLearn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic MarksMagic Marks
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueBhangaleSonal
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersMairaAshraf6
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network DevicesChandrakantDivate1
 
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxA CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxmaisarahman1
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityMorshed Ahmed Rahath
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARKOUSTAV SARKAR
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Call Girls Mumbai
 
Bridge Jacking Design Sample Calculation.pptx
Bridge Jacking Design Sample Calculation.pptxBridge Jacking Design Sample Calculation.pptx
Bridge Jacking Design Sample Calculation.pptxnuruddin69
 
2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projectssmsksolar
 
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...Health
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Arindam Chakraborty, Ph.D., P.E. (CA, TX)
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaOmar Fathy
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesMayuraD1
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"mphochane1998
 
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...HenryBriggs2
 
Air Compressor reciprocating single stage
Air Compressor reciprocating single stageAir Compressor reciprocating single stage
Air Compressor reciprocating single stageAbc194748
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxSCMS School of Architecture
 

Último (20)

AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech students
 
Learn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic MarksLearn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic Marks
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to Computers
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxA CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna Municipality
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
 
Bridge Jacking Design Sample Calculation.pptx
Bridge Jacking Design Sample Calculation.pptxBridge Jacking Design Sample Calculation.pptx
Bridge Jacking Design Sample Calculation.pptx
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects
 
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
 
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
 
Air Compressor reciprocating single stage
Air Compressor reciprocating single stageAir Compressor reciprocating single stage
Air Compressor reciprocating single stage
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 

Theory of Automata and formal languages unit 2

  • 1. THEORY OF AUTOMATAAND FORMAL LANGUAGES UNIT-2 ABHIMANYU MISHRA ASSISTANT PROF.(CSE) JETGI Abhimanyu Mishra(CSE) JETGI12/31/2016 1
  • 2. A regular expression (sometimes called a rational expression)is, in computer science and formal languages theory, a sequence of characters that define a search pattern. usually this pattern is then used by in string searching algorithm "find" or "find and replace" operations on strings. 2. REGULAR EXPRESSION AND LANGUAGES Abhimanyu Mishra(CSE) JETGI12/31/2016 2
  • 3. 2.1 Definition of Regular Expression: The set of regular expression of defined by the following rules: (i) Every letter of ∑ can be made into regular expression, null string,€ itself is a regular expression. (ii) If r1 and r2 are regular expression, then (a) (r1) (b) r1r2 (c) r1+r2 (d) r1 * (e) r1 + are also regular expression (iii) Nothing else is regular expression. 12/31/2016 Abhimanyu Mishra(CSE) JETGI 3
  • 4. 2.1.1 Building Regular Expression (i) The constants ϵ(null string) and ɸ(empty set) are regular expression, denote the languages {ϵ} and ɸ, respectively. That is, L(ϵ) = {ϵ} , and L(ɸ)= ɸ. (ii) If a is any symbol, then a is regular expression. This expression denotes the language {a}. That is L(a)={a}. (iii) A variable, usually capitalized and such as L is a variable, representing any language. 12/31/2016 Abhimanyu Mishra(CSE) JETGI 4
  • 5. 2.2 Construction of FA for Regular Expression • The Expression is r+s for some smaller expression r and s. The following automation serves, where R is automation for r and S is automation for s. That is, starting at the new start state, We can go to the start state of either the automation for r or the automation for S So L(r) and L(s) ϵ ϵ Start ϵ ϵ 12/31/2016 Abhimanyu Mishra(CSE) JETGI 5 R S
  • 6. 2.The expression rs for some smaller expression r and s. The automation for the concatenation is …………. Start ϵ ϵ ϵ 3. The expression is r* for some smaller expression r. Then we use automation of ………. ϵ Start ϵ ϵ ϵ 12/31/2016 Abhimanyu Mishra(CSE) JETGI 6 R S R
  • 7. Example 1: Find the automation for regular expression a.(a+b)*.b.b Solution: The basic regular expression involved are a and b,we start with automation for a and automation for b. Since brackets are evaluated first.(a+b). ϵ a ϵ Start ϵ ϵ b 12/31/2016 Abhimanyu Mishra(CSE) JETGI 7
  • 8. Step 2: Since closure is required to take next, we construct automation for (a+b)* using automation for (a+b) …….. ϵ a ϵ ϵ Start ϵ ϵ ϵ b ϵ ϵ 12/31/2016 Abhimanyu Mishra(CSE) JETGI 8
  • 9. Step 3: Next we construct the automation for a.(a+b)* as……… ϵ a ϵ ϵ Star a ϵ ϵ ϵ b ϵ ϵ 12/31/2016 Abhimanyu Mishra(CSE) JETGI 9
  • 10. Step 4: Next we construct the automation for a.(a+b)*.b by using automation ϵ ϵ a ϵ Start a ϵ ϵ b ϵ b ϵ ϵ 12/31/2016 Abhimanyu Mishra(CSE) JETGI 10
  • 11. Step 5: Now finally we can construct automation for a.(a+b)*.b.b ϵ ϵ a ϵ Start a ϵ b b ϵ ϵ ϵ b ϵ 12/31/2016 Abhimanyu Mishra(CSE) JETGI 11
  • 12. Arden's Theorem In order to find out a regular expression of a Finite Automaton, we use Arden’s Theorem along with the properties of regular expressions. Statement − • Let P and Q be two regular expressions. • If P does not contain null string (I) R = Q + RP has a unique solution, (ii) R = QP* 12/31/2016 Abhimanyu Mishra(CSE) JETGI 12
  • 13. Proof − R = Q + (Q + RP)P [After putting the value R = Q + RP] = Q + QP + RPP When we put the value of R recursively again and again, we get the following equation − R = Q + QP + QP2 + QP3….. R = Q (ϵ + P + P2 + P3 + …. ) R = QP* [As P* represents (ϵ + P + P2 + P3 + ….) ] proved. 12/31/2016 Abhimanyu Mishra(CSE) JETGI 13
  • 14. Assumptions for Applying Arden’s Theorem − The transition diagram must not have NULL transitions It must have only one initial state: Method Step 1 − Create equations as the following form for all the states of the DFA having n states with initial state q1. q1 = q1R11 + q2R21 + … + qnRn1 + ϵ q2 = q1R12 + q2R22 + … + qnRn2 ……………………………………………………………. ……………………………………………………………. qn = q1R1n + q2R2n + … + qnRnn Rij represents the set of labels of edges from qi to qj, if no such edge exists, then Rij = ɸ Step 2 − Solve these equations to get the equation for the final state in terms of Rij 12/31/2016 Abhimanyu Mishra(CSE) JETGI 14
  • 15. Example 1: Construct a regular expression corresponding to the automata given below − b a b b a a 12/31/2016 Abhimanyu Mishra(CSE) JETGI 15 q2 q1 q3
  • 16. Solution: Here the initial state is q2 and the final state is q1. The equations for the three states q1, q2, q3 q1 = q1a + q3a + ϵ (ϵ move is because q1 is the initial state) q2 = q1b + q2b + q3b q3 = q2a Now, we will solve these three equations − q2 = q1b + q2b + q3b = q1b + q2b + (q2a)b (Substituting value of q3) = q1b + q2(b + ab) = q1b (b + ab)* (Applying Arden’s Theorem) 12/31/2016 Abhimanyu Mishra(CSE) JETGI 16
  • 17. q1 = q1a + q3a + ϵ = q1a + q2aa + ϵ (Substituting value of q3) = q1a + q1b(b + ab*)aa + ϵ (Substituting value of q2) = q1(a + b(b + ab)*aa) + ϵ = ϵ (a+ b(b + ab)*aa)* = (a + b(b + ab)*aa)* Hence, the regular expression is (a + b(b + ab)*aa)*. 12/31/2016 Abhimanyu Mishra(CSE) JETGI 17
  • 18. Solve This Problem? Construct the regular expression 0 0,1 1 1 0 12/31/2016 Abhimanyu Mishra(CSE) JETGI 18 q1 q2 q3
  • 19. Construction of an FA from an RE We can use Thompson's Construction to find out a Finite Automaton from a Regular Expression. We will moderate the regular expression into minimum regular expressions and converting these to NFA and finally to DFA. Case 1 − For a regular expression ‘a’, we can construct the following FA Finite Automata for RE = a Start a 12/31/2016 Abhimanyu Mishra(CSE) JETGI 19 q1 qf
  • 20. Case 2 − For a regular expression ‘ab’, we can construct the following FA − Start a b Case 3 − For a regular expression (a+b), we can construct the following FA − Start a b Case 4 − For a regular expression (a+b)*, we can construct the following FA − a,b Start 12/31/2016 Abhimanyu Mishra(CSE) JETGI 20 qfq1 q2 q1 qf qf
  • 21. Example:-Convert the following RE into its equivalent DFA − 1 (0 + 1)* 0 0,1 start 1 ϵ ϵ 0 12/31/2016 Abhimanyu Mishra(CSE) JETGI 21 q0 q1 q2 q3 qf
  • 22. Pumping Lemma for Regular Languages Theorem Let L be a regular language. Then there exists a constant ‘c’ such that for every string w in L − |w| ≥ c We can break w into three strings, w = xyz, such that − |y| > 0 |xy| ≤ c For all k ≥ 0, the string xykz is also in L. 12/31/2016 Abhimanyu Mishra(CSE) JETGI 22
  • 23. 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 is non-regular, it does not satisfy Pumping Lemma. Method to prove that a language L is not regular At first, we have to assume that L is regular. So, the pumping lemma should hold for L. Use the pumping lemma to obtain a contradiction − 12/31/2016 Abhimanyu Mishra(CSE) JETGI 23
  • 24. Use the pumping lemma to obtain a contradiction − Select w such that |w| ≥ c Select y such that |y| ≥ 1 Select x such that |xy| ≤ c Assign the remaining string to z. Select k such that the resulting string is not in L. Hence L is not regular. 12/31/2016 Abhimanyu Mishra(CSE) JETGI 24
  • 25. Application of the Pumping Lemma (i) Select the language L ,You wish to prove non-regular. (ii) The “adversary” pinks n, the constant mentioned in the pumping lemma, Once the adversary has picked n, he may not change it. (iii) Select a string z in L. Your choice may depend implicitly on the of n chosen. (iv) The adversary breaks z into u, v and w, subject to the constants that |uv|<=n and |v|>=1 (v) You achieve a contradiction to the pumping leema by showing, for any u,v and determined by the adversary that there exit i for which uviw is not in L.it May then concluded and L is not regular. Your selection of pumping leema on n,u,v and w. 12/31/2016 Abhimanyu Mishra(CSE) JETGI 25
  • 26. Example: Prove that language L =(anbn for n= 0,1,2,3……} is not regular Solution: Case 1 If middle part y is made off entirely of a’s,as x aaaaaaa….z If we jump it as xyyz,xyyyz,then number of a”s increases,but in language {(anbn for n= 0,1,2,3,……} a’s and b’s are equal so it os not allowed. Case 2 If middle part y is made off entirely of b’s as x bbbbbbb……z For the same reason, it is also not allowed. Case 3 y part is made of some positive number of a’s and some number of b’s. This would mean that y contain the substring ab x……aaaaaaaabbbbbbbbbbb…………..z Then xyyz would have two copies of the substring ab.But every world in L contains substring ab exactly once. This proves that the pumping lemma cannot apply to L and therefore L is not regular 12/31/2016 Abhimanyu Mishra(CSE) JETGI 26
  • 27. Q1.Prove That L={0n1m2n , n,m>=0} is not regular. Q2. Prove that language L ={0n |n is perfect square} is not regular. Q3. Prove that language L ={0n |n is perfect cube} is not regular. 12/31/2016 Abhimanyu Mishra(CSE) JETGI 27
  • 28. AUTOMATA WITH OUTPUT Here we are using two Machines for finding the Finite Automata Output (i) Moore Machine (ii) Mealy Machine 12/31/2016 Abhimanyu Mishra(CSE) JETGI 28
  • 29. Moore Machine (i) Moore Machine Moore machine is an FSM whose outputs depend on only the present state. A Moore machine can be described by a 6 tuple (Q, ∑, ∆, δ, ƛ’, q0) where − Q is a finite set of states. ∑ is a finite set of symbols called the input alphabet. ∆ is a finite set of symbols called the output alphabet. δ is the input transition function where δ: Q × Σ → Q ƛ’ is the output transition function where ƛ’ : Q × Σ → ∆ q0 is the initial state from where any input is processed (q0 ∈ Q). 12/31/2016 Abhimanyu Mishra(CSE) JETGI 29
  • 30. Representation of Moore Machine:( Transition Table) Present State Next state at input Output a=0 a=1 q0 q3 q1 0 q1 q1 q2 1 q2 q2 q3 0 q3 q3 q0 0 12/31/2016 Abhimanyu Mishra(CSE) JETGI 30
  • 31. Representation of Moore Machine:( Transition Diagram) 0 0 Start 1 1 0 1 0 1 0 0 1 0 12/31/2016 Abhimanyu Mishra(CSE) JETGI 31 q3 q0 q2 q1
  • 32. Mealy Machine A Mealy Machine is an FSM whose output depends on the present state as well as the present input. It can be described by a 6 tuple (Q, ∑, ∆, δ, ƛ’, q0) where − Q is a finite set of states. ∑ is a finite set of symbols called the input alphabet. ∆ is a finite set of symbols called the output alphabet. δ is the input transition function where δ: Q × ∑ → Q ƛ’ is the output transition function where X: Q → ƛ’, q0 is the initial state from where any input is processed (q0 ∈ Q). 12/31/2016 Abhimanyu Mishra(CSE) JETGI 32
  • 33. Representation of Mealy Machine:( Transition Table) Present State For input a=0 for input a=1 State Output State Output q1 q3 0 q2 0 q2 q1 1 q4 0 q3 q2 1 q1 1 q4 q4 1 q3 0 12/31/2016 Abhimanyu Mishra(CSE) JETGI 33
  • 34. Representation of Mealy Machine:( Transition Diagram) Start 0/1 1/0 1/1 0/0 0/1 1/0 0/1 1/0 12/31/2016 Abhimanyu Mishra(CSE) JETGI 34 q1 q3 q4 q2
  • 35. Mealy Machine vs. Moore Machine 12/31/2016 Abhimanyu Mishra(CSE) JETGI 35 Mealy Machine Moore Machine Output depends both upon present state and present input. Output depends only upon the present state. Generally, it has fewer states than Moore Machine. Generally, it has more states than Mealy Machine. Output changes at the clock edges. Input change can cause change in output change as soon as logic is done. Mealy machines react faster to inputs. In Moore machines, more logic is needed to decode the outputs since it has more circuit delays.