SlideShare a Scribd company logo
1 of 40
Download to read offline
FORMAL LANGUAGES & AUTOMATA THEORY
MODULE 2
PRIYA MARIAM RAJU
ASSISTANT PROFESSOR
DEPARTMENT OF INFORMATION TECHNOLOGY
RAJAGIRI SCHOOL OF ENGINEERING & TECHNOLOGY
Converting Regular Expressions to Automata
The basis of the construction of an automaton from a regular expression
(a) R + S
(b) RS
(c) R*
1. Convert the Regular Expression (0+1)*1(0+1)
to an epsilon NFA
2. Convert the Regular expression 01 + 101 to an epsilon NFA
3. Convert the Regular expression (a+b)*a to an epsilon NFA
3. Convert the Regular expression a + ba* to an epsilon NFA
Regular Expressions to NFA
• a + b
• ab
• a*
A B
a, b
A B C
a b
A
a
Convert the regular expression ba*b to NFA
• L = {bb, bab, baab,…}
Convert the regular expression (a+b)c to NFA
Convert the regular expression a(bc)* to NFA
L = {a, abc, abcbc,….}
Convert the regular expression 10 = (0+11)0*1
Conversion of Automata to Regular Expressions – State Elimination Method
• Rule 1: If there are incoming transitions to the initial state, to get rid of incoming edges
make a new start state with no incoming edges and an outgoing edge to the old start
state with Ɛ-transition. The initial state before is now normal state with added incoming
Ɛ-transition.
Conversion of DFA to Regular Expressions – State Elimination Method
• Rule-2 :
If there are outgoing transitions from final state, to get rid of outgoing edges make a
new final state with no outgoing edges and an incoming edge from old final state of Ɛ-
transition. Old final state is transformed into normal state with the added transition of Ɛ.
Conversion of DFA to Regular Expressions – State Elimination Method
• Rule-3 :
If the Automata have multiple final states it is recommended to strip their status of
being final states and add outgoing Ɛ-transition to new and only final state with no
outgoing transitions.
Rule 4: Eliminating intermediate states
1 2 3
a b
1 3
ab
b
1 2
a
1 3
a+b
1
a
2
b 1 2
a*b
1. Convert the given DFA to regular expression by state
elimination method
2. Convert the given DFA to regular expression by state elimination method (DFA with multiple final
states)
3. Convert the given DFA to regular
expression by state elimination method
4. Convert the given DFA to regular
expression by state elimination method
Proving Languages Not to Be Regular
• We have established that the class of languages known as the regular languages has at least four
different descriptions.
• They are the languages accepted by DFAs, by NFAs and by ϵ-NFAs and they are also the languages
defined by regular expressions.
• Not every language is a regular language.
• In this section we shall introduce a powerful technique known as the pumping lemma for showing
certain languages not to be regular.
The Pumping Lemma for Regular Languages
• Pumping Lemma is used to prove that a language is NOT REGULAR.
• It cannot be used to prove that a language is REGULAR.
• THEOREM: If L is a regular language, then L has a pumping length ‘P’ such that any string S where
|S|>=P may be divided into 3 parts S = xyz such that the following conditions must be true:
1) 𝑥𝑦𝑖𝑧 ∈ 𝐿 for every 𝑖 ≥ 0
2) 𝑦 > 0
3) 𝑥𝑦 ≤ 𝑃
• That is, we can always find a nonempty string y not too far from the beginning of S that can be
“pumped”, that is, repeating y any number of times, or deleting it (the case i=0), keeps the resulting
string in the language L.
PROOF:
• Suppose L is regular. Then, L=L(A) for some DFA A.
• Suppose A has n states.
• Now consider any string 𝑤 of length 𝑛 or more, say 𝑤 = 𝑎1𝑎2 … . 𝑎𝑚, where 𝑚 ≥
𝑛, and each 𝑎𝑖 is an input symbol.
• For 𝑖 = 0,1,2, … . , 𝑛, define state 𝑝𝑖 to be መ
𝛿 𝑞0, 𝑎1𝑎2 … 𝑎𝑖 , where 𝛿 is the
transition function of 𝐴 and 𝑞0 is the start state of 𝐴. That is, 𝑝𝑖 is the state 𝐴 is in after
reading the first 𝑖 symbols of 𝑤.
• Note that 𝑝0 = 𝑞0.
• By the pigeonhole principle, it is not possible for the n+1 different 𝑝𝑖’s for 𝑖 =
0,1,2, … . , 𝑛 to be distinct, since there are only 𝑛 different states.
• Thus, we can find two different integers i and j, with 0 ≤ 𝑖 < 𝑗 ≤ 𝑛, such that 𝑝𝑖 = 𝑝𝑗.
• Now, we can break 𝑤 = 𝑥𝑦𝑧 as follows:
1. x = 𝑎1𝑎2 … . 𝑎𝑖
2. 𝑦 = 𝑎𝑖+1𝑎𝑖+2 … 𝑎𝑗
3. 𝑧 = 𝑎𝑗+1𝑎𝑗+2 … 𝑎𝑚
• That is, 𝑥 takes us to 𝑝𝑖 once; 𝑦 takes us from 𝑝𝑖 back to 𝑝𝑖 (since 𝑝𝑖 is also 𝑝𝑗), and 𝑧 is the balance of 𝑤.
• The relationships among the strings and states are suggested by Fig.
Every string longer than the number of states must cause a state to repeat
• Note that 𝑥 may be empty, in the case that 𝑖 = 0. Also, z may be empty if 𝑗 = 𝑛 = 𝑚.
• However, 𝑦 cannot be empty, since 𝑖 is strictly less than 𝑗.
• Now, consider what happens if the automaton 𝐴 receives the input 𝑥𝑦𝑘𝑧, for any
𝑘 ≥ 0.
• If 𝑘 = 0, then the automaton goes from the start state 𝑞0 (which is also 𝑝0) to
𝑝𝑖 on input 𝑥.
• Since 𝑝𝑖 is also 𝑝𝑗, it must be that 𝐴 goes from 𝑝𝑖 to the accepting state shown in
Figure on input 𝑧. Thus, A accepts 𝑥𝑧.
• If 𝑘 > 0, then 𝐴 goes from 𝑞0 to 𝑝𝑖 on input 𝑥 circles from 𝑝𝑖 to 𝑝𝑖 𝑘 times on
input 𝑦𝑘, and then goes to the accepting state on input 𝑧.
• Thus, for any 𝑘 ≥ 0 , 𝑥𝑦𝑘
𝑧 is also accepted by 𝐴; that is, 𝑥𝑦𝑘
𝑧 is in 𝐿.
1. Prove that the language L = {0n1n: n>0} is non-regular using pumping lemma
Proof:
i. Suppose 𝐿 is regular
ii. Let pumping length of 𝐿 be 𝑝
iii. Choose 𝑤 = 0𝑝
1𝑝
iv. Look at every possible decomposition of 𝑤 into 𝑥𝑦𝑧 such that:
a) 𝑥𝑦 ≤ 𝑝
b) 𝑦 ≥ 1
Third condition can be used to get the contradiction
v. Since 𝑥𝑦 ≤ 𝑝, 𝑥𝑦 contains only 0𝑠 and no 1𝑠.
Let 𝑥 = 0∝
, 𝛼 ≥ 0;
𝑦 = 0𝛽
, 𝛽 ≥ 1; 𝛼 + 𝛽 ≤ 𝑝;
𝑧 = 0𝑝−𝛼−𝛽
1𝑝
i. Choose an 𝑖 such that 𝑥𝑦𝑖
𝑧 ∉ 𝐿
𝑥𝑦𝑖
𝑧 = 0𝛼
0𝑖𝛽
0𝑝−𝛼−𝛽
1𝑝
= 0𝑝+𝛽(𝑖−1)
1𝑝
This string belongs to L only if: 𝑝 + 𝛽 𝑖 − 1 = p
i.e., 𝛽 𝑖 − 1 = 0
𝑖 − 1 = 0
𝑖 = 1
Therefore, if 𝑖 ≠ 1, 𝑥𝑦𝑖
𝑧 ∉ 𝐿, and hence, L is not regular.
Example for contradiction:
Let 𝑝 = 2, 𝑖 = 2
𝑤 = 0011
Let 𝑥 = 0, 𝑦 = 0 and then, 𝑧 = 11
𝑥𝑦𝑖
𝑧 =00011 ∉ 𝐿
2. Prove that the language L = {strings having same no. of 0s and 1s} is non-regular using pumping lemma
Proof:
i. Suppose 𝐿 is regular
ii. Let pumping length of 𝐿 be 𝑝
iii. Choose 𝑤 = 0𝑝
1𝑝
iv. Look at every possible decomposition of 𝑤 into 𝑥𝑦𝑧 such that:
a) 𝑥𝑦 ≤ 𝑝
b) 𝑦 ≥ 1
Third condition can be used to get the contradiction
v. Since 𝑥𝑦 ≤ 𝑝, 𝑥𝑦 contains only 0𝑠 and no 1𝑠.
Let 𝑥 = 0∝
, 𝛼 ≥ 0;
𝑦 = 0𝛽
, 𝛽 ≥ 1; 𝛼 + 𝛽 ≤ 𝑝;
𝑧 = 0𝑝−𝛼−𝛽
1𝑝
i. Choose an 𝑖 such that 𝑥𝑦𝑖
𝑧 ∉ 𝐿
𝑥𝑦𝑖
𝑧 = 0𝛼
0𝑖𝛽
0𝑝−𝛼−𝛽
1𝑝
= 0𝑝+𝛽(𝑖−1)
1𝑝
This string belongs to L only if: 𝑝 + 𝛽 𝑖 − 1 = p
i.e., 𝛽 𝑖 − 1 = 0
𝑖 − 1 = 0
𝑖 = 1
Therefore, if 𝑖 ≠ 1, 𝑥𝑦𝑖
𝑧 ∉ 𝐿 and hence, L is not regular
3. Prove that the language L = {strings having more no. of 1s than 0s} is non-regular using pumping lemma
Proof:
i. Suppose 𝐿 is regular
ii. Let pumping length of 𝐿 be 𝑝
iii. Choose 𝑤 = 0𝑝
1𝑝+1
iv. Look at every possible decomposition of 𝑤 into 𝑥𝑦𝑧 such that:
a) 𝑥𝑦 ≤ 𝑝
b) 𝑦 ≥ 1
Third condition can be used to get the contradiction
v. Since 𝑥𝑦 ≤ 𝑝, 𝑥𝑦 contains only 0𝑠 and no 1𝑠.
Let 𝑥 = 0∝
, 𝛼 ≥ 0;
𝑦 = 0𝛽
, 𝛽 ≥ 1; 𝛼 + 𝛽 ≤ 𝑝;
𝑧 = 0𝑝−𝛼−𝛽
1𝑝+1
vi. Choose an 𝑖 such that 𝑥𝑦𝑖
𝑧 ∉ 𝐿
𝑥𝑦𝑖
𝑧 = 0𝛼
0𝑖𝛽
0𝑝−𝛼−𝛽
1𝑝+1
= 0𝑝+𝛽(𝑖−1)
1𝑝+1
This string belongs to L only if: 𝑝 + 𝛽 𝑖 − 1 < p + 1
i.e., 𝛽 𝑖 − 1 < 1
𝑖 − 1 < 1
𝑖 = 0 or 1
Therefore, if 𝑖 ≠ 1 𝑜𝑟 𝑖 ≠ 0, 𝑥𝑦𝑖
𝑧 ∉ 𝐿 and hence L is not regular. (Verify using i=2)
4. Prove that the language L = {𝟎𝟐𝒏
𝟏𝒏
: 𝒏 ≥ 𝟎} is non-regular using pumping lemma
Proof:
i. Suppose 𝐿 is regular
ii. Let pumping length of 𝐿 be 𝑝
iii. Choose 𝑤 = 02𝑝
1𝑝
iv. Look at every possible decomposition of 𝑤 into 𝑥𝑦𝑧 such that:
a) 𝑥𝑦 ≤ 𝑝
b) 𝑦 ≥ 1
Third condition can be used to get the contradiction
v. Since 𝑤 has 2𝑝 zeros and 𝑥𝑦 ≤ 𝑝, 𝑥𝑦 contains only 0𝑠 and no 1𝑠.
Let 𝑥 = 0∝
, 𝛼 ≥ 0;
𝑦 = 0𝛽
, 𝛽 ≥ 1; 𝛼 + 𝛽 ≤ 𝑝;
𝑧 = 02𝑝−𝛼−𝛽
1𝑝
i. Choose an 𝑖 such that 𝑥𝑦𝑖
𝑧 ∉ 𝐿
𝑥𝑦𝑖
𝑧 = 0𝛼
0𝑖𝛽
02𝑝−𝛼−𝛽
1𝑝
= 02𝑝+𝛽(𝑖−1)
1𝑝
This string belongs to L only if: 2𝑝 + 𝛽 𝑖 − 1 = 2𝑝
i.e., 𝛽 𝑖 − 1 = 0
𝑖 − 1 = 0
𝑖 = 1
Therefore, if 𝑖 ≠ 1, 𝑥𝑦𝑖
𝑧 ∉ 𝐿 and hence L is not regular
5. Prove that the language L = {strings having no. of zeros as a perfect square i.e. 𝟎𝒏𝟐
} is non-regular using pumping lemma (No. of zeros =0, 2, 4, 9,…)
Proof:
i. Suppose 𝐿 is regular
ii. Let pumping length of 𝐿 be 𝑝
iii. Choose 𝑤 = 0𝑝2
iv. Look at every possible decomposition of 𝑤 into 𝑥𝑦𝑧 such that:
a) 𝑥𝑦 ≤ 𝑝
b) 𝑦 ≥ 1
Third condition can be used to get the contradiction
v. Let 𝑥 = 0∝
, 𝛼 ≥ 0;
𝑦 = 0𝛽
, 𝛽 ≥ 1; 𝛼 + 𝛽 ≤ 𝑝;
𝑧 = 0𝑝2−𝛼−𝛽
i. Choose an 𝑖 such that 𝑥𝑦𝑖
𝑧 ∉ 𝐿
𝑥𝑦𝑖
𝑧 = 0𝛼
0𝑖𝛽
0𝑝2−𝛼−𝛽
= 0𝑝2+𝛽(𝑖−1)
This string belongs to L only if: 𝑝2
+ 𝛽 𝑖 − 1 is a perfect square
Let 𝑖 = 2, then 𝑝2
+ 𝛽 should be a perfect square.
𝑝2
< 𝑝2
+ 𝛽 𝑠𝑖𝑛𝑐𝑒, 𝛽 ≥ 1 ≤ 𝑝2
+ 𝑝 (𝑠𝑖𝑛𝑐𝑒, 𝛽 ≥ 1; 𝛼 + 𝛽 ≤ 𝑝) < (𝑝 + 1)2
Therefore, 𝑝2
+ 𝛽 is not a perfect square and , 𝑥𝑦𝑖
𝑧 ∉ 𝐿 (Verify using i=2)
5. Prove that the language L = {strings that are not palindrome} is non-regular using pumping lemma (Example: 𝒂𝒃𝒃 ∈ 𝑳, 𝒃𝒂𝒃 ∉ 𝑳 )
Proof:
i. Suppose 𝐿 is regular
ii. Let pumping length of 𝐿 be 𝑝
iii. Choose 𝑤 = 0𝑝
110𝑝+𝑝!
iv. Look at every possible decomposition of 𝑤 into 𝑥𝑦𝑧 such that:
a) 𝑥𝑦 ≤ 𝑝
b) 𝑦 ≥ 1
Third condition can be used to get the contradiction
v. Let 𝑥 = 0∝
, 𝛼 ≥ 0;
𝑦 = 0𝛽
, 𝛽 ≥ 1; 𝛼 + 𝛽 ≤ 𝑝;
𝑧 = 0𝑝−𝛼−𝛽
110𝑝+𝑝!
i. Choose an 𝑖 such that 𝑥𝑦𝑖
𝑧 ∉ 𝐿
𝑥𝑦𝑖
𝑧 = 0𝛼
0𝑖𝛽
0𝑝−𝛼−𝛽
110𝑝+𝑝!
= 0𝑝+𝛽(𝑖−1)
110𝑝+𝑝!
This string belongs to L only if: 𝑝 + 𝛽 𝑖 − 1 ≠ 𝑝 + 𝑝!
𝛽 𝑖 − 1 ≠ 𝑝!
𝑖 ≠
𝑝!
𝛽
+ 1
Since 1 ≤ 𝛽 ≤ 𝑝,
𝑝!
𝛽
𝑖𝑠 𝑎𝑛 𝑖𝑛𝑡𝑒𝑔𝑒𝑟
Therefore, if 𝑖 =
𝑝!
𝛽
+ 1 , 𝑥𝑦𝑖
𝑧 ∉ 𝐿
5. Prove that the language L = {strings with no. of zeros is a factorial} is non-regular using pumping lemma (No. of zeros =0, 1, 2, 6, 24,…)
Proof:
i. Suppose 𝐿 is regular
ii. Let pumping length of 𝐿 be 𝑝
iii. Choose 𝑤 = 0𝑝!
iv. Look at every possible decomposition of 𝑤 into 𝑥𝑦𝑧 such that:
a) 𝑥𝑦 ≤ 𝑝
b) 𝑦 ≥ 1
Third condition can be used to get the contradiction
v. Let 𝑥 = 0∝
, 𝛼 ≥ 0;
𝑦 = 0𝛽
, 𝛽 ≥ 1; 𝛼 + 𝛽 ≤ 𝑝;
𝑧 = 0𝑝!−𝛼−𝛽
i. Choose an 𝑖 such that 𝑥𝑦𝑖
𝑧 ∉ 𝐿
𝑥𝑦𝑖
𝑧 = 0𝛼
0𝑖𝛽
0𝑝!−𝛼−𝛽
= 0𝑝!+𝛽(𝑖−1)
This string belongs to L only if: 𝑝! + 𝛽 𝑖 − 1 is a factorial
Let i=2, 𝑝! + 𝛽 should be a factorial
𝑝! < 𝑝! + 𝛽 𝑠𝑖𝑛𝑐𝑒, 𝛽 ≥ 1 ≤ 𝑝! + 𝑝(𝑠𝑖𝑛𝑐𝑒, 𝛽 ≥ 1; 𝛼 + 𝛽 ≤ 𝑝) < 𝑝 + 1 !
Therefore, 𝑝! + 𝛽 is not a factorial, 𝑎𝑛𝑑 𝑥𝑦𝑖
𝑧 ∉ 𝐿
To prove that a language is not regular using Pumping Lemma, follow the below steps:
• We prove using contradiction.
• Assume that L is regular.
• It has to have a pumping length (say P)
• All strings longer than P can be pumped 𝑆 ≥ 𝑃.
• Now find a string ‘S’ in L such that 𝑆 ≥ 𝑃.
• Divide S into xyz
• Show that 𝑥𝑦𝑖
𝑧 ∉ 𝐿 for some 𝑖.
• S cannot be pumped == CONTRADICTION
Myhill Nerode Theorem
• The Myhill Nerode theorem is a fundamental result coming down to
the theory of languages.
• This theory was proven by John Myhill and Anil Nerode in 1958.
• It is used to prove whether or not a language L is regular and it is also
used for minimization of states in DFA.
• To understand this theorem, first we need to understand
what Indistinguishability(or equivalence) is :
• Given a language L and x,y are strings over ∑*, if for every string z ∈
∑*, xz, yz ∈ L or xz, yz ∉ L then x and y are said to be
indistinguishable over language L.
• Formally, we denote that x and y are indistinguishable over L by the
following notation : x ≡L y.
• ≡L partitions ∑* into disjoint sets called equivalence classes.
•
• Myhill Nerode Theorem :
• A language is regular if and only if ≡L partitions ∑* into finitely many
equivalence classes. If ≡L partitions ∑* into n equivalence classes, then a
minimal DFA recognizing L has exactly n states.
• If there are infinitely many equivalence classes, that means the DFA has
infinite no. of states, which is not realizable. i.e., we cannot define an
automata to accept that language and hence the language is not regular.
• Example : To prove that L = {anbn | n ≥ 0} is not regular.
• We can show that L has infinitely many equivalence classes by showing that
ak and ai are distinguishable by L whenever k ≠ i.
• Thus, for x = ak and y = ai we let z = bk. Then xz = akbk is in the language but
yz = aibk is not.
• Thus, each equivalence class of L can contain at most one string of the form
ai so there must be infinitely many equivalence classes.
• That means L is not regular by the Myhill Nerode theorem.
Myhill-Nerode Theorem
(Minimization of DFA – Table Filling Method)
STEPS:
1. Draw a table for all pairs of states (𝑃, 𝑄).
2. Mark all pairs where 𝑃 ∈ 𝐹 and 𝑄 ∉ 𝐹, where
𝐹 is the set of final states.
3. If there are any unmarked pairs (𝑃, 𝑄) such that
[𝛿 𝑃, 𝑥 , 𝛿 𝑄, 𝑥 ] is marked, then mark
𝑃, 𝑄 where 𝑥 is an input symbol.
4. Repeat this until no more markings can be made.
5. Combine all the unmarked pairs and make them a
single state in the minimized DFA.
A B C D E F
A
B
C
D
E
F
A B C D E F
A
B
C
D
E
F
Step 2. Mark all pairs where 𝑃 ∈ 𝐹 and 𝑄 ∉ 𝐹, where 𝐹 is the set of final states. (In this case {C, D, E} are the final states and {A,B,F} are the
non final states.
Step3: If there are any unmarked pairs (𝑃, 𝑄) such that [𝛿 𝑃, 𝑥 , 𝛿 𝑄, 𝑥 ] is marked, then mark 𝑃, 𝑄 where 𝑥 is an input symbol.
1) (B,A) : 𝛿 𝐴, 0 → 𝐵, 𝛿(𝐴, 1) → 𝐶
𝛿 𝐵, 0 → 𝐴, 𝛿(𝐵, 1) → 𝐷
2) (D,C) : 𝛿 𝐷, 0 → 𝐸, 𝛿(𝐷, 1) → 𝐹
𝛿 𝐶, 0 → 𝐸, 𝛿(𝐶, 1) → 𝐹
3) (E,C) : 𝛿 𝐸, 0 → 𝐸, 𝛿(𝐸, 1) → 𝐹
𝛿 𝐶, 0 → 𝐸, 𝛿 𝐶, 1 → 𝐹
4) (E,D) : 𝛿 𝐸, 0 → 𝐸, 𝛿(𝐸, 1) → 𝐹
𝛿 𝐷, 0 → 𝐸, 𝛿 𝐷, 1 → 𝐹
5) (F,A) : 𝛿 𝐹, 0 → 𝐹, 𝛿(𝐹, 1) → 𝐹
𝛿 𝐴, 0 → 𝐵 𝛿(𝐴, 1) → 𝐶
6) (F,B) : 𝛿 𝐹, 0 → 𝐹, 𝛿 𝐹, 1 → 𝐹
𝛿 𝐵, 0 → 𝐴, 𝛿(𝐴, 1) → 𝐶
• Final unmarked states are: {B,A}, {D,C}, {E,C}, {E,D}
• Final minimized DFA:
Minimize the given DFA using Myhill-Nerode theorem
A B C D E
A
B ✓
C
D
E
A B C D E
A
B ✓
C ✓
D
E
A B C D E
A
B ✓
C ✓
D ✓
E
A B C D E
A
B ✓
C ✓
D ✓
E ✓
A B C D E
A
B ✓
C ✓
D ✓
E ✓ ✓
A B C D E
A
B ✓
C ✓
D ✓
E ✓ ✓ ✓
• If there are any unmarked pairs (𝑃, 𝑄) such that [𝛿 𝑃, 𝑥 , 𝛿 𝑄, 𝑥 ] is marked, then mark 𝑃, 𝑄 where 𝑥 is an input symbol.
1) (C,A) : 𝛿 𝐶, 0 → 𝐵, 𝛿(𝐶, 1) → 𝐶
𝛿 𝐴, 0 → 𝐵, 𝛿(𝐴, 1) → 𝐶
2) (D,A) : 𝛿 𝐷, 0 → 𝐵, 𝛿 𝐷, 1 → 𝐸
𝛿 𝐴, 0 → 𝐵, 𝛿(𝐴, 1) → 𝐶
4) (E,B) : 𝛿 𝐸, 0 → 𝐵, 𝛿(𝐸, 1) → 𝐶
𝛿 𝐵, 0 → 𝐵, 𝛿(𝐵, 1) → 𝐷
5) Final unmarked states are: {A,C}, {B}, {D}, {E} and minimized DFA is given by:
3) (D,C) : 𝛿 𝐷, 0 → 𝐵, 𝛿 𝐷, 1 → 𝐸
𝛿 𝐶, 0 → 𝐵, 𝛿(𝐶, 1) → 𝐶
A B C D E
A
B ✓
C ✓
D ✓
E ✓ ✓ ✓

