refining the nonterminal complexity of graph-controlled grammars

36
Refining the Nonterminal Complexity of Graph-controlled Grammars Faculty of Informatics TU Wien, Wien, Austria Rudolf FREUND Wilhelm-Schickard-Institut für Informatik, Univ. Tübingen, Tübingen, Germany Henning FERNAU Klaus REINHARDT Marion OSWALD

Upload: arien

Post on 13-Jan-2016

39 views

Category:

Documents


0 download

DESCRIPTION

Refining the Nonterminal Complexity of Graph-controlled Grammars. Henning FERNAU. Rudolf FREUND. Klaus REINHARDT. Marion OSWALD. Wilhelm-Schickard-Institut für Informatik, Univ. Tübingen, Tübingen, Germany. Faculty of Informatics TU Wien, Wien, Austria. Overview. - the problem. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Refining the  Nonterminal Complexity  of Graph-controlled Grammars

Refining the Nonterminal Complexity of

Graph-controlled Grammars

Faculty of Informatics

TU Wien, Wien, Austria

Rudolf FREUND

Wilhelm-Schickard-Institut

für Informatik, Univ. Tübingen,

Tübingen, Germany

Henning FERNAU

Klaus REINHARDT Marion OSWALD

Page 2: Refining the  Nonterminal Complexity  of Graph-controlled Grammars

- the problem

Overview

- the history

- the solution

- related problems and solutions

- open problems

Page 3: Refining the  Nonterminal Complexity  of Graph-controlled Grammars

Graph-controlled grammars

A (context-free) graph-controlled grammar G is a construct (N,T,P,S,R,L(in),L(fin)) where (N,T,P,S) is a context-free grammar, V := N T,

R is a finite set of rules r of the form ( l(r): p(l(r)), σ(l(r)), φ(l(r)) ), where l(r) Lab(G), a set of labels, p(l(r)) P, σ(l(r)) Lab(G) is the success field, φ(l(r)) Lab(G) is the failure field of the rule r; L(in) Lab(G) is the set of initial labels, and L(fin) Lab(G) is the set of final labels.

Page 4: Refining the  Nonterminal Complexity  of Graph-controlled Grammars

Graph-controlled grammar - derivations

For ( l(r): p(l(r)), σ(l(r)), φ(l(r)) ) and v,u V*we define (v,l(r)) G (u,k) if and only if ∙ either p(l(r)) is applicable to v, v u, and k (l(r)), ∙ or p(l(r)) is not applicable to v, u=v, and k (l(r)).

Page 5: Refining the  Nonterminal Complexity  of Graph-controlled Grammars

Graph-controlled grammar - languages

The language generated by G is

L(G) = {v T* : (w0,l0) G (w1,l1)… G (wk,lk),

k ≥ 1, wj V*, lj Lab(G) for 0 ≤ j ≤ k,

w0 = S, wk = v, l0 L(in), lk L(fin) }.

Page 6: Refining the  Nonterminal Complexity  of Graph-controlled Grammars

Graph-controlled grammar - complexity

GC( n,j,k) is the family of languages

- over some terminal alphabet of cardinality k 1,

- that can be generated by graph-controlled grammars with at most n 1 nonterminals,- out of which at most j 0 nonterminals are used in the appearance checking mode

GCac := k 1, n 1, j 0 GC( n,j,k)

GC := k 1, n 1 GC( n,0,k)

Page 7: Refining the  Nonterminal Complexity  of Graph-controlled Grammars

Graph-controlled grammars – the nonterminal complexity problem

For each k 1, which is

the minimal number n 1 and

the minimal number j 1 such that

GC( n,j,k) = RE(k),

where RE(k) is the family of recursively enumerable languages over a k-letter alphabet.

Page 8: Refining the  Nonterminal Complexity  of Graph-controlled Grammars

Programmed grammars

A (context-free) programmed grammar G is a graph-controlled grammar (N,T,P,S,R,L(in),L(fin)) where

L(in) = L(fin) = Lab(G).

In a (context-free) programmed grammar G there is no specific starting rule for a derivation, and moreover, every derivation yielding a terminal string adds this string to L(G).

