Trovare esempi di lingue "anti-palindromiche"


15

Lascia Σ={0,1} . Un linguaggio L⊆Σ∗ è detto di avere la proprietà "anti-palindromo" se per ogni stringa w che è un palindromo, w∉L . Inoltre, per ogni stringa u che è non un palindromo sia u∈L o Reverse(u)∈L , ma non entrambi (!) (OR esclusivo).

Comprendo la proprietà anti-palindromo, ma non sono riuscito a trovare alcuna lingua con questa proprietà. Il più vicino che ho trovato è Σ∗∖L , ma non ha la esclusiva o parte ... che è, per esempio, sia 01 e 10 sono in L .

Qualcuno potrebbe darmi un esempio di una lingua che ha questa proprietà? O forse anche più di un singolo esempio, perché non riesco a vedere che tipo di limitazioni questo pone su una lingua. (Deve essere non regolare? Contesto libero? O nemmeno in R ? Ed ecc.)


"Non sono riuscito a trovare alcuna lingua con questa proprietà." - ne hai appena definito uno dando la proprietà, supponendo che ci sia un linguaggio che soddisfi la condizione.
— Raffaello

7
Non sono d'accordo, ciò che ha definito era una classe di lingue. Ciò non costituisce una definizione ben definita per una lingua.
— Shreesh,

Risposte:


12

Un esempio sarà .L={x  |  binary(x)<binary(xR),x∈[0,1]∗}

E ancora un altro esempio .L′={x  |  binary(x)>binary(xR),x∈[0,1]∗}

L'idea è che se fai una regola per sceglierne solo una. Devi scegliere la regola in modo che i palindromi debbano essere respinti ( f ( x ) < f ( x R ) , per i palindromi devi avere f ( x ) = f ( x R ) ). Puoi anche cambiare l'alfabeto, ho preso alfabeto binario solo per ottenere una risposta rapida.x≠xRf(x)<f(xR)f(x)=f(xR)

e L ′ sopra non sono regolari. E ognilinguaggioanti-palindromicosarà non regolare e può essere cattivo come un linguaggio non-RE. Esempio di un linguaggio indecidibile: L = { x | tali che b i n un r y ( x ) < b i n un r y ( x R ) se entrambi x e x R ∉ Halt o entrambi x e x R ∈ Alt, altrimenti seLL′L={x  |  binary(x)<binary(xR)xxR ∉xxR ∈ Halt }x∈}

Klaus Draeger ha spiegato nel commento qui sotto che il linguaggio anti-palindromico dato all'inizio della risposta è privo di contesto: L={x0y1xR | x,y∈{0,1}∗}


Vedo, quindi è vero che ogni lingua anti-palindromo non è regolare. Ma si può dire che deve essere in ? perché anche espandendo questa idea ogni ordine / funzione che useremo può essere calcolato con una TM in R .. ok? RR
— Marik S.

@Marik Ci sono funzioni ben definite ma non contestabili . Ad esempio, mappando da numeri che rappresentano M, w nel problema Halting a [0,1].
— Shreesh,

Sì, ma tali funzioni saranno in grado di definire un ordine totale su ? Σ∗
— Marik S.

1
Sì. Ad esempio se sia x che x R ∉ o ∈ Halt, altrimenti x o x R qualunque sia in Halt } . Halt è tutto ( M , w ) tale che ML={x|x≠xR,binary(x)<binary(xR)xxR∉∈xxR}(M,w)M fermaw

1
E se prendi il linguaggio di diagonalizzazione, allora diventa non-RE.
— Shreesh,

10

About generating a few examples:

L={x | x<xR}(∗)
<.

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

That every L 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 L 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 L is non regular, assume by contradiction it is regular.

  1. Since regularity is preserved by reversal, LR is also regular.
  2. Since regularity is preserved by union, L∪LR, 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)


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 L that has this property if from the form L={x|x<xR} does it indicate that every language is also Context Free? Or if not CFL, then must it be in R? since every order < can be calculated in R with a TM.
— Marik S.

@MarikS. The grammar of rici below proves that L can be context-free. I'm pretty sure that some L 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 x and xR, and each combination gives a distinct L. So the cardinality of such languages is the same of {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:

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.)


8
Which leads to an even more explicit description: L={x0y1xR | x,y∈{0,1}∗}.
— Klaus Draeger
Utilizzando il nostro sito, riconosci di aver letto e compreso le nostre Informativa sui cookie e Informativa sulla privacy.
Licensed under cc by-sa 3.0 with attribution required.