More Related Content

Similar to 09.LearningMaterial_Sample.pdf

Mean value theorem
Mean value theoremMean value theorem
Mean value theoremUzairAhmad83
 
RegularLanguageProperties.pptx
RegularLanguageProperties.pptxRegularLanguageProperties.pptx
RegularLanguageProperties.pptxEzhumalai p
 
Mod 2_RegularExpressions.pptx
Mod 2_RegularExpressions.pptxMod 2_RegularExpressions.pptx
Mod 2_RegularExpressions.pptxRaviAr5
 
Automata
AutomataAutomata
AutomataGaditek
 
Automata
AutomataAutomata
AutomataGaditek
 
Teorema balzano weierstrass
Teorema balzano weierstrassTeorema balzano weierstrass
Teorema balzano weierstrassfitriasolihah1
 
F_Autómatas_MIT_2010--------------------
F_Autómatas_MIT_2010--------------------F_Autómatas_MIT_2010--------------------
F_Autómatas_MIT_2010--------------------MIGUELANGEL2672
 
Uniform Boundedness of Shift Operators
Uniform Boundedness of Shift OperatorsUniform Boundedness of Shift Operators
Uniform Boundedness of Shift Operatorsiosrjce
 
Infinite Series Presentation by Jatin Dhola
Infinite Series Presentation by Jatin DholaInfinite Series Presentation by Jatin Dhola
Infinite Series Presentation by Jatin DholaJatin Dhola
 
