Philippe Flajolet & Analytic Combinatorics: Inherent...

70
Philippe Flajolet & Analytic Combinatorics: Inherent Ambiguity of Context-Free Languages Fr´ ed´ erique Bassino and Cyril Nicaud LIGM, Universit´ e Paris-Est & CNRS December 16, 2011

Transcript of Philippe Flajolet & Analytic Combinatorics: Inherent...

Page 1: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

Philippe Flajolet & Analytic Combinatorics:Inherent Ambiguity of Context-Free

Languages

Frederique Bassino and Cyril Nicaud

LIGM, Universite Paris-Est & CNRS

December 16, 2011

Page 2: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

I first met Philippe in 1996 (teaching an AofAcourse).

I started my PhD in automata theory and read INRIAresearch reports for a year.

I attended the same course in 1998 !

12πi

∫f (z)zn+1 dz

Page 3: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

I first met Philippe in 1996 (teaching an AofAcourse).

I started my PhD in automata theory and read INRIAresearch reports for a year.

I attended the same course in 1998 !

12πi

∫f (z)zn+1 dz

Page 4: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

I first met Philippe in 1996 (teaching an AofAcourse).

I started my PhD in automata theory and read INRIAresearch reports for a year.

I attended the same course in 1998 !

12πi

∫f (z)zn+1 dz

Page 5: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

I first met Philippe in 1996 (teaching an AofAcourse).

I started my PhD in automata theory and read INRIAresearch reports for a year.

I attended the same course in 1998 !

12πi

∫f (z)zn+1 dz

Page 6: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

Philippe Flajolet & Analytic Combinatorics:Inherent Ambiguity of Context-Free

Languages

Frederique Bassino and Cyril Nicaud

LIGM, Universite Paris-Est & CNRS

December 16, 2011

Page 7: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

I. Context-free languages

Page 8: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

I A word on a (finite) alphabet A = a, b, . . . is a (finite)sequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b.

I The empty word ε is the word with no letter.I A language is a set of words. It can be finite or infinite.

Program for L

u

true false

Interested in languages L such thata machine can decide if u ∈ L :

I Turing machineI Context-free languagesI Regular languagesI . . .

Page 9: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

I A word on a (finite) alphabet A = a, b, . . . is a (finite)sequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b.

I The empty word ε is the word with no letter.

I A language is a set of words. It can be finite or infinite.

Program for L

u

true false

Interested in languages L such thata machine can decide if u ∈ L :

I Turing machineI Context-free languagesI Regular languagesI . . .

Page 10: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

I A word on a (finite) alphabet A = a, b, . . . is a (finite)sequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b.

I The empty word ε is the word with no letter.I A language is a set of words. It can be finite or infinite.

Program for L

u

true false

Interested in languages L such thata machine can decide if u ∈ L :

I Turing machineI Context-free languagesI Regular languagesI . . .

Page 11: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

I A word on a (finite) alphabet A = a, b, . . . is a (finite)sequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b.

I The empty word ε is the word with no letter.I A language is a set of words. It can be finite or infinite.

Program for L

u

true false

Interested in languages L such thata machine can decide if u ∈ L :

I Turing machineI Context-free languagesI Regular languagesI . . .

Page 12: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

I A word on a (finite) alphabet A = a, b, . . . is a (finite)sequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b.

I The empty word ε is the word with no letter.I A language is a set of words. It can be finite or infinite.

Program for L

u

true false

Interested in languages L such thata machine can decide if u ∈ L :

I Turing machineI Context-free languagesI Regular languagesI . . .

Page 13: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

I A context-free grammar is a formal description of a context-freelanguage. It is made of :

I A finite set V = S,X,Y, . . . of variables.I A finite set A = a, b, c, . . . of terminals.I A starting axiom S ∈ V .I Rules of the form X → w, where X ∈ V and w is a sequence of

symbols of V ∪ A.

