One-Sided Random Context Grammars

One-Sided Random Context
Grammars
Alexander Meduna, Lukáš Vrábel, and Petr Zemek
Brno University of Technology, Faculty of Information Technology
Božetěchova 1/2, 612 00 Brno, CZ
http://www.fit.vutbr.cz/∼{meduna,ivrabel,izemek}
Supported by the FRVŠ MŠMT FR271/2012/G1 grant, 2012.
Outline
Introduction
Motivation
Definitions and Examples
Results
Open Problems
One-Sided Random Context Grammars
2 / 18
Introduction
One-sided random context grammars
• variant of a random context grammar
• P = PL ∪ PR
• bA → x, U, W c ∈ P
−
.←
..A
One-Sided Random Context Grammars
3 / 18
Introduction
One-sided random context grammars
• variant of a random context grammar
• P = PL ∪ PR
• bA → x, U, W c ∈ PL
.←
.−
.−
.−
.. A ......
One-Sided Random Context Grammars
3 / 18
Introduction
One-sided random context grammars
• variant of a random context grammar
• P = PL ∪ PR
• bA → x, U, W c ∈ PR
. . . . . . A .−.−.−.→
..
One-Sided Random Context Grammars
3 / 18
Introduction
One-sided random context grammars
• variant of a random context grammar
• P = PL ∪ PR
• bA → x, U, W c ∈ PR
. . . . . . A .−.−.−.→
..
Illustration
bA → x, {B, C}, {D}c ∈ PL
bBcECbAcD
One-Sided Random Context Grammars
3 / 18
Introduction
One-sided random context grammars
• variant of a random context grammar
• P = PL ∪ PR
• bA → x, U, W c ∈ PR
...... A −
. .−.−.→
..
Illustration
bA → x, {B, C}, {D}c ∈ PL
←−−−−−−
bBcECb A cD
One-Sided Random Context Grammars
3 / 18
Introduction
One-sided random context grammars
• variant of a random context grammar
• P = PL ∪ PR
• bA → x, U, W c ∈ PR
...... A −
. .−.−.→
..
Illustration
bA → x, {B, C}, {D}c ∈ PL
←−−−−−−
bBcECb A cD ⇒ bBcECb x cD
One-Sided Random Context Grammars
3 / 18
Motivation
• A natural generalization of left forbidding grammars and
left permitting grammars.
• Theoretical viewpoint:
• What is the impact of this restriction on the generative power
of random context grammars?
• The achieved results may be useful in the future when solving
open problems.
• Practical viewpoint: possible applicability in practice.
One-Sided Random Context Grammars
4 / 18
One-Sided Random Context Grammars
Definition
A one-sided random context grammar is a quintuple
G = N, T , PL , PR , S
where
• N is the alphabet of nonterminals;
• T is the alphabet of terminals;
• PL and PR two are finite sets of rules of the form
bA → x, U, W c
where A ∈ N, x ∈ (N ∪ T )∗ , and U, W ⊆ N;
• S is the starting nonterminal.
One-Sided Random Context Grammars
5 / 18
One-Sided Random Context Grammars
Definition
A one-sided random context grammar is a quintuple
G = N, T , PL , PR , S
where
• N is the alphabet of nonterminals;
• T is the alphabet of terminals;
• PL and PR two are finite sets of rules of the form
bA → x, U, W c
where A ∈ N, x ∈ (N ∪ T )∗ , and U, W ⊆ N;
• S is the starting nonterminal.
Definition
If bA → x, U, W c ∈ PL ∪ PR implies that |x| ≥ 1, then G is
propagating.
One-Sided Random Context Grammars
5 / 18
One-Sided Random Context Grammars
Definition
The direct derivation relation, denoted by ⇒, is defined as
uAv ⇒ uxv
if and only if
bA → x, U, W c ∈ PL , U ⊆ alph(u), and W ∩ alph(u) = ∅
or
bA → x, U, W c ∈ PR , U ⊆ alph(v), and W ∩ alph(v) = ∅
One-Sided Random Context Grammars
6 / 18
One-Sided Random Context Grammars
Definition
The direct derivation relation, denoted by ⇒, is defined as
uAv ⇒ uxv
if and only if
bA → x, U, W c ∈ PL , U ⊆ alph(u), and W ∩ alph(u) = ∅
or
bA → x, U, W c ∈ PR , U ⊆ alph(v), and W ∩ alph(v) = ∅
Definition
The language of G, denoted by L(G), is defined as
L(G) = w ∈ T ∗ | S ⇒∗ w
where ⇒∗ is the reflexive-transitive closure of ⇒.
One-Sided Random Context Grammars
6 / 18
Example
Example
Consider the one-sided random context grammar
G = {S, A, B, Ā, B̄}, {a, b, c}, PL , PR , S
where PL contains
bS → AB, ∅, ∅c
bB̄ → B, {A}, ∅c
bB → bB̄c, {Ā}, ∅c
bB → ε, ∅, {A, Ā}c
and PR contains
bA → a Ā, {B}, ∅c
bĀ → A, {B̄}, ∅c
bA → ε, {B}, ∅c
L(G) = a n bn c n | n ≥ 0
One-Sided Random Context Grammars
7 / 18
Denotation of Language Families
• LCF . . . the family of context-free languages
• LCS . . . the family of context-sensitive languages
• LRE . . . the family of recursively enumerable languages
• LRC . . . the family of random context languages
−ε
• LRC
. . . the family of propagating random context
languages
• LORC . . . the family of one-sided random context languages
−ε
• LORC
. . . the family of propagating one-sided random
context languages
One-Sided Random Context Grammars
8 / 18
Generative Power
Random Context Grammars:
Theorem
−ε
LCF ⊂ LRC
⊂ LCS ⊂ LRC = LRE
One-Sided Random Context Grammars
9 / 18
Generative Power
Random Context Grammars:
Theorem
−ε
LCF ⊂ LRC
⊂ LCS ⊂ LRC = LRE
One-Sided Random Context Grammars:
Theorem
−ε
LORC
= LCS and LORC = LRE
One-Sided Random Context Grammars
9 / 18
Generative Power
Random Context Grammars:
Theorem
−ε
LCF ⊂ LRC
⊂ LCS ⊂ LRC = LRE
One-Sided Random Context Grammars:
Theorem
−ε
LORC
= LCS and LORC = LRE
Corollary
−ε
−ε
LRC
⊂ LORC
⊂ LRC = LORC
One-Sided Random Context Grammars
9 / 18
One-Sided Permitting Grammars
Definition
If bA → x, U, W c ∈ PL ∪ PR implies that W = ∅, then G is a
one-sided permitting grammar.
One-Sided Random Context Grammars
10 / 18
One-Sided Permitting Grammars
Definition
If bA → x, U, W c ∈ PL ∪ PR implies that W = ∅, then G is a
one-sided permitting grammar.
• LOPer . . . the family of one-sided permitting languages
−ε
• LOPer
. . . the family of propagating one-sided permitting
languages
One-Sided Random Context Grammars
10 / 18
One-Sided Permitting Grammars
Definition
If bA → x, U, W c ∈ PL ∪ PR implies that W = ∅, then G is a
one-sided permitting grammar.
• LOPer . . . the family of one-sided permitting languages
−ε
• LOPer
. . . the family of propagating one-sided permitting
languages
Theorem
−ε
−ε
LCF ⊂ LOPer
⊆ LSC
⊆ LCS
◦
−ε
• LSC
. . . the family of propagating scattered context
languages
One-Sided Random Context Grammars
10 / 18
One-Sided Forbidding Grammars
Definition
If bA → x, U, W c ∈ PL ∪ PR implies that U = ∅, then G is a
one-sided forbidding grammar.
One-Sided Random Context Grammars
11 / 18
One-Sided Forbidding Grammars
Definition
If bA → x, U, W c ∈ PL ∪ PR implies that U = ∅, then G is a
one-sided forbidding grammar.
• LOFor . . . the family of one-sided forbidding languages
−ε
• LOFor
. . . the family of propagating one-sided forbidding
languages
One-Sided Random Context Grammars
11 / 18
One-Sided Forbidding Grammars
Definition
If bA → x, U, W c ∈ PL ∪ PR implies that U = ∅, then G is a
one-sided forbidding grammar.
• LOFor . . . the family of one-sided forbidding languages
−ε
• LOFor
. . . the family of propagating one-sided forbidding
languages
Theorem
−ε
LOFor
= LS−ε and LOFor = LS
• LS . . . the family of languages generated by selective
substitution grammars
• LS−ε . . . the family of languages generated by propagating
selective substitution grammars
One-Sided Random Context Grammars
11 / 18
Left Random Context Grammars
Definition
If PR = ∅, then G is a left random context grammar.
One-Sided Random Context Grammars
12 / 18
Left Random Context Grammars
Definition
If PR = ∅, then G is a left random context grammar.
• LLRC . . . the family of left random context languages
−ε
• LLRC
. . . the family of propagating left random context
languages
One-Sided Random Context Grammars
12 / 18
Left Random Context Grammars
Definition
If PR = ∅, then G is a left random context grammar.
• LLRC . . . the family of left random context languages
−ε
• LLRC
. . . the family of propagating left random context
languages
Open Problem
What is the generative power of left random context
grammars?
One-Sided Random Context Grammars
12 / 18
Left Forbidding Grammars
Definition
A one-sided forbidding grammar G with PR = ∅ is a left
forbidding grammar.
One-Sided Random Context Grammars
13 / 18
Left Forbidding Grammars
Definition
A one-sided forbidding grammar G with PR = ∅ is a left
forbidding grammar.
• LLFor . . . the family of left forbidding languages
−ε
• LLFor
. . . the family of propagating left forbidding languages
One-Sided Random Context Grammars
13 / 18
Left Forbidding Grammars
Definition
A one-sided forbidding grammar G with PR = ∅ is a left
forbidding grammar.
• LLFor . . . the family of left forbidding languages
−ε
• LLFor
. . . the family of propagating left forbidding languages
Theorem
−ε
LLFor = LLFor
= LCF
◦
One-Sided Random Context Grammars
13 / 18
Left Permitting Grammars
Definition
A one-sided permitting grammar G with PR = ∅ is a left
permitting grammar.
One-Sided Random Context Grammars
14 / 18
Left Permitting Grammars
Definition
A one-sided permitting grammar G with PR = ∅ is a left
permitting grammar.
• LLPer . . . the family of left permitting languages
−ε
• LLPer
. . . the family of propagating left permitting languages
One-Sided Random Context Grammars
14 / 18
Left Permitting Grammars
Definition
A one-sided permitting grammar G with PR = ∅ is a left
permitting grammar.
• LLPer . . . the family of left permitting languages
−ε
• LLPer
. . . the family of propagating left permitting languages
Theorem
−ε
−ε
LCF ⊂ LLPer
⊆ LSC
⊆ LCS
One-Sided Random Context Grammars
14 / 18
Some Other Interesting Properties
Theorem
Every one-sided random context grammar can be turned into
an equivalent one-sided random context grammar satisfying
PL = PR
One-Sided Random Context Grammars
15 / 18
Some Other Interesting Properties
Theorem
Every one-sided random context grammar can be turned into
an equivalent one-sided random context grammar satisfying
PL = PR
Theorem
Every one-sided random context grammar can be turned into
an equivalent one-sided random context grammar satisfying
PL ∩ PR = ∅
One-Sided Random Context Grammars
15 / 18
Some Other Interesting Properties
Theorem
Every one-sided random context grammar can be turned into
an equivalent one-sided random context grammar satisfying
PL = PR
Theorem
Every one-sided random context grammar can be turned into
an equivalent one-sided random context grammar satisfying
PL ∩ PR = ∅
Theorem
Every one-sided random context grammar can be turned into
an equivalent one-sided random context grammar having at
most 10 nonterminals.
One-Sided Random Context Grammars
15 / 18
Further Properties and Modifications
• other descriptional complexity results
• normal forms
• leftmost derivations
• generalized one-sided forbidding grammars
• LL one-sided random context grammars
• one-sided ET0L systems
One-Sided Random Context Grammars
16 / 18
Main Open Problems
• What is the generative power of left random context
grammars?
−ε
−ε
−ε
−ε
• Are the inclusions LOPer
⊆ LSC
and LLPer
⊆ LSC
, in fact,
proper?
• Can one-sided forbidding grammars generate every
recursively enumerable language?
One-Sided Random Context Grammars
17 / 18
Main References
A. Meduna and P. Zemek.
One-sided random context grammars.
Acta Informatica, 48(3):149–163, 2011.
A. Meduna and P. Zemek.
Nonterminal complexity of one-sided random context grammars.
Acta Informatica, 49(2):55–68, 2012.
A. Meduna and P. Zemek.
On one-sided forbidding grammars and selective substitution grammars.
International Journal of Computer Mathematics, 89(5):586–596, 2012.
A. Meduna and P. Zemek.
One-sided random context grammars with leftmost derivations.
LNCS Festschrift Series: Languages Alive, 160–173, 2012.
A. Meduna and P. Zemek.
Generalized one-sided forbidding grammars.
International Journal of Computer Mathematics, to appear.
P. Zemek.
Normal forms of one-sided random context grammars.
In EEICT 2012 Volume 3, pages 430–434. BUT FIT, Brno, CZ, 2012.
A. Meduna, L. Vrábel, and P. Zemek.
LL one-sided random context grammars.
Submitted manuscript.
One-Sided Random Context Grammars
18 / 18
Discussion