Question: Let L be the language over alphabet { a , b } of strings with an equal number of as and bs ( ie ,
Let L be the language over alphabet a b of strings with an equal number of as and bs ie ab ba aabb, abab, abba, etc
Lis a contextfree language and we can prove it by showing a PDA that accepts L We can use the PDA stack to keep track of how many more of one character we have consumed than the other so if the
PDA has consumed more as than bs there should be as on the stack Write a PDA that accepts L following this strategy. My solution has two states and seven triples.
However, L is not a regular language. In a proof that L is not regular we assume L is regular with pumping length p and then pick a string that would allow an easy contradiction using the pumping lemma.
What string would you choose?
The Pumping Lemma says that your string can be broken into xyz where y is a nonempty substring of the first p characters of your string and that both xz and xyyz are also in L
But
write either xz or xyyz is not in L because:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