I The idea is to produce sequences of terminals only, by startingwith S and by repeatedly applying the rules to the variables.

I Notation : X → aX | XY | YbbY instead ofX → aXX → XYX → YbbY

Page 14: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

I A context-free grammar is a formal description of a context-freelanguage. It is made of :

I A finite set V = S,X,Y, . . . of variables.I A finite set A = a, b, c, . . . of terminals.I A starting axiom S ∈ V .I Rules of the form X → w, where X ∈ V and w is a sequence of

symbols of V ∪ A.

I The idea is to produce sequences of terminals only, by startingwith S and by repeatedly applying the rules to the variables.

I Notation : X → aX | XY | YbbY instead ofX → aXX → XYX → YbbY

Page 15: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

I A context-free grammar is a formal description of a context-freelanguage. It is made of :

I A finite set V = S,X,Y, . . . of variables.I A finite set A = a, b, c, . . . of terminals.I A starting axiom S ∈ V .I Rules of the form X → w, where X ∈ V and w is a sequence of

symbols of V ∪ A.

I The idea is to produce sequences of terminals only, by startingwith S and by repeatedly applying the rules to the variables.

I Notation : X → aX | XY | YbbY instead ofX → aXX → XYX → YbbY

Page 16: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

Example 1

I V = SI A = a, bI S→ aSbS | ε

S → aSbS

aSbS → aSbaSb → aaSbSb

aaSbSb → aabSbaabSb → aabaSbSb

aabaSbSb → aababSbaababSb → aababb

I aababb is in the language generated by the grammar.

Page 17: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

Example 1

I V = SI A = a, bI S→ aSbS | ε

S → aSbSaSbS → aSb

aSb → aaSbSbaaSbSb → aabSbaabSb → aabaSbSb

aabaSbSb → aababSbaababSb → aababb

I aababb is in the language generated by the grammar.

Page 18: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

Example 1

I V = SI A = a, bI S→ aSbS | ε

S → aSbSaSbS → aSbaSb → aaSbSb

aaSbSb → aabSbaabSb → aabaSbSb

aabaSbSb → aababSbaababSb → aababb

I aababb is in the language generated by the grammar.

Page 19: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

Example 1

I V = SI A = a, bI S→ aSbS | ε

S → aSbSaSbS → aSbaSb → aaSbSb

aaSbSb → aabSbaabSb → aabaSbSb

aabaSbSb → aababSbaababSb → aababb

I aababb is in the language generated by the grammar.

Page 20: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

Example 1

I V = SI A = a, bI S→ aSbS | ε

S → aSbSaSbS → aSbaSb → aaSbSb

aaSbSb → aabSbaabSb → aabaSbSb

aabaSbSb → aababSbaababSb → aababb

I aababb is in the language generated by the grammar.

Page 21: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

I A context-free language is a language generated by acontext-free grammar.

I Examples of context-free languages with A = a, b, c :

L1 = anbmck | n,m, k ≥ 0L2 = anbncm | n,m ≥ 0

I Example of a language that is not context-free :

L3 = anbncn | n ≥ 0

I The set of context-free languages is closed under union,concatenation and Kleene star.

I It is not closed under complementation and intersection.

Page 22: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

I A context-free language is a language generated by acontext-free grammar.

I Examples of context-free languages with A = a, b, c :

L1 = anbmck | n,m, k ≥ 0L2 = anbncm | n,m ≥ 0

I Example of a language that is not context-free :

L3 = anbncn | n ≥ 0

I The set of context-free languages is closed under union,concatenation and Kleene star.

I It is not closed under complementation and intersection.

Page 23: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

Example 1

I V = SI A = a, bI S→ aSbS | ε

S

a S b S

εa S b S

ε a S b S

ε ε

Page 24: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

Example 1

I V = SI A = a, bI S→ aSbS | ε

S

a S b S

ε

a S b S

ε a S b S

ε ε

