Menemukan contoh bahasa yang “anti-palindromic”

15

Biarkan Σ = { 0 , 1 } . Sebuah bahasa L Σ * dikatakan memiliki "anti-palindrom" properti jika untuk setiap string yang w yang palindrom, w L . Selain itu, untuk setiap string yang u yang tidak sebuah palindrom baik u L atau R e v e r s e ( u ) L , tapi tidak keduanya (!) (Eksklusif atau).Σ={0,1}LΣwwLuuLReverse(u)L

Saya memahami properti anti-palindrome, tetapi saya tidak dapat menemukan bahasa apa pun yang memiliki properti ini. Paling dekat saya bisa menemukan adalah Σ *L , tetapi tidak memiliki eksklusif atau bagian ... yang, misalnya, baik 01 dan 10 berada di L .ΣL0110L

Adakah yang bisa memberi saya contoh bahasa yang memiliki kelayakan ini? Atau mungkin bahkan lebih dari satu contoh, karena saya gagal melihat batasan apa yang ada pada bahasa ini. (Apakah harus non-reguler? Konteks Gratis? Atau bahkan tidak dalam R ? Dan lain-lain)R

Marik S.
sumber
"Saya tidak dapat menemukan bahasa apa pun yang memiliki properti ini." - Anda baru saja ditetapkan satu dengan memberikan properti, dengan asumsi bahwa ada setiap bahasa yang memenuhi kondisi tersebut.
Raphael
7
Saya tidak setuju, apa yang dia definisikan adalah kelas bahasa. Itu bukan merupakan definisi yang didefinisikan dengan baik untuk suatu bahasa.
Shreesh

Jawaban:

12

Salah satu contohnya adalah L = { x | b i n a r y ( x ) < b i n a r y ( x R ) , x [ 0 , 1 ] * }     .L={x  |  binary(x)<binary(xR),x[0,1]}

Dan contoh lain L = { x | b i n a r y ( x ) > b i n a r y ( x R ) , x [ 0 , 1 ] * }     .L={x  |  binary(x)>binary(xR),x[0,1]}

The idea is, if xxRxxR you make a rule to choose only one of them. You need to choose the rule such that palindromes should be rejected (f(x)<f(xR)f(x)<f(xR), for palindromes you must have f(x)=f(xR)f(x)=f(xR)).You can also change the alphabet, I took binary alphabet just to get a quick answer.

LL and LL above are not regular. And every anti-palindromic language will be non-regular and can be as bad as a non-RE language. Examble of an undecidable language: L={x  |  L={x  |  such that binary(x)<binary(xR)binary(x)<binary(xR) if both xx and xRxR Halt or both xx and xRxR Halt, otherwise if xx Halt}}

Klaus Draeger explained in the comment below that anti-palindromic language given at the beginning of the answer is context-free: L={x0y1xR | x,y{0,1}}L={x0y1xR | x,y{0,1}}

Shreesh
sumber
I see, so it is true that every anti-palindrome language is non-regular. But can it be said that it must be in RR? because even expanding this idea every order/function we will use can be computed with a TM in RR..right?
Marik S.
@Marik There are well-defined but uncomputable functions. For example mapping from numbers representing M,w in Halting problem to [0,1].
Shreesh
Yes, but will such functions be able to define a total order on ΣΣ?
Marik S.
1
Yes. For example L={x|xxR,binary(x)<binary(xR)L={x|xxR,binary(x)<binary(xR) if both xx and xRxR or Halt, otherwise xx or xRxR whichever is in Halt}}. Halt is all (M,w)(M,w)such that MM halts on ww.
Shreesh
1
And if you take diagonalization language then it becomes non-RE.
Shreesh
10

About generating a few examples:

Building on the answer of @shreesh, we can prove that every anti-palindrome language must be of the form L={x | x<xR}()

L={x | x<xR}()
for some strict total ordering <<.

Indeed, given any anti-palindrome LL, we can define an associated << as follows. We start by taking any enumeration x0,x1,x0,x1, of {0,1}{0,1}, where each word occurs exactly once. Then, we alter the enumeration: for each pair of non-palindromes x,xRx,xR, we swap their position so to make the one that belongs to LL to appear before the other. The new enumeration induces a total ordering << satisfying ()().

That every LL defined as ()() is non-palindrome is trivial, so ()() is a complete characterization of non-palindrome languages.

Addressing the original question, we now know that we can obtain several examples of anti-palindrome languages LL by crafting orderings <<. We also know that by doing that we are not restricting ourselves to a subclass of languages, losing generality.


About the question "can these languages be regular?":

To prove that any anti-palindrome LL is non regular, assume by contradiction it is regular.

  1. Since regularity is preserved by reversal, LRLR is also regular.
  2. Since regularity is preserved by union, LLRLLR, which is the set of all the non-palindromes, is also regular.
  3. Since regularity is preserved by complement, the set of all palindromes is regular.

From the last statement, we can derive a contradiction by pumping. (See e.g. here for a solution)

chi
sumber
1
Or more simply, you can observe that in order for a DFA to accept the language of palindromes, it needs to consider the first half of the string while parsing the second half -- but a DFA has a finite number of states and cannot store an arbitrarily long string. It's the same reasoning that shows the language of balanced parentheses is non-regular (paren-depth can be arbitrarily large).
Kevin
I see, but if any LL that has this property if from the form L={x|x<xR}L={x|x<xR} does it indicate that every language is also Context Free? Or if not CFL, then must it be in RR? since every order << can be calculated in RR with a TM.
Marik S.
@MarikS. The grammar of rici below proves that LL can be context-free. I'm pretty sure that some LL is non-recursive, since there are uncountably many such languages -- in my proof above we can make countably infinite choices about which to put first between xx and xRxR, and each combination gives a distinct LL. So the cardinality of such languages is the same of {0,1}N{0,1}N, which is uncountable.
chi
9

For what it's worth, here is a simple context-free grammar for one anti-palindromic language:

S0S01S10X1XϵX0X1

SX0S01S10X1ϵX0X1

(In fact, this is the anti-palindromic language proposed by @shreesh, using lexicographic comparison for the less-than operator.)

rici
sumber
8
Which leads to an even more explicit description: L={x0y1xR | x,y{0,1}}.
Klaus Draeger