Formal Languages and Automata Theory unit 2
Formal Languages and Automata Theory unit 2Formal Languages and Automata Theory unit 2
Formal Languages and Automata Theory unit 2Srimatre K
 
practice-final-soln.pdf
practice-final-soln.pdfpractice-final-soln.pdf
practice-final-soln.pdfT17Rockstar
 
Infinite series-Calculus and Analytical Geometry
Infinite series-Calculus and Analytical GeometryInfinite series-Calculus and Analytical Geometry
Infinite series-Calculus and Analytical GeometryRabin BK
 
Theory of computation:Finite Automata, Regualr Expression, Pumping Lemma
Theory of computation:Finite Automata, Regualr Expression, Pumping LemmaTheory of computation:Finite Automata, Regualr Expression, Pumping Lemma
Theory of computation:Finite Automata, Regualr Expression, Pumping LemmaPRAVEENTALARI4
 
PPT 2.1.1(The Pumping Lemma for Regular sets, Application of the Pumping Lemm...
PPT 2.1.1(The Pumping Lemma for Regular sets, Application of the Pumping Lemm...PPT 2.1.1(The Pumping Lemma for Regular sets, Application of the Pumping Lemm...
PPT 2.1.1(The Pumping Lemma for Regular sets, Application of the Pumping Lemm...ArjunMehra32
 
JoeAr-LIMITSReports in Math- MAT 2024 403
JoeAr-LIMITSReports in Math- MAT 2024 403JoeAr-LIMITSReports in Math- MAT 2024 403
JoeAr-LIMITSReports in Math- MAT 2024 403JoelynRubio1
 

Similar to 09.LearningMaterial_Sample.pdf (20)

Mean value theorem
Mean value theoremMean value theorem
Mean value theorem
 
RegularLanguageProperties.pptx
RegularLanguageProperties.pptxRegularLanguageProperties.pptx
RegularLanguageProperties.pptx
 
Mod 2_RegularExpressions.pptx
Mod 2_RegularExpressions.pptxMod 2_RegularExpressions.pptx
Mod 2_RegularExpressions.pptx
 
Automata
AutomataAutomata
Automata
 
Automata
AutomataAutomata
Automata
 
Teorema balzano weierstrass
Teorema balzano weierstrassTeorema balzano weierstrass
Teorema balzano weierstrass
 
Flat unit 2
Flat unit 2Flat unit 2
Flat unit 2
 
F_Autómatas_MIT_2010--------------------
F_Autómatas_MIT_2010--------------------F_Autómatas_MIT_2010--------------------
F_Autómatas_MIT_2010--------------------
 
Uniform Boundedness of Shift Operators
Uniform Boundedness of Shift OperatorsUniform Boundedness of Shift Operators
Uniform Boundedness of Shift Operators
 
Infinite Series Presentation by Jatin Dhola
Infinite Series Presentation by Jatin DholaInfinite Series Presentation by Jatin Dhola
Infinite Series Presentation by Jatin Dhola
 
Formal Languages and Automata Theory unit 2
Formal Languages and Automata Theory unit 2Formal Languages and Automata Theory unit 2
Formal Languages and Automata Theory unit 2
 
pumpexamples.pptx
pumpexamples.pptxpumpexamples.pptx
pumpexamples.pptx
 
Lex analysis
Lex analysisLex analysis
Lex analysis
 
practice-final-soln.pdf
practice-final-soln.pdfpractice-final-soln.pdf
practice-final-soln.pdf
 
Infinite series-Calculus and Analytical Geometry
Infinite series-Calculus and Analytical GeometryInfinite series-Calculus and Analytical Geometry
Infinite series-Calculus and Analytical Geometry
 
Theory of computation:Finite Automata, Regualr Expression, Pumping Lemma
Theory of computation:Finite Automata, Regualr Expression, Pumping LemmaTheory of computation:Finite Automata, Regualr Expression, Pumping Lemma
Theory of computation:Finite Automata, Regualr Expression, Pumping Lemma
 
PPT 2.1.1(The Pumping Lemma for Regular sets, Application of the Pumping Lemm...
PPT 2.1.1(The Pumping Lemma for Regular sets, Application of the Pumping Lemm...PPT 2.1.1(The Pumping Lemma for Regular sets, Application of the Pumping Lemm...
PPT 2.1.1(The Pumping Lemma for Regular sets, Application of the Pumping Lemm...
 
FLAT.pdf
FLAT.pdfFLAT.pdf
FLAT.pdf
 
JoeAr-LIMITSReports in Math- MAT 2024 403
JoeAr-LIMITSReports in Math- MAT 2024 403JoeAr-LIMITSReports in Math- MAT 2024 403
JoeAr-LIMITSReports in Math- MAT 2024 403
 
hw4s05solns.ppt
hw4s05solns.ppthw4s05solns.ppt
hw4s05solns.ppt
 

More from ssuser47f7f2

functions (1).pptx
functions (1).pptxfunctions (1).pptx
functions (1).pptxssuser47f7f2
 
Module 2_Conditional Statements.pptx
Module 2_Conditional Statements.pptxModule 2_Conditional Statements.pptx
Module 2_Conditional Statements.pptxssuser47f7f2
 
03-FiniteAutomata.pptx
03-FiniteAutomata.pptx03-FiniteAutomata.pptx
03-FiniteAutomata.pptxssuser47f7f2
 
FiniteAutomata (1).ppt
FiniteAutomata (1).pptFiniteAutomata (1).ppt
FiniteAutomata (1).pptssuser47f7f2
 
Module 1-System Software PROGRAMS.pptx
Module 1-System Software PROGRAMS.pptxModule 1-System Software PROGRAMS.pptx
Module 1-System Software PROGRAMS.pptxssuser47f7f2
 
module1 network security.pdf
module1 network security.pdfmodule1 network security.pdf
module1 network security.pdfssuser47f7f2
 

More from ssuser47f7f2 (10)

rs1.ppt
rs1.pptrs1.ppt
rs1.ppt
 
Lecture7x.ppt
Lecture7x.pptLecture7x.ppt
Lecture7x.ppt
 
NORMAL-FORMS.ppt
NORMAL-FORMS.pptNORMAL-FORMS.ppt
NORMAL-FORMS.ppt
 
functions (1).pptx
functions (1).pptxfunctions (1).pptx
functions (1).pptx
 
Module 2_Conditional Statements.pptx
Module 2_Conditional Statements.pptxModule 2_Conditional Statements.pptx
Module 2_Conditional Statements.pptx
 
03-FiniteAutomata.pptx
03-FiniteAutomata.pptx03-FiniteAutomata.pptx
03-FiniteAutomata.pptx
 
15159222.ppt
15159222.ppt15159222.ppt
15159222.ppt
 
FiniteAutomata (1).ppt
FiniteAutomata (1).pptFiniteAutomata (1).ppt
FiniteAutomata (1).ppt
 
Module 1-System Software PROGRAMS.pptx
Module 1-System Software PROGRAMS.pptxModule 1-System Software PROGRAMS.pptx
Module 1-System Software PROGRAMS.pptx
 
module1 network security.pdf
module1 network security.pdfmodule1 network security.pdf
module1 network security.pdf
 

Recently uploaded

The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...ranjana rawat
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...Call Girls in Nagpur High Profile
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 

Recently uploaded (20)

The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 

09.LearningMaterial_Sample.pdf

  • 1. FORMAL LANGUAGES & AUTOMATA THEORY MODULE 2 PRIYA MARIAM RAJU ASSISTANT PROFESSOR DEPARTMENT OF INFORMATION TECHNOLOGY RAJAGIRI SCHOOL OF ENGINEERING & TECHNOLOGY
  • 2. Converting Regular Expressions to Automata The basis of the construction of an automaton from a regular expression
  • 3. (a) R + S (b) RS (c) R*
  • 4. 1. Convert the Regular Expression (0+1)*1(0+1) to an epsilon NFA
  • 5. 2. Convert the Regular expression 01 + 101 to an epsilon NFA
  • 6. 3. Convert the Regular expression (a+b)*a to an epsilon NFA
  • 7. 3. Convert the Regular expression a + ba* to an epsilon NFA
  • 8. Regular Expressions to NFA • a + b • ab • a* A B a, b A B C a b A a
  • 9. Convert the regular expression ba*b to NFA • L = {bb, bab, baab,…}
  • 10. Convert the regular expression (a+b)c to NFA
  • 11. Convert the regular expression a(bc)* to NFA L = {a, abc, abcbc,….}
  • 12. Convert the regular expression 10 = (0+11)0*1
  • 13. Conversion of Automata to Regular Expressions – State Elimination Method • Rule 1: If there are incoming transitions to the initial state, to get rid of incoming edges make a new start state with no incoming edges and an outgoing edge to the old start state with Ɛ-transition. The initial state before is now normal state with added incoming Ɛ-transition.
  • 14. Conversion of DFA to Regular Expressions – State Elimination Method • Rule-2 : If there are outgoing transitions from final state, to get rid of outgoing edges make a new final state with no outgoing edges and an incoming edge from old final state of Ɛ- transition. Old final state is transformed into normal state with the added transition of Ɛ.
  • 15. Conversion of DFA to Regular Expressions – State Elimination Method • Rule-3 : If the Automata have multiple final states it is recommended to strip their status of being final states and add outgoing Ɛ-transition to new and only final state with no outgoing transitions.
  • 16. Rule 4: Eliminating intermediate states 1 2 3 a b 1 3 ab b 1 2 a 1 3 a+b 1 a 2 b 1 2 a*b
  • 17. 1. Convert the given DFA to regular expression by state elimination method
  • 18. 2. Convert the given DFA to regular expression by state elimination method (DFA with multiple final states)
  • 19. 3. Convert the given DFA to regular expression by state elimination method
  • 20. 4. Convert the given DFA to regular expression by state elimination method
  • 21. Proving Languages Not to Be Regular • We have established that the class of languages known as the regular languages has at least four different descriptions. • They are the languages accepted by DFAs, by NFAs and by ϵ-NFAs and they are also the languages defined by regular expressions. • Not every language is a regular language. • In this section we shall introduce a powerful technique known as the pumping lemma for showing certain languages not to be regular.
  • 22. The Pumping Lemma for Regular Languages • Pumping Lemma is used to prove that a language is NOT REGULAR. • It cannot be used to prove that a language is REGULAR. • THEOREM: If L is a regular language, then L has a pumping length ‘P’ such that any string S where |S|>=P may be divided into 3 parts S = xyz such that the following conditions must be true: 1) 𝑥𝑦𝑖𝑧 ∈ 𝐿 for every 𝑖 ≥ 0 2) 𝑦 > 0 3) 𝑥𝑦 ≤ 𝑃 • That is, we can always find a nonempty string y not too far from the beginning of S that can be “pumped”, that is, repeating y any number of times, or deleting it (the case i=0), keeps the resulting string in the language L.
  • 23. PROOF: • Suppose L is regular. Then, L=L(A) for some DFA A. • Suppose A has n states. • Now consider any string 𝑤 of length 𝑛 or more, say 𝑤 = 𝑎1𝑎2 … . 𝑎𝑚, where 𝑚 ≥ 𝑛, and each 𝑎𝑖 is an input symbol. • For 𝑖 = 0,1,2, … . , 𝑛, define state 𝑝𝑖 to be መ 𝛿 𝑞0, 𝑎1𝑎2 … 𝑎𝑖 , where 𝛿 is the transition function of 𝐴 and 𝑞0 is the start state of 𝐴. That is, 𝑝𝑖 is the state 𝐴 is in after reading the first 𝑖 symbols of 𝑤. • Note that 𝑝0 = 𝑞0. • By the pigeonhole principle, it is not possible for the n+1 different 𝑝𝑖’s for 𝑖 = 0,1,2, … . , 𝑛 to be distinct, since there are only 𝑛 different states. • Thus, we can find two different integers i and j, with 0 ≤ 𝑖 < 𝑗 ≤ 𝑛, such that 𝑝𝑖 = 𝑝𝑗.
  • 24. • Now, we can break 𝑤 = 𝑥𝑦𝑧 as follows: 1. x = 𝑎1𝑎2 … . 𝑎𝑖 2. 𝑦 = 𝑎𝑖+1𝑎𝑖+2 … 𝑎𝑗 3. 𝑧 = 𝑎𝑗+1𝑎𝑗+2 … 𝑎𝑚 • That is, 𝑥 takes us to 𝑝𝑖 once; 𝑦 takes us from 𝑝𝑖 back to 𝑝𝑖 (since 𝑝𝑖 is also 𝑝𝑗), and 𝑧 is the balance of 𝑤. • The relationships among the strings and states are suggested by Fig. Every string longer than the number of states must cause a state to repeat • Note that 𝑥 may be empty, in the case that 𝑖 = 0. Also, z may be empty if 𝑗 = 𝑛 = 𝑚. • However, 𝑦 cannot be empty, since 𝑖 is strictly less than 𝑗.
  • 25. • Now, consider what happens if the automaton 𝐴 receives the input 𝑥𝑦𝑘𝑧, for any 𝑘 ≥ 0. • If 𝑘 = 0, then the automaton goes from the start state 𝑞0 (which is also 𝑝0) to 𝑝𝑖 on input 𝑥. • Since 𝑝𝑖 is also 𝑝𝑗, it must be that 𝐴 goes from 𝑝𝑖 to the accepting state shown in Figure on input 𝑧. Thus, A accepts 𝑥𝑧. • If 𝑘 > 0, then 𝐴 goes from 𝑞0 to 𝑝𝑖 on input 𝑥 circles from 𝑝𝑖 to 𝑝𝑖 𝑘 times on input 𝑦𝑘, and then goes to the accepting state on input 𝑧. • Thus, for any 𝑘 ≥ 0 , 𝑥𝑦𝑘 𝑧 is also accepted by 𝐴; that is, 𝑥𝑦𝑘 𝑧 is in 𝐿.
  • 26. 1. Prove that the language L = {0n1n: n>0} is non-regular using pumping lemma Proof: i. Suppose 𝐿 is regular ii. Let pumping length of 𝐿 be 𝑝 iii. Choose 𝑤 = 0𝑝 1𝑝 iv. Look at every possible decomposition of 𝑤 into 𝑥𝑦𝑧 such that: a) 𝑥𝑦 ≤ 𝑝 b) 𝑦 ≥ 1 Third condition can be used to get the contradiction v. Since 𝑥𝑦 ≤ 𝑝, 𝑥𝑦 contains only 0𝑠 and no 1𝑠. Let 𝑥 = 0∝ , 𝛼 ≥ 0; 𝑦 = 0𝛽 , 𝛽 ≥ 1; 𝛼 + 𝛽 ≤ 𝑝; 𝑧 = 0𝑝−𝛼−𝛽 1𝑝 i. Choose an 𝑖 such that 𝑥𝑦𝑖 𝑧 ∉ 𝐿 𝑥𝑦𝑖 𝑧 = 0𝛼 0𝑖𝛽 0𝑝−𝛼−𝛽 1𝑝 = 0𝑝+𝛽(𝑖−1) 1𝑝 This string belongs to L only if: 𝑝 + 𝛽 𝑖 − 1 = p i.e., 𝛽 𝑖 − 1 = 0 𝑖 − 1 = 0 𝑖 = 1 Therefore, if 𝑖 ≠ 1, 𝑥𝑦𝑖 𝑧 ∉ 𝐿, and hence, L is not regular. Example for contradiction: Let 𝑝 = 2, 𝑖 = 2 𝑤 = 0011 Let 𝑥 = 0, 𝑦 = 0 and then, 𝑧 = 11 𝑥𝑦𝑖 𝑧 =00011 ∉ 𝐿
  • 27. 2. Prove that the language L = {strings having same no. of 0s and 1s} is non-regular using pumping lemma Proof: i. Suppose 𝐿 is regular ii. Let pumping length of 𝐿 be 𝑝 iii. Choose 𝑤 = 0𝑝 1𝑝 iv. Look at every possible decomposition of 𝑤 into 𝑥𝑦𝑧 such that: a) 𝑥𝑦 ≤ 𝑝 b) 𝑦 ≥ 1 Third condition can be used to get the contradiction v. Since 𝑥𝑦 ≤ 𝑝, 𝑥𝑦 contains only 0𝑠 and no 1𝑠. Let 𝑥 = 0∝ , 𝛼 ≥ 0; 𝑦 = 0𝛽 , 𝛽 ≥ 1; 𝛼 + 𝛽 ≤ 𝑝; 𝑧 = 0𝑝−𝛼−𝛽 1𝑝 i. Choose an 𝑖 such that 𝑥𝑦𝑖 𝑧 ∉ 𝐿 𝑥𝑦𝑖 𝑧 = 0𝛼 0𝑖𝛽 0𝑝−𝛼−𝛽 1𝑝 = 0𝑝+𝛽(𝑖−1) 1𝑝 This string belongs to L only if: 𝑝 + 𝛽 𝑖 − 1 = p i.e., 𝛽 𝑖 − 1 = 0 𝑖 − 1 = 0 𝑖 = 1 Therefore, if 𝑖 ≠ 1, 𝑥𝑦𝑖 𝑧 ∉ 𝐿 and hence, L is not regular
  • 28. 3. Prove that the language L = {strings having more no. of 1s than 0s} is non-regular using pumping lemma Proof: i. Suppose 𝐿 is regular ii. Let pumping length of 𝐿 be 𝑝 iii. Choose 𝑤 = 0𝑝 1𝑝+1 iv. Look at every possible decomposition of 𝑤 into 𝑥𝑦𝑧 such that: a) 𝑥𝑦 ≤ 𝑝 b) 𝑦 ≥ 1 Third condition can be used to get the contradiction v. Since 𝑥𝑦 ≤ 𝑝, 𝑥𝑦 contains only 0𝑠 and no 1𝑠. Let 𝑥 = 0∝ , 𝛼 ≥ 0; 𝑦 = 0𝛽 , 𝛽 ≥ 1; 𝛼 + 𝛽 ≤ 𝑝; 𝑧 = 0𝑝−𝛼−𝛽 1𝑝+1 vi. Choose an 𝑖 such that 𝑥𝑦𝑖 𝑧 ∉ 𝐿 𝑥𝑦𝑖 𝑧 = 0𝛼 0𝑖𝛽 0𝑝−𝛼−𝛽 1𝑝+1 = 0𝑝+𝛽(𝑖−1) 1𝑝+1 This string belongs to L only if: 𝑝 + 𝛽 𝑖 − 1 < p + 1 i.e., 𝛽 𝑖 − 1 < 1 𝑖 − 1 < 1 𝑖 = 0 or 1 Therefore, if 𝑖 ≠ 1 𝑜𝑟 𝑖 ≠ 0, 𝑥𝑦𝑖 𝑧 ∉ 𝐿 and hence L is not regular. (Verify using i=2)
  • 29. 4. Prove that the language L = {𝟎𝟐𝒏 𝟏𝒏 : 𝒏 ≥ 𝟎} is non-regular using pumping lemma Proof: i. Suppose 𝐿 is regular ii. Let pumping length of 𝐿 be 𝑝 iii. Choose 𝑤 = 02𝑝 1𝑝 iv. Look at every possible decomposition of 𝑤 into 𝑥𝑦𝑧 such that: a) 𝑥𝑦 ≤ 𝑝 b) 𝑦 ≥ 1 Third condition can be used to get the contradiction v. Since 𝑤 has 2𝑝 zeros and 𝑥𝑦 ≤ 𝑝, 𝑥𝑦 contains only 0𝑠 and no 1𝑠. Let 𝑥 = 0∝ , 𝛼 ≥ 0; 𝑦 = 0𝛽 , 𝛽 ≥ 1; 𝛼 + 𝛽 ≤ 𝑝; 𝑧 = 02𝑝−𝛼−𝛽 1𝑝 i. Choose an 𝑖 such that 𝑥𝑦𝑖 𝑧 ∉ 𝐿 𝑥𝑦𝑖 𝑧 = 0𝛼 0𝑖𝛽 02𝑝−𝛼−𝛽 1𝑝 = 02𝑝+𝛽(𝑖−1) 1𝑝 This string belongs to L only if: 2𝑝 + 𝛽 𝑖 − 1 = 2𝑝 i.e., 𝛽 𝑖 − 1 = 0 𝑖 − 1 = 0 𝑖 = 1 Therefore, if 𝑖 ≠ 1, 𝑥𝑦𝑖 𝑧 ∉ 𝐿 and hence L is not regular
  • 30. 5. Prove that the language L = {strings having no. of zeros as a perfect square i.e. 𝟎𝒏𝟐 } is non-regular using pumping lemma (No. of zeros =0, 2, 4, 9,…) Proof: i. Suppose 𝐿 is regular ii. Let pumping length of 𝐿 be 𝑝 iii. Choose 𝑤 = 0𝑝2 iv. Look at every possible decomposition of 𝑤 into 𝑥𝑦𝑧 such that: a) 𝑥𝑦 ≤ 𝑝 b) 𝑦 ≥ 1 Third condition can be used to get the contradiction v. Let 𝑥 = 0∝ , 𝛼 ≥ 0; 𝑦 = 0𝛽 , 𝛽 ≥ 1; 𝛼 + 𝛽 ≤ 𝑝; 𝑧 = 0𝑝2−𝛼−𝛽 i. Choose an 𝑖 such that 𝑥𝑦𝑖 𝑧 ∉ 𝐿 𝑥𝑦𝑖 𝑧 = 0𝛼 0𝑖𝛽 0𝑝2−𝛼−𝛽 = 0𝑝2+𝛽(𝑖−1) This string belongs to L only if: 𝑝2 + 𝛽 𝑖 − 1 is a perfect square Let 𝑖 = 2, then 𝑝2 + 𝛽 should be a perfect square. 𝑝2 < 𝑝2 + 𝛽 𝑠𝑖𝑛𝑐𝑒, 𝛽 ≥ 1 ≤ 𝑝2 + 𝑝 (𝑠𝑖𝑛𝑐𝑒, 𝛽 ≥ 1; 𝛼 + 𝛽 ≤ 𝑝) < (𝑝 + 1)2 Therefore, 𝑝2 + 𝛽 is not a perfect square and , 𝑥𝑦𝑖 𝑧 ∉ 𝐿 (Verify using i=2)
  • 31. 5. Prove that the language L = {strings that are not palindrome} is non-regular using pumping lemma (Example: 𝒂𝒃𝒃 ∈ 𝑳, 𝒃𝒂𝒃 ∉ 𝑳 ) Proof: i. Suppose 𝐿 is regular ii. Let pumping length of 𝐿 be 𝑝 iii. Choose 𝑤 = 0𝑝 110𝑝+𝑝! iv. Look at every possible decomposition of 𝑤 into 𝑥𝑦𝑧 such that: a) 𝑥𝑦 ≤ 𝑝 b) 𝑦 ≥ 1 Third condition can be used to get the contradiction v. Let 𝑥 = 0∝ , 𝛼 ≥ 0; 𝑦 = 0𝛽 , 𝛽 ≥ 1; 𝛼 + 𝛽 ≤ 𝑝; 𝑧 = 0𝑝−𝛼−𝛽 110𝑝+𝑝! i. Choose an 𝑖 such that 𝑥𝑦𝑖 𝑧 ∉ 𝐿 𝑥𝑦𝑖 𝑧 = 0𝛼 0𝑖𝛽 0𝑝−𝛼−𝛽 110𝑝+𝑝! = 0𝑝+𝛽(𝑖−1) 110𝑝+𝑝! This string belongs to L only if: 𝑝 + 𝛽 𝑖 − 1 ≠ 𝑝 + 𝑝! 𝛽 𝑖 − 1 ≠ 𝑝! 𝑖 ≠ 𝑝! 𝛽 + 1 Since 1 ≤ 𝛽 ≤ 𝑝, 𝑝! 𝛽 𝑖𝑠 𝑎𝑛 𝑖𝑛𝑡𝑒𝑔𝑒𝑟 Therefore, if 𝑖 = 𝑝! 𝛽 + 1 , 𝑥𝑦𝑖 𝑧 ∉ 𝐿
  • 32. 5. Prove that the language L = {strings with no. of zeros is a factorial} is non-regular using pumping lemma (No. of zeros =0, 1, 2, 6, 24,…) Proof: i. Suppose 𝐿 is regular ii. Let pumping length of 𝐿 be 𝑝 iii. Choose 𝑤 = 0𝑝! iv. Look at every possible decomposition of 𝑤 into 𝑥𝑦𝑧 such that: a) 𝑥𝑦 ≤ 𝑝 b) 𝑦 ≥ 1 Third condition can be used to get the contradiction v. Let 𝑥 = 0∝ , 𝛼 ≥ 0; 𝑦 = 0𝛽 , 𝛽 ≥ 1; 𝛼 + 𝛽 ≤ 𝑝; 𝑧 = 0𝑝!−𝛼−𝛽 i. Choose an 𝑖 such that 𝑥𝑦𝑖 𝑧 ∉ 𝐿 𝑥𝑦𝑖 𝑧 = 0𝛼 0𝑖𝛽 0𝑝!−𝛼−𝛽 = 0𝑝!+𝛽(𝑖−1) This string belongs to L only if: 𝑝! + 𝛽 𝑖 − 1 is a factorial Let i=2, 𝑝! + 𝛽 should be a factorial 𝑝! < 𝑝! + 𝛽 𝑠𝑖𝑛𝑐𝑒, 𝛽 ≥ 1 ≤ 𝑝! + 𝑝(𝑠𝑖𝑛𝑐𝑒, 𝛽 ≥ 1; 𝛼 + 𝛽 ≤ 𝑝) < 𝑝 + 1 ! Therefore, 𝑝! + 𝛽 is not a factorial, 𝑎𝑛𝑑 𝑥𝑦𝑖 𝑧 ∉ 𝐿
  • 33. To prove that a language is not regular using Pumping Lemma, follow the below steps: • We prove using contradiction. • Assume that L is regular. • It has to have a pumping length (say P) • All strings longer than P can be pumped 𝑆 ≥ 𝑃. • Now find a string ‘S’ in L such that 𝑆 ≥ 𝑃. • Divide S into xyz • Show that 𝑥𝑦𝑖 𝑧 ∉ 𝐿 for some 𝑖. • S cannot be pumped == CONTRADICTION
  • 34. Myhill Nerode Theorem • The Myhill Nerode theorem is a fundamental result coming down to the theory of languages. • This theory was proven by John Myhill and Anil Nerode in 1958. • It is used to prove whether or not a language L is regular and it is also used for minimization of states in DFA. • To understand this theorem, first we need to understand what Indistinguishability(or equivalence) is : • Given a language L and x,y are strings over ∑*, if for every string z ∈ ∑*, xz, yz ∈ L or xz, yz ∉ L then x and y are said to be indistinguishable over language L. • Formally, we denote that x and y are indistinguishable over L by the following notation : x ≡L y. • ≡L partitions ∑* into disjoint sets called equivalence classes. • • Myhill Nerode Theorem : • A language is regular if and only if ≡L partitions ∑* into finitely many equivalence classes. If ≡L partitions ∑* into n equivalence classes, then a minimal DFA recognizing L has exactly n states. • If there are infinitely many equivalence classes, that means the DFA has infinite no. of states, which is not realizable. i.e., we cannot define an automata to accept that language and hence the language is not regular. • Example : To prove that L = {anbn | n ≥ 0} is not regular. • We can show that L has infinitely many equivalence classes by showing that ak and ai are distinguishable by L whenever k ≠ i. • Thus, for x = ak and y = ai we let z = bk. Then xz = akbk is in the language but yz = aibk is not. • Thus, each equivalence class of L can contain at most one string of the form ai so there must be infinitely many equivalence classes. • That means L is not regular by the Myhill Nerode theorem.
  • 35. Myhill-Nerode Theorem (Minimization of DFA – Table Filling Method) STEPS: 1. Draw a table for all pairs of states (𝑃, 𝑄). 2. Mark all pairs where 𝑃 ∈ 𝐹 and 𝑄 ∉ 𝐹, where 𝐹 is the set of final states. 3. If there are any unmarked pairs (𝑃, 𝑄) such that [𝛿 𝑃, 𝑥 , 𝛿 𝑄, 𝑥 ] is marked, then mark 𝑃, 𝑄 where 𝑥 is an input symbol. 4. Repeat this until no more markings can be made. 5. Combine all the unmarked pairs and make them a single state in the minimized DFA. A B C D E F A B C D E F A B C D E F A B C D E F
  • 36. Step 2. Mark all pairs where 𝑃 ∈ 𝐹 and 𝑄 ∉ 𝐹, where 𝐹 is the set of final states. (In this case {C, D, E} are the final states and {A,B,F} are the non final states.
  • 37. Step3: If there are any unmarked pairs (𝑃, 𝑄) such that [𝛿 𝑃, 𝑥 , 𝛿 𝑄, 𝑥 ] is marked, then mark 𝑃, 𝑄 where 𝑥 is an input symbol. 1) (B,A) : 𝛿 𝐴, 0 → 𝐵, 𝛿(𝐴, 1) → 𝐶 𝛿 𝐵, 0 → 𝐴, 𝛿(𝐵, 1) → 𝐷 2) (D,C) : 𝛿 𝐷, 0 → 𝐸, 𝛿(𝐷, 1) → 𝐹 𝛿 𝐶, 0 → 𝐸, 𝛿(𝐶, 1) → 𝐹 3) (E,C) : 𝛿 𝐸, 0 → 𝐸, 𝛿(𝐸, 1) → 𝐹 𝛿 𝐶, 0 → 𝐸, 𝛿 𝐶, 1 → 𝐹 4) (E,D) : 𝛿 𝐸, 0 → 𝐸, 𝛿(𝐸, 1) → 𝐹 𝛿 𝐷, 0 → 𝐸, 𝛿 𝐷, 1 → 𝐹 5) (F,A) : 𝛿 𝐹, 0 → 𝐹, 𝛿(𝐹, 1) → 𝐹 𝛿 𝐴, 0 → 𝐵 𝛿(𝐴, 1) → 𝐶 6) (F,B) : 𝛿 𝐹, 0 → 𝐹, 𝛿 𝐹, 1 → 𝐹 𝛿 𝐵, 0 → 𝐴, 𝛿(𝐴, 1) → 𝐶
  • 38. • Final unmarked states are: {B,A}, {D,C}, {E,C}, {E,D} • Final minimized DFA:
  • 39. Minimize the given DFA using Myhill-Nerode theorem A B C D E A B ✓ C D E A B C D E A B ✓ C ✓ D E A B C D E A B ✓ C ✓ D ✓ E A B C D E A B ✓ C ✓ D ✓ E ✓ A B C D E A B ✓ C ✓ D ✓ E ✓ ✓ A B C D E A B ✓ C ✓ D ✓ E ✓ ✓ ✓
  • 40. • If there are any unmarked pairs (𝑃, 𝑄) such that [𝛿 𝑃, 𝑥 , 𝛿 𝑄, 𝑥 ] is marked, then mark 𝑃, 𝑄 where 𝑥 is an input symbol. 1) (C,A) : 𝛿 𝐶, 0 → 𝐵, 𝛿(𝐶, 1) → 𝐶 𝛿 𝐴, 0 → 𝐵, 𝛿(𝐴, 1) → 𝐶 2) (D,A) : 𝛿 𝐷, 0 → 𝐵, 𝛿 𝐷, 1 → 𝐸 𝛿 𝐴, 0 → 𝐵, 𝛿(𝐴, 1) → 𝐶 4) (E,B) : 𝛿 𝐸, 0 → 𝐵, 𝛿(𝐸, 1) → 𝐶 𝛿 𝐵, 0 → 𝐵, 𝛿(𝐵, 1) → 𝐷 5) Final unmarked states are: {A,C}, {B}, {D}, {E} and minimized DFA is given by: 3) (D,C) : 𝛿 𝐷, 0 → 𝐵, 𝛿 𝐷, 1 → 𝐸 𝛿 𝐶, 0 → 𝐵, 𝛿(𝐶, 1) → 𝐶 A B C D E A B ✓ C ✓ D ✓ E ✓ ✓ ✓