Page 25: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

Example 1

I V = SI A = a, bI S→ aSbS | ε

S

a S b S

εa S b S

ε a S b S

ε ε

Page 26: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

Example 1

I V = SI A = a, bI S→ aSbS | ε

S

a S b S

εa S b S

ε

a S b S

ε ε

Page 27: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

Example 1

I V = SI A = a, bI S→ aSbS | ε

S

a S b S

εa S b S

ε a S b S

ε ε

Page 28: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

Example 1

I V = SI A = a, bI S→ aSbS | ε

S

a S b S

εa S b S

ε a S b S

ε ε

I The derivation tree of aababb.I It is the unique derivation tree for aababb.

Page 29: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

Example 2

I V = SI A = aI S→ SS | a

S

S S

S S a

a a

S

S S

SSa

aa

I The word aaa has two derivation trees.I Every binary tree with 2n + 1 nodes produces an+1.

Page 30: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

Example 2

I V = SI A = aI S→ SS | a

S

S S

S S a

a a

S

S S

SSa

aa

I The word aaa has two derivation trees.I Every binary tree with 2n + 1 nodes produces an+1.

Page 31: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

Example 2

I V = SI A = aI S→ SS | a

S

S S

S S a

a a

S

S S

SSa

aa

I The word aaa has two derivation trees.I Every binary tree with 2n + 1 nodes produces an+1.

Page 32: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

Example 2

I V = SI A = aI S→ SS | a

S

S S

S S a

a a

S

S S

SSa

aa

I The word aaa has two derivation trees.I Every binary tree with 2n + 1 nodes produces an+1.

Page 33: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

I A grammar is ambiguous if there exists a word with at least twoderivation trees in its generated language.

I A context-free language L is ambiguous (inherently ambiguous)if every grammar that generates L is ambiguous.

I an | n ≥ 1 is generated by S→ SS | a, which is an ambiguousgrammar . . .

I but an | n ≥ 1 is also generated by the non-ambiguousS→ Sa | a, and is therefore a non-ambiguous language.

I Main focus : sufficient conditions that ensure the ambiguity of acontext-free language.

Page 34: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

I A grammar is ambiguous if there exists a word with at least twoderivation trees in its generated language.

I A context-free language L is ambiguous (inherently ambiguous)if every grammar that generates L is ambiguous.

I an | n ≥ 1 is generated by S→ SS | a, which is an ambiguousgrammar . . .

I but an | n ≥ 1 is also generated by the non-ambiguousS→ Sa | a, and is therefore a non-ambiguous language.

I Main focus : sufficient conditions that ensure the ambiguity of acontext-free language.

Page 35: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

I A grammar is ambiguous if there exists a word with at least twoderivation trees in its generated language.

I A context-free language L is ambiguous (inherently ambiguous)if every grammar that generates L is ambiguous.

I an | n ≥ 1 is generated by S→ SS | a, which is an ambiguousgrammar . . .

I but an | n ≥ 1 is also generated by the non-ambiguousS→ Sa | a, and is therefore a non-ambiguous language.

I Main focus : sufficient conditions that ensure the ambiguity of acontext-free language.

Page 36: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

I Do ambiguous context-free languages exist ?

I Yes !anbmck | n = m or m = k

I The original proof is combinatorial, using classical techniques oflanguage theory (pumping lemmas, . . . )

I Is the problem difficult ?I Yes !I Some languages seem to resist (discrete) combinatorial

approachesI The problem is undecidable : there is no algorithm to check

whether a given context-free language is ambiguous.

Page 37: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

I Do ambiguous context-free languages exist ?I Yes !

anbmck | n = m or m = k

I The original proof is combinatorial, using classical techniques oflanguage theory (pumping lemmas, . . . )

I Is the problem difficult ?I Yes !I Some languages seem to resist (discrete) combinatorial

approachesI The problem is undecidable : there is no algorithm to check

