La lingua che coinvolge il numero irrazionale non è un CFL


10

Sto lavorando a un duro esercizio in un libro di testo e non riesco proprio a capire come procedere. Ecco il problema Supponiamo di avere la lingua L = { a i b j : i j γ , i 0 , j 1 }L={aibj:ijγ,i0,j1} dove γγ è un numero irrazionale. Come potrei dimostrare che LL non è un linguaggio privo di contesto?

Nel caso in cui γγ sia razionale, è abbastanza facile costruire una grammatica che accetta la lingua. Ma poiché γγ è irrazionale, non so davvero cosa fare. Non sembra che nessuno dei lemmi di pompaggio funzionerebbe qui. Forse il teorema di Parikh avrebbe funzionato qui, poiché sembrerebbe intuitivamente che questa lingua non abbia un'immagine semilineare di Parikh di accompagnamento.

Questo esercizio è tratto da "Un secondo corso in lingue formali e teoria degli automi" di Jeffrey Shallit, esercizio 25 del capitolo 4.

Gradirei davvero qualsiasi aiuto, o spingendo nella giusta direzione. Grazie!


Hai provato ad applicare il teorema di Parikh?
Yuval Filmus,

Perché non mostrare che non è direttamente semilineare? Usa la definizione
Yuval Filmus,

4
Giusto in tempo per i compiti! Grazie. CS 462/662 Lingue ufficiali e analisi inverno 2019, set di problemi 9, esercizio 3. Due venerdì 22 marzo 2019.
Hendrik Jan

@HendrikJan I'm selfstudying from the textbook "A Second Course in Formal Languages and Automata Theory" by Jeffrey Shallit. It is Exercise 25 of Chapter 4 fyi. Would it be possible to hide this post until the assignment is due?

I appreciate what you were trying to do and your good intentions, but please don't destroy the question by editing it to hide the question (even for a few days). Thank you. P.S. Thank you for crediting the source of the problem!
D.W.

Risposte:


7

According to Parikh's theorem, if LL were context-free then the set M={(a,b):aγb}M={(a,b):aγb} would be semilinear, that is, it would be the union of finitely many sets of the form S=u0+Nu1++NuS=u0+Nu1++Nu, for some ui=(ai,bi)ui=(ai,bi).

Obviously u0Mu0M, and moreover uiMuiM for each i>0i>0, since otherwise u0+NuiMu0+NuiM for large enough NN. Therefore g(S):=max(a0/b0,,a/b)<γg(S):=max(a0/b0,,a/b)<γ (since g(S)g(S) is rational). This means that every (a,b)S(a,b)S satisfies a/bg(S)a/bg(S).

Now suppose that MM is the union of S(1),,S(m)S(1),,S(m), and define g=max(g(S(1)),,g(S(m)))<γg=max(g(S(1)),,g(S(m)))<γ. The foregoing shows that every (a,b)(a,b) in the union satisfies a/bg<γa/bg<γ, and we obtain a contradiction, since sup{a/b:(a,b)M}=γsup{a/b:(a,b)M}=γ.


When γγ is rational, the proof fails, and indeed MM is semilinear: {(a,b):astb}=s1a=0(a,tsa)+N(s,t)+N(0,1).

{(a,b):astb}=a=0s1(a,tsa)+N(s,t)+N(0,1).
Indeed, by construction, any pair (a,b)(a,b) in the right-hand side satisfies astbastb (since s=stts=stt). Conversely, suppose that astbastb. While asas and btbt, subtract (s,t)(s,t) from (a,b)(a,b). Eventually a<sa<s (since b<tb<t implies astb<sastb<s). Since astbastb, necessarily btsabtsa. Hence we can subtract (0,1)(0,1) from (a,b)(a,b) until we reach (a,tsa)(a,tsa).


Nice answer. Just a clarification, the logic behind "every (a,b)S(a,b)S satisfies a/bg(S)a/bg(S)" is that otherwise if there was an (a,b)>g(S)(a,b)>g(S), then we could build an (x,y)S(x,y)S such that x/yx/y is as large as wanted and therefore larger than γγ?

No, this follows directly from the definition of g(S)g(S). Your argument explains why g(S)<γg(S)<γ.
Yuval Filmus

6

Every variable except γ in this answer stands for a positive integer. It is well-known that given an irrational γ>0, there is a sequence of rational numbers a1b1<a2b2<a3b3<<γ such that aibi is nearer to γ than any other rational number smaller than γ whose denominator is less than bi.


It turns out that the pumping lemma does work!

For the sake of contradiction, let p be the pumping length of L as a context-free language. Let s=aapbbp, a word that is L but "barely". Note that |s|>bpp. Consider s=uvwxy, where |vx|>1 and sn=uvnwxnyL for all n0.

Let ta and tb be the number of as and bs in vx respectively.

  • If tb=0 or tatb>γ, for n large enough, the ratio of the number of as to that of bs in sn will be larger than γ, i.e., snL.
  • Otherwise, tatb<γ. Since tb<bp, tatb<apbp. Hence, aptabptb>apbp Since bptb<bp, aptabptb>γ, which says that s0L.

The above contradiction shows that L cannot be context-free.


Here are two related easier exercises.

Exercise 1. Show that Lγ={aiγ:iN} is not context-free where γ is an irrational number.

Exercise 2. Show that Lγ={aibj:ijγ,i0,j0} is context-free where γ is a rational number.


The property in the answer can be proved simply by selecting all rational numbers that is nearer to γ than all previous numbers in the list of all rational numbers that are smaller than γ in the order of increasing denominators and, for the same denominators, in increasing order.
John L.

The usual construction is to take convergents of the continued fraction.
Yuval Filmus

@YuvalFilmus Yes, I agree. On the other hand, that almost-one-line proof is much simpler and accessible. (the "increasing order" in my last message should be "decreasing order".)
John L.
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.