Darshan Institute of Engineering and Technology, Rajkot Mid Semester Exam (March, 2022) B.E. Sem.-VI
Darshan Institute of Engineering and Technology, Rajkot Mid Semester Exam (March, 2022) B.E. Sem.-VI
1. x=uvw
2. |uv|<=n
3. |v|>0
4. For any m>=0, uvmw ∈ L
Application: (Explain the application of the Pumping Lemma to show a Language is Regular or Not)
The pumping lemma is extremely useful in proving that certain sets are non-regular. The general
methodology followed during its applications is :
𝑞1
a/1 a/1
a/1,b/1
Start
𝑞0 b/0 𝑞3
b/0
b/1
𝑞2
a/0
Mealy machine
M1
b,a/ ^ ^,z0/z0
q0 q1 q2
^,z0/ z0
3 Kleene’s Theorem Part-1 (7)
Proof:
• On the basis of statement L can be recognized by FA, NFA and NFA-^. It is sufficient to so that every
regular language can be accepted by NFA- ^.
• Set of regular language over alphabet Ʃ contains the basic languages. Ø, {^} and {a} (a ∈ Ʃ) to be closed
under operation of union, concatenation, and Kleene*.
• This allows us to prove using structural induction that every regular language over Ʃ can be accepted
by an NFA-^.
• The basis step of the proof is to show that the three basic languages can be accepted by NFA-^s.
• The induction hypothesis is that L1 and L2 are languages that can be accepted by NFA-^s, and the
induction step is to show that L1 U L2, L1L2, and L1* can also be accepted by NFA-^s.
• NFA-^ for the three basic languages is shown below.
W a W
Ø {^} {a}
FBasic Languages for NFA-^
• Now, suppose that L1 and L2 are recognized by the NFA-^s M1 and M2, respectively, where for both
i=1 and i=2,
Mi=(Qi,ε,qi,Ai,δi)
• By renaming state if necessary, we may assume that Q1 ∩ Q2 = Ø. We will construct NFA-^s Mu, Mc,
and Mk recognizing the language L1 U L2, L1L2, and L1*, respectively.
Construction Of Mu
f1
q1
f1’
^
qu
f2
^ q2
’
f2
Construction Of Mu
• Construction of Mu = (Qu, ε,qu,Au,δu). Let qu be a new state, not in either Q1 or Q2 and let
Qu = Q1 U Q2 U { qu }
Au = A1 U A2
• Now, we define δu so that Mu can move from its initial state to either q1 or q2 by a ^ transition, and
then make exactly the same moves that the respective Mi would. Normally we define:
δu(qu,^) = {q1,q2}
• For either value of i, if x∈ Li, then Mu can process x by moving to qi on a ^-transition and then executing
the moves that cause Mi to accept x, on the other hand, if x is accepted by M u, there is a sequence of
transition corresponding to x, starting at qu and ending at an element of A1 or A2. The first of these
transition must be a ^-transition from qu to either q1 or q2, since there are no other transition from q u.
therefore, since Q1 ∩ Q2 = Ø, either all the transition are between of Q1 or all are between elements
of Q2. It follow that x must be accepted by either M1 or M2.
Construction Of Mc
• Construction of Mc = (Qc, ε, qc, Ac, δc). In this case we do not need any new states, Let Q c = Q1 U Q2,
qc=q1, and Ac = A2. The transition will include all those of M1 and M2 as well as a ε-transition from each
state in A1 to q2.
• In other words, for any q not in A1, and α ∈ ε U {^}, δc(q,a) is defined to be either δ1(q,a) or δ2(q,a),
depending on whether q is in Q1 and Q2, for q ∈ A1.
f1 f2
^
qc=q1 q2
f1’ ^ f2’
Construction Of Mc
• On an input string x1x2, where xi ∈ Li for both value of i, Mc can process x1, arriving at a state A1; jump
from this state to q2 by a ˄-transition; and then process x2 the way M2 would, So that x1x2 is accepted.
Conversely, if x is accepted by Mc, there is a sequence of transition corresponding to x that begins at q1
and ends at an element of A2. One of them must therefore be from an element of Q1 to an element
Q2, and according to the definition of δc, this can only be a ˄- transition from an element of A1 to q2.
Because Q1 ∩ Q2= Ø, all the previous transition are between elements of Q1 and all the subsequent
ones are between elements of Q2. It follows that x=x1˄x2=x1x2, where x1 is accepted by M1 and x2 is
accepted by M2; in other words, x ∈ L1L2.
Construction Of Mk
q1
^ 1
qk
^ f1 f1’
Construction Of Mk
• Construction of Mk = (Qk, Ʃ, qk, Ak,δk). Let qk be a new state not in Q1 and let Qk=Q1U{qk}. Once again all
the transitions of M1 will be allowed in Mk, but in addition there is a ˄-transition from qk to q1 and there
is a ˄-transition from each elements of A1 to qk. More precisely,
• Suppose x∈L1*. if x=˄ then clearly x is accepted by Mk. Otherwise, for some m≥1,x=x1x2….xm, where
xi ∈ L1 for each i, Mk can move from qk to q1 by a ˄-transition; for each i, Mk moves from q1 to an
element fi of A1 by a sequence of transition corresponding to x i; and for each i, Mk then moves from fi
back to qk by a ˄-transition.
• It follows that (˄x1˄) (˄x2˄)…… (˄xm˄)=x is accepted by Mk. On the other hand, if x is accepted by Mk,
there is a sequence of transition corresponding to x that begins and ends at q k. Since the only transition
from qk is a ˄-transition to q1, and the only transition to qk are ˄-transition from elements of A1, x can
be decomposed in the form
• Where, for each i, there is a sequence of transition corresponding to x i from q1 to an element of A1.
Therefore, x∈ L1*.
• Since we have constructed an NFA-˄ recognizing L in each of the three cases, the proof is complete.
^ b
1 4 5
b b
a
2 3
a
δ*(1,^) = {1,4}
δ*(1,a) =^( U δ(r,a))
r∈δ*( 1,^)
=^( U δ(r,a))
r∈δ(1,4)
= ^(δ(1,a)U δ(4,a))
= ^{Φ}
=Φ
δ*(2,^) = {2}
δ*(2,a) =^( U δ(r,a))
r∈δ*( 2,^)
=^( U δ(r,a))
r∈δ (2)
= ^(δ(2,a))
= ^{ 3}
= { 3}
δ*(2,b) =^( U δ(r,b))
r∈δ*( 2,^)
= ^( U δ(r,b))
r∈(2)
= ^(δ(2,b))
=Φ
δ*(3,^) = {3}
δ*(3,a) =Ø
δ*(3,b) =Ø
δ*(4,^) = {4}
δ*(4,a) =^( U δ(r,a))
r∈δ*( 4,^)
=^( U δ(r,a))
r∈(4)
= ^(δ(4,a))
=Ø
δ*(4,b) =^( U δ(r,b))
r∈δ*( 4,^)
=^( U δ(r,b))
r∈(4)
= ^(δ(4,b))
= ^{5}
= {5}
δ*(5,^) ={5}
δ*(5,a) =^( U δ(r,a))
r∈δ*( 5,^)
=^( U δ(r,a))
r∈(5)
= ^(δ(5,a))
=^{5}
=5
δ*(5,b) =^( U δ(r,b))
r∈δ*( 5,^)
=^( U δ(r,b))
r∈(5)
= ^(δ(5,b))
= ^{Φ}
=Φ a
b a
1 2 b 5 b 4
3
b
b b
b a
b
Construction of DFA
δ(1,a)=Φ
δ(1,b)={2,3,5}
δ((2,3,5),a)={3,4}
δ((2,3,5),b)=Φ
δ((3,4),a)=Φ
δ((3,4),b)={5}
δ(5,a)={4}
δ(5,b)=Φ
δ(4,b)={5}
δ(4,a)=Φ
DFA
-------------X----------X------------