whether a given context-free language is ambiguous.

Page 38: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

I Do ambiguous context-free languages exist ?I Yes !

anbmck | n = m or m = k

I The original proof is combinatorial, using classical techniques oflanguage theory (pumping lemmas, . . . )

I Is the problem difficult ?

I Yes !I Some languages seem to resist (discrete) combinatorial

approachesI The problem is undecidable : there is no algorithm to check

whether a given context-free language is ambiguous.

Page 39: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

I Do ambiguous context-free languages exist ?I Yes !

anbmck | n = m or m = k

I The original proof is combinatorial, using classical techniques oflanguage theory (pumping lemmas, . . . )

I Is the problem difficult ?I Yes !I Some languages seem to resist (discrete) combinatorial

approachesI The problem is undecidable : there is no algorithm to check

whether a given context-free language is ambiguous.

Page 40: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

II. From languages to functions

Page 41: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

I The counting generating function of a language L, is the formalpower series (seen as a function) :

L(z) =∑n≥0

`nzn,

where `n is the number of words of length n in L.I The function is analytic in a neighborhood of the origin : since`n ≤ |A|n, we have

1|A|≤ ρ ≤ 1

I A function is algebraic (over Q) when there exists a polynomialP with coefficients in Q such that P(z,L(z)) = 0. It istranscendental otherwise.

Page 42: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

Theorem (Chomsky-Schutzenberger)

The counting generating function of a non-ambiguous context-freelanguage is algebraic over Q.

Proof :S → XYT → aT | TbT | YcYY → YaY | cY | abTaYYa | XX → a | b | c

s(z) = x(z)y(z)t(z) = zt(z) + zt(z)2 + zy(z)2

y(z) = zy(z)2 + zy(z) + z4t(z)y(z)2 + x(z)x(z) = 3z

Algebraic elimination gives

s(z)8 − 27(z3 − z2) s(z)5 + . . .+ 59049z10 = 0

Page 43: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

Theorem (Chomsky-Schutzenberger)

The counting generating function of a non-ambiguous context-freelanguage is algebraic over Q.

Proof :S → XYT → aT | TbT | YcYY → YaY | cY | abTaYYa | XX → a | b | c

s(z) = x(z)y(z)t(z) = zt(z) + zt(z)2 + zy(z)2

y(z) = zy(z)2 + zy(z) + z4t(z)y(z)2 + x(z)x(z) = 3z

Algebraic elimination gives

s(z)8 − 27(z3 − z2) s(z)5 + . . .+ 59049z10 = 0

Page 44: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

Theorem (Chomsky-Schutzenberger)

The counting generating function of a non-ambiguous context-freelanguage is algebraic over Q.

Proof :S → XYT → aT | TbT | YcYY → YaY | cY | abTaYYa | XX → a | b | c

s(z) = x(z)y(z)t(z) = zt(z) + zt(z)2 + zy(z)2

y(z) = zy(z)2 + zy(z) + z4t(z)y(z)2 + x(z)x(z) = 3z

Algebraic elimination gives

s(z)8 − 27(z3 − z2) s(z)5 + . . .+ 59049z10 = 0

Page 45: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

Theorem (Chomsky-Schutzenberger)

The counting generating function of a non-ambiguous context-freelanguage is algebraic over Q.

Corollary

If the counting generating function is transcendental over Q, then thelanguage is ambiguous.

Page 46: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

Theorem (Chomsky-Schutzenberger)

The counting generating function of a non-ambiguous context-freelanguage is algebraic over Q.

Corollary

If the counting generating function is transcendental over Q, then thelanguage is ambiguous.

Page 47: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

III. Transcendence

Page 48: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

Transcendental numbers

I A number α is algebraic when there exists a polynomial P ofQ[X] such that P(α) = 0.

I√

2 is algebraic, since it is a root of X2 − 2.I A number is transcendental when it is not algebraic.

I e is transcendental [Hermite 1873]I π is transcendental [von Lindemann 1882]I ab is always transcendental for algebraic a /∈ 0, 1 and

irrational algebraic b [Gelfond 1934] [Schneider 1935] (Hilbert’sseventh problem).

I not known : e + π, ee, eπ, γ, . . .

Page 49: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

Transcendental functions

I It is usually easier to establish the transcendence of a function.

I Algebraic functions have some typical properties.

I Philippe gave several criteria to establish transcendence, usingthis properties.

I We shall see two of them in this talk.

Page 50: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

TheoremAn algebraic function L(z) over Q as finitely many singularities,which are algebraic numbers.

Criterion 1A function having infinitely many singularities is transcendental.

Page 51: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

Theorem (Puiseux+Transfert)

If L(z) is an algebraic function over Q then

`n ∼βnns

