0

I got a question on how to prove whether a language is context free using pumping lemma. Let's say language L. It contains a finite sequence of positive integers, it rises then falls (informally). Formally, we require that there exists k ∈ {1, 2, . . . , n} such that:

for all i such that 1 ≤ i ≤ k − 1, we have xi ≤ xi+1; and
for all i such that k ≤ i ≤ n − 1, we have xi ≥ xi+1.

which is: x1 ≤ · · · ≤ xk−1 ≤ xk ≥ xk+1 ≥ · · · ≥ xn

This means there is a max value.the max value may be at the very start or the very end, so that increasing sequences and decreasing sequences are just special cases; the sequence can have consecutive equal terms before, at, or after the peak; and the peak may be broad, i.e., there may be more than one equal maximum term in the sequence.

Actually in L, every integer is represented as binary numbers, separated by #. Examples of members:

1#100#110#100#1, 11#101#101#1, 101#101#101, 1#1#10#11#101#1000, 1110#101#10#1, 101010

Examples of strings that are not in L:

1#100#110#100#1#0, 11#1#100, 1#101#1001#10#110, 101#11#101, 0, ε

The question is: is the L context free? Prove or disprove. I think the L is context free, but I don't know how to prove it. Thanks for help.

Chaot1c
  • 67
  • 5
  • What about something ‘similar’ to `11#1#0#1#11`, and let v=1, w=0, x=1? – user2864740 Oct 05 '21 at 06:26
  • You cannot prove that a language is context-free with the pumping lemma. All you can do with the lemma is prove that a language is *not* context-free, and that is not always possible because there are non-context-free languages which can nonetheless be pumped. To prove a language is context-free, write a CF grammar and prove that it generates/recognizes the language – rici Oct 05 '21 at 06:49
  • Fortunately, that language is not context-free (I believe) and you can probably prove that with the PL. It would be easier to work with the language in which the numbers are coded in unary, though. – rici Oct 05 '21 at 06:53
  • @rici Thanks for your reply. Can you give me an example of choice of word in L, because if I need to prove it using the pumping lemma, I need to show that for every u,v,x,y,z there exist "pumped" words not in L. – Chaot1c Oct 05 '21 at 08:32
  • OK, maybe you can't prove it with the pumping lemma. In that case, you should try [Ogden's Lemma](https://cs.stackexchange.com/a/279/4416), which is a generalization. (Or, as the cited answer suggests, the pumping lemma is a special case of Ogden's Lemma). – rici Oct 05 '21 at 18:07

0 Answers0