Page 9: Refining the  Nonterminal Complexity  of Graph-controlled Grammars

Programmed grammars - complexity

P( n,j,k) is the family of languages

- over some terminal alphabet of cardinality k 1,

- that can be generated by programmed grammars with at most n 1 nonterminals,- out of which at most j 0 nonterminals are used in the appearance checking mode

Pac := k 1, n 1, j 0 P( n,j,k)

P := k 1, n 1 P( n,0,k)

Page 10: Refining the  Nonterminal Complexity  of Graph-controlled Grammars

Matrix grammars

M is a finite set of finite sequences of productions (an element of M is called a matrix), and F P.

A (context-free) matrix grammar G is a construct(N,T,P,S,M,F) where (N,T,P,S) is a context-free grammar,

Page 11: Refining the  Nonterminal Complexity  of Graph-controlled Grammars

Matrix grammars - derivations

For a matrix m(i) = [mi,1,…,mi,n(i)] in M

and v,u V* we define v m(i) u if and only if

there are w0,w1,…,wn(i) V* such that

w0 = v, wn(i) = u,

and for each j, 1 ≤ j ≤ n(i),

∙ either wj-1 m(i,j) wj

∙ or m(i,j) is not applicable to wj-1,

wj = wj-1, and m(i,j) F.

Page 12: Refining the  Nonterminal Complexity  of Graph-controlled Grammars

Matrix grammars - languages

The language generated by G is

L(G) = {v T* : S m(i,1) w1… m(i,k) wk, wk = v,

wj V*, m(i,j) M for 1 ≤ j ≤ k ,k ≥ 1}.

Page 13: Refining the  Nonterminal Complexity  of Graph-controlled Grammars

Matrix grammars - complexity

M( n,j,k) is the family of languages

- over some terminal alphabet of cardinality k 1,

- that can be generated by matrix grammars with at most n 1 nonterminals,- out of which at most j 0 nonterminals are used in the appearance checking mode

Mac := k 1, n 1, j 0 M( n,j,k)

M := k 1, n 1 M( n,0,k)

Page 14: Refining the  Nonterminal Complexity  of Graph-controlled Grammars

Graph-controlled, programmed, and matrix grammars

RE = Mac = Pac = GCac and M = P = GC.

Jürgen Dassow and Gheorghe Păun: Regulated Rewriting in Formal Language Theory. Volume 18 of EATCS Monographs in Theoretical Computer Science. Springer, 1989.

Page 15: Refining the  Nonterminal Complexity  of Graph-controlled Grammars

Graph-controlled, programmed, and matrix grammars – the importance of appearance checking

RE = Mac = Pac = GCac M = P = GC.

D. Hauschildt and M. Jantzen: Petri net algorithms in the theory of matrix grammars. Acta Informatica, 31 (1994), pp. 719 - 728.

M( n,0,1) = REG(1).

Page 16: Refining the  Nonterminal Complexity  of Graph-controlled Grammars

A famous example from GC( 2,2,1)

L = { a2n : n 1 }

G = ({A,B},{a},P,A,R,{1},{4})

P = { A BB, B A, B a }

Lab(G) = { 1,2,3,4 }

R = { ( 1: A BB, {1}, {2,3} ),

( 2: B A, {2}, {1} ),

( 3: B a, {3}, {4} ),

( 4: B a, , ) }

Page 17: Refining the  Nonterminal Complexity  of Graph-controlled Grammars

The history – first results

Gheorghe Păun: Six nonterminals are enough for generating each r.e. language by a matrix grammar. International Journal of ComputerMathematics, 15 (1984), pp. 23 - 37.

RE(k) = M( 6,6,k) for all k 1.

Page 18: Refining the  Nonterminal Complexity  of Graph-controlled Grammars

The history continued

MCU 2001: Two new results obtained in parallel in Proc. 3rd MCU. LNCS 2055, Springer, 2001.

Henning Fernau: Nonterminal complexity of programmed grammars. In: MCU 2001, 202 - 213.

RE(k) = GC( 3,3,k) = P( 3,3,k) = M( 4,4,k) for k 1.