Γ(s + 1)

m∑i=0

Ciωni ,

where s ∈ Q \ −1,−2, . . ., β > 0 is algebraic, the Ci and ωi arealgebraic, with |ωi| = 1.

Criterion 2If the asymptotic of `n is of the form

`n ∼ αβn ns,

with s /∈ Q \ −1,−2, . . ., then the language is ambiguous.

Page 52: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

IV. Ambiguous languages

Page 53: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

Goldstine language

I Initial motivation for Philippe’s paper.I G = an1ban2b . . . anpb | p ≥ 1, ∃i, ni 6= iI abaabaaab /∈ G but abaabaabb ∈ G

I A∗ \ G = I ∪ J, with

I = ua | u ∈ A∗J = ε ∪ a1ba2b . . . apb | p ≥ 1

I We obtain, using |a1ba2b . . . apb| = n(n+1)2 − 1, that

g(z) =1− z1− 2z

−∑n≥1

zn(n+1)/2−1

Page 54: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

Goldstine language

I Initial motivation for Philippe’s paper.I G = an1ban2b . . . anpb | p ≥ 1, ∃i, ni 6= iI abaabaaab /∈ G but abaabaabb ∈ G

I A∗ \ G = I ∪ J, with

I = ua | u ∈ A∗J = ε ∪ a1ba2b . . . apb | p ≥ 1

I We obtain, using |a1ba2b . . . apb| = n(n+1)2 − 1, that

g(z) =1− z1− 2z

−∑n≥1

zn(n+1)/2−1

Page 55: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

Lacunary functions

I A lacunary function is an analytic function that cannot beanalytically continued anywhere outside its circle ofconvergence.

I f (z) =∑

n≥0 fλnzλn , with fλn 6= 0I Sufficient conditions :

Iλn+1−λn

λn→∞ [Hadamard 1892]

Iλn+1−λn√

λn→∞ [Borel 1896]

I λn+1 − λn →∞ [Fabry 1896]I λn/n→∞ [Faber 1904]

I A lacunary function is transcendental (Criterion 1)

Page 56: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

Goldstine language

I G = an1ban2b . . . anpb | p ≥ 1, ∃i, ni 6= iI We obtained that

g(z) =1− z1− 2z

−∑n≥1

zn(n+1)/2−1

I∑

n≥1 zn(n+1)/2−1 is a lacunary function, hence g(z) istranscendental.

Theorem (Flajolet)

The Goldstine language is ambiguous.

Page 57: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

Another example

I Let Ω3 be the context free language defined by

Ω3 = u ∈ a, b, c∗ | |u|a 6= |u|b or |u|a 6= |u|c

I Its complementary is

I = A∗ \ Ω3 = u ∈ a, b, c∗ | |u|a = |u|b = |u|c

I Its counting generating function O(z) satisfies

O3(z) +∑n≥0

(3n

n, n, n

)z3n =

11− 3z

Page 58: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

Another example

I Let Ω3 be the context free language defined by

Ω3 = u ∈ a, b, c∗ | |u|a 6= |u|b or |u|a 6= |u|c

