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).
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 .
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)
sumber
Jawaban:
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 x≠xRx≠xR 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 L′L′ 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 x∈x∈ 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}∗}
sumber
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}(∗)
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.
From the last statement, we can derive a contradiction by pumping. (See e.g. here for a solution)
sumber
For what it's worth, here is a simple context-free grammar for one anti-palindromic language:
S→0S0∣1S1∣0X1X→ϵ∣X0∣X1
(In fact, this is the anti-palindromic language proposed by @shreesh, using lexicographic comparison for the less-than operator.)
sumber