0

I see one note about automaton theory:

Consider the following language:

L={xy : x,y in {a,b}*}

and consider following constraint:

1) x=y

2) x != y

3) x=(y)reverse

4) number of x is not equal to number of y

i read a language with constraint 2,3,4 is context free. any hint or tutorial for 1 to 3 is highly appreciated.

  • You may need to describe what you're asking somewhat better - it's not very clear right now. Also, it seems to me that both constraints (2) and (4) are incompatible with either (1) or (3)... – twalberg Aug 28 '14 at 15:26
  • Dear @twalberg, i edit it. i means a language with constraint (1) is context sensitive. what about (2), (3), (4)? okey ? –  Aug 28 '14 at 15:29

1 Answers1

0

As you say, L1: {xy | x,y ∈ {a,b}* ∧ x=y} is not a context-free language.

However, the very similar L3: {xy | x,y ∈ {a,b}* ∧ x=y-1} is context free, as follows:

S → Ø
S → a S a
S → b S b

Technically speaking, the two other languages in your question are trivial:

L2: {xy | x,y ∈ {a,b}* ∧ x≠y}
L4: {xy | x,y ∈ {a,b}* ∧ |x|≠|y|}

because the only string which does not satisfy the constraint is the empty string. Any non-empty string S can be trivially decomposed into the two non-equal strings Ø and S; it's clear that the concatenation of these two strings is S and that unless S is empty, the two strings are unequal and have different lengths. The language consisting of all non-empty strings is not only context free, but also regular: (a|b)+.

Since that was so easy, I suspect that it is not what you were actually asking, but I cannot guess what you really meant. I suggest you edit the question to be more precise.

rici
  • 234,347
  • 28
  • 237
  • 341
  • Dear rici, at first I'm so glad from your kind detail and learn me some new things, i misunderstand some part of your answer. you means L2 and L4 is CFG and Also Regular? again thanks so much. –  Aug 28 '14 at 21:11
  • @AIismylove: As I said, `L2` and `L4` *as defined precisely in my response* are both the set of all non-empty strings in `{a,b}*`. That set is a regular language. All regular languages are context-free. I don't know whether my `L2` and `L4` are what you intended, so I defined them mathematically in the hopes that it avoids language issues. – rici Aug 29 '14 at 03:06