Rudolf Freund and Gheorghe Păun: On the number of non-terminal symbols in graph-controlled, programmed and matrix grammars. In: MCU 2001, 214 - 225.

RE(k) = GC( 3,2,k) = P( 4,2,k) = M( 4,3,k)

= M(*,2,k) for k 1.

Page 19: Refining the  Nonterminal Complexity  of Graph-controlled Grammars

The history of the latest results

Theorietag 2001 in Magdeburg:

Klaus Reinhardt: The reachability problem of Petri nets with one inhibitor arc is decidable.

proved by Henning Fernau and Rudolf Freund,and as well:

GC( n,1,1) RE(1)

GC(1,1,k) = GC(1,0,k) and

RE(1) = GC(2,2, 1).

Page 20: Refining the  Nonterminal Complexity  of Graph-controlled Grammars

Newest results

proved by using a decibability result for priority-multicounter-automataestablished by Klaus Reinhardt.

Theorem 2. GC( n,1,1) RE(1)

Theorem 1. RE(k) = GC( 2,2,k) for all k 1.

Page 21: Refining the  Nonterminal Complexity  of Graph-controlled Grammars

Register machines - definitionA (deterministic)register machine is a construct M = (n,R,l0,lh) where n is the number of registers, R is a finite set of instructions injectively labelled with elements from a given set lab(M), l0 is the initial/start label, and lh is the final label. The instructions are of the following forms:

- l1:(ADD(r), l2) Add 1 to the contents of register r and proceed to the instruction (labelled with) l2.

- l1:(SUB(r), l2, l3) If register r is not empty, then subtract 1 from its contents and go to instruction ) l2, otherwise proceed to instruction ) l2 .

- l1:halt Stop the machine.

Page 22: Refining the  Nonterminal Complexity  of Graph-controlled Grammars

Register machines – results (accept)

Proposition 3. For any recursively enumerable set L N there exists a register machine M with two registers accepting L in such a way that,

when starting with 2n in register 1 and 0 in

register 2, M accepts the input 2n (by halting with both registers being empty) if and only if n L.

Page 23: Refining the  Nonterminal Complexity  of Graph-controlled Grammars

Register machines – results (compute)

Proposition 4. For any partial recursive function f: N N there exists a register machine M with two registers computing f in such a way that,

when starting with 2n in register 1 and 0 in

register 2, M computes f(n) by halting with 2f(n) in register 1 and 0 in register 2.

Page 24: Refining the  Nonterminal Complexity  of Graph-controlled Grammars

Complexity results for graph-controlled grammars

Proof: Given L RE(k), L T*, for some

alphabet T = { am : 1 m k }, we construct a

graph-controlled grammar G = ( { A,B } , T , P , A , R , { i }, { f } ) with ( G) = L as follows: Every string in T* can be encoded as a non-negative integer using

the function gT: T* N inductively defined by

gT() = 0, gT(am) = m for 1 m k , and gT(wa)

= gT(w) (k+1) +gT(a) for a T and w T*.

Theorem 1. RE(k) = GC( 2,2,k) for all k 1.

Page 25: Refining the  Nonterminal Complexity  of Graph-controlled Grammars

Complexity results for graph-controlled grammars – proof

We now iteratively generate wA2g

T(w)

for some

w T*. The addition of a new symbol a starts with applying the production A aB;then renaming all symbols A to B exhaustively using the sequence of productions A and B BB finally yields the string

waB2g

T(w)

. Then we simulate a register machine

constructed according to Propostion 4 computing

2g

T(wa)

from 2g

T(w)

.

Page 26: Refining the  Nonterminal Complexity  of Graph-controlled Grammars

Simulation of a register machine by a graph-controlled grammar – ADD

l1: (ADD(1) ,l2) is simulated in G by

( l1’: B BA, {l2 }, ) ;

( l1: A AA, {l2 }, { l1’ }) and

l1: (ADD(2) ,l2) is simulated in G by

( l1’: A AB, {l2 }, ) ;

( l1: B BB, {l2 }, { l1’ }) and

Page 27: Refining the  Nonterminal Complexity  of Graph-controlled Grammars

Simulation of a register machine by a graph-controlled grammar – SUB

