Presentation on theme: "Languages Generated by Programmed Grammars with Various Graphs"— Presentation transcript:
1Languages 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
2A programmed grammar is a quadruple G=(N, T, S, P) where:N, T and S are specified as in a context-free grammar andP 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.
3We 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.
4ExampleLetNote: because the order in which an edge binds two vertices does matter, in this presentation we will consider only directed graphs.
6For 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 graphsPlanar graphsConnected graphsEulerian graphsHamiltonian graphsBipartite graphsRing backbonesGraphs with limited degree ( )
7Complete GraphsTheorem 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.
8Planar GraphsTheorem 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.
14Connected GraphsTheorem 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 graphWe define:- the union of all maximally connected subgraphs of containing at least one of the vertices from the set .
15We introduce a new terminal symbol , which will be the new start symbol for our grammar and we defineThe grammar is a programmed grammar in which the associated graph is connected, and it generates the same language as
16Eulerian GraphsTheorem Any language obtained by a programmed grammar can be obtained by a programmed grammar with an eulerian graph.Proof: Let be a programmed grammar andthe associated graph. We denote the vertices byA 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 undesiredderivations.Our goal is to connect the old nodes to the new one such that the in-degree for each node equals the out-degree.
17Put the new edges in the following way: 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 .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.All we have to do now is to make sure that this property will hold also for each .
18The 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.
19Hamiltonian GraphsTheorem 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 .Let We introduce new nodes:and we connect each node to the node
21Other ResultsAny 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.
22Conclusions 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.