Is the set of quadratic-length strings over {0} a regular set? Is it a CFL? Prove both
Subject:Computer SciencePrice:2.87 Bought7
Share With
Is the set of quadratic-length strings over {0} a regular set? Is it a CFL? Prove both.
Purchase A New Answer
Custom new solution created by our subject matter experts
GET A QUOTE
Answer Preview
Answer:
The set of quadratic length strings over {0} is not a CFL, which automatically implies that it is not regular as well.
To prove that it is not a CFL, apply the pumping lemma for CFLs as follows.
Let the pumping length be P≥1
Consider the word W = 0(P^2)
which has quadratic length.
Consider any breakup of the word
W=UVXYZ
with |VXY|≤P
And |VY|≥1
Then this implies that vy = 0i
for some 1≤i≤P as implied by the two constraints
Consider the pumped up word w' = uv2xy2z = 0{p^2 + i}.
Now note that as i≥ 1,
this implies that i > 0,
hence, P2 + i >P2
so, as i ≤p, it implies that P2+ i ≤ P2 +P
Now consider that (P+1)2 = P2 + 2P+ 1.
As P ≥ 1, this implies P < 2P,
therefore P < 2P + 1.
Therefore
P2 + i ≤ P2 + P < P2 + 2p + 1 = (P+1)2
The two observations above give that P2 < P2 + i < (P+1)2
As P2 +i
is between two consecutive squares but not equal to any of them, this implies that it cannot be a perfect square itself.
This implies that
is not a quadratic length string.
Hence, it is not in the given set.
As pumping up produces a word that is not in the set, this implies that the set doesn't satisfy the pumping lemma for CFLs, proving that it is not a CFL.
Note that as each regular set is a CFL as well, this implies that the given set is not regular either.