I Its complementary is

I = A∗ \ Ω3 = u ∈ a, b, c∗ | |u|a = |u|b = |u|c

I Its counting generating function O(z) satisfies

O3(z) +∑n≥0

(3n

n, n, n

)z3n =

11− 3z

Page 59: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

Another example

I Let Ω3 be the context free language defined by

Ω3 = u ∈ a, b, c∗ | |u|a 6= |u|b or |u|a 6= |u|c

I Its complementary is

I = A∗ \ Ω3 = u ∈ a, b, c∗ | |u|a = |u|b = |u|c

I Its counting generating function O(z) satisfies

O3(z) +∑n≥0

(3n

n, n, n

)z3n =

11− 3z

Page 60: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

I But using Stirling formula(3n

n, n, n

)∼√

32π· 27n · n−1

Criterion 2If the asymptotic of `n is of the form

`n ∼ αβn ns,

with s /∈ Q \ −1,−2, . . ., then the language is ambiguous.

TheoremThe language Ω3 is ambiguous.

Page 61: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

Conclusion

I Need the counting generating function in some wayI Need to fulfill a criterion

I Solving computer science problems using analysisI Solving discrete problems using continuous mathematics

I Beautiful ideasI Exciting mathematicsI Simple proofs (relying on complicated earlier results)

I Analytic combinatorics for something else than asymptoticresults.

Page 62: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

Conclusion

I Need the counting generating function in some wayI Need to fulfill a criterion

I Solving computer science problems using analysisI Solving discrete problems using continuous mathematics

I Beautiful ideasI Exciting mathematicsI Simple proofs (relying on complicated earlier results)

I Analytic combinatorics for something else than asymptoticresults.

Page 63: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

Conclusion

I Need the counting generating function in some wayI Need to fulfill a criterion

I Solving computer science problems using analysisI Solving discrete problems using continuous mathematics

I Beautiful ideasI Exciting mathematicsI Simple proofs (relying on complicated earlier results)

I Analytic combinatorics for something else than asymptoticresults.

Page 64: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

Conclusion

I Need the counting generating function in some wayI Need to fulfill a criterion

I Solving computer science problems using analysisI Solving discrete problems using continuous mathematics

I Beautiful ideasI Exciting mathematicsI Simple proofs (relying on complicated earlier results)

I Analytic combinatorics for something else than asymptoticresults.

Page 65: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

I’m trying to get a unambiguousgrammar that generates this contextfree language.

You can’t, it’s inherentlyambiguous !

Why ?

Because π is a transcendentalnumber.

That’s why we are doing research !

Page 66: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

I’m trying to get a unambiguousgrammar that generates this contextfree language.

You can’t, it’s inherentlyambiguous !

Why ?

Because π is a transcendentalnumber.

That’s why we are doing research !

Page 67: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

I’m trying to get a unambiguousgrammar that generates this contextfree language.

You can’t, it’s inherentlyambiguous !

Why ?

Because π is a transcendentalnumber.

That’s why we are doing research !

Page 68: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

I’m trying to get a unambiguousgrammar that generates this contextfree language.

You can’t, it’s inherentlyambiguous !

Why ?

Because π is a transcendentalnumber.

That’s why we are doing research !

Page 69: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

I’m trying to get a unambiguousgrammar that generates this contextfree language.

You can’t, it’s inherentlyambiguous !

Why ?

Because π is a transcendentalnumber.

That’s why we are doing research !

Page 70: Philippe Flajolet & Analytic Combinatorics: Inherent …algo.inria.fr/pfac/PFAC/Program_files/nicaud.pdfsequence of letters : u = aaba, v = bcbaa, w = aaaaab = a5b. I Theempty word

I’m trying to get a unambiguousgrammar that generates this contextfree language.

You can’t, it’s inherentlyambiguous !

Why ?

Because π is a transcendentalnumber.

That’s why we are doing research !