Chapter 11 - 4. Regular Language Topics. Section 11.4 Regular Language Topics. Regular languages are also characterized by special grammars called regular grammars whose productions take the following form, where w is a string of terminals. A → wB or A → w.
Regular Language Topics
A → wB or A → w.
S →٨ | aS | T
T → b | bT.
S → aT
T → b | cT.
A → Bw or A → w.
T →٨ | cT.
T →٨ | Ta.
T → bT | cT | dU
U →٨ | eU.
T → a | Tb | Tc.
1. State names become the nonterminals. So rename them to be uppercase letters.
2. The start state becomes the start symbol of the grammar.
3. For each state transition from I to J labeled with x construct a production I → xJ.
4. For each final state F construct a production F →٨.
S → aI | F
I → aI | bF
This grammar can be simplified to
S → aI | ٨
I → aI | b
The resulting grammar:
S → aS | bI | ٨
I → aF
F → bJ | ٨
J → aF.
S → aS | baF | ٨
F → baF | ٨
S → aF | bE
F → aE | bJ | ٨
J → aF | bE
E → aE | bE.
But E does not derive a terminal string. So the grammar simplifies to
S → aF
F → bJ | ٨
J → aF.
F → baF | ٨.
1. Replace any production with multiple terminals by productions with single terminals.
2. The start state is the grammar start symbol.
3. Transform I → aJ into a transition from I to J labeled with a.
4. Transform I → J into a transition from I to J labeled with ٨.
5. Transform each I → a into a transition from I to new single final state F labeled with a.
6. The final states are F together with each state I with a production I →٨.
S → abS | T | ٨
T → cT | d
S → aI | T | ٨
I → bS
T → cT | d
Now the NFA can
Choose s = ambm. Then s = xyz, where y ≠٨, | xy | ≤ m, and xykz ∈ L for all k ∈ N.
Since | xy | ≤ m and s = ambm = xyz, it follows that xy is a string of a’s.
Since y ≠٨, it must be that y = ai for some i > 0.
We’ll try for a contradiction with k = 2. The pumping property implies xy2z ∈ L.
But xy2z = am + ibm, which is not in L because i > 0.
This contradiction implies that L is not regular. QED.
But xz = am-ibm, which is not in L because i > 0. This contradiction implies that L is notregular. QED.
(k = 3) The pumping property implies xy3z ∈ L. But xy3z = am + 2ibm, which is not in L
because i > 0. This contradiction implies that L is not regular. QED.
Choose s = aabmac2m. Then s = xyz, where y ≠٨, | xy | ≤ m and xykz ∈ L for all k ∈ N.
Since | xy | ≤ m, there are three cases for y:
Case 1: y = aabi for some 0 ≤ i ≤ m-2. (Remember, | xy | ≤ m, so x = ٨ in this case.)
Case 2: y = abi for some 0 ≤ i ≤ m-2. (In this case, we have x = a.)
Case 3: y = bi for some 0 < i ≤ m-2-j. (In this case, x = aabj for some 0 ≤ j ≤ m-3)
We can obtain a contradiction in each case by considering k = 0, which implies xz ∈ L.
Case 1: xz = bm-iac2m which is not in L because strings of L must begin with aa.
Case 2: xz = abm-iac2m which is not in L because strings of L must begin with aa.
Case 3: xz = aabm-iac2mwhich is not in L because strings in L must have twice as many c’s as b’s which can’t be the case since i > 0.
So each of the three cases yields a contradiction. Therefore L is not regular. QED.