l1: (SUB(1) ,l2, l3 ) is simulated in G by

( l1: A , {l2 }, { l3 } );

l1: (SUB(2) ,l2, l3 ) is simulated in G by

( l1: B , {l2 }, { l3 } ).

Page 28: Refining the  Nonterminal Complexity  of Graph-controlled Grammars

Simulation of a register machine by a graph-controlled grammar – accept

After having generated a string w over T and its encoding we simulate a register machine M constructed according to Propostion 3. M checks whether w is in L which is the case if and only if the encoding of w is accepted by M. After halting in the final label, the two registers are empty, hence, the remaining sentential form is terminal, i.e., G has generated the terminal string w. q.e.d.

Page 29: Refining the  Nonterminal Complexity  of Graph-controlled Grammars

For graph-controlled grammars this complexity result is optimal

RE(k) = GC( 2,2,k) for all k 1

is optimal with respect to the number of nonterminals as well as with respect to the number of nonterminals to be used in the appearance checking mode.

This is due to the fact that we can prove

GC( n,1,k) RE(k) for all n 1 and all k 1.

Theorem 2. GC( n,1,1) RE(1)In fact, we will show

Page 30: Refining the  Nonterminal Complexity  of Graph-controlled Grammars

Priority-multicounter-automataA priority-multicounter-automaton is a one-

way automaton described by

A = ( k, Z, T, , z0, E)

with the set of states Z,

the input alphabet T,

the transition relation

(Z x (T {}) x {0,...,k}) x (Z x {-1,0,1}k),

initial state z0 Z,

accepting states E Z.

Page 31: Refining the  Nonterminal Complexity  of Graph-controlled Grammars

Priority-multicounter-automata - configurations

configurations CA = Z x T* x Nk,

initial configuration A(x) = <z0,x,0k>

configuration transition relation

<z,ax,n1,...,nk> |A <z‘,x,n1+i1,...,nk+ik>

if and only if

z,z‘ Z, a T {},

<(z,a,j),(z',i1,...ik)> ,

and for all i j ni = 0.

Page 32: Refining the  Nonterminal Complexity  of Graph-controlled Grammars

Priority-multicounter-automata - language

L(A) = { w : <z0,w,0k> |*A <ze,,0k> }The family of languages over a k-letter

alphabet accepted by priority-multicounter-

automata with n counters of which at most j

can be tested for zero in the restricted way

defined above is denoted by PnkCA(j) .

Page 33: Refining the  Nonterminal Complexity  of Graph-controlled Grammars

Priority-multicounter-automata - results

Theorem 5. (KlausReinhardt: Habilschrift, 2005)

The emptiness problem for priority-multicounter-

automata is decidable.

(The same holds for the halting problem.)

Page 34: Refining the  Nonterminal Complexity  of Graph-controlled Grammars

Priority-multicounter-automata – relation to graph-controlled grammars

Theorem 6. GC(n,1,1) Pn1CA(1) .

Proof (sketch). The counters count the number of

nonterminals. The first counter (the only one tested for

zero) corresponds to the only nonterminal symbol that is

used in the appearance checking mode.

States correspond to labels of G.

Reading an input symbol a corresponds to producing the

terminal symbol a.

The input am is accepted by the automaton if and only if a

am can be generated by the grammar.

Page 35: Refining the  Nonterminal Complexity  of Graph-controlled Grammars

Complexity results for programmed grammars and matrix grammars

RE(k) = P( 3,2,k) = M( 3,3,k) for all k 1.

These results are immediate consequences of Theorem 1 and the proof methods used inRudolf Freund and Gheorghe Păun: From regulated rewriting to computing with membranes: collapsing hierarchies. Theoretical Computer Science 312 (2004), pp. 143 – 188:

Page 36: Refining the  Nonterminal Complexity  of Graph-controlled Grammars

Open ProblemsProgrammed grammars:

Is the third variable needed?

Matrix grammars:

Is the third variable needed in the appearance checking mode?

The third variable here is needed anyway due toJürgen Dassow and Gheorghe Păun: Further remarks on the complexity of regulated rewriting. Kybernetika, 21, pp. 213 - 227.