Presentation is loading. Please wait.

Presentation is loading. Please wait.

Languages Generated by Programmed Grammars with Various Graphs Jurgen Dassow, Benedek Nagy, Cristina Bibire, Madalina Barbaiani, Szilard Fazekas, Aidan.

Similar presentations


Presentation on theme: "Languages Generated by Programmed Grammars with Various Graphs Jurgen Dassow, Benedek Nagy, Cristina Bibire, Madalina Barbaiani, Szilard Fazekas, Aidan."— Presentation transcript:

1 Languages Generated by Programmed Grammars with Various Graphs Jurgen Dassow, Benedek Nagy, Cristina Bibire, Madalina Barbaiani, Szilard Fazekas, Aidan Delaney, Mihai Ionescu, GuangWu Liu, Atif Lodhi

2 A programmed grammar is a quadruple G=(N, T, S, P) where: G=(N, T, S, P) where: N, T and S are specified as in a context-free grammar and P is a finite set of triples r = (p, σ, φ) where p is a context-free production and σ and φ are subsets of P (σ and φ are called the success field and the failure field, respectively). If the failure field of any rule in P is empty we say that G is a programmed grammar without appearance checking. Otherwise G is a programmed grammar with appearance checking.

3 We will consider another interpretation of the programmed grammars: as graphs. From now on, we will consider only programmed grammars without appearance checking. Let G = (N, T, S, P) be a programmed grammar. We can construct a graph H=(P, E), where P is the set of rules from G and (r, r’) is in E if and only if r’ is one of the rules from the success field of r.

4 Example Let Let Note: because the order in which an edge binds two vertices does matter, in this presentation we will consider only directed graphs.

5 The corresponding graph is:

6 For a particular class of restricted graphs, one can determine which class of languages can be generated with it. Types of graphs that we had in mind: Complete graphs Complete graphs Planar graphs Planar graphs Connected graphs Connected graphs Eulerian graphs Eulerian graphs Hamiltonian graphs Hamiltonian graphs Bipartite graphs Bipartite graphs Ring backbones Ring backbones Graphs with limited degree ( ) Graphs with limited degree ( )

7 Complete Graphs Theorem The language obtained by a programmed grammar in which the corresponding graph is a complete one is context-free. Proof: We know that the rules in a programmed grammar are all context-free. A complete graph is simply telling us that each rule of the grammar can be followed (in the derivation) by any of the other rules. That reduces the power of the given programmed grammar to an arbitrary context-free grammar.

8 Planar Graphs Theorem All languages obtained by a programmed grammar can be obtained by a programmed grammar using a planar graph. Proof: Planar graphs are graphs which can be drawn in such a way that their edges do not intersect each other, so our task here is to avoid the intersections without altering the generated language. It suffices to consider a simpler case, with only four vertices. We will apply this algorithm to all the other intersections from the graph.

9 A → u B → v

10 A → u B → v

11 A → u B → v X → λ

12 A → u B → v B → BX A → AX X → λ

13 A → u B → v B → BXA 1 A 1 → λA → AXA 2 A 2 → λ X → λ

14 Connected Graphs Theorem Any language obtained by a programmed grammar can be obtained by a programmed grammar with a connected graph. Proof: Consider the programmed grammar associated with the graph. We define: - the union of all maximally connected subgraphs of containing at least one of the vertices from the set. - the union of all maximally connected subgraphs of containing at least one of the vertices from the set.

15 We introduce a new terminal symbol, which will be the new start symbol for our grammar and we define. The grammar is a programmed grammar in which the associated graph is connected, and it generates the same language as

16 Eulerian Graphs Theorem Any language obtained by a programmed grammar can be obtained by a programmed grammar with an eulerian graph. Proof: Let be a programmed grammar and the associated graph. We denote the vertices by. the associated graph. We denote the vertices by. A directed connected graph is eulerian if and only if for every vertex, the in-degree equals the out-degree. A directed connected graph is eulerian if and only if for every vertex, the in-degree equals the out-degree. We will extend our graph to a new one by introducing the vertices where. The new non- terminals are meant to block the undesired We will extend our graph to a new one by introducing the vertices where. The new non- terminals are meant to block the undesired derivations. derivations. Our goal is to connect the old nodes to the new one such that the in-degree for each node equals the out-degree.

17 Put the new edges in the following way: Put the new edges in the following way: 1.For each connect the node to the node if and only if there was not an edge from to. In this way all vertices will have out-degree. 2.For each connect the node to the node if and only if there was not an edge from to. In this way all vertices will have in-degree. In this way in our new graph, for all nodes, we have that the in-degree equals the out-degree. In this way in our new graph, for all nodes, we have that the in-degree equals the out-degree. 3.All we have to do now is to make sure that this property will hold also for each.

18 The following property is true for any directed graph: But we know that: From and we obtain: Connect any node which has higher in-degree than out- degree to any node having higher out-degree than in- degree. In this way the number of in-degrees and out-degrees will increase both, and after finitely many steps (the difference for any node is not more than n) each node will have equal number of in- and out-degree.

19 Hamiltonian Graphs Theorem Any language obtained by a programmed grammar can be obtained by a programmed grammar with an Hamiltonian graph. Proof: Given a programmed grammar, let ( is the number of rules in ) be new non- terminal symbols which were not in. ( is the number of rules in ) be new non- terminal symbols which were not in. Let. We introduce new nodes: and we connect each node to the node

20

21 Other Results Any language obtained by a programmed grammar can be obtained by a programmed grammar with a bipartite graph. Any language obtained by a programmed grammar can be obtained by a programmed grammar with the graph having the nodes’ degree at most 3.

22 Conclusions and Further Research Combining our constructive proofs one can generate any language obtained by a programmed grammar without appearance checking with a connected planar graph having nodes degree at most 3. There are some related open questions, for example what is the language family generated by programmed grammars such a way that there is a word which is generated by a Hamiltonian or Eulerian trail/cycle.

23


Download ppt "Languages Generated by Programmed Grammars with Various Graphs Jurgen Dassow, Benedek Nagy, Cristina Bibire, Madalina Barbaiani, Szilard Fazekas, Aidan."

Similar presentations


Ads by Google