Global Index Languages

A Dissertation

Presented to The Faculty of the Graduate School of Arts and Sciences Brandeis University Department of Computer Science James Pustejovsky, Advisor

In Partial Fulfillment of the Requirements for the Degree Doctor of Philosophy

by Jos´ M. Casta˜o e n February, 2004

The signed version of this dissertation page is on file at the Graduate School of Arts and Sciences at Brandeis University. This dissertation, directed and approved by Jos´ M. Casta˜o’s committee, has been accepted and e n approved by the Graduate Faculty of Brandeis University in partial fulfillment of the requirements for the degree of:

DOCTOR OF PHILOSOPHY

Adam Jaffe, Dean of Arts and Sciences

Dissertation Committee: James Pustejovsky, Dept. of Computer Science, Chair. Martin Cohn, Dept. of Computer Science Timothy J. Hickey, Dept. of Computer Science Aravind K. Joshi, University of Pennsylvania

.

c Copyright by Jos´ M. Casta˜o e n 2004 .

.

Rodr´ ıguez. vii . Debes amar la arcilla que va en tus manos debes amar su arena hasta la locura y si no. no lo emprendas.Al Campris y su eterna perserverancia. que ser´ en vano a S. A la Pipi y su gran amor.

.

Acknowledgments Many people contributed to this work. some I don’t know. Pablo Funes. Francesco Rizzo. Ana Arregui. Jos´ Alvarez. I would like to thank Martin Cohn for introducing me to Formal Languages and having always time for me. I am extremely grateful to Aravind Joshi for being part of my committee and for his precise comments and suggestions. Roser Saur´ and Bob Knippen. My family n has a very special dedication. Aldo Blanco. Marc Verhagen. Domingo Medina. Edward Stabler and Stuart Shieber helped me to find a way at the initial stages of this endeavour. This work was influenced by many people. Piroska Cs´ri. in many different ways. Alejandro Renato and the extraordinary friends I met at Brandeis. I would like to express my gratitude to James Pustejovsky who supported and encouraged me during these years. Ricardo e Rodr´ ıguez. Many thanks to my Argentinian friends and colleagues. Mar´ Pi˜ango. ı I cannot express how grateful I am to my compa˜era Daniela in this and every route. Anna ıa n u Rumshisky. far away from my initial interests when I arrived at Brandeis. ix . My sincere thanks to Tim Hickey and Ray Jackendoff. First and foremost. Also many circumstances led me to this unexpected path. My highest appreciation to those anonymous reviewers who made an effort to understand and comment on my submissions during these years. my American friend. It is my belief that every intellectual work is fruit of a community.

.

This family of languages preserves the desirable properties mentioned above: bounded polynomial parsability. Mildly context-sensitive languages and grammars emerged as a paradigm capable of modeling the requirements of natural languages. as well as an LR-parsing algorithm for the deterministic version of GILs. This thesis presents an abstract family of languages. we discuss in Chapter 6 the relevance of Global Index Languages for natural language phenomena. polynomial parsability and semi-linearity. We present a two-stack automaton model for GILs and a grammar model (Global Index Grammars) in Chapter 2 and 3. and at the same time has an “extra” context-sensitive descriptive power (e. it might be necessary to deal with the multiple copies language: {ww+ |w ∈ Σ∗ } [29]. An Earley type algorithm to solve the recognition problem is discussed in Chapter 5. Innumerable formalisms have been proposed to extend the power of context-free grammars. However there are many problems that cannot be described by context-free languages: “the world is not context-free” [25]. In order to model coordination. Massachusetts by Jos´ M. Casta˜o e n Context-free grammars (CFGs) is perhaps the best understood and most applicable part of formal language theory. There is increasing consensus that modeling certain natural language problems would require more descriptive power than that allowed by context-free languages. GIls descriptive power is shown both in terms of the set of string languages included in GILs. At the same time there is a special concern to preserve the ‘nice’ properties of context-free languages: for instance. semi-linearity. One of those problems concerns natural language phenomena. named Global Index Languages (GILs).g the “multiple-copies” language is a GI language). Waltham. One of the hard problems in natural language is coordination. This work takes these ideas as its goal. Finally. as well as the structural descriptions generated by the corresponding grammars. xi .ABSTRACT Global Index Languages A dissertation presented to the Faculty of the Graduate School of Arts and Sciences of Brandeis University. Then characterization and representation theorems as well as closure properties are also presented.

.

. 3. . . . . . . . . . . . . . . . 2. . . . . . . . 2. . . . . . . .2 LR-2PDA with deterministic auxiliary stack . . . . . . . 1. . . . . 2. . .2 Closure Properties of GILs . . . . . . . 3 Global Index Grammars 3. . . . . . . . . . . . . . .1. . . . . .1 Automata with two Stacks . . . . . .3 Our proposal . . . 2. . . . . . . . . . . . . . . . .1 EPDA and equivalent 2 Stack Machines . . . . . . . . . . . . . . . . . . . .1. . . . . . . . . . .5 Determinism in LR-2PDA . . . . . . . . . . . . . . . . . . . 4. . . . . . .1 Deterministic LR-2PDA . . . . . . .5. . . . .2 Global Index Grammars . . . . . . . . . . . . . . . . . . . . . . . . . . .2 GIGs examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1 Indexed Grammars and Linear Indexed Grammars 3. . . 2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1. . . . . . . . . . . ix xi xv 1 1 2 4 5 6 9 9 10 12 13 15 17 20 20 21 23 23 24 26 28 32 35 41 41 42 44 46 47 2 Two Stack Push Down Automata 2. . . . . . . .3 GILs and Dyck Languages . . . . . . . . . . . . . . . . . . . . . . . . .1 Introduction . 4. . . . . . . 2. . . . . .3 Comparison with TM.4 Pumping Lemmas and GILs . . . 2. .3 Semilinearity of GILs and the Constant Growth property 4. .1 trGIGS . . . . . . . . . . . . . . . . . . . . . . . 4. .2 Outline of the Thesis and Description of the . . . . . . . . . . . . . . . . .2. .1. . . . . . 3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1 Natural Language . . . . . . . finite turn CFGs and Ultralinear GILs . . . . . . 2. . . . . . . . . . . . . . . . . . . . . . . . . . . . .1 Relations to other families of languages . . . . .1 GILs. . . . . . . . . . . . .5. . . . . . . . . . . xiii . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PDA and LR-2PDA . .2 Shrinking Two Pushdown Automata . . . . . . . . . . . . . . . . . . . . . . .Contents vii Acknowledgments Abstract List of Figures 1 Introduction 1. . . . . . . . . . . . . .4 Examples of LR-2PDAs . . . . . . . . . . . . . . . . . . . .2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3. . . . . . . . . . . . .2 Biology and the Language of DNA .1. . 1. . . . . 4 Global Index Languages Properties 4. . . . . . . . . . . . . . . . . . . . .2 Left Restricted 2 Stack Push Down Automatas (LR-2PDAs) . . . . . . . . . Results . . . . . . . .4 Equivalence of GIGs and LR-2PDA . . . . . . . . . .1. . . . 3. . . . . . . . 1. . .4. . . . . . . .

. . . .1 Overview . . . . . . . . . .3. . . . . 5. . . . . . . . . . . . .3 GIGs and HPSGs . . . . . . . . . . . . . . . . . .2 First approach to an Earley Algorithm for 5. . . . 5. . . . . . . . . . . . . . . . . . . .6. . . . . . . . . . . . . . . . .1 Graph-structured Stacks . .1 Control Languages . . 5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1. . . . . GILs. . . . . . . . . . . . . 61 . . . . . . . . . . .3. . . .1 LIGs in push-Greibach Normal Form . . . . . . . . . . . 7 Conclusions and Future Work 125 7. . . . . 98 . . . . . . .2. . . . . . . . . . . . .3 Parsing Schemata for GIGs . . . . . 6. . . . . . . . . . . . . . . . . 5. 126 xiv . . . . 80 . . . 52 . . . . . .1 Future Work . . . . 73 . . . . . . . . . . . . . .2 The palindrome language . . . . .3 Refining the Earley Algorithm for GIGs . . . . 51 . . . . . . . . . . . 5. . . . . . . . 5. . . . . . . . 6. . . . . . 96 . .4. . . . .4. . . . .2 Time and Space Complexity . . . . 6. . . . . . . . . . . . . .4. . . . . . . .3 Complexity Analysis . . . . . . . . .6. . . . . . . . . . 6. . . . . . . . . . 79 . . . . . . . . . . . . . . .1. 100 . . . . . . . . . .5 Derivation order and Normal Form . . .6. . . . . . . . .2 Set Inclusion between GIGs and LIGs . . . . . . 75 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6. . . . . . . . . 51 . . . . . . . . . . . . . . . . . . . . .4 Proof of the Correctness of the Algorithm . . . . . 53 . . . . . . .3 The Copy Language . . . . . . . . . . . . . . .1 LR items and viable prefixes . . . . . . .4 Multiple dependencies . 5. . . . . . . . . . . . . . . . . . . . . . . . 73 . . . . . . .2. . . . . . . . . . . . . . . . . . . . . 6.1. . . . . . . . . . .2 The Closure Operation. . . . . . . . . . . . . . . . . . . . . . . . . .5 Crossing dependencies . . . . . .1 Control of the derivation in LIGs and GIGs . . .3 The Goto Operation. . . . . . . 5. . . . . . . 83 . . . . . . . . . . . . . . 5. .4. 5. . . . . . . . . . . . . 5. . . . . .1.2. . . .2. . . . . . . . . . . .1 Earley Algorithm. . . . . . . . . . . . . . . . . . .1. . . . . . . . . . . . . . . .1 Linear Indexed Grammars (LIGs) and Global Index Grammars (GIGs) 6.6 LR parsing for GILs . . . . . 98 . . . . 5. . . . . . . . . . . . . 5. . . . . . . . . . . . . . . . . 107 107 108 108 110 112 113 115 116 119 6 Applicability of GIGs 6. . . . . . 57 . 52 . . . . . . . . . . . . . . . . . . . . . . . 81 . . 6. . . . 5. . . . . . 5. . . . . . . . . . . .2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 . . 5. . . . . . . .2 Parsing Schemata . . . . . . . . . . . . .4 Earley Algorithm for GIGs: final version . . . . . . . . . . . . . . . . . .5 Implementation . . 48 5 Recognition and Parsing of GILs 5. . . . . . . . . . . . .2 GILs Recognition using Earley Algorithm . .

. . . . . . . . . . . . . . . . . . . . . . . A non context-free structural description for the language wwR . . . . . . .18 5. . . . . . . . . . . . . . . . . . annotated with indices for the grammar Gwcw . . . . . . . . . . . . . . . . . . . . . . . . . . . .23 5. . . . . . . last case . . . . . . . . . . . . . . . . . . . . . . . . . . .14 5. . . . . . . . . . . . . . . . . sLR-2PDA . . Multiple agreement in an sLR-2PDA . . . . . . . .3 6. . 62 i A graph structured stack with i and ¯ nodes . . . . . 102 LIGs: multiple spines (left) and GIGs: leftmost derivation . . . . . . . . . 58 i Push and Pop moves on different spines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4 5. . . . . .24 6. . . . . . . .2 6. . . . . . . . . .4 6. A PDA . . . . . . . . . . . . . . . . . . . 68 Completer C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 Completer G . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 Completer D . . .15 5. . 68 Completer B . 60 Ambiguity on different spines . . . . . . . . . . 59 A complete steps in the graph . . . . . . . . . . . . . . . . .5 Language relations . . . . . . . . . . . . . .5 5. . . . . . . . . . . . . . . . . . . . . .9 5. . . . . . . . . . . .7 5. . . . . . . . 71 Completer F . . . . . . . . . . . . . . . . . . . . . . . .1 2. . . . . . . . . . . . . . . . . . . . . . . . . . .List of Figures 1. . . . . . .22 5. . . . . . . . .4 2. . . . . . . . . . . . . . . . . . . . . . . . . Two LIG structural descriptions for the copy language . . . . 59 Two alternative graph-structured stacks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 Set of States for Gwcw . . 73 Earley CFG invariant . . . . . . . . . . . .3 5. . . . . . . . . . . . . . . . . . . . . . . . .1 6. . .1 2. . . . . . . . . . . 63 i I-edges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 109 109 110 110 xv . . . . . . . . . LR-2PDA . . . . . . . . . . . . .8 5. 81 Path invariant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .17 5. . . . . . . . . 60 Two alternative graph-structured stacks distinguished by position . . . . . 79 GIG invariant . . . . . . 64 Completer A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20 5. . Another non context-free structural description for the language wwR GIG structural descriptions for the language wwR . . 100 Transition diagram for the PDA recognizing the set of valid prefixes. . . . . . . . . . . . . . . . .3 2. . . . . . .5 2. . . . . .1 5. . . . . . . . . . . . . . . 60 Paths and reductions in a graph structured stack with i and ¯ nodes . . . . . . . . . . . . . . . . . . 52 Push and Pop moves on the same spine . . . . . . . . . . . . . . . . . . . .11 5. . . . . . . . . . . . . . 57 A graph structured stack with i and ¯ nodes . . .19 5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Dutch Crossed Dependencies (Joshi & Schabes 97) A Turing Machine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .16 5. . . . . . . . . . . . . . . . . . 8 11 15 15 17 17 18 Two graph-structured stacks . .6 5. . . . . . . . . . . . . 58 A predict time graph .2 5. . . . . . . . . . . . .21 5. . . . . . . . . . . . . . . . . . . . . . . . . . . .2 2. . . . . . . . . . . . . . .6 5. . . . . . . . .10 5. . . . . . . . . . . . . . . . . . . . . . . . . . . . .12 5. . . . . . . . . .13 5. . . . . 70 Completer E. . . . . . . . . . . .

LIGs not in push-GNF I . .12 6.6 6. . . . . . . . . . . . . . . . . . . . . . . . . . .15 6. . . . . . . . . . . . . . . . . .21 6. . . . . . . . . . . . . . . . . . . . . . . . . . . GIG structural descriptions of 4 dependencies . Left and right recursive equivalence in LIGs . . . . . . . . . . . . . . . . . Left and right recursive equivalence in LIGs. . . Head-Comp in GIG format . . LIGs not in push-GNF II in GIGs . . . . . . . . . . . . . . . . . . . . . . . . . second case . . . . . . . . Head-Subject Schema .20 6. . .6. . . . . . . . . . . . . . . . . . . . . . .19 6. . . . . . . .22 An IG and GIG structural descriptions of the copy language . . . . . . .14 6. . . . Head-Comps Schema tree representation . . . . . . . . . . . . A GIG structural description for the multiple copy language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . GIG structural descriptions of 3 dependencies .7 6. . . . . . . . . . . . . . . . . . . .13 6. . . . . . . . . . . . . . . . . . . SLASH in GIG format . . . . . . .11 6. . . . . . . . . . . . . . . . . . . . . . .18 6. . . . . . . . . . LIGs not in push-GNF II . . . . . . . . . . . . LIG and GIG structural descriptions of 4 and 3 dependencies A LIG and a GIG structural descriptions of 3 dependencies . . . . . . . .9 6. . . . . . . . . . . . . . . . . . . Head-Subject in GIG format . . . . . . . . . . . . . . . . . . . . . . . . . . . .10 6. . . . 111 111 112 112 113 113 117 117 118 118 119 120 121 121 122 123 124 xvi .8 6.16 6. .17 6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . SLASH and coordination in GIG format . . . . . . .

In an automaton model those extensions either use constrained embedded or additional stacks (cf. 1 .g.Chapter 1 Introduction 1. In [25] seven situations which cannot be described with a context-free framework are given. well understood and most widely applicable part of formal language theory. However there are many problems that cannot be described by context-free languages. We try to obtain a model with efficient computation properties. at least. 81. Many formalisms have been proposed to extend the power of context-free grammars using control devices. polynomial parsability. for the following areas: • Natural Language modeling and processing. semilinearity property. The appeal of this approach is that many of the attractive properties of context-free languages are preserved (e. 59]).1 Introduction Context-free grammars (CFGs) constitute perhaps the most developed. • Computational Biology • Possibly also relevant to programming languages which might use context sensitive features (like Algol 60). where the control device is a context-free grammar (see [87] and [26] regarding control languages). closure properties). [7. Such a model is relevant. The purpose of this thesis is to explore an alternative formalism with restricted context-sensitivity and computational tractability.

and multi-push-down grammars [21]. leading to languages of the form {ww |w ∈ Σ∗ } – multiple agreements. 86] and [55. in particular related to the so called Mildly-Context Sensitive formalisms.1 Natural Language Regarding natural languages (one of the seven cases mentioned above). We will focus in natural language problems from a language theoretic point of view. These constructions are exemplified as [26]:2 – reduplication. Within Mildly-Context Sensitive formalisms we focus on Linear Indexed Grammars (LIGs) and Tree Adjoining Grammars (TAGs) which are weakly equivalent. 23. among others. there is increasing consensus1 on the necessity of formalisms more powerful than CFGs to account certain typical natural languages constructions. additional levels of embeddedness. 4 See for example. [46. scrambling. as modeled by {an bm cn dm | n m ≥ 1} Mildly context-sensitive grammars [43] have been proposed as capable of modeling the above mentioned phenomena.g. multiple context free grammars [71]. . Examples of those related hierarchies are: Khabbaz’s [49]. that can be modeled with GILs.1. As a consequence those generalizations provide more expressive power but at a computational cost. 47] on semi-linearity.3 It has been claimed that a NL model must have the following properties:4 1 See 2 The for example [73. following type of languages are also relevant to model molecular biology phenomena [70] there are other phenomena (e. In general. {an bn cn dn | n ≥ 1}. We will exemplify this issue with some properties of natural language and we will consider some biology phenomena. etc.2 CHAPTER 1. INTRODUCTION Such models can be generalized and additional control levels. 1. for a level k language the complexity of the recognition problem is a polynomial where the degree of the polynomial is a function of k. 29]. or additional stacks can be added. They form hierarchies of levels of languages. where a language of level k properly includes a language of level k − 1. Weir’s [87]. – crossed agreements. Georgian Case and Chinese numbers) might be considered 3 However to be beyond certain mildly context-sensitive formalisms. corresponding to languages of the form {an bn cn | n ≥ 1}. The complexity of the recognition problem is dependent on the language level.

Therefore the following relations follow: The family of level-k languages contains the languages n n {a1 .. The equivalent machine model is a nested or embedded push down automata (NPDA or EPDA). a stronger version of this requirement ) – Polynomial parsability – Limited cross-serial dependencies – Proper inclusion of context-free languages 3 The most restricted mildly context-sensitive grammar formalisms are linear indexed Grammars (LIGs).. A TAG/LIG is a level-2 control grammar. its descriptive power. and combinatory categorial grammars (CCGs) which are weakly equivalent. More expressive power can be gained in a mildly context-sensitive model by increasing the progression of this mechanism: in the grammar model adding another level of grammar control.a2 k +1 | n ≥ 0} and {w2 k −1 +1 |w ∈ Σ∗ } . These formalisms have long been used to account for natural language phenomena. tree adjoining grammars (TAGs).g. L = {an bn cn dn |n ≥ 1}).. head grammars (HGs). an increase in descriptive power is correlated with an increase in time and space parsing complexity. Their expressive power regarding multiple agreements is limited to 4 counting dependencies (e.a2 k | n ≥ 0} and {w2 k −1 |w ∈ Σ∗ } but does not contain the languages n n {a1 . INTRODUCTION – Constant growth property (or semi-linearity. However.1. A lemma for level k of the hierarchy involves “pumping” 2k positions in the string. 62]). where a CFG controls another CFG.. and in the machine model allowing another level of embeddedness in the stack. One of the characteristics of mildly context sensitive formalisms is that they can be described by a geometric hierarchy of language classes. Many different proposals for extending the power of LIGs/TAGs have been presented in the recent past. In such hierarchies there is a correlation between the complexity of the formalism (grammar or automata).. and the time and space complexity of the recognition problem. Tree Adjoining languages belong to the class L2 in Weir’s hierarchy.1. They have been proven to have recognition algorithms with time complexity O(n6 ) considering the size of the grammar a constant factor ( [67. This is reflected in the pumping lemma.

Contextual Languages do not properly include context-free languages. or ordering) the recognition problem is in O(n3 ·2 k −1 ) [86. In this case the complexity of the recognition problem is a bound polynomial: O(n6 ) space and O(n9 ) time [36].4 CHAPTER 1. Searls [70. Those problems which are beyond context free are: Tandem Repeats (multiple copies). 1. 10. recombination. Contextual Grammars [52. 69]). 12]. generative grammars have been proposed as models of biological phenomena and the connections between linguistics and biology have been exploited in different ways (see [40. mutation and rearrangements. 68] proposes a grammar model to capture the language of DNA. Tree Description Grammars [47] are other such examples. and m the number of terms in the productions. gene structure and expression. Some of those formalisms are: Minimalist grammars [78. 54]. There are other formalisms related to mildly context-sensitive languages that are not characterized by a hierarchy of grammar levels. conformation of macromolecules and the computational analysis of sequence data are problems which have been approached from such a perspective. Gene regulation. 66] is another formalism with some mildly context sensitive characteristics. 87]. Range Concatenative Grammars [34. that it is ambiguous and that it is not context-free. nor deterministic nor linear. In Coupled Context-Free Grammars the recognition problem is in O(|P | · n3l ) where l is the rank of the grammar [28] and Multiple Context Free Grammars is O(ne ) where e is the degree of the grammar. For LMGs the complexity of the recognition problem is O(|G|m(+p)n1 +m+2p ) where p is the arity of the predicates. However. Pseudoknots (crossing dependencies) represented as: Lk = {uv¯R v R }.2 Biology and the Language of DNA Recently. but their complexity and expressive power is bound to some parameter in the grammar (in other words the expressive power is bound to a parameter of the grammar itself). and the related Literal Movement Grammars (LMGs). u ¯ .1. He shows that the language of nucleic acids is not regular. INTRODUCTION An increase in the language level increases the time (and space) complexity but it still is in P : for a level-k control grammar (or a level-k of stack embeddedness. 38. Direct Repeats (the copy language). Multivalued Linear Indexed Grammars [63].

1.1. c}∗ and |a|w = |b|w = |c|w ≥ 1} The mix language. However there is no known algorithm that decides the recognition problem for String Variable Languages. combinations. Recently Rivas and Eddy [64] proposed an algorithm which is O(n6 ) to predict RNA structure including pseudoknots. INTRODUCTION 5 Unbounded number of repeats. The following languages can be generated by a Global Index Grammar: • Lm = {a1 n a2 n . inverted repeats.1. or interleaved repeats. We will also show that it is able to describe phenomena relevant both to natural language and biology. and they are able to describe those phenomena.. are characteristic of the language of DNA. which is in time O(n6 ). We will show that the automaton and grammar model proposed here extends in a natural way the properties of Push Down Automata and context-free languages.1. however there are many GI languages which do not belong to the set of Linear Indexed Languages . Probably the work by Searls is the most salient in this field. and proposed a formal grammar [65] corresponding to the language that can be parsed using such an algorithm. which is conjectured not to be an Indexed Language.ak n | n ≥ 1. • L(Ggenabc ) = {an (bn cn )+ | n ≥ 1} unbounded number of agreements. dependent branches There are many similarities between Linear Indexed Grammars and Global Index Grammars. in the model we present here. • L(Gmix ) = {w|w ∈ {a.. which we call Global Index Languages. String Variable Languages are a subset of Indexed Languages. b}∗ } unbounded number of copies or repeats (which allows also an unbounded number of crossing dependencies). b.3 Our proposal Unlike mildly context-sensitive grammars and related formalisms. He proposed String Variable Grammars to model the language of DNA. • L(Gwwn ) = {ww+ |w ∈ {a. • L(Gsum ) = { an bm cm dl el f n | n = m + l ≥ 1}. there is no correlation between the descriptive power (regarding the three phenomena we mentioned) and the time complexity of the recognition problem. (GILs). k ≥ 2} any number of agreements or dependencies.

and the family of Global Index Languages (GILs) in Chapter 3. INTRODUCTION (LILs). GILs are also semi-linear. although no further implications are pursued. However GIGs can generate structural descriptions where the dependencies are expressed in dependent paths of the tree. The set of Global Index Languages is an Abstract Family of Languages. We present the corresponding grammar model : Global Index Grammars (GIGs). u In Chapter 4 we discuss some of the closure properties of Global Index Languages and their relationship with other languages. and there is no correlation between the recognition problem complexity and the expressive power.2 Outline of the Thesis and Description of the Results Language Theoretic Aspects (Chapters 2-4) We define the corresponding Automaton model. 44]. In this work we will address three aspects of the problem: language theoretic issues. An abstract family of languages (AFL) is a family of languages closed under the following . We also discuss the structural descriptions generated by GIGs along the lines of Gazdar [29] and Joshi [82. a property which can be proved following the proof presented in [37] for counter automata. which we call LR-2PDAs in Chapter 2 (a significant part of this chapter was published in [18]). Therefore GILs have at least three of the four properties required for mild context sensitivity: a) semi-linearity b) polynomial parsability and c) proper inclusion of context free languages. This suggests that Linear Indexed Languages might be properly included in the family of Global Index Languages. The fourth property. is also presented in Chapter 3. We detail the properties of GILs in the following section. given they contain the MIX (or Bach) language [11]. In addition. The recognition problem for Global Index Languages (GILs) has a bounded polynomial complexity. GILs include multiple copies languages and languages with any finite number of dependencies as well as the MIX language. A subset of GIGs (trGIGs). limited cross-serial dependencies does not hold for GILs. a proof of equivalence between the grammar model and the automaton model (the characterization Theorem) and a Chomsky-Sch¨tzenberger representation Theorem are presented in Chapter 3. We show in Chapter 6 that the relevant structural descriptions that can be generated by LIGs/TAGs can also be generated by a GIG. 1.6 CHAPTER 1. parsing and modeling of natural language phenomena. The initial presentation of Global Index Languages was published in [17].

concatenation and Kleene star. The construction of the Goto function shows an interesting (though not surprising) fact about GILs: the Goto function defines a PDA that recognizes the set of viable prefixes. We also give an LR parsing algorithm for for deterministic GILs. OUTLINE OF THE THESIS AND DESCRIPTION OF THE RESULTS 7 six operations: union. e-free regular sets. Parsing (Chapter 5) We present a recognition algorithm that extends Earley’s algorithm for CFGs using a graphstructured stack [80] to compute the operations corresponding to the index operations in a GIG. This is due to the fact that GILs inherit most of CFL properties. catenation. Deterministic LR parsing techniques are relevant. The time complexity of the algorithm is O(n6 ). but the indexing mechanism could have a higher impact. Most of the properties of GILs shown in these chapters are proved using straightforward extensions of CFL proofs. LIGs. We show by construction using GIGs that GILs are closed under union. free morphisms and inverse morphisms. such as a non-deterministic Generalized LR parsing. Kleene star. The space complexity is O(n4 ). intersection with regular languages. for higher level programming languages or deterministic approaches for shallow parsing in natural language. Combinatory Categorial Grammars. The graph-structured stack enables the computations of a Dyck language over the set of indices and their complements. Tree Adjoining Grammars and Head Grammars are weakly . They are also the basis for non-deterministic approaches. e-free homomorphism. shows that the size of the grammar has the same impact as in the CFG case. We evaluated the impact of the size of the grammar and the indexing mechanism separately. We also show that GILs are closed under intersection with regular languages and inverse homomorphism (proved by construction with LR-2PDAs). for example.2.1. However it is O(n) for LR or state bound grammars and is O(n3 ) for constant indexing grammars which include a large set of ambiguous indexing grammars. O(|I|3 · |G|2 · n6 ). We also prove that GILs are semi-linear. Natural Language Modeling (Chapter 6) We present a comparison of LIGs and GIGs (some of these results were presented in [20]). We also show that GILs are closed under substitution by e-free CFLs. The result.

INTRODUCTION equivalent. Those natural language phenomena that require an extra power beyond CFLs can be dealt with GILs with much more flexibility than with LILs/TALs. Other formalisms that might share structural similarities with GIGs could be Minimalist Grammars and Categorial Grammars. Our conjecture is that it is. There is a long and fruitful tradition that has used those formalisms for Natural Language modeling and processing. We discuss the relationship of LIGs with GILs in depth in section 6.1.8 CHAPTER 1. and GILs can be represented as in figure 1. We also show that GIGs can generate trees with dependent paths. The set inclusion relation between CFLs. LCFRLs LILs CFLs ww anbncn ww + an(bncn ) + GILs Figure 1. LILs/TALs. Finally. The question still to be answered is whether the area with lines in the LILs and LCFR languages set is empty or not. GILs include CFLs by definition. we disscuss how some properties of HPSGs can be modeled with GIGs (presented in [19].2.1: Language relations . so the descriptive power of CFGs regarding by natural language phenomena is inherited by GIGs.

but behaves like a PDA.[7.. 2 E. 83. 81. also generalized models of multistacks (e. We need to guarantee that the proposed automaton model does not have the power of a Turing Machine.Chapter 2 Two Stack Push Down Automata 2. 59] [21. Restricted classes of PDA with two stacks (2-PDA) were proposed as equivalent to a second order EPDA1 .g. Those models restrict the operation of additional stacks (be embedded or ordered) allowing to read or pop the top of an additional stack only if the preceding stacks are empty. 84]). 84. The simulation of a TM by a 2-PDA is enabled by the possibility of representing the head position and the tape to the left side of the head in a TM with one stack and the tape to the right side with the second stack. 21.[31.. 85]. 9 .. The model of 2-PDA that we want to explore here is a model which preserves the main characteristics of a PDA but has a restricted additional storage capacity: allows accessing some limited left context information.2 It is well known that an unrestricted 2-PDA is equivalent to a Turing Machine (cf. (e. and n-Stack PDA. Consequently it is possible to simulate the capacity that a TM 1 See [7.g. in the sense that it is forced to consume the input from left to right and has a limited capacity to go back from right to left. 9]. or multi-store PDAs as equivalent to n-order EPDA.g.1 Automata with two Stacks Different models of 2-Stack Push Down Automata have been proposed. [41]).

.. Consequently this would produce a more restricted set of languages. Given that it is not possible to re-store them again in the auxiliary stack. However transitions that push a symbol into the second auxiliary stack do not allow moves. sb2 . and st1 . stn are stacks introduced above the current stack. In 2. We adopt the following restrictions to the transitions performed by the kind of 2-PDA we propose here: the Main stack behaves like an ordinary PDA stack (allows the same type of transitions that a PDA allows).st1 . The number of stacks is specified in each move. and the LR-2-PDA is presented in section 2. . the input must be consumed and it must be possible to transfer symbols from one stack to the other. [83. the input might be initially stored in the second stack (e. sbm are a finite number of stacks introduced below the current stack. they cannot be recovered (unless some more input is consumed). . PDAs. Moving back to the left. In the next two subsections we review some models that proposed 2-stack or nested stack automata. Its expressive power is beyond PDA (context free grammars) and possibly beyond EPDA (e.. is similar to a PDA. stack symbol)= (new state.1 EPDA and equivalent 2 Stack Machines An EPDA.10 CHAPTER 2. A more detailed comparison of TMs. 3 We might restrict even more the operation of the auxiliary stack disallowing moves that pop symbols from the auxiliary Stack. M’...g...3 we define the LR-2PDA.. it is not possible to write into the auxiliary stack. 13]).. .. sb1 . st2 .3...g. stn ) where sb1 . . st2 . “erases” the symbols as they are removed from the stack.3 These constraints force a left to right operation mode on the input in the LR-2PDA.1. In order to simulate these movements in a 2-PDA. push/pop on current stack. sb2 . either reading or replacing symbols. current state. TWO STACK PUSH DOWN AUTOMATA has to move from left to right and from right to left. except that the push-down store may be a sequence of stacks. It is initiated as a PDA but may create new stacks above and below the current stack. Then a transition function looks like (from [45]): δ (input symbol. Consequently it is possible to “use” the information stored in the auxiliary stack only once. 2. .. a 2nd order PDA in the progression hierarchy presented in [86]. sbm . because once the input is consumed.. Alternatively. TAGs).

1: Dutch Crossed Dependencies (Joshi & Schabes 97) 2 Stack automata (2-SA) were shown to be equivalent to EPDA [7. AUTOMATA WITH TWO STACKS 11 The possibility of swapping symbols from the top stack to embedded stacks produces the context sensitive power of L2 languages in Weir’s hierarchy. to recognize crossed dependencies as in the example depicted in the next figure: Figure 2. they use the additional stack in the same way as the embedded stacks are used in the EPDA. so as to separate different sub-stacks. The possible moves for a 2-SA automaton are the following [7]: • Read a symbol from the input tape . 81. for instance. Symbols written in the second stack can be accessed only after the preceding stack is empty. 59].1. It allows the NPDA.2. They also require the use of a symbol for the bottom of the stack.

is defined as follows: Definition 1 a) A TPDA is a 7-tuple M = (Q. 15. The recognition problem for growing context sensitive grammars is NP-complete ( [14]).2 Shrinking Two Pushdown Automata Recently there has been interest on Church-Rosser Languages. In [16] Buntrock and Otto’s Growing Context Sensitive Languages (GCSLs) are characterized by means of the Shrinking Two Pushdown Automata (sTPDA). 16. b}∗ } belongs to CSL \ GCSLs. 58]. where • Q is the finite set of states. The kind of automata we present implements a restriction on the writing conditions on the additional stack. The reading/writing restriction is related to the requirement that the preceding stacks be empty. But this restriction is not related to conditions on the the main stack but to conditions on the input. Γ. • remove bottom of the stack symbols. ⊥. b}∗ }. δ. F ). Σ. 2. but {an bn cn |n ≥ 1} is a GCSL. GCSLs are a proper subclass of CSLs: The Gladkij language {w#wR #w | w ∈ {a. q 0 . and the alternative restriction with respect to writing. Wartena [85] shows the equivalence of the concatenation of one-turn multi-pushdown automata restricted with respect to reading (as in the 2-SA case). • pop a symbol from the auxiliary stack provided the main stack contains the bottom of the stack symbol • create a new set of empty stacks (add a string of bottom of the stack symbols). n . GCSLs contain the non-context-free and non-semi-linear {a2 |n ≥ 0} [16] The copy language is not a GCSL {ww|w ∈ {a. 53.12 CHAPTER 2. TWO STACK PUSH DOWN AUTOMATA • push a string onto. Growing Context Sensitive Languages (defined by a syntactic restriction on context sensitive grammars) and the corresponding model of two pushdown automata (see [24. The shrinking-TPDA. the main stack • push a string onto the auxiliary stack. or pop a symbol from.1. The TPDA initializes the input in one of the stacks.

Either of these symbols may be . b) A TPDA is M is called shrinking if there exists a weight function φ : Q ∪ Γ → N+ such that for all q ∈ Q and a. LEFT RESTRICTED 2 STACK PUSH DOWN AUTOMATAS (LR-2PDAS) • Σ is the finite input alphabet. b) then φ(puv) < φ(qab).2. The definition of the transition function δ ensures that transitions with epsilon moves are allowed only if they do not push a symbol into the auxiliary stack. We use a standard notation similar to the one used in [77] or [41]. a. • ⊥ ∈ Γ \ Σ is the bottom marker of pushdown store. and • d : Q × Γ × Γ → P(Q × Γ∗ × Γ∗ ) Σ and Γ ∩ Q = ∅ 13 It can be seen that this kind of automaton needs some restriction. only if they are equivalent to a PDA transition function. i. We can consider the automaton model we present in the next section as preserving a shrinking property that conditions the use of the additional stack: it has to consume input. The current state. causing the machine to move without reading a symbol from the input or from the stacks. Part a) in the definition of the transition function is equivalent to a PDA. • Γ is the finite tape alphabet with Γ • q 0 ∈ Q is the initial state. • F ⊆ Q is the set of final (or accepting) states.2.e.2 Left Restricted 2 Stack Push Down Automatas (LR2PDAs) We define here the model of automaton that we described and proposed at the beginning of this section. The restriction is implemented using a weight function over the automaton configuration. Part b) enables transitions that affect the auxiliary stack if and only if an input symbol is consumed (i. the next symbol read and the top symbols of the stacks determine the next move of a LR-2PDA. and the requirement that every move must be weight reducing [57]. b ∈ Γ if (p. Part c) is a relaxation of the previous one and enables . u.. otherwise it is equivalent to a TM.e. 2. v) ∈ (δ. if it is not ).

q 0 . Σ is the input alphabet. 3. Σ. Definition 3 A sLR-2PDA is a LR-2PDA where δ is: a. Q is the set of states. F ⊆ Q is the set of accept states. Q × (Σ ∪ { }) × Γ × { } → P F (Q × Γ∗ × { }) and 4 The two transition types a. Γ. Γ. δ is the transition function ( where P F denotes a finite power set. Q × (Σ ∪ { }) × Γ × Γ → P F (Q × Γ∗ × { })4 5. δ. 2. F ) where Q. We keep them separate to show the parallelism with the type of productions in the grammar model. Q × Σ × Γ × Γ → P F (Q × Γ∗ × Γ2 ) c. TWO STACK PUSH DOWN AUTOMATA -moves that pop elements from the second stack.14 CHAPTER 2. . but this would rule out reduplication (copy) languages (See the introduction) as we will see below. and c. ⊥ ∈ Γ \ Σ is the bottom marker of the stacks 7. The set of languages that can be recognized by a sLR-2PDA is therefore a proper subset of the set of languages that can be recognized by a LR-2PDA. Γ is the stacks alphabet. Such a restriction could be accomplished in the sLR-2PDA case because the auxiliary stack cannot be emptied using -moves. Σ. If part c) is removed from the definition a different class of automata is defined: we will call it sLR-2PDA. ⊥. and Γ is Γ ∪ { } ) : a. can be conflated in: a’. Q × (Σ ∪ { }) × Γ × { } → P F (Q × Γ∗ × { }) and b. Q × (Σ ∪ { }) × Γ × Γ → P F (Q × Γ∗ × { }) . For Natural Language purposes it might be desirable to keep stronger restrictions on the auxiliary stack. q 0 ∈ Q is the start state 6. Definition 2 A LR-2PDA is a 7-tuple (Q. The auxiliary stack should be emptied only consuming input. 4. and F are all finite sets and 1.

⊥. plus it has an unlimited work-space. Σ. Q × Σ × Γ × Γ → P F (Q × Γ∗ × Γ∗ ) 15 The instantaneous descriptions (IDs) of a LR-2PDA describe its configuration at a given moment. A clear example of maximum transversal and input storage is the language Lr = {wwR | w ∈ Σ∗ } which can be recognized by a PDA. There is a work space (storage data structure) that also can be transversed only once (as soon there is a move to the left. δ. Reads left to right only. w. The input can be transversed as many times as desired. δ. η). ⊥. whatever remains at the right is forgotten). ζ. Z. that can be also used and reused at any time. aw. ηβ) if δ(q.3 Comparison with TM. γ 2 are strings of stack symbols. Read and Write one cell One head Figure 2.2: A Turing Machine A PDA: The input can be transversed only once. from left to right. . γ 1 . Γ. w. It has the capacity of remembering a sequence of symbols and matching it with another equal length sequence. but it cannot recognize Lc = {ww | w ∈ Σ∗ } which would require additional use of the storage capacity. Figure 2. Oβ) contains (p. ∗ is denoted by ∗ The language ac- cepted by a LR-2PDA M = (Q. F ) is a LR-2PDA. PDA and LR-2PDA A Turing Machine: the input tape is also a storage tape. The reflexive and transitive closure of M M (p. F ) is {w | (q 0 . COMPARISON WITH TM. ⊥. q 0 . q 0 . ζα. PDA AND LR-2PDA b. Γ. ⊥. O) M.3. then (q. They specify the current input. Writes left to right or same cell Independent operation: allows e-moves Moves to the left erasing.3: A PDA . Σ.2. state and stack contents. 2. Zα. An ID is a 4-tuple (q. w. γ 2 ) where q is a state w is a string of input symbols and γ 1 . ⊥)} for some p in F . a. ⊥) (Acceptance by empty stacks) (p. If M = (Q.

However. This exemplifies how many times (and the directions in which) the same substring can be transversed. (above) . a. the second storage can be written to only when consuming input. The following languages which can be recognized by an LR-2PDA are examples of a maximum use of the storage of the input: L2ra = {wwR wR w | w ∈ Σ∗ } and L2rb = {wwR wwR | w ∈ Σ∗ }. and store the symbols of the second copy back A loop back from state q 3 to state q 2 allows recognition of the language of any finite number of copies (example 2). (q 1 . Transfer from one stack to the other is restricted. au) (recognize the second copy using the symbols stored in the main stack. TWO STACK PUSH DOWN AUTOMATA A LR-2PDA: The input can be transversed only once. a. . While recognizing the second copy all the information stored about the first copy is lost. In order to avoid the possibility of transferring symbols from one stack to the other indefinitely. a. ) = (q 1 .16 CHAPTER 2. . (q 3 . then the possibility of storing information from the input seen at this move is lost. A sLR-2PDA cannot recognize the copy language: if the auxiliary stack is used to store all the symbols of the input tape then it would be of no more use than storing all the symbols in the main stack: the symbols can only be transferred from the auxiliary stack to the main stack only if the input tape is being read. . a) = (q 2 . The crucial fact is that transitions type c. from left to right. Consider the following transitions (where a is a symbol in Σ). 1. ) (transfer symbols from auxiliary to main stack) 3. The corresponding machine is detailed below in the exsection 2. u) = (q 3 . a. given the constraints imposed on LR-2PDAs.4. an LR-PDA can recognize the language L3 = {www | w ∈ Σ∗ }. . . if information from the first ordered stack is transferred to the second auxiliary stack. a LR-2PDA is not able to transverse a substring indefinitely. (q 2 . but it can store again in the second stack (the second copy). whatever remains at the right is forgotten). but unlike a TM. a) (store the symbols of the first copy) 2. This capacity is reduced even further in the case of sLR-2PDA: both types of operations on the auxiliary stack are made dependent on consuming input. There are two work- spaces which also can be transversed only once (as soon there is a move to the left. consequently what is being read cannot be stored in the main or the auxiliary stack if there is a transferral occurring.

{x}.4. EXAMPLES OF LR-2PDAS Reads left to right only. However the language L = {wuw | u. Dependent moving (erasing) Figure 2. Independent moving. Writes left to right or same cell Independent both operations.4: LR-2PDA are not allowed.2. ⊥. q 3 ) where δ: .5: sLR-2PDA 2. b. δ. Writes left to right or same cell Transfer NOT possible Dependent writing from 1. w ∈ Σ∗ and |w| ≤ |u|} is recognized by a sLR-2PDA. Reads left to right only. q 2 . q 0 . e}. Figure 2. Example 1 (Multiple Agreements) . Transfer possible Dependent writing from 1. Writes left to right or same cell Moves to the left erasing. Independent both operations. 17 Writes left to right or same cell Moves to the left erasing. q 1 . Examples 2 and 3 are LR-2PDAs. d.4 Examples of LR-2PDAs The first example is a sLR-2PDA. {a. Moves to the left erasing. c. M 5 = ({q 0 . q 3 }. Moves to the left erasing.

a’$) Idem 2 (b. ⊥) = {(q 1 . ⊥. ⊥. ε ) 1 (a.a’) = (cc. ⊥. . x. ⊥. xx. $ .a’) = ($. $) ( d . ε ) = (aa. a’ ) = ( ε. x. TWO STACK PUSH DOWN AUTOMATA Four Counting Dependencies M2 Five Counting dependencies M3 (a. ⊥) = {(q 1 . ⊥.a. ε) = (a$. x) = {(q 2 . .. )} L(M 5 ) = {an bn cn | n ≥ 1} ∪ {an bn cn dn | n ≥ 1} ∪ {an bn cn dn en | n ≥ 1} It can be easily seen that the following is a proper generalization: Claim 1 For any alphabet Σ = {a1 . )} 10. ε ) Idem 3 (c. where k > 3. x) = {(q 1 ..a. x) = {(q 2 . c . x) = {(q 2 .a’) = ($. δ(q 0 . c’c’) ( e .$. b. c . $ . ⊥) = {(q 2 . ε ) ( [] . ⊥)} 2. $ .$. e. d. ε) ( d . )} 6.. xx. ⊥) = {(q 1 . $) = ( ε. x⊥). a. ⊥. δ(q 1 . )} 7. ⊥) = {(q 1 . c. $ . c . ε ) (b. (q 2 . c. ε ) 4 ( d . xx} 9. ⊥. ⊥)} 3. x. δ(q 1 .an | n ≥ 1} 1 2 k . ak }. ⊥)} 8. c’) = ( $ . ε ) ( [] . c’) = ( $ . . $ ) = (ε .. $ .a’a’) (c. d. $) = accept 6 Figure 2.a’) = (c$. ⊥. a. δ(q 2 . c . δ(q 2 . b. x. c. c’) = ( ε. (q 1 . x.18 Three counting dependencies M1 0 CHAPTER 2. δ(q 1 . c’$) 4 4 ( d . )} 11. ε ) 3 ( [] . $) = accept 5 5 ( e. x) = {(q 2 . $) = accept (c. x⊥)} 4. ε ) (c. c . δ(q 1 . x⊥.. there is an sLR-2PDA that recognizes the language L(M k ) = {an an . ). $) = ( ε. δ(q 1 . x) = {(q 1 . d. δ(q 1 . . ⊥)} 12. xx}) 5. e. ⊥.a.$. . δ(q 2 . δ(q 1 . . x⊥. x.6: Multiple agreement in an sLR-2PDA 1. δ(q 1 . . $ . x. x) = {(q 1 . ε ) = ( ε.

y⊥)} 3. x. δ(q 1 . y. xw. b. ⊥) = {(q 1 . q 2 ) where δ is as follows. δ(q 0 . δ(q 1 . )} 7. δ(q 1 . y) = {(q 2 . ak −1 . ae . w. ae ⊥)} 8. x⊥. b. ⊥. ⊥. δ. (q 3 . . ⊥. Σ. . u) = {(q 3 . ⊥. . In the next example. y}. b}. q 3 }. . δ(q 2 . ⊥)} if k is even. b. y) = {(q 2 . ⊥)} 11. ⊥. ⊥) = {(q 1 . ae−1 . a2 ) = {(q 1 . δ(q 0 . δ(q 2 . x) = {(q 2 . e ≥ 3 < k and o is odd and e is even: 1. a1 . y⊥. w. δ(q 3 . . ⊥. ⊥) = {(q 2 . δ(q 1 . ao−1 ) = {(q 1 . EXAMPLES OF LR-2PDAS Proof Construct the sLR-2PDA M k as follows: 19 M k = ({q 0 . δ(q 2 . ⊥. ⊥. transitions 1 to 4 recognize the first occurrence of w. ⊥) = {(q 3 . δ(q 1 . δ(q 1 . . a. . . a1 a1 . b. δ(q 3 . )} L(M 4 ) = {ww+ |w ∈ {a. ⊥)} 2. . transitions 9 to 12 recognize either the following copy or the last copy. q 0 . )} if k is odd or 10. )} 6. (q 3 . ⊥) = {(q 1 . ⊥. Example 2 (The language of multiple copies) M wwn = ({q 0 . δ(q 3 . a. such that o. {x.2. x) = {(q 2 . ⊥)} 12. δ(q 1 . ⊥) = {(q 1 . . xu). a1 . )} 14. )} . u) = {(q 1 . . ⊥. ⊥. u) = {(q 1 . ⊥)} 13. y) = {(q 2 . (q 3 . ao ⊥. . ao . y. )} 6. a1 . ⊥. (q 3 . )} 7. ao−1 ) = {(q 1 . xu)} 4. yw. ae−1 . . yu). ⊥. q 3 ) where δ (s. . a. ak . b}+ } 8. . δ(q 1 . ao . δ(q 1 . q 1 . yu)} 5. ⊥) = {(q 3 . y⊥). x⊥)} 2. ⊥. x⊥. δ(q 1 . . ak −1 ) = {(q 2 . ae ae } and 9. a2 a2 }) 5. u) = {(q 3 .4. transitions 5 to 8. ⊥. q 2 . q 0 . δ. x) = {(q 2 . ⊥) = {(q 1 . . x. . {a. Σ. ⊥)} 10. a1 . u is any symbol in the vocabulary): 1. ⊥) = {(q 1 . a. ae . δ(q 1 . δ(q 1 . q 1 . ae ) = {(q 1 . ⊥)} 3. a1 . δ(q 3 . )} 9. q 2 }. y⊥. x⊥). If an intermediate copy is recognized transitions 13 and 14 allow going back to state 2 and reverse the order of the stored symbols. δ(q 2 . a2 . ⊥. δ(q 0 . δ(q 1 . ⊥. reverse the order of the stored symbols. ⊥. a1 ⊥. . ao ao . ak . a2 .t. a2 ⊥)} 4. ao .

I) is empty for all a ∈ Σ. z⊥. yz. . ⊥. δ(q 3 . )} 13. d. m. . ⊥)} 14. δ(q 1 . ⊥) = {(q 1 . yy. Z. x) = {(q 1 . TWO STACK PUSH DOWN AUTOMATA Example 3 (Crossed dependencies) M cr3 = ({q 0 . c. xx)} 3. . e. whenever δ(q. yx)} 4. xy. y. δ(q 1 .5 Determinism in LR-2PDA An LR parser for a CFL is essentially a compiler that converts an LR CFG into a DPDA automata [41. f. I ∈ Γ. A. c. y) = {(q 1 . l ≥ 1} n m l n m l 9. y. Deterministic GILs are recognized in linear time as we mentioned in the introduction. ⊥) = {(q 3 . δ(q 3 . ⊥. . Z. δ(q 1 . and a ∈ Σ ∪ { } does δ(q. ⊥) = {(q 3 . δ. I) is empty for all I ∈ Γ. zy)} 6. a. I) is nonempty. . e. q 3 ) where δ: 1. )} L(M cr3 = {a b c d e f | n. {a. δ(q 2 . b. zz)} 7. δ(q 0 . δ(q 2 .20 CHAPTER 2. q 3 }. . Z. Z. ⊥)} 2. y. for each q ∈ Q. ⊥. then δ(q. ⊥. for each q ∈ Q and Z. I) contain more than one element. x. . I ∈ Γ. δ(q 1 .5. Therefore understanding the deterministic LR-2PDA is crucial for obtaining a deterministic LR parser for GILs defined in chapter 6. f }. ⊥. ) is nonempty. zz. Z. y) = {(q 1 . a. Z. y. b. δ(q 2 . δ(q 2 . yy)} 12. q 1 . z) = {(q 1 . x⊥)} 2. z. z. x) = {(q 1 . )} 10. 3. then δ(q. y) = {(q 1 . z) = {(q 1 . y) = {(q 1 . ⊥. ⊥. q 2 . z. ⊥. . ⊥. d. δ(q 1 . )} 8. c. ⊥)} 15. ⊥. . δ(q 3 . for no q ∈ Q. . x) = {(q 1 . ⊥. 2.1 Deterministic LR-2PDA Definition 4 A LR-2PDA is deterministic iff: 1. {x. ⊥. ⊥) = {(q 3 . I ∈ Γ. . ⊥. δ(q 1 . )} 11. a. b. a. x. The corresponding definition of a deterministic LR-2PDA is as follows: 2. z) = {(q 2 . d. δ(q 2 . ⊥. ⊥)} 5. z}. 2]. A. q 0 . ⊥) = {(q 3 . whenever δ(q. A ∈ Σ and Z.

i) 3. We can regard to be an abbreviation for all the possible symbols in the top of the stack. for no q ∈ Q. Condition 2 prevents the choice of move for any equal 4-tuple. I) is empty for all a ∈ Σ. Z. j) = (q.5. whenever δ(q. a. j) 4. 3. 1. (q. I j ) such that I i = I j . . for each q ∈ Q and Z. a. whenever δ(q. I) is empty for all I ∈ Γ. . Z. Therefore. ) = (q. (q. ) = (q. i) = (q.5. The construction of the LR(k) parsing tables would show whether the indexing mechanism for a given GIG is non-deterministic. A. If the non-determinism is in the CFG backbone only we can guarantee that the recognition problem is in O(n3 ). a. I) is nonempty. Z j . Z. I ∈ Γ. . Z. then δ(q. (q. . ) 2. . then δ(q. Z. 2. I i ) and (q j .2 LR-2PDA with deterministic auxiliary stack Even if a GIG grammar is non-deterministic. I) contain two elements = (q i . . . Z. Definition 5 A LR-2PDA has a deterministic indexing. . I ∈ Γ. the first case is not compatible with the third. A ∈ Σ and Z. a. and a ∈ Σ ∪ { } does δ(q. for each q ∈ Q. a. j) 2. DETERMINISM IN LR-2PDA 21 Condition 1 prevents the possibility of a choice between a move independent of the input symbol ( -move) and one involving an input symbol. in the following examples of transitions. Z i . because they imply a non-deterministic choice. A. it might be an advantage to be able to determine whether the non-determinism lies in the CFG back-bone only and the indexing mechanism does not introduce non-determinism. (q. or is a deterministic indexing LR-2PDA if and only if: 1. . Condition 3 prevents the possibility of a choice between a move independent of the second stack symbol ( -move) and one involving a symbol from the stack. nor with the fourth. b. I ∈ Γ. ) is nonempty.2. .

22 CHAPTER 2. TWO STACK PUSH DOWN AUTOMATA .

a string in I ∗ .e.. A → α b. strings in (V I ∗ ∪ T )∗ . Let β and γ be in (V I ∗ ∪ T )∗ . The class of LILs contains L4 but not L5 (see Chapter 1). 23 . on sentential forms. where N is the set of non-terminal symbols. As a consequence they are semi-linear and belong to the class of MCSGs. An Indexed Grammar is a 5-tuple (N. (IGs) [1]. P. The relation derives. T the set of terminals. T. S).1 Indexed Grammars and Linear Indexed Grammars Indexed grammars. and X i in V ∪ T . i is in I .LILs) [29]. δ be in I ∗ . I..] c. A[..Chapter 3 Global Index Grammars 3. and P is a finite set of productions of the form: a. and Linear Index Grammars. (LIGs. LIGs are Indexed Grammars with an additional constraint on the form of the productions: the stack of indices can be “transmitted” only to one non-terminal..] → B[i.] → [.. IGs are not semi-linear (the class of ILs contains the language {a2 | n ≥ 0}).]α n where A and B are in V . I the set of indices. S in V is the start symbol. [.] represents a stack of indices. and α is in (V ∪ T )∗ . i. is defined as follows. A[i. have the capability to associate stacks of indices with symbols in the grammar rules.. ⇒.

d}.] A[. {a}. these grammars provide a global but restricted context that can be updated at any local point in the derivation. B[ ] → 3.. {i}.2 Global Index Grammars In the IG or LIG case.] → α B[..] γ c..X k is a production of type a.. P. In this sense.] → aS[i.] A[i.] → B[x. A[....] → bB[.] X 1 ...X k δ k γ where δ i = δ if X i is in V and δ i = if X i is in T... If A[. S).] → B[... {i}. where P is: S[.. Example 4 L(G1 ) = {a2 n ≥ 0}.]A → [. A[.. It is a grammar that controls the derivation through the variables of a CFG.] → αB[i. S[. If [x. then βAδγ ⇒ βX 1 δ 1 .24 CHAPTER 3.]d. The proposal we present here uses the stack of indices as a unique designated global control structure.] → α B[..] → A[. P. This feature makes the use .].. where A and B are non terminals and α and γ are (possible empty) sequences of terminals and non terminals: a. If A → X 1 . then βAxδγ ⇒ βX 1 δ 1 ..] A[] → a A Linear Indexed Grammar is an Indexed Grammar where the set of productions have the following form.. A[i.] γ Example 5 L(G1 ) = {an bn cn dn |n ≥ 0}... B}... GLOBAL INDEX GRAMMARS 1.] is a production of type b. G1 = ({S. G1 = ({S..] γ b. S) where P : S[.... GIGs are a kind of regulated rewriting mechanism [25] with global context and history of the derivation (or ordered derivation) as the main characteristics of its regulating device.X k is a is a production of type c. The introduction of indices in the derivation is restricted to rules that have terminals in the right-hand side. 2.. then βAδγ ⇒ βBxδγ 3. A}.X k δ k γwhere δ i = δ if X i is in V and δ i = n if X i is in T.].]c.] → A[. B[i.] → S[i. b.] A[. S[. c... the stack of indices is associated with variables. {a...

]α (epsilon rules or context free (CF) rules ) (epsilon rules or CF with constraints) (push rules or opening parenthesis) (pop rules or closing parenthesis) b. Definition 6 A GIG is a 6-tuple G = (N.. The constraint on push rules is a crucial property of GIGs. P ) where N.]A → [. without it GIGs would be equivalent to a Turing Machine. It also makes explicit that the operations are associated to the computation of a Dyck language (using such notation as used in e.X k γ Using a different notation: δ#βAγ ⇒ δ#βX 1 .1 or context free ) xδ#βAγ ⇒ xδ#βX 1 .]A → [x. [39]).]A → [. If A → X 1 .1 A → α a. I.. A → α x ¯ Note the difference between push (type b) and pop rules (type c): push rules require the righthand side of the rule to contain a terminal in the first position. α. A → a β x c.. This string of indices is not associated with variables. Let β and γ be in (N ∪ T )∗ . T. having the following form.1 where x ∈ I. which are strings in I ∗ #(N ∪ T )∗ as follows.]a β [x..N . We define the derives relation ⇒ on sentential forms..X k is a production of type a. T. S..2.X k γ) (production type a. y ∈ {I ∪ #}..e. The notation at the right is intended to be more similar to the notation used in IGs and LIGs. δ be in I ∗ . w be in T ∗ and X i in (N ∪ T ). β ∈ (N ∪ T )∗ and a ∈ T . and allows the kind of recognition algorithm we propose in Chapter 5..3. µ = µ or µ = [x].X k γ (production type a. x in I. I are finite pairwise disjoint sets and 1) N are non-terminals 2) T are terminals 3) I a set of stack indices 4) S ∈ N is the start symbol 5) # is the start stack symbol (not in I. 1. . so we can consider them global..]α [. in a linguistic sense.2 A → α [y] or or or or A→α [. Pop rules do not require a terminal at all. A ∈ N .2) [x] 1 The notation at the left makes explicit that operation on the stack is associated to the production and not to terminals or non-terminals. x ∈ I) then: δ#βAγ ⇒ δ#βX 1 . (i. Derivations in a GIG are similar to those in a CFG except that it is possible to modify a string of indices.... GLOBAL INDEX GRAMMARS 25 of indices dependent on lexical information. #..g. In the next subsection we present an even more restricted type of GIG that requires both push and pop rules in Greibach Normal Form.T ) and 6) P is a finite set of productions.. a. An additional constraint imposed on GIGs is strict leftmost derivation whenever indices are introduced or removed by the derivation.

... x ∈ I.X n γ ) x ¯ ∗ The reflexive and transitive closure of ⇒ is denoted as usual by ⇒. If A → aX 1 .) or pop : µ = x. ∗ 3.] a β . In IGs the stacks of indices are distributed over the non-terminals on the right-hand side of the rule.. If A → X 1 . GIGs can have rules where the right-hand side of the rule is composed only of terminals and affects the stack of indices. GLOBAL INDEX GRAMMARS This is equivalent to a CFG derives relation in the sense that it does not affect the stack of indices (push and pop rules).X n is a production of type (b. α... A ∈ N .. where x ∈ I. but to an extreme: there is only one stack to be considered..) rules in GIGs. A → a β x ¯ or [x.. In LIGs indices are associated with only one non-terminal at the right-hand side of the rule. with the consequence that LILs are semilinear.X n γ ) x 3. is the interpretation of the derives relation relative to the behavior of the stack of indices.X n γ ( or xδ#wAγ ⇒ δ#wX 1 . x ∈ I.. the stack of indices in a GIG is independent of non-terminals in the GIG case.26 CHAPTER 3.]A → [.X n is a production of type (c. IGs. are as follows. Definition 7 A trGIG is a GIG where the set of production of types (c) (pop) rules. then: µ δ#wAγ ⇒ xδ#waX k . This produces the effect that there is only one stack affected at each derivation step. We define the language of a GIG G.. β ∈ (N ∪ T )∗ ... L(G) to be: {w|#S ⇒ #w and w is in T ∗ } It can be observed that the main difference between.) or push: µ = x. then: ¯ xδ#wAγ ⇒ δ#wX 1 . and a ∈ T : c.) are constrained to start with a terminal in a similar way as push (type b..X n γ µ ( or δ#wAγ ⇒ xδ#waX 1 .. LIGs and GIGs.. x ∈ I.1 trGIGS We now define trGIGs as GIGs where the pop rules (type c.b) (in other words push productions must be in Greibach Normal Form). GIGs share this uniqueness of the stack with LIGs.2. The derives definition requires a leftmost derivation for those rules (push and pop rules) that affect the stack of indices. We also introduce some examples of trGIGs modeling multiple agreements and crossed dependencies. Unlike LIGs and IGs.. Indeed push rules (type b) are constrained to start the right-hand side with a terminal as specified in GIG’s definition (6. 2.

D1 . P ) and P is: S → ACE C → cD ¯ i 27 A → aAb i A → ab i ¯ j ¯ j C → cD1 ¯ i D1 → CD D→d j E → eE E→e The derivation of w = aabbccddee: #S ⇒ #ACE ⇒ i#aAbCE ⇒ ii#aabbCE ⇒ i#aabbcD1 E ⇒ i#aabbcCDE ⇒ #aabbccDDE ⇒ j#aabbccdDE ⇒ jj#aabbccddE ⇒ j#aabbccddeE ⇒ #aabbccddee Example 7 (crossing dependencies) L(Gcr ) = {an bm cn dm | n. e}. {a1 . D → d D | d x ¯ Now we generalize example 6 and show how to construct a trGIG that recognizes any finite number of dependencies (similar to the LR-2PDA automaton presented in the previous chapter): Claim 2 The language Lm = {an an . E. c}.an | n ≥ 1. g }. d. A. G5 = ({S. m ≥ 1}.ak | n ≥ 1. R. a 4 . d}. P ) and P is: S → AR L → OR | C A → aAE ¯ i A→a ¯ i E→b i R→bL i C→cC|c O → c OE | c . {x and P is: 1. S→ a1 E 2 4a. {a. {a. E 2 . O3 .. Ak → ak 6b.E i → ai E i ai ai−1 ¯ 2. C... S → A D 2. and P is composed by: 1. A → a A c | a B c 3. .3. E i → ai Oi+1 ai and for every E i and Oi such that i is odd in Oi and i is even in E i add the following rules: 5a. {a.. ak }. {a 2 . O. a j }. S. E}.. b.. GLOBAL INDEX GRAMMARS Example 6 (multiple agreements) L(G5 ) = {an bn cn dn en | n ≥ 1}. ... c. C}. S. 4 ≤ k} We can generalize the same mechanism even further as follows: Example 8 (Multiple dependencies) L(Ggdp ) = { an (bn cn )+ | n ≥ 1}. S. b. #. Oi → ai E i+1 If k is even add: If k is odd add: n n 3b.Ak → ak Ak 5b. B. Ak → ak Ak ak −1 ¯ n 4b. S → a1 S E 2 3a. {i}. c... #. where Gc r = ({S.. D. L}. Ggdp = ({S.. Ak }. A. P ) such that k ≥ 4 and j = k if k is even or j = k − 1 if k is odd. k ≥ 4} is in trGIL 1 2 k Proof Construct the GIG grammar Gk = ({S. .2. {a . b. Ok → ak ak −1 ¯ L(Gn ) = {a1 a2 . B → b B | b x 4. #. Oi → ai Oi E i+1 ai−1 ¯ 6a. A..

C. {a. j}.28 CHAPTER 3. b}. {i. R → Ra | a ¯ i 5. f }. S → R 4. P ) and P = S → AS | BS | C B→b j ¯ i C → RC | L L → Lb | b ¯ j R → RA ¯ i R → RB ¯ j R→ [#] A→a i L → La | a The derivation of ababab: #S ⇒ #AS ⇒ i#aS ⇒ i#aBS ⇒ ji#abS ⇒ ji#abC ⇒ ji#abRC ⇒ i#abRBC ⇒ #abRABC ⇒ #abABC ⇒ i#abaBC ⇒ ji#ababS ⇒ ji#ababL ⇒ i#ababLb ⇒ #ababab In the next example. C}. we mentioned the difference between push and pop rules in GIGs. {i. This difference enables the use of left recursive pop rules so that the order of the derivation is a mirror image of the left-right order of the input string. j.2. b}∗ } Gww = ({S. e. B. R → Rb | b ¯ j The derivation of the string abbabb: #S ⇒ i#aS ⇒ ji#abS ⇒ jji#abbS ⇒ ji#abbRb ⇒ i#abbRbb ⇒ #abbRabb ⇒ #abbabb Example 10 (Multiple Copies) L(Gwwn ) = {ww+ | w ∈ {a. A. {a. S → bS j 3.2 GIGs examples We conjecture that the following languages can be defined with a GIG and cannot be defined using a trGIG. j}. It is easy to see that by generalizing the same mechanism any finite number of crossing dependencies can be generated. {i. Example 9 (Copy Language) L(Gww ) = {ww |w ∈ {a. B. E}. S. d. P ) and P = . GLOBAL INDEX GRAMMARS The derivation of the string aabbccbbcc shows five dependencies. S. This is not possible in trGIGs because pop rules cannot be left recursive. c. #. S. b. R. #S ⇒ #AR ⇒ #aAER ⇒ #aaER ⇒ i#aabR ⇒ ii#aabbL ⇒ ii#aabbOR ⇒ i#aabbcOER ⇒ #aabbccER ⇒ i#aabbccbRii#aabbccbbL ⇒ ii#aabbccbbC ⇒ i#aabbccbbcC ⇒ #aabbccbbcc 3. Above. #. L. {a. P ) and P = 1. S → aS i 2. Example 11 (Crossing Dependencies) L(Gcr3 ) = {an bm cl dn em f l } Gcr3 = ({S. D. b}∗ } Gwwn = ({S. k}. b}. #. we can see that by using left recursive pop productions we can generate a language with a higher number of crossing dependencies than we can by using a trGIG. R}. F.

Example 12 (MIX language) Gmix = ({S}. GLOBAL INDEX GRAMMARS 1. see e. k}. Joshi p. b. obtaining sets of crossing dependencies. There are also factorial duplicates for the number of times a character occurs in the string.g. F → aF | aB i ¯ j 4. S → F L ¯ k 29 3. It was conjectured in [29] that the MIX language is not an IL. This is important because it is very difficult to build a proof for the claim that the MIX language belongs (or does not belong to) to a family of languages 2 . L → Lf | Ef 6. S. as exemplified by Lmcr = {an bm cl dn em f l g n hm il } or {an bm cl (dn em f l )+ } The next example shows the MIX (or Bach) language (the language with equal number of a’s b’s and c’s in any order. and 1680 strings of length 9). . however it is not so easy to prove or assess whether the 2 A. #. {a. We show that GILs are semilinear. It allows an incredible number of possible strings of any given length in the language.c. b’s and c’s) are observed. j.2.3. turns out to be a very challenging problem. b. D → Dd | d This can be even further generalized. P ) and P is: S → cS i ¯ i ¯ j S → bS j S → aS k S → SaSbS | SbSaS S → SaScS | ScSaS S → SbScS | ScSbS ¯ k S→ L(Gmix ) = Lmix = {w|w ∈ {a. In the mix language each character occurs in one third of the string and there are three characters. [11] ). {i. E → Ee | De 7. and at the same time it requires that three dependencies be observed. The number of strings of length 3n is (3n)!/(n!)3 . S ⇒ k#aS ⇒ #aSbScS ⇒ #abScS ⇒ j#abbcS ⇒ #abbcScSaS ⇒ #abbccSaS ⇒ #abbccaS ⇒ #abbcca We present here the proof that L(Gmix ) = Lmix . This language though conceptually simple. The number of permutations for a string of length n is n!. It is easy to design GIG grammars where the respective languages are in Lmix . and the need to ensure that the three dependencies (between a’s. c}∗ and |a|w = |b|w = |c|w ≥ 1} Example of a derivation for the string abbcca. c}. C → cC | c k 5. B → bB | bC j ¯ i 2. The difficulty is due to the number of strings in the language at the basic combination level (there are 90 strings of length 6. therefore ILs and GILs could be incomparable under set inclusion.

where ¯ ¯ ¯ ¯ |uwyz| = n. S ⇒ δ#uS ⇒ kδ#uaS ⇒ δ#uaSbScS ⇒ δ #uawbScS But at this point the strings b and c might block a possible derivation. we reach the following point: ∗ ∗ ∗ ∗ . and t are members of the pairs that remove indices in the derivation. w = w c2 and y = a2 y b2 trigger the following derivation (perhaps the only one). This blocking effect can be illustrated by the following hypothetical situation: suppose uwyz might be composed by u = u b1 . b. 1. b s and c s due to the constraint imposed by the indexing mechanism.30 CHAPTER 3. Proof . S ⇒ k#a ⇒ #acb k j j i i S ⇒ j#b ⇒ #bac ¯ j ¯ j S ⇒ j#b ⇒ #bca S ⇒ i#b ⇒ #cba ¯ i ¯ i S ⇒ i#b ⇒ #cab Inductive Hypothesis: Assume for any string uwyz in Lmix then uwyz is in L(GMIX ). Second direction: Lmix is in L(Gmix ) Basis n = 0. n = 3: S ⇒ k#a ⇒ #abc k ¯ k ¯ k is clearly in the language. We need to prove that ut1 wt2 y t3 z is in L(GMIX ) ( |uti wti y ti z| = n + 3). It can be seen that all the derivations allow only equal number of a s. S ⇒ jδ #u bS ⇒ δ#u bSaScS ⇒ iδ #u bw caScS ⇒ δ #u bw caay bcS If we try to combine the derivation proposed in 1. y = a1 y c1 z. GLOBAL INDEX GRAMMARS language is indeed Lmix . Where ¯ ¯ t1 t2 t3 is any string of length three in Lmix and t designates the terminals that introduce the indices ¯ in the derivation. n ≥ 0. 2. c}∗ and |a|w = |b|w = |c|w ≥ 0}. with the one proposed in 2. We show ¯ ¯ that Gmix generates any uti wti y ti z It is trivial to see that the following derivation is obtained (where a corresponds to tk and b and c ¯ to the tk ’s. First direction: L(Gmix ) is in Lmix = {w|w ∈ {a. It might just turn out to be a significant subset of Lmix (in other words it is not so easy to figure out if there are some set of strings in Lmix that might not be generated by a particular grammar).

3.. there is more than one element in one of the indices : ¯¯ ¯¯ ti tj (ti )n [tj tj (ti ti )n+1 ] for example: ab(a)n [cacb](cb)n ab(a)n [accb](cb)n S ⇒ ti S[ti ti ] reduces to the following problem which is derived by the embedded S ¯ ¯ ¯ ¯ tj (ti )n [tj ..: baScacbS where the two non terminal S expand the ti n−1 triples. This in turn can be easily derived by: δ#S ⇒ jδ#bS ⇒ δ#baScS ⇒ in−1 δ#baan−1 cS ⇒ kin−1 δ#baan−1 caS ⇒ in−1 δ#baan−1 cacbS ⇒ δ#baan−1 cacb(cb)n−1 Claim 4 For any sequence of two possible conflicting indices there is always at least a derivation in Gmix . Claim 3 For any sequence of possibly conflicting indices the conflicting indices can be reduced to two conflicting indices in a derivation of the grammar Gmix .. is there any possible combination of indices : ¯ ¯ ¯ ¯ ¯ ¯ ti · · · tj · · · tk · · · tj · · · tk · · · ti · · · tj · · · tk · · · ti that cannot be derived by GMIX ? Remember t designates the terminals that introduce the indices ¯ in the derivation. because the grammar is highly ambiguous.. there are three different indices (ti = tj = tk ): ti utj vtk . In other words.2. Case 1. We need to account whether there is a possible configuration such that a conflict of indices arises. S ⇒ jδ #u b1 S ⇒ kjδ #u b1 a0 S ⇒ jδ #u b1 a0 Sb0 Sc0 S ∗ 31 At this point the next step should be the derivation of the non-terminal S at b0 Sc0 .(ti . This cannot be done because the derivation has to proceed with the preceding S (at a0 Sb0 ) due to the leftmost derivation constraint for GIGs. GLOBAL INDEX GRAMMARS 3.e. tk . We show now that this situation is impossible and that therefore Lmix is in L(GMIX ). We prove now that such a blocking effect in the indexing is not possible: there are always alternative derivations. tj are reduced to the case of two conflicting indices. . removing the index j. Case 2. there is no guarantee that the necessary sequence of indices are removed. and t are members of the pairs that remove indices in the derivation.. clearly S ⇒ i#ti S ⇒ #ti Stj Stk S and the complements of ti .tj ..ti )n ] And this problem is reduced to: ¯¯¯¯ tj ti S tj tj ti ti S i. Therefore..

The well-known Chomsky-Sch¨tzenberger theorem [22]. ¯ ¯ ¯ ¯ S ⇒ i#uti S ⇒ #uti S ti S ti S ⇒ j#uti vtj ti S ti S ⇒ ¯ ¯ ¯ ¯ ¯ ¯ ∗ ¯ ¯ ¯ ¯ j#uti vtj ti xti S ⇒ #uti vtj ti xti S tj S tj ⇒ #uti vtj ti xti z tj y tj Similar alternatives are possible for the remaining combinations: ¯ ¯ ¯ ¯ uti v ti wtj xti z tj y tj ¯ ¯ ¯ ¯ uti vtj wtj xti z tj y ti ¯ ¯ ¯ ¯ uti vtj wti xtj z tj y ti ¯ ¯ ¯ ¯ uti v ti wtj xtj z ti y tj ¯ ¯ ¯ ¯ uti vtj wtj xti z ti y tj ¯ ¯ ¯ ¯ uti vtj wti xtj z ti y tj ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ However the last one requires some additional explanation. GLOBAL INDEX GRAMMARS Assume the possible empty strings u.e. x. Therefore we conclude that there is no possible blocking effect and there is always a derivation: S ⇒ #uawbycz ∗ ∗ ∗ ∗ We also used the generate-and-test strategy to verify the correctness of the above grammar Gmix for Lmix and two other grammars for the same language. 3. z and y do not introduce possible blocking indices (i. etc. Formally: S ⇒ #uS ⇒ #uwS ⇒ #uwxS ⇒ #uwxzS ⇒ #uwxzy Therefore for the following combination: ¯ ¯ ¯ ¯ ti utj wti xti z tj y tj : the following derivation is possible.3 GILs and Dyck Languages We argue in this section that GILs correspond to the result of the “combination” of a CFG with a Dyck language. they are also removed in the derivation of the substring). Let us assume the ti triple corresponds to a(bc) and tj triple corresponds to b(ca) therefore it is: uai vbj wbi xcj zci yaj (or uai vbj ci xcj zbi yaj . The tests were performed on the strings of length 6 and 9. given we are considering just two possible conflicting indices. w.) It can be seen that there is an alternative derivation: S ⇒ k#uai vS ⇒ #uai vbj Scj S ⇒ j#uai vbj wbi xcj S ⇒ #uai vbj wbi xcj Sci Saj ⇒ #uai vbj wbi xcj zci yaj .32 CHAPTER 3. This assumption is made based on the previous two claims. shows that any CFG is u . if indices are introduced.

φ(¯ = i) if a ∈ T . R is a regular set and φ is a homomorphism [39]. has the power to compute the Dyck language of the vocabulary of indices relative to their derivation order. there is an integer r. which results in a PDA. T and I are pairwise disjoint and |T ∪ I| = r ¯ ¯ The alphabet for the semi-Dyck set will be Σ0 = (T ∪ I) ∪ (T ∪ I). a CFL and a homomorphism φ such that L = φ(Dr ∩CF L). This stack of indices. GILs include languages that are not context free. This “combination” is formally defined in the CFG case as follows: each context-free language L is of the form. Theorem 1 (Chomsky-Sch¨ tzenberger for GILs) . such that α1 and β 1 ∈ (N ∪ T T )∗ as follows: 1. S. . Σ0 . #. I. β ∈ (N ∪ T )∗ create a new ¯ production p1 ∈ P 1. GILS AND DYCK LANGUAGES 33 the result of the “combination” of a Regular Language with a Dyck Language. if i ∈ I. Define a CFG grammar G1 = (N. Dyck languages can also provide a representation of GILs. L = φ(Dr ∩ R). S 1 . Let Dr be the semi-Dyck set over Σ0 . P ). T. GILs can be represented using a natural extension of Chomsky-Sch¨tzenberger u theorem (we will follow the notation used in [39]).3. Push and pop moves of the stack have the power to compute a Dyck language using the stack symbols. where D is a semi-Dyck set. i ∈ I. φ(¯) = a φ(i) = . As we have seen above. where G = (N T. Define φ as the homomorphism from Σ0 ∗ into T ∗ determined by φ(a) = a. P 1) such that P1 is given according to the following conditions. u For each GIL L. if p = A → αaβ then p1 = A1 → α1 a¯β 1 a 2. and α. Proof Let L = L(G). if p = A → α then p1 = A1 → iα1 i 3 We 3 use a subscript 1 to make clear that either productions and non-terminals with such subscript belong to the CFG G1 and not to the source GIG. as we said. A GIG is the “combination” of a CFG with a Dyck language: GIGs are CFG-like productions that may have an associated stack of indices. For every production p ∈ P where a ∈ T. The analogy in the automaton model is the combination of a Finite State Automaton with a stack.3.

Induction Hypothesis. if p = A → α then p1 = A1 → ¯ 1 ¯ i CHAPTER 3. The proof is an induction on the length of the computation sequence. Suppose w ∈ φ(Dr ∩ L(G1)). φ and the corresponding CFL. Suppose w ∈ L. (2) and (3) i k n−1 n i n n−1 n−1 by Induction Hypothesis and (1) S ⇒ u A1 ⇒ u ia¯B 1 ⇒ u ia¯zC 1 ⇒ u ia¯z¯ a a a a ia¯ If u . z ∈ (T T ∪ I ∪ I)∗ ) such that z ∈ Dr k and φ(z) = y for every k < n. Basis a) w = then #S ⇒ # and S 1 ⇒ b) |w| = 1 then #S ⇒ #a and S 1 ⇒ a¯ a Both and a¯ are in Dr ∩ L(G1) a The induction hypothesis exploits the fact that any computation starting at a given configuration of the index stack and returning to that initial configuration is computing a Dyck language. Suppose that if there is a GIL derivation δ#uA ⇒ δ#uyB (where u. z ∈ Dr so is u ia¯z¯ a. n > 1 then: Case (A) If: #S ⇒ #yB ⇒ #ya S 1 ⇒ zA1 ⇒ za¯ a It is clear that if z ∈ Dr . And if φ(z) = y and φ(u ) = u then φ(u ia¯z¯ a) = uaza a ia¯ a ia¯ The reverse direction φ(Dr ∩ L(G1)) ⊆ L. GLOBAL INDEX GRAMMARS 4. First direction L ⊆ φ(Dr ∩ L(G1)). y ∈ k ¯ ¯ T ∗ ) implies there is a L(G1) derivation u A ⇒ u zB (where u . And if φ(z) = y then φ(za¯) = ya a a Case (B) If: #S ⇒ #uA ⇒ i#uaB ⇒ i#uayC ⇒ #uaya by Induction Hypothesis. if p = A → α then p1 = A1 → ¯ 1 iiα [i] L(G1) is a CFL. We have to show that L = φ(Dr ∩ L(G1)). so we have defined Dr . Basis: a) w = then S 1 ⇒ and #S ⇒ # k k n−1 b) |w| = 1 then S 1 ⇒ a¯ and #S ⇒ #a and φ(a¯) = a a a Induction Hypothesis Suppose that if there is a CFL derivation uA ⇒ uzB and z ∈ Dr then there is a GIL derivation δ#u ⇒ δ#u yA such that φ(z) = y Case (A) If: S 1 ⇒ zA1 ⇒ za¯ then a n−1 k . so is za¯.34 iα 3.

S → S b ¯ j 6. The proof is an extension of the equivalence proof between CFGs and PDAs. #. S → bS j 3. {a. . a. #. Σ = T = {a. ¯ i. S → a¯iS a 6. S → 4. S →S b¯¯ bj 4. {i. b. j}. ¯ S. S → S a ¯ i 5. S → S a ¯ i 7. b}∗ } Given Gww = ({S. S → 3. ¯ = Σ∪Σ. ¯ j.4. Theorem 2 If L is a GIL. ¯ i. {a. This is on our view a consequence of the fact that GIGs are a natural extension of CFGs. ¯ j. a.3. j} ¯ b. S → S b¯¯ bj 1. b}. 2. S → b¯ bjS 7. S → S b ¯ j ¯ Let D4 be the semi-Dyck set defined over Σ0 = {a. z ∈ Dr so is u ia¯z¯ a and if φ(z) = y and φ(u ) = u then φ(u ia¯z¯ a) = uaza a ia¯ a ia¯ If other (possible) derivations were applied to u ia¯zC then the corresponding string would not a be in Dr . ¯ i We exemplify how the Chomsky-Sch¨tzenberger equivalence of GIGs can be obtained constructu ing the grammar for the language L1: Example 13 () L(Gww ) = {ww |w ∈ {a. S }. b. j}. i. P ) and P = ¯ b. S }.4 Equivalence of GIGs and LR-2PDA In this section we show the equivalence of GIGs and LR-2PDA. EQUIVALENCE OF GIGS AND LR-2PDA #S ⇒ #yA ⇒ #ya If z ∈ Dr so is za¯a¯ and if φ(z) = y then φ(za¯a¯) = yaa a a a a Case (B) If: S 1 ⇒ u A1 ⇒ u ia¯B 1 ⇒ u ia¯zC 1 ⇒ u ia¯z¯ a then a a a ia¯ #S ⇒ #yA ⇒ i#yaB ⇒ i#uayC ⇒ #uaya i k n−1 k n−1 n−1 35 If u . then there exists a LR-2PDA M such that L= L(M). S → S ¯ a ia¯ 5. S →S a¯¯ ai 3. b}∪I = {i. P ) and P = 1. j} CF Lww = L(GwwD ). S. S → aS i 2. and we construct GwwD from Gww as follows: GwwD = ({S. i.

. If the top of the stack is a variable A. δ(q 1 . use G to construct an equivalent LR-2PDA. A. . .e. )| where A → w is a rule in P } 3. S. j) = {(q 1 . Repeat the following steps forever. δ. Therefore each sentential must be of the form xα where x ∈ T and alpha ∈ V ∪ T Claim 5 #S ⇒ #xα iff (q1. b. δ 2 = ⊥ . δ(q 1 . ju)| where A → aw is a rule in P } j 5. #. u) = {(q 1 . The general description of the algorithm is as follows. a. δ(q 1 . S. i. )| where A → w is a rule in P } ¯ j 6. q 0 . a.36 CHAPTER 3. δ(q 1 . q 2 }. . ⊥) where δ 1 . . Γ. )} Now we have to prove that L(G) = L(M). x. Given a GIG G: 1. q 2 ) where Γ = V ∪ T ∪ I and δ: 1. w. if #S ⇒ #xα if and only if (q1. α. w. ⊥) ∗ ∗ (q1. w. a. Otherwise reject this branch of the non-determinism. A. T. q 1 . Construct the LR-2PDA M = ({q 0 . . If the top of the stack is a terminal a. δ(q 1 . . ⊥) ∗ Notice that the proof is trivial if all the derivations are context free equivalent. x. ⊥)} 2. δ 2 = ∗ δ2 δ1 (q1. . ) = {(q 1 . A. and affect the second stack accordingly. S. δ(q 0 . If they match repeat. j)| where A → w is a rule in P } [j] 4. If the top of the stack is ⊥ accept. We use as a basis the algorithm used in [77] to convert a CFG into an equivalent PDA. the only change that we require is to take into account the operations on the indices stated in the grammar rules. α. select one of the rules for A and substitute A by the string on the right-hand side of the rule. GLOBAL INDEX GRAMMARS Proof Assume a GIG G that generates L. ⊥) or δ = [#]. ) = {(q 1 . c. The corresponding formalization is: Let G = (V. w. I. Place the marker symbol ⊥ and the start variable on the stack. T. P ) be a GIG. j) = {(q 1 . ) = {(q 1 . ⊥. 2. a. compare it to the next symbol in the input. Remember GIGs require leftmost derivations for the rules that affect the stack to apply. A. S⊥.

x. δ). µ) j (q 1 . ⊥) or δ = [#]. δ) (q 1 . ya. β. (q 1 . S. Therefore we need to prove that whenever the stacks are used. . (q 1 . By (1. ⊥. ya. δ) Induction Hypothesis. w. S. ⊥) First direction (if) Basis: #S ⇒ #x if (q1. S. . that the claim above is a particular case of: #S ⇒ δ#xα iff (q1.e. α. (q 1 . Aγ. α. a. A → aη ∈ P where ι = #S ⇒ δ#yβ ⇒ yaηγ = xα Case B. jµ) where δ = jµ. ηγ.) or (2. This case is a standard CFL derivation. a. Push moves in the auxiliary stack. α. a. α. . ya. Aγ. ya. ¯ j ∗ j k−1 ∗ ∗ k k ∗ (q 1 . S. ⊥) Case C Pop #S ⇒ jδ#yAγ ⇒ δ#yaηγ = δ#xα then by IH and 5. α. δ) (q 1 . the corresponding equivalence holds. Pop moves in the auxiliary stack. β. S. x. α. ∗ ¯ j The last step implies A → aη ∈ P Hence: #S ⇒ jδ#yβ ⇒ δ#yaηγ = xα The only if direction: Suppose that #S → δ#wα implies that (q 1 . γ) j j (q 1 .3. jγ) where δ = jγ. ⊥) Case B Push #S ⇒ µ#yAγ ⇒ jµ#yaηγ = jµ#xα then by IH and 4. α. ⊥) k≥1 Case A context free If #S ⇒ δ#yAγ ⇒ δ#yaηγ = δ#xα where x = ya and α = ηγ then by IH and 2 or 3: (q 1 . . jδ) ¯ j ¯ j (q 1 . i. ⊥) ∗ (q1. . (q 1 . EQUIVALENCE OF GIGS AND LR-2PDA 37 This holds true by the equivalence of PDA and CFG. k ∗ ∗ ∗ (q1. . Assume (q1. a. β. S. a. ι Given the last step implies β = Aγ for some A ∈ V . ⊥) where x ∈ T ∪ { } and δ = (q1. S. ya. . ⊥) ∗ k−1 (q 1 . ⊥) k−1 and α = ηγ Hence: (q 1 . δ) implies #S ⇒ δ#yβ for any k ≥ 1 and show by induction on k that #S ⇒ δ#xα Let x = ya Case A. . δ) for any (q 1 .) respectively. S. .4. x. δ) . δ) (q 1 . The last step implies A → aη ∈ P Hence: #S ⇒ γ#yβ ⇒ jγ#yaηγ = xα j ∗ Case C. S. ⊥) k−1 (q 1 .

δ. In all the cases if n = 1. ⊥) Theorem 3 If L is recognized by a LR-2PDA M. q 1 .. such that Γ1 is used in the main stack and Γ2 is used in the auxiliary stack. ⊥) k−1 CHAPTER 3.. S. i) contains (q 1 . A... (push) 5. A. q and p in Q. j in I. Σ. items 3. a. and 4. A. proving by induction on the steps in a derivation of G or moves of M that: #[qAp] ⇒ #w if and only if (q. [qAq n ] → a [q 1 B 1 q 2 ] [q 2 B 2 q 3 ] .. [qAq n ] → a [q 1 B 1 q 2 ] [q 2 B 2 q 3 ] . GLOBAL INDEX GRAMMARS (q 1 . q n in Q. w.e. . I = Γ2 . I. Proof Given a LR-2PDA construct an equivalent GIG as follows. Σ.[q n−1 B n−1 q n ] (pop) such that ¯ j δ(q. S. then L is a GIL. ji). B 1 B 2 . . ⊥. a must be in δ Σ. Notice that in case 4. plus the new symbol S.. δ) = (q 1 . and cannot be given the constraints imposed on the possible transitions in a LR-2PDA. [qAq n ] → a [q 1 B 1 q 2 ] [q 2 B 2 q 3 ] . B 1 B 2 . then the production is [qAq 1 ] → a.[q n−1 B n−1 q n ] such that [j] δ(q....38 (q 1 . α = (which excludes Case B Push to be the last step or move but not as a (q 1 .. and P is the set of productions. ⊥) ∗ ∗ (p. [qAq n ] → a [q 1 B 1 q 2 ] [q 2 B 2 q 3 ] . B 1 . A. Let M be the LR-2PDA (Q. ya. q 2 . a. #. Γ. each a in Σ ∪ { }..B n−1 . jδ) ∗ ¯ j (q 1 . δ) Given the values δ. B 2 . ⊥. . P ) where V is the set of variables of the form qAp. Γ2 . α.[q n−1 B n−1 q n ] such that δ(q.B n−1 . A. 1. ) contains (q 1 . This conversion algorithm to construct a CFG from a PDA follows the one in [41] (including the notation). Assume Γ is composed of two disjoint subsets Γ1 . a. ). j) contains (q 1 . α. ). B n−1 in Γ and i. 4..B n−1 . . Let G be a GIG = (V. We follow the proof from [41]. the only modification is to mimic the operation of the auxiliary stack. ⊥) . j). S → q 0 ⊥q for each q in Q And for each q. A. ⊥.B n−1 . with the stack of indices in the grammar. i. F ). 3. ⊥) step ≤ k − 1) we obtain #S ⇒ δ#xα = #x iff (q 1 . x. a.. a. We need to show that L(G) = L(M ). A in Γ. 2. B 1 B 2 . Aγ... This construction is defined so that a leftmost derivation in G of a string w is a simulation of the LR-2PDA M when processing the input w.[q n−1 B n−1 q n ] such that j δ(q.. S.. B 1 B 2 . q 0 . . j) contains (q 1 ...

γ k −1 ) (p.y m = #w The same holds for the last symbol that is extracted from the stack (from II again): III. γ 1 ) k (p.[q n−1 B n−1 q n ] ⇒ γ k #ay 1 y 2 . First (if) direction: Induction Hypothesis: If (q. γ k ) Decomposing y in m substrings. ⊥) (q 1 . (q i . γ i+1 ) then γ i #[q i B i q i+1 ] ⇒ γ i+1 #y i ∗ (q 1 .B m . ⊥. then either 1.. the induction hypothesis states that whenever the LR-2PDA M recognizes a string emptying the main stack and changing the auxiliary stack from a string of indices γ 1 to a string of indices γ k . (q. ⊥) δ ∗ (q i+1 . where γ i ∈ I ∗ and ∗ u. B i . ie..3.B m . γ i ) for 1 ≤ j ≤ m The first move in I.y m−1 [q n−1 B n−1 q n ] ⇒ γ k #ay 1 y 2 . PDA equivalence. γ 1 ) k−1 (p. so the induction hypothesis is: If γ 1 #u[qAp] ⇒ γ k #uw then (q. EQUIVALENCE OF GIGS AND LR-2PDA 39 If only rules created with step 1 or 2 and the corresponding transitions are used then. q m + 1 = p.. . Therefore I. ⊥..y m = #w where γ k = ⊥.. then γ 1 = . such that the inductive hypothesis holds for each: II. w. w.y m where each y i has the effect of popping B i from the stack (see the details corresponding to the PDA-CFG case in [41]) then there exist states q 2 . γ k ) then γ 1 #u[qAp] ⇒ γ k #uw. given the only type of rules/moves applicable are 1 and 2 (in this case where δ = [⊥]). ⊥. γ k −1 = j ∈ I and δ = ¯ j Now the “only if” part (the basis was proven above).4.. A.: (q.. A...[q n−1 B n−1 q n ] where δ can be only be some j in I then γ 1 = j or δ is [⊥]. B m . ay. .. The basis is also proven for both directions. ay. y. . A. (q. . y... γ k −1 = ⊥ and δ = or [#] or 2. these are a CFG and a PDA and therefore follows from the standard CFG. B 1 B 2 . A. ⊥) ∗ k−1 ∗ (q n−1 . y m . ⊥. γ k ) implies: δ #[qAq n ] ⇒ γ k −1 #ay 1 y 2 . q m +1. in k moves (for any k ≥ 1) then the GIG G will derive the same string w and string of indices γ k I. w ∈ Σ∗ ... implies: #[qAq n ] ⇒ γ 1 #a[q 1 B 1 q 2 ] [q 2 B 2 q 3 ] . B 1 B 2 . In other words. y = y 1 .... .. . y i . γ 1 ) Suppose: k ∗ (p... A. . γ 1 ) implies #[qAq n ] ⇒ γ 1 #a [q 1 B 1 q 2 ] [q 2 B 2 q 3 ] . γ k ) for any k ≥ 1. ay..

A. Z 0 ) ∗ ∗ (p.40 CHAPTER 3. So according to 1. GLOBAL INDEX GRAMMARS I. xm . Again. γ k ) #u[qAq n ] ⇒ γ k −1 #uax1 . . γ i+1 ) From the first step of the derivation in I. #u[qAq n ] ⇒ γ 1 #ua [q 1 B 1 q 2 ] [q 2 B 2 q 3 ] . ⊥. ⊥). we can decompose w as ax1 x2 . 2. in the construction of the GIG G.B n .. A. where i = 1. we obtain: #S ⇒ #w iff (q 0 .B n ... . w. is If we consider the last step from I... w.. ⊥) (q 1 . γ i ) ∗ (q i+1 . .n.. w. xi .. x1 x2 ...xn such that γ i #ui [q i B i q i+1 ] ⇒ γ i+1 #ui xi therefore by the induction hypothesis: (q i . γ k − 1) (q n . ⊥.. ∗ where γ 1 is ⊥ if δ in the first step of I.: and from this move and II. γ i+1 ) for 1 ≤ i ≤ n Now we can add B i+1 .B n .. B n . γ i ) ∗ ∗ (q i+1 . .. ⊥. ⊥) k−1 ∗ (p. then (q.[q n−1 B n−1 q n ] ⇒ γ k #uw δ k−1 where q n = p. w.. .xm [q n−1 B n−1 q n ] ⇒ γ k #uw which in turn implies: δ (q. γ k ) where the possibilities are either xm = xn or δ = [⊥] or and given we require γ k to be ⊥ then the only possibilities are: (A) either γ k = γ k −1 = ⊥ and δ = (B) δ = γ k −1 then γ k = ⊥ ¯ The final observation is that we satisfy the first claim assigning the following values: q = q O and A = Z 0 . ⊥..B n to each stack in the sequence of ID’s so that: II.. B i B i+1 .. . we obtain (remember w = ax1 x2 . B i+1 .... . γ 1 ) or [⊥]. B i .. (q i .xn ): (q. ⊥) or xm = (q n−1 . A.xn . xi . B 1 B 2 .

GILs and ILs might be incomparable.1 Relations to other families of languages There are two clear cut relations that place GILs between CFLs and CSLs: GILs are included in CSLs and GILs include CFLs. The relation to Growing Context Sensitive languages is interesting for a similar reason.Chapter 4 Global Index Languages Properties 4. GILs are incomparable to the Growing Context Sensitive Languages (GCSLs). corresponds to an amount of tape equal to the input in a LBA. It is interesting to establish the relation of GILs to LILs and LCFRLs because there is an extensive tradition that relates these families of languages to natural language phenomena. Most of other relations are more difficult to determine. We do not address possible relationship with the counter languages [42] however. The corresponding automaton is another two stack machine. GILs might include LILs and perhaps LCFRLs. the relation to LILs is interesting because of their similarities both in the grammar and the automaton model. Due to the constraints on the push productions at most the same amount of symbols as the size of the input can be introduced in the additional stack. 41 . another family of languages that has some similarities with GILs. Therefore a LBA can simulate a LR-2PDA. However GCSLs might include trGILs. • Proper inclusion of GILs in CSLs. and the constraints imposed on the use of the additional stack in the GIL automaton might be seen as a shrinking property. The additional stack in GIGs/LR-2PDA. Moreover.

P 2 .42 CHAPTER 4. we assume that N 1 . N 2 . We discuss this issue in Chapter 6. n 4. • GILs and Growing Context Sensitive Languages are incomparable. such as the MIX language. S 5 are not in N 1 or N 2 . S 1 ) and G2 = (N 2 . Proposition 1 GILs are closed under: union. I 1 . care should be taken that the two sets of stack indices be disjoint. GCSLs include the language {ba2 |n ≥ 1} which is not semi-linear. I 2 . This result is obtained from the definition of GIGs.g. I 1 . using two GIG grammars. This can be proved using the same type of construction as in the CFL case (e. #. Union L1 ∪ L2 :. • CFLs are properly included in GILs. S 4 . instead of two CFG grammars. I 2 are disjoint. #. Construct the grammar G3 = (N 1 ∪ N 2 . We consider this quite possible. Assume also that S 3 . GLOBAL INDEX LANGUAGES PROPERTIES • Proper inclusion of GILs in ILs. A string w is in L1 if and only if the derivation #S 3 ⇒ #S 1 ⇒ #w is a derivation in G3 . For concatenation. • Proper inclusion of LILs in GILs. T 1 ∪ T 2 . ∗ . I 1 ∪ I 2 . The copy language {ww|w ∈ Σ∗ } is not a GCSL [53]. S 3 ) where P 3 is P 1 ∪ P 2 plus the productions S 3 → S 1 | S 2 . concatenation and Kleene closure. Proof Let L1 and L2 be GILs generated respectively by the following GIGs: G1 = (N 1 . ILs are not semi-linear and GILs are semi-linear. However it remains as an open question. This is an open question. #. There are no other derivations from S 3 than #S 3 ⇒ #S 1 and #S 3 ⇒ #S 2 Therefore L1 ∪ L2 = L3 . P 1 . S 2 ) Since we may rename variables at will without changing the language generated. GILs contain some languages that might not be ILs. T 1 . T 2 . [41]).2 Closure Properties of GILs The family of GILs is an Abstract Family of Languages. P 3 . The same argument holds for w in L2 starting the derivation #S 3 ⇒ #S 2 .

S 1 ) where P 5 is P 1 plus the productions: S5 → S1 S5 | . Assume that the non-terminals of G an Ga are disjoint. (e) The productions of G1 are all the productions of each Ga together with all the productions from G modified as follows: replace each instance of a terminal a in each production by the start symbol of Ga . The proof that L(G4 ) = L(G1 )L(G2 ) is similar to the previous one. I 1 . S 4 ) such that P 4 is P 1 ∪ P 2 plus the production S 4 → S 1 S 2 . [#] ∗ ∗ ∗ The proof is similar to the previous one.2. Construct a GIG grammar G1 such that: (a) the non terminals of G1 are all the non-terminals of G and of each Ga . T 1 ∪ T 2 . (c) the set of indices I and # are the set of indices and # from G (d) the start symbol of G1 is the start symbol of G. CLOSURE PROPERTIES OF GILS 43 Concatenation:. This proof adapts the substitution closure algorithm given in [41] to prove substitution closure by CFLs. T 1 .Let G5 = (N 1 ∪ {S 5 }. and for each a in Σ let La be a CFL. Proposition 2 GILs are closed under substitution by -free CFLs. -free homomorphisms. therefore also no δ ∈ I 2 can be generated at this position. where each Ga is in GNF. #.4. Closure:. and a string u is in L2 if and only if the derivation #wS 2 ⇒ #wu. I 1 ∪ I 2 . is a derivation in G4 for some w. P 4 . Notice that #S 4 ⇒ #S 1 ⇒ δ#wS 2 for some δ in I 1 does not produce any further derivation because the I 1 and I 2 are disjoint sets. -free regular sets. Construct G4 = (N 1 ∪ N 2 . P 5 . given the only production that uses S 1 and S 2 is S 4 L(G4 ) = L1 · L2 . #. A string w is in L1 if and only if the derivation #S 4 ⇒ #S 1 ⇒ #wS 2 is a derivation in G4 . L ⊆ Σ∗ . The substituting CFG must be in Greibach Normal Form (so as to respect the constraints on productions that push indices in the stack). Let L be L(G) and for each a in Σ let La be L(Ga ). (b) the terminals of G1 are the terminals of the substituting grammars Ga . Proof Let L be a GIL.

F A ). Proposition 3 If L is a Global Index Language and R is a regular set. Σ. q]. F G ) and let R be L(A) for a DFA A = (QA . Again. F ).44 CHAPTER 4. w. γ. a. X. ⊥. a) = p and δ G (q. q 0 ]. η). q 0 . Z. Γ. Proof Let h : Σ → ∆ be a homomorphism and let L be a GIL. w) = p i Proposition 4 Global Index Languages are closed under inverse homomorphism. q 0 . Σ. a. On input a M 1 generates the string h(a) stores it in a buffer and simulates M on h(a). GILs are also closed under intersection with regular languages and inverse homomorphism. Σ. [p0 . in which case p = p and η = i or η = Y It is easy to see that ([p0 . Y ) contains ([p . q ]. γ. ⊥. GLOBAL INDEX LANGUAGES PROPERTIES Note that the requirement that the substituting grammar be in GNF implies that it is an -free CFL. q]. η) if and only if (an induction proof is given by [41] for the CFL case) (q 0 . Let L = L(M ) where M is the LR-2PDA (Q. (push) productions which require Greibach normal form. Σ. δ.3 Semilinearity of GILs and the Constant Growth property The property of semilinearity in a language requires that the number of occurrences of each symbol in any string (also called the commutative or Parikh image of a language) to be a linear combination of the number of occurrences in some finite set of strings. . q 0 ]. . Parikh [60] showed that CFLs are semilinear. X. Proof Let L be L(M ) for an LR-2PDA M =(QG . γ. F A ×F G ) such that δ is defined as follows: δ([p. L ∩ R is a Global Index Language. Construct an LR-2PDA M 1 accepting h−1 (L) in the following way. ⊥) (q. . δ G . Construct M’ = (QA ×QG . w. δ. p0 . δ A . Therefore L(M 1) = {w | h(w) ∈ L}. η) and δ(p0 . GILs do not tolerate an substitution due to the constraints on type b. γ. η) if and only if: δ A (p. Note that a may be . ⊥. a similar proof to that used in the CFL case works for these closure properties: in both cases a LR-2PDA with a modified control state is used (again see [41] for the CFL case). Γ. ⊥) ([p. Γ. Y ) contains (q . 4.

3. SEMILINEARITY OF GILS AND THE CONSTANT GROWTH PROPERTY 45 i. |an |(w)) where |ai |(w) denotes the number of occurrences of ai in w. then their intersection X ∩Y is also semilinear. Definition 9 Parikh Mapping (see [39]) : Let Σ be {a1 . We will use the following lemma in the proof of semilinearity for GIGs. 60]. Theorem 5 If L is a GIL then L is a semi-linear language. ψ(L) = {ψ(w)|w ∈ L}. This property has been extensively used as a tool to characterize formal languages (e.. However. The Parikh image of a language is the set of all vectors obtained from this mapping to every string in the language. We assume a definition of semilinearity of languages such as that found in [39. an }.4. 37]). define a mapping from Σ∗ into N n as follows: ψ(w) = (|a1 |(w). the property of semi-linearity of GILs follows from the properties of the control mechanism that GILs use..g. .. v i ∈ Nn for 1 ≤ i ≤ m} b) is semilinear if V is the finite union of linear sets. Intuitively. 86]). L is a semi-linear language. 35]).e. Two languages L1 .. [46. The commutative or Parikh image of a language L ∈ Σ∗ . .. [33.g. as Theorem 5.. We follow the proof presented in [37] to prove that the class of languages L(M c ).. If ψ(L) is semi-linear. The proof of this lemma is in [30].1. + cm v m |ci ∈ N. concept. where M c is obtained from an automata class C by augmenting it with finitely many reversal-bounded counters. The Parikh mapping is a function that counts the number of occurrences in every word of each letter from an ordered alphabet. Definition 8 A set V in Nn a) is linear if V = {v 0 + c1 v 1 + .. We will not discuss here whether semilinearity is the correct approach to formalize constant growth. [55. recently it has been claimed that semilinearity might be too strong a requirement for models of natural language (e. the constant growth property requires that there should be no big gaps in the growth of the strings in the languages. that CFLs are letter-equivalent to a regular set.6.g. . is semilinear provided that the languages corresponding to C are semilinear. Lemma 4 If X and Y are semilinear subsets of Nn . L2 in Σ∗ are letter-equivalent if ψ(L1 ) = ψ(L2 ). Semilinearity has been assumed as a good formulation of the constant growth property of natural languages (e. Roughly speaking.

and α. ∈ (N ∪ T )∗ create a new production p1 ∈ P 1. By the Parikh theorem [60] the Parikh map of the CFL L(G1).. if p = A → α then p1 = A → ¯ iiα [i] It can be seen that L(G1) ⊆ Σ1 ∗ and that for each w that is in the GIL L(G) there is a word w1 ∈ L(G1) such that |i|(w1) = |¯ i|(w1). Let S 2 be the semilinear set {(a1 . ik .. GLOBAL INDEX LANGUAGES PROPERTIES The proof exploits the properties of Theorem 1: every GIL L = φ(Dr ∩ L1) such that L1 is a CFL.. From S3 we obtain S 0 the semilinear set corresponding to ψ(L(G)).46 CHAPTER 4. #.. ¯n . i ∈ I. Σ1 . if p = A → α then p1 = A → α 2. This follows from Theorem 1. P 1) Define a CFG grammar G1 = (N. The intersection of S 1 and S 2 is a computable semilinear set S 3 according to [30].4 Pumping Lemmas and GILs This section and the remainder of this chapter will present some exploratory ideas rather than established results. if p = A → α then p1 = A → iα i 3. Dr and L1 are semilinear by the Parikh theorem (L1 and Dr are CFLs). ¯k ∈ N} where the pairs of ik and ¯k i i i i ¯ coordinates correspond to symbols in I and the corresponding element in I. if p = A → α then p1 = A → ¯ iα ¯ i 4. I. in other words. ψ(L(G1)) is an effectively computable semi-linear set S 1 . S.. We can consider pumping lemmas for different families of languages as specifying the following facts about them: . P ) such that ¯ Σ1 is (Σ ∪ I ∪ I) and P 1 is given according to the following conditions. Σ. Computing the intersection of S 1 and S 2 amounts to compute the properties that the control performed by the additional stack provides to GILs. ip . ¯p )|aj . S. note that S 2 is a subset of S 1 . as follows: 1. in . . removing the pairs of ik and ¯k coordinates. am . i Corollary 6 The emptiness problem is decidable for GILs.. removing the illegal derivations. We modify the construction of L1 in the proof of Theorem 1. Proof Given a GIG G = (N. 4. For every production p ∈ P where a ∈ T.

4.4. PUMPING LEMMAS AND GILS

47

• Regular Languages: Inserting any number of copies of some substring in a string always gives a regular set. • Context Free Languages: every string contains 2 substrings that can be repeated the same number of times as much as you like. • GCFLs, LCFRLs, others and GILs, there is always a number of substrings that can be repeated as many times as you like. Following upon this last observation, the following definition is given in [35] as a more adequate candidate to express properties of natural language. This is a candidate for a pumping lemma for GILs. Definition 10 (Finite Pumpability) . Let L be a language. Then L is finitely pumpable if there is a constant c0 such that for any w ∈ L with |w| > c0 , there are a finite number k and strings u0 , ..., uk and v 1 , ..., v k such that w = u0 v 1 u1 v 2 u2 ...uk −1 v k uk and for each i, 1 ≤ |v i | < c0 and for any p ≥ 0, u0 v 1 p u1 v 2 p u2 ...uk −1 v k p uk ∈ L. Compare the previous definition with the following k-pumpability property of LCFRS ([71], and also in [35]) which applies to any level-k language. Definition 11 (k-pumpability) Let L be a language. Then L is (universally) k − pumpable if there are constants c0 ,k such that for any w ∈ L with |w| > c0 , there are stringsu0 , · · · , uk and v 1 , · · · , v k such that u0 v 1 u1 v 2 u2 · · · uk −1 v k uk , for each i : 1 ≤ |v i | < c0 , and for any u0 v 1 p u1 v 2 p u2 ...uk −1 v k p uk ∈ L. In this case the k value is a constant determined by the k-level of the language.

4.4.1

GILs, finite turn CFGs and Ultralinear GILs

We showed that there is no boundary in the number of dependencies that can be described by a GIL (see the language Lm in the previous chapter). This fact and the candidate pumping lemma for GILs are related to the following observation. For any CFG that recognizes a number of pairs of dependencies, ( e.g., La = {an bn , cm dm |n ≥ 1, m ≥ 1} has 2 pairs of dependencies or turns [32, 39, 88, 5]) there is a GIG that generates the total number of dependencies included in the

48

CHAPTER 4. GLOBAL INDEX LANGUAGES PROPERTIES

pairs. This is done by “connecting” the CFG pairs of dependencies (turns) with “dependencies” (turns) introduced by the GIG extra stack. This “connection” is encoded in the productions of the corresponding terminals. For example, in La it is possible to “connect” the b’s and c’s, in a turn of the GIG stack: any production that has a b in the right-hand side also adds an index symbol to the GIG stack (our notation for this will be bx ), and every production that has a c in the right-hand side removes the same index symbol from the production stack (we will denote this by c¯ ). x La = {an bn cm dm |n ≥ 1, m ≥ 1} → Lb = {an bx n c¯ m dm |n ≥ 1, m ≥ 1} = {an bn cn dn |n ≥ 1, } x Conjecture 1 For any k-turn CFG, where k > 1 is finite, there is a GIG that generates a language with (2 · k) dependencies. These observations are also related to the fact that LIGs (and the equivalent automata), can connect one-turn for each stack [85]. Therefore the boundary of the number of dependencies is four.

4.5

Derivation order and Normal Form

We introduced GIGs as a type of control grammar, with leftmost derivation order as one of its characteristics. GIG derivations required leftmost derivation order. We did not address the issue of whether this is a normal form for unconstrained order in the derivation, or if an extension of GIGs with unconstrained order in the derivation would be more powerful than GIGs. In this section we will speculate about the possibility of alternative orders in the derivation, e.g. (rightmost) or free derivation order. The following grammar does not generate any language in either leftmost or rightmost derivation order: Example 14 L(G6 ) = {an bm cn dm }, where G6 = ({S, A, B, C, D}, {a, b, c, d}, {i, j}, S, #, P ) and P = 1. S → A B C D 6. C → cC
¯ i

2. A → aA
i

3. A → a
i ¯ j ¯ j

4. B → bB
j

5. B → b
j

7. C → c
¯ i

8. D → dD

9.D → d

The only derivation ordering is an interleaved one, for instance all the a’s are derived first, then all the c’s, followed by the b’s and finally the d’s. However we know that such a language is a GIL. It is our belief that the following conjecture holds, though it might be difficult to prove. Unrestricted derivation order would introduce only unnecessary additional ambiguity.

4.5. DERIVATION ORDER AND NORMAL FORM

49

Conjecture 2 Unrestricted order of the derivation in a GIG is not more powerful than leftmost derivation order. Following the previous example, the next example might seem impossible with leftmost/rightmost derivation. It looks like an example that might support the possibility that unrestricted order of the derivation might yield more powerful grammars. Example 15 L(G6b ) = {an bm cl dm en f l | n, m, n ≥ 1}, where G6b = ({S, A, B, C, D, E, F }, {a, b, c, d, e, f }, {i, j, k}, S, #, P ) and P is: 1. S → ABCDEF 5. B → b
j k

2. A → aA
i

3. A → a
i

4. B → bB
j

6. C → cC | c 10.E → e
¯ i

7. D → dD
¯ j

8.D → d
¯ j

9.E → eE
¯ i

11. F → f F
¯ k

12. F → f
¯ k

A derivation with unrestricted order would proceed as follows: S ⇒ ABCDEF ⇒ i#aABCDEF ⇒ ji#abCDEF ⇒ kji#abcDEF ⇒ ji#abcDEf ⇒ i#abcdEf ⇒ #abcdef However the following grammar generates the same language in leftmost derivation: Example 16 L(G6c = {an bm cl dm en f l | n, m, n ≥ 1}, where G6b = ({S, A, B, C, D, E, F }, {a, b, c, d, e, f }, {i, j, k}, S, #, P ) and P is: 1. S → A 5. B → bC
j

2. A → aA
i k

3. A → aB
i

4. B → bB
j

6. C → cCf | cM f 10.E → De
¯ i

M → DE

7. D → dD
¯ j

8.D → d
¯ j

9.E → Ee
¯ i

Similarly the following language which contain unordered crossing dependencies is a GIL: {an bm cl dp bm an dp c l |n, m, l, p ≥ 1}
2 2 2 2

The next example also shows that leftmost and rightmost derivation ordering might produce two different languages with the same grammar for each ordering, introducing therefore another dimension of ambiguity. Example 17 L(G7 ) = {ww|w ∈ {a, b}∗ } ∪ {wwR |w ∈ {a, b}∗ } derivation respectively) (in leftmost and rightmost

G7 = ({S, S , A, B}, {a, b}, {i, j}, S, #, P ) and P =

50 1. S → aS
i

CHAPTER 4. GLOBAL INDEX LANGUAGES PROPERTIES 2. S → bS
j

3. S → S 8. A → a
¯ i

4. S → S A 9. B → b
¯ j

5. S → S B

6. S → A

7. S → B

Rightmost derivation produces: #S → i#aS → ji#abS → ji#abS → ji#abS B → ji#abAB → i#abAb → #abab
i j ¯ j ¯ i

Leftmost derivation produces: #S → i#aS → ji#abS → ji#abS → ji#abS A → ji#abBA → i#abbA → #abba
i j ¯ j ¯ i

iii#.1 If all the possible stack configurations in a GIG derivation were to be represented. (i.e. Each node at length n can have an edge only to a node at length n − 1. jij#. iji#. jjj#. The numbers indicate the length. ij#.1. While the number of possible nodes increases. each node of the graph-structured stack will represent a unique index and a unique length of the stack. the number of edges connecting a node to others is limited.) #. For instance. jii#. ii#. 1 See [51] for a similar approach to Tomita’s. 51 . It is a device for efficiently handling of nondeterminism in stack operations.1 Graph-structured Stacks In this section we introduce the notion of a graph-structured stack [80] to compute the operations corresponding to the index operations in a GIG. This is a departure from Tomita’s graph-structured stack. The set of nodes that represents the top of the stack will be called active nodes (following Tomita’s terminology). jj#. The graph-structured stack at the left represents the following possible stack configurations: iii#. and [50] for an approach to statistical parsing using graph algorithms. ji#. j#. the active nodes are represented by circles and the inactive are represented by squares. in figure 5. etc. i#. The one at the right is equivalent to the maximal combination of stack configurations for indices i. ijj#. the number of possible configurations would grow exponentially with the length of the input. As an initial approach. j with maximum length of stack 3.Chapter 5 Recognition and Parsing of GILs 5.

S. Algorithm 1 (Earley Recognition for GFGs) .3 i. These items are used to represent intermediate steps in the recognition process. Let w = a1 a2 · · · an be an input string.2 j..3 Figure 5. An item [A → α • β. 5. Create the Sets S i : 1 S0 = [S → • S$. which are composed of a ”dotted” rule and a starting position: [A → α • β. Because at this point we use nodes of unambiguous length.. Earley’s main data structures are states or “items”. P ) be a CFG. Earley’s parsing algorithm [27] computes a leftmost derivation using a combination of top-down prediction and bottom-up recognition.. Push(newnode.2..2 j. n ≥ 0.1 $. given a string w = a1 a2 .an with n ≥ 0 any integer i such that 0 ≤ i ≤ n is a position in w.1 GILs Recognition using Earley Algorithm Earley Algorithm. 0] 2 For 0 ≤ i ≤ n do: Process each item s ∈ S1i in order performing one of the following: a) Predictor: (top-down prediction closure) .oldnode). pj ] is inserted in the set of states S i if α corresponds to the recognition of the substring aj .2 i.3 CHAPTER 5. pj ].2 i. RECOGNITION AND PARSING OF GILS i. currentnode connects only to nodes of current length-1.3 i. and ai ∈ T for 1 ≤ i ≤ n.52 i.1: Two graph-structured stacks The following operations are possible on the graph-structured stack. T.2 5. Creates a newnode if it is not in the graph and creates an edge from newnode to oldnode if necessary. Therefore.0 j.1 j. Pop(curretnode).ai .0 j. Retrieves all the nodes that are connected by an edge from the currentnode. Earley items are inserted in sets of states. Let G = (N. There are as many sets as positions in the input string.1 $. Therefore the number of edges connecting a node to a preceding one is bound by the size of the indexing vocabulary.1 j.

Let G = (N. GILS RECOGNITION USING EARLEY ALGORITHM If [B → α • Aβ. T.{a. Create the Sets S i : 1 S0 = [(#.2 First approach to an Earley Algorithm for GILs. k] ∈ S j : add [A → αB • β. We use the graph-structured stack and we represent the stack nodes as pairs of indices and counters (the purpose of the counters is to keep track of the length of the stack for expository purposes). 0). Reject. and O. 0). A → α • Aβ. j] ∈ S i : for [A → α • Bβ. Initialize the graph-structured stack with the node (#. #. Let w = a1 a2 · · · an be an input string. If i = n and Sn+1 = {[S → S$ • . pj ] Algorithm 2 (Earley Recognition for GIGs) .2. if pop rules “erase” symbols from the stack.2. O.{S}. j] ∈ S i and wi + 1 = a: add [A → αa • β. n ≥ 0. such that O ≤ n where n is the length of the input.5. An example of such case would be the following i grammar: Gd = ({S}.{P}) with P: S → aS | bS S→S| ¯ i .{#}. 0] 2 For 0 ≤ i ≤ n do: Process each item s ∈ S i in order performing one of the following: a) Predictor b) Completer c) Scanner 2 Actually O ≤ 2n. S. S → • S$.2 Therefore Earley items for GILs might be as follows: [∆. I. i] to S i b) Completer: (bottom-up recognition) If [B → γ • . We modify Earley items adding two parameters: ∆. P ) be a GIG.{i}. j] ∈ S i and (A → γ) ∈ P : add [A → • γ. 0. If [A → α • aβ. k] to S1i c) Scanner: equivalent to shift in a shift-reduce parser.b}. 0]} then accept 53 5. a pointer to an active node in the graph-structured stack. used to record the ordering of the rules affecting the stack. and ai ∈ T for 1 ≤ i ≤ n. j] to S i + 1 3 4 If S i+1 is empty.

O1 . C 2 = C 1 − 1 if δ = then (δ 1 . j] ∈ S i where µ = µ δ or µ = [i]: for [(δ 2 . As we said. A → αB • β.t. j] ∈ S i and wi + 1 = a: µ add [∆. C 2 ) and O1 = O2 ( move) if δ = [δ 1 ] then (δ 1 . C 2 ). C) such that C ≤ n.54 3 4 If S i+1 is empty. A → αa • β. A → α • Bβ. A → α • Bβ. O. i] to S i δ such that: if δ ∈ I then δ 2 = δ. The operations predictor. O − 1. RECOGNITION AND PARSING OF GILS If i = n and Sn+1 = {[(#. C 1 )) s. O2 . C 2 ). 0). k] to S i δ 3. j] ∈ S i : µ for [(δ 2 . C 1 ) ) s. k] ∈ S j where δ 2 = i if µ = [i]: add [∆1 . j] to S i + 1 µ 3. O − 1. Scanner If [∆. C 1 ) = (δ 2 . A → α • aβ. The example . C 2 ). C 2 ). B → γ • . C 2 ) and O1 = O2 2.t. This implementation used Shieber’s deduction engine backbone [72]. O.2 add every [(δ 2 . O. CHAPTER 5. and have the corresponding initial order in the derivation. Reject. C 2 ) ∈ pop((δ 1 . O. Completer A If [∆1 . A → • γ. Completer B If [∆1 . B → α • Aβ. 0]} then accept The structure of the main loop of Earley’s algorithm remains unchanged except for the require- ment that the initial item at S 0 (line 1) and the accepting item at S n + 1 (line 4) point to the empty stack node (#. C 1 ) = (δ 2 . O. O2 = O1 + 1 and push( (δ 2 . B → γ • . to perform the corresponding operations on the graph-structured stack. 1. O. 0. k] to S i δ The following example shows the trace of the items added to a chart parser implementing the above algorithm. we represent nodes in the graph-structured stack with pairs (δ. (δ 1 . A → αB • β. C 2 = C 1 + 1 if δ = ¯ and i = δ 1 then O2 = O1 + 1 and i (δ 2 . j] ∈ S i and (A → γ) ∈ P : µ δ 1. C 1 ). Predictor If [(δ 1 . completer used in the For loop in 2 are modified as follows. S → S$ • . 0). k] ∈ S j where δ 2 = i if µ = ¯ i: δ add [∆1 . scanner.

(i.d].[].1.c].1) 5.ir]. Adding to chart: <23852> item(B.[].2. Each item is represented as follows: item(LeftSymbol.0.[i.3) 15.[b.1.2.[#.1. where P is: S → aSd.3.d]. OrderCounter.4.1.[#.[i.d].3).[i.Adding to chart: <27540> item(S.3) 16 Adding to chart: <23852> item(B.2.0.0) 3 Adding to chart: <23470> item(S.d].[i.[B].e].[b.1.[i.2.1.S.3.Adding to chart: <23725> item(B.1.[].4.[b.2) 10. Adding to chart: <27798> item(B.0.2.e].1) 6.1.c].0. d}. Adding to chart: <23851> item(B.[B].2).2) 13.c].2.[#.1.[b]. P.Adding to chart: <27671> item(S. i S→B B → bBc ¯ i B → bc ¯ i 1 Adding to chart: <10898> item(<start>.[a.5. {a.[#.1) 9 Adding to chart: <10640> item(S.1).[]. [Stacksymbol.2.0.[].[S.3.ir].B.1. Example 18 (Trace of aabbccdd) L(G2 ) = {an bn cn dn |n ≥ 0}.ir].[B.[#. GILS RECOGNITION USING EARLEY ALGORITHM 55 shows the recognition of the string aabbccdd with the grammar G2 transformed into a trGIG. {i}.2)]) 12 Adding to chart: <23725> item(B.Adding to chart: <23599> item(S. c.[B.ir].[a.[i.[].[].0. B}.S.2.ir].3. #.1.e].il].[B].Adding to chart: <23724> item(S.3) 17.[].[a].[i.1.2.0.1)) 7 Adding to chart: <23598> item(B.0.B.[b.[b.0)) 4 Adding to chart: <10771> item(S.[S.3.[i.[].il]. StackOperation].1) 8 Adding to chart: <23598> item(B. StackCounter.3. b.2.[].4.d].2.c].3.0.3) 18. initialposition.(#. Adding to chart: <26897> item(B.[].0.2.0.[#.[#.[i.1. finalposition) The stack operation is represented as follows: “il” is a push rule of the stack index “i” and “ir” is a pop rule. Predotlist.ir].c].[].1. Postdotlist.c].B.3.[].[S].2.2) Adding to stack: <22863> item((i.4) .1) Adding to stack: <22732> item((i.il].c].0.ir].ir].2) 14.2) 11.0.0) Adding to stack: <22605> item((i.[i.1.il].(i.[c].[a.2.il].0) 2 Adding to chart: <27413> item(S.e].[b].3. S).[b.2.ir]. G2 = ({S.[b].S.c].[a].[i.

S → R 4.[b].il].[#. aaRa ⇒ (?.6) 25.3. Adding to chart: <23085> item(B.e].0. Adding to chart: <10625> item(S.0.[#.2) aaS ⇒ (j . 2.[c.6) 24.4.5) 21.56 19 CHAPTER 5.[S]. j .1)aabR[a][b]⇒(#. 3. 3).[d.[#.0. Adding to chart: <10754> item(S.8) yes The following example shows why some bookkeeping of the order of the derivation is required in Earley items.[c]. (#. instead of the one introduced at step 5.[#.1. Adding to chart: <10982> item(<start>.0.[#. Adding to chart: <27783> item(B. the following complete operation would be performed : Given [(#.2) aaS ⇒(i. Adding to chart: <10883> item(S. Adding to chart: <23215> item(S.0)aaba[a][b] ¯ i 6 After recognized this substring.?) aaba i i ¯ i ¯ j 1 2 3 4 However.7) 26.b].0. the following sequences can be generated using Earley’s Algorithm if no ordering constraint is enforced at the Completer Operation.2.3.[#.b].1). the corresponding productions of the grammar Gww repeated below and the string aaba 1. S → bS • .3) aabR⇒(i.8) 28.S.3.a]. b}∗ }.[#.[c].[#.S.2.1) aS ⇒ (i.3.3) aabS ⇒(j .[d].[].a].2.B.0.[S.[c.a].[].0.6) 23. S → aS i 2. 6.[#.1. R → Ra | a ¯ i 5.[#. R → Rb | b ¯ j The following derivation is not possible (in particular step 4).[B.1.ir]. 0). S → bS j 3.0.0. Consider the language Lww = {ww |w ∈ {a.2. 2].[d. In other words.4) 20.[].0) S ⇒ (x. Adding to chart: <23342> item(S. 3] to S 4 Then the following are sequentially added to S 4 : a) [(#.[S.0. This bookkeeping is performed here by the order parameter.0. R → a • .[].il].2) aaR⇒ (i. In the following example the square brackets represent substrings to be recognized.2. S → R • . 3.b]. S → • R.[d].e]. The pairs in parenthesis represent the nodes of the graph-structured stack: (#.7) 27.1) aS ⇒ (i.[].a].0.ir]. RECOGNITION AND PARSING OF GILS Adding to chart: <22956> item(B. 3] ∈ S 4 and [(j. the completer operation may jump up two steps and complete the “R” introduced after step 3.0.ir].0.[B]. 0).1.il].2)aabR[b]⇒ i i j ¯ j ¯ i 1 2 3 4 5 (i.5) 22.[].ir].4. 0). 3] ∈ S 3 : ¯ j add [(#.0) S ⇒ (i.2.il]. Adding to chart: <27654> item(B.

{a. there is no way to control the correct derivation given no information on the pop moves has been stored. In other words. The ambiguity arises in the following configuration S ⇒ aabR which would lead to the following items: [(#. 0. at some predict steps. S → aSc j 3. 4. The predict-complete ambiguity In this case. It cannot handle cases of what we call predict-complete ambiguity. and at completer cases.5. R → bRd ¯ j Grammar Gamb4 produces the following derivation: S ⇒ i#aSd ⇒ ji#aaScd ⇒ ji#aaRcd ⇒ i#aabRdcd ⇒ #aabbcdcd But it does not generate the string aabbcddc nor aabbdccd. 2). R → bc ¯ i 6. 2]. S → R 7. {i.2. 1. complete steps have to check that there is a corresponding pop-move item that has been completed for every item produced at a reduced push move. R → [(#. j}. the complete operation of the previous algorithm does not specify the correct constraints. 2] and b d. GILS RECOGNITION USING EARLEY ALGORITHM b) [(#. 1].2. #.3 Refining the Earley Algorithm for GIGs The Algorithm presented in the preceding section does not specify all the necessary constraints. Example 19 Gamb4 = ({S. b.2. S → aS • . The exact prediction path that led to the current configuration has to be transversed back in the complete steps. completed-stack ambiguity and stack-position ambiguity. push push pop pop Figure 5. 4. P ) where P is: 1. At this point. 2). This is depicted in the following figure 5. . S → aS • . 0] i 5. d}. 0). R → • ∗ • b c. i 57 c) [(#. S → aSd i 2. R → bd ¯ j 4. R → bRc ¯ i 5. c. S. 0). R}.2: Push and Pop moves on the same spine The following grammar produces alternative derivations which illustrate this issue.

58

CHAPTER 5. RECOGNITION AND PARSING OF GILS ¯ A solution is to extend the graph-structured stack to include I nodes. Whenever a push item is

being completed it has to be matched against the complement node on the stack. The existence of ¯ a corresponding I node stored in the stack has to be checked whenever an item with a reduced push ¯ node is completed. The following figure 5.11 depicts a graph that includes I nodes (pop nodes). It also shows some additional edges (the dashed edges) that depict the corresponding active nodes in the I domain. We will discuss this issue again in the next subsection.

i,1 $,0 j,1

i,2

i,3

i,3

i,2

j,2

j,3

j,3

j,2

j,1

Figure 5.3: A graph structured stack with i and ¯ nodes i

Completed stack ambiguity The graph-structured stack we presented so far is built at prediction steps and no additional computation is performed on the graph at completion steps. Therefore there is no way to represent the difference between a configuration like the one depicted in figure 5.2 and the one we present in figure 5.4.

A
push

B
pop

Figure 5.4: Push and Pop moves on different spines Such a difference is relevant for a grammar like Gamb5 Example 20 Gamb5 = ({S, A, R, B}, {a, b, c, d, e}, {i, j}, S, #, P ) where P is: S→AB A→R A → aAb |ab
i

R → aRd |ad
j

B → cBd |cd
¯ i

B → cBe |ce
¯ j

5.2. GILS RECOGNITION USING EARLEY ALGORITHM

59

Grammar Gamb5 generates the string aadbccde but it does not generate the string aadbcced. If we consider the recognition of the string aaaddbccdde, it will generate the following stack nodes for the derivation A ⇒ aaaddb: a(i, j, 1)a(i, j, 2)a(i, j, 3)d(→ j, 3)d(→ j, 2)b(→ i, 1). The notation (i, j, 1) indicates that two nodes (i, 1) and (j, 1) where created at position a1 , and (→ j, 3) indicates that the node (j, 3) was completed at the position d4 . Consequently only the nodes (j, 3), (j, 2) and (i, 1) are completed at the derivation point S ⇒ aaaddbB. The edges depicted in figure 5.5 are all valid at position 3 (i.e accessible from the item [∆, 3, R → aaa • d, 3] in S 3 ). However they would be still valid at position 6: [∆, 3, B → α • d, 6] in S 6
i,1 $,0 j,1 j,2 j,3 i,2 i,3
∗ ∗

Figure 5.5: A predict time graph Therefore, it is necessary to distinguish between prediction and complete stages. We need to introduce a new edge, a completion edge. The arrows in figure 5.6 are intended to designate this completion edge. They also indicate that there is a different kind of path between nodes. So, the simple lines indicate that there was a potential edge at the prediction step. Only those paths with additional arrows were confirmed at a complete step.
i,1 $,0 j,1 j,2 j,3 i,2 i,3

Figure 5.6: A complete steps in the graph

Stack position Ambiguity Two (or more) different stacks might have the same active nodes available at the same position. However those alternative stacks might correspond to alternative derivations. This issue is illustrated by the two stacks represented in figure 5.7.

60

CHAPTER 5. RECOGNITION AND PARSING OF GILS

i,1 $,0 j,1

i,2

i,3

i,1 $,0

i,2

i,3

j,2

j,3

j,1

j,2

j,3

Figure 5.7: Two alternative graph-structured stacks

The alternative graph-structured stacks depicted in figure 5.7 might be generated at different positions, e.g. in the following alternative spines as illustrated in the following figure 5.8.

push pop

Figure 5.8: Ambiguity on different spines Notice that although these stacks have the same active nodes, they do differ in the nodes that can be reached from those active nodes. They even might be continued by the same pop complement part of the graph. It must be noticed that the active nodes from the graph structures in figure 5.8 are indistinguishable from each other. Some information must be added to make sure that they point to active nodes in different graphs. The information that will enable to distinguish the corresponding nodes in the graph will be the position in which the push nodes are generated. This information replaces the order parameter that was used in the preliminary version of the algorithm. In this case the graph structured stack will be more like the one that is proposed in Tomita’s algorithm, in the sense that there is not an unambiguous length of the stack at each node.
i,5 $,0 $,0 j,1 j,2 j,3 j,4 j,5 j,8 i,6 i,7

i,1

i,2

i,3

Figure 5.9: Two alternative graph-structured stacks distinguished by position

2. the path function obtains the nodes in I which can be active. Push(newnode. We say ∆i > ∆j if ∆i = (δ i . oldnode. Note that the position is determined by the corresponding position of the terminal introduced by the push production. p < 0. This operation is the equivalent of the previous Pop function with a stack ¯ that keeps record of the nodes in I. p) such that δ is an index and p > 0 (p s are integers). The following operations are possible on the graph-structured stack. GILS RECOGNITION USING EARLEY ALGORITHM 61 5. PushC(currentnode. initialnode). The modifications are ¯ necessary due to the fact that the graph-structured stack contains both nodes in I and I. These operations enable the computation of the Dyck language over the graph-structured stack. Creates a complete edge from currentnode to precednode if necessary. pj ). Path(currentnode). It is a pair (δ. We say ∆− ∈ I. ∆j = (δ j .initialnode). for a node at position pi there might be pi−1 edges to other nodes. A node can connect to any node at a preceding position.10. It finds the preceding unreduced push node after one or more reductions have been performed. We will use also the complement notation to designate the ¯ corresponding complements. Therefore. i. Therefore ∆+ will designate a node corresponding to a pop move which ¯ “removes” ∆+ . On the other hand ∆− will designate a push node which has been removed by ∆− .e. p) such ¯ ¯ that δ ∈ I. . We will use a slightly more complicated version that takes into account completed nodes and the initial nodes introduced by the Push operation. Creates a newnode if it is not in the graph and creates an edge from newnode to oldnode if necessary. We will discuss it again below. It retrieves all the nodes in I that are connected by an edge to the push node that currentnode reduces. precednode). These edges will be represented then by triples: (newnode. A node ∆− designates a node corresponding to a pop move in the stack. and pi > pj . It is a pair (δ. after a reduce operation has been done. It also creates an i-edge from initialnode to newnode.4 Earley Algorithm for GIGs: final version Revised Operations on the stack We will use the following notation. We say ∆+ ∈ I. Therefore the number of edges connecting a node to a preceding one is bound by the position of the current node. A node ∆+ designates a node corresponding to a push move on the stack.2.oldactivnode.5. as is specified in algorithm 5 and depicted in figure 5. pi ).

Completed nodes are designated by a particular kind of edge. −3 j. −2 i. 2 j.1 $.−3 i. Both Path and Path2 perform Dyck language reductions on the graph structured stack. Path(∆ − 1 ): CHAPTER 5.−3 i. RECOGNITION AND PARSING OF GILS ¯ ¯ where ∆ − 1 .3 j. .2 i.1 j.10: Paths and reductions in a graph structured stack with i and ¯ nodes i The following operation operates on the reverse direction of the Path function. ∆ + 2 ∈ I 1 2 3 4 5 6 valueset = {} ¯ For edge((∆ − 1.1 $. named edgeC.3 i. ∆ − 3 ∈ I. −3 i. −1 j. The portion of the graph that is already reduced corresponds to completed nodeswhich already matched their respective complements. −1 j.2 i. 2 j. −2 j.0 i. Path2 performs them at complete time. The returned set of nodes represent points in the derivation at which to continue performing reductions at complete time. While Path performs them at predict time. Path obtains the closest non reduced nodes ¯ ¯ in I.62 Algorithm 3 .3 i. Path2 returns a set of nodes in I accessible from another node in I. −2 S S S S S Figure 5.3 j. −2 j.1 j. ∆ + 2 ) add ∆ + 2 to valueset ¯ For edge(∆ − 1 . and ∆ − 1 . ∆ − 3 ) add Path2(∆ − 3 ) to valueset return valueset S S i.0 j.

p) to the node (δ. [∆Ac . DI = I ∪ I ∪ {#}). will be denoted by DI (i. ∆2 ) add ∆2 to valueset ¯ For edgeC(∆ − 1 .3 j. -1 j. We ¯ ¯ say a node ∆− is in I if it designates a pair (delta. Two parameters represent the portion of the stack: the current active node ∆Ac and the initial node ∆In . -3 Figure 5. p) such that δ ∈ I. 2 j.1 j.3 j. -3 S S paths $. ∆ − 3 ) add Path2(∆ − 3 ) to valueset return valueset c c S 63 $. ∆In . -2 j. A → α • aβ. 0). p) (∆) in the stack. but inherit the last generated node. defined as follows: cl(δ) = cδ for any δ ∈ DI ∆cl represents a node (cl(δ).0 j. 2 j. The vocabulary corresponding to the set of indices (I). ∆ − 3 ∈ I.2. -2 j. GILS RECOGNITION USING EARLEY ALGORITHM Algorithm 4 . A node ∆cl (or cl(∆)) is a pointer (cl(δ).e.0 j. their ¯ ¯ complements (I) and the empty stack symbol (#). We refer to these as transmitted nodes. We need also to represent those constituents that did not generate a node of their own ( a push or pop derivation). p > 0. Path2(∆ − 1 ): ¯ ¯ ¯ where ∆ − 1 . We use a substitution mapping cl from DI into DI ∪ {c}∗ .1 j. p) such that δ ∈ I. The empty stack is then represented by the node (#. and positive. p < 0.11: A graph structured stack with i and ¯ nodes i New Earley items for GIGs Earley items have to be modified to represent the portion of the non reduced graph-stack corresponding to a recognized constituent.5. j] ∈ S i ¯ Nodes are represented by pairs of elements in I ∪ I ∪ {#}. . -1 j. ∆ − 1 ∈ I) and : ∆2 ∈ I ∪ {#} 1 2 3 4 5 6 valueset = {} ¯ For edgeC((∆ − 1. negative integers and zero respectively. We say a node ∆+ is in I if it designates a pair (δ. p) such that δ ∈ DI and p is an integer.

StorePath(∆ − 1 .12: I-edges Now that we have introduced I − edges we present a second version of the path computation that takes into account I − edges (here ∆R ) as boundary points to define a path. ∆ − 3 ) and For Path(∆ − 3 .oldactivnode. and ∆ − 1 . B I−edge α push or pop edge A Figure 5. we will make use of an additional type of edge. ∆R2 ) to Pathset ¯ else if ∆ − 1 > ∆R ¯ For edgeC(∆ − 1 . Algorithm 5 . I the set of indices. ∆ + 2 ∈ I. by the following Push function. ∆ − 3 ∈ I. ∆R . 1 2 3 4 5 6 7 8 9 10 11 12 ¯ If ∆ − 1 = ∆R : ¯ For edge(∆ − 1 . These edges will be introduced in the predict operation. ∆ + 2 . ∆R ) to Pathset ¯ For edgeC (∆−1 . It also takes into account the difference between nodes corresponding to completed constituents (lines 7-12) and nodes corresponding to incomplete constituents (lines 1-6). ∆ + 2 .64 CHAPTER 5.12. This kind of edge relates ∆In nodes. therefore we will call them I-edges. ∆R2 ) to Pathset ¯ For edge(∆−1 . Notice that an I-edge can be identical to a push or pop edge. I-edges are depicted in figure 5. ∆ − 3 . ∆ − 3 ) For Path (∆ − 3 . ∆R2 ) add Path(∆ − 1 ∆ − 3 . RECOGNITION AND PARSING OF GILS As we mentioned when we introduced the Push operation Push(newnode. ∆ + 2 . ∆ + 2 . ∆R2 ) add Path(∆ − 1 . ∆R ) to Pathset . ∆R 2) add Path(∆ − 1 . ∆ + 2 .initialnode). ∆ + 2 ) such that ∆ + 2 ≥ ∆R add Path(∆ − 1 . ∆R ): ¯ ¯ ¯ where ∆ − 1 . ∆R2 ∈ I ∪ I. ∆ + 2 . The interpretation of these edge is that there is a path connecting the two ∆In nodes.

(#. we represent nodes in the graph-structured stack with pairs (δ ± .a): ¯ the active node in the triggering item is in I or (1. In the second case. Let w = a1 a2 · · · an be an input string. (#. 0] 2 For 0 ≤ i ≤ n do: Process each item s ∈ S i in order performing one of the following: a) Predictor b) Completer c) Scanner 3 4 If S i+1 is empty. 0).an in which the index δ + in I was introduced. 0).2. The operations predictor.. In the pop case there are two subcases (1. S. n ≥ 0.b) where the active node is in I. I. Create the Sets S i : 1 S0 = [(#. and ai ∈ T for 1 ≤ i ≤ n. Let G = (N.5. completer used in the For loop in 2 are modified as follows to perform the corresponding operations on the graph-structured stack: as we said. GILS RECOGNITION USING EARLEY ALGORITHM Algorithm 6 (Earley Recognition for GIGs) . δ ∈ DI and the absolute value of p (abs(p)) refers to the position in w = a1 . p0 ) designates an item initial node. p1 ) designates an item active node (∆Ac ) and I(δ 0 . This is also required for productions ¯ that check the top of the stack: (A → γ) when the triggering item Active node is in I. T. 0). to retrieve the active nodes in I. [δ] . pop or e-move). Ac(δ 1 . 0). S → • S$.2. #. These subcases are constrained by the type of production applied (push. 0). 0]} then accept 65 The structure of the main loop of Earley’s algorithm remains unchanged except for the requirement that the initial item at S 0 (line 1) and the accepting item at S n + 1 (line 4) have an empty stack Active and Initial node: (#. Initialize the graph-structured stack with the node (#. the function path is used. p) such that −n ≤ p ≤ n.. If i = n and Sn+1 = {[(#.2. Prediction and Scanner Operations Prediction Operations will be divided in different subcases. 0). Reject. P ) be a GIG. scanner. S → S$ • .

p1 ). p3 ) ∈ path((δ 1 . A → • γ. (A → γ) ∈ P δ2 and δ 2 ∈ I: add every [Ac(δ 2 . j] ∈ S i and wi + 1 = a: add [∆A . pr )) and δ 2 = δ 3 and p3 = −p2 and push( (δ 2 . p3 ). (δ 3 . j] ∈ S i δ= and (A → γ) ∈ P such that δ ¯ or δ = [δ 1 ] or (δ 2 . p2 ). i] to S i such that: p2 = i + 1.b Predictor Pop: Active Node is in I ¯ If [Ac(δ 1 . p0 ). i] to S i and push( (δ 2 .a Predictor Pop: Active Node is in I If [Ac(δ 1 . B → α • Aβ. j] ∈ S i . p2 ). (δ 0 . All the completer operations . ∆In . i] to S i 2. p2 ). j] to S i + 1 Completer Operations The different subcases of Completer operations are motivated by the contents of the Active Node ∆Ac and the Initial Node ∆In in the triggering completed item (item in S i ) and also by the contents of the Initial Node ∆I0 of the combination target item (item in S j ). A → • γ. (δ 0 . p0 ). I(δ 2 . p1 ). p2 ). A → • γ. I(δ 2 . δ 1 ∈ I and δ 2 = δ add every [Ac(δ 1 . p1 ). A → α • aβ.3 Predictor e-move If [Ac(δ 1 . p2 ). I(δ 0 .2. RECOGNITION AND PARSING OF GILS If [Ac(δ 1 . (δ r . B → α • Aβ. I(cl(δ 0 ). δ 2 ∈ I: δ2 add every [Ac(δ 2 . p0 ). j] ∈ S i and (A → γ) ∈ P and δ 1 . p2 ). j] ∈ S i .1 Predictor Push CHAPTER 5. I(δ 0 . p1 ). p0 )) ¯ 1. A → αa • β. p1 ). p2 ). and push( (δ 2 . δ r . p0 ) ) StorePath((δ 2 . p1 ). (δ 0 . p2 ) ∈ path(δ 1 . p0 ). B → α • Aβ. i] to S i ¯ such that: (δ 3 . p2 ). I(δ 2 . pr )) 1. p0 ) ) StorePath((δ 2 . p0 ). I(δ 0 .2. (δ 1 .66 1. p1 ). ∆In . (δ 1 . B → α • Aβ. p1 ). p1 ). (δ 0 . p2 ). p2 ). p1 ). p0 ) ) 1. A → • γ. p2 ). ¯ such that: δ 2 = δ 1 and p2 = −p1 (A → γ) ∈ P δ2 and ¯ δ 2 ∈ I = δ¯ : 1 add every [Ac(δ 2 . Scanner If [∆Ac . (δ 1 . I(δ 0 .

GILS RECOGNITION USING EARLEY ALGORITHM 67 check properties of the combination target item in S j against edges that relate its the initial node ∆I0 to the initial node of the completed triggering item ∆In . a stack that is in the ¯ Dyck3 language of the indices and its complements (I ∪ I)). As a result of the combination. p2 ) such that δ ∈ I ∪ {#} and 0 ≤ p2 ≤ n). At this step.5. ¯ 3. p0 ) I(δ 0 . a}. ∆I0 = (cl(δ). and the active node has to contain its inverse. we need to check also whether the stack associated ¯ with each subtree is a proper substring of the Dyck language over I ∪ I. Therefore if the information is stored in a three dimension table. p3 ). The idea is to be able to compute whether a tree has a valid stack (i. A → α • Bβ.3 e-move) and therefore its initial node is a transmitted node.e ∆Ac = (δ 2 . the initial node ∆In is inherited by the result item. p0 ). We use the symbol ‘ ’ hereafter to indicate that the information stored in the corresponding field is not required in the computation. k] to S i Subcase 3. p).1).b combines a completed triggering item generated by a push production (using the prediction operation 1. I(δ 3 . These edges are of the form (∆In . The active node ∆Ac is also in I or it is the empty stack (i. the transmitted nodes are consumed. A completion edge is introduced recording the fact that this push node ∆In has been completed. The constraint that there is an I-edge between ∆In and ∆I0 is checked. The first completer subcase involves a combination item in S j that had been generated by an e-production. This is the reverse of predictor 1. p2 ). k] ∈ S j such that: ¯ δ 0 ∈ cl(I ∪ I) add [Ac(δ 2 .e. ). No further constraints are checked. p3 ). ( . . I(δ 3 . p0 )) and for [Ac1(δ 0 . the initial node ∆In is in I.3.a Completer A. The result item preserves the active node from the triggering item and the initial node from the combination target item. therefore. p3 ). (δ 0 . This is the equivalent of a production S → aS¯ for a Dyck language over the alphabet {a. ie. it means that only two dimensions are being used. 3 Use the standard terminology concerning Dyck languages as found for instance in [39]. For a subtree to be in the Dyck language over DI is as follows: the initial node has to contain the node for the first index introduced in the derivation. (derived by Predictor 1. ∆I0 ) (where the omitted element is the active node ∆Ac of the combination target). . However. a reduction can be performed.2. A → αB • β. B → γ • . . p2 ). If a subtree is in the Dyck language over a ¯ DI. Combination with an e-move item: δ 0 ∈ cl(I ∪ I) If [Ac(δ 2 . j] ∈ S i : for edge((δ 3 .

(δ 0 . RECOGNITION AND PARSING OF GILS I_3 I−edge edge I_3 Ac_2 + Ac_2 + − − Figure 5. p3 ). There are two additional constraints. A → α • Bβ.14: Completer B Subcase 3.68 I_0: e−move CHAPTER 5. δ 0 . I(δ 0 . In other words the active node ∆Ac is a closing parenthesis of the Dyck language that has not yet exceeded its opening parenthesis. In this case ¯ ¯ the active node ∆Ac is in I (i. j] ∈ S i δ 3 ∈ I.e ∆Ac = (δ 2 . A → αB • β. p3 ).c also combines a triggering item generated by a push production. ). p2 ) such that δ 2 ∈ I and −n ≤ p2 < 0). B → γ • . The first is −p2 < pI . It should be noted that the string position in which an index in I is introduced constrains the possible orderings of the control . p0 ). δ 2 ∈ I ∪ {#}. p0 )) such that: ¯ δ 0 ∈ I ∪ I.13: Completer A 3. p2 ). p2 ). p0 ). add [Ac(δ 2 . The existence of an edge between ∆In and ∆I0 is checked as in the previous cases. (p2 > −1) If [Ac(δ 2 . ( . I(δ 0 . k] ∈ S j pushC( (δ 3 . ∆In ∈ I. p3 ). p0 )) and for [ .b Completer B: Push with Active Node in I ∪ {#}. I(δ 3 . k] to S i and such that I_0 − + I_0 I−edge + − I_3 + push edge + Ac_2 + Ac_2 + Figure 5. and (p2 > −1) : for edge((δ 3 .

[(I0 . For instance. p3 ).(In . p_3) (d_1. In this case the active node ∆Ac is also in I ( like in subcase 3. k] to S i such that ¯ δ 3 ∈ I. and −p2 < p3 If [Ac(δ 2 .5... ¯ 3. j] ∈ S i for edge((δ 3 ..d is the last case that combines a completed item generated by a push production...)Ac ] ¯ ¯ The result item preserves the active node from the triggering item and the initial node from the combination item.. Following the preceding example )¯ has to be inside the square I brackets: (Ac . p0 )) and ¯ for [ . (p2 < 0) and ¯ −p2 < p3 there is a completed edge((δ 3 ... I(δ 0 . k] ∈ S j such that: δ 0 ∈ I ∪ I. p0 ). ¯ (Ac .−p_1) A_2 − A_2 − Figure 5.c). two nodes ∆In = (i. ( .. p0 )..e. But there is a ¯ different constraint: ∆Ac = ∆In . B → γ • . because ∆Ac should have met the corresponding matching Dyck element and a reduction should have been performed. δ 0 . 2) and ∆Ac = (¯ − 3). (p2 < 0). add [Ac(δ 2 .(I . I(δ 0 .)Ac ] ¯ The second constraint requires that ∆In has to have a matching closing parenthesis.15: Completer C Subcase 3. p2 ). The substring of the Dyck language that corresponds to the completed subtree is indicated by the square brackets.p_1) + − I_3 + push edge mirror push/pop (d_3.[(I0 . ( )) I_0 + − I_0 I−edge (d_1. −p3 ). p3 ). do not constitute a j valid stack configuration for a subtree. δ 2 ∈ I. A → α • Bβ. ¯ ∆In ∈ I..c Completer C: Push with Active Node in I.. so the node ¯ ∆In has to have been completed.. i. I(δ 3 ..2. ∆Ac is the matching parenthesis of ∆In . GILS RECOGNITION USING EARLEY ALGORITHM 69 language elements.. ). p2 ). In other words: ... )In . This constraint then expresses the fact that (Ac is outside the square brackets. A → αB • β.

−p3 ) such that δ I ∈ I and 0 < p3 ≤ n. A node preceding the active node (∆Ac1 ) of the target item (δ 1 . ∆Ac1 . (δ 0 . k] to S i I_0 such that ¯ δ 3 ∈ I. B → γ • .d. k] ∈ S j such that: δ 0 ∈ I ∪ I. (δ 1 . p0 )) and ¯ for [Ac(δ 1 . ¯ ¯ 3. p2 ). product of the reduction. becomes the updated Active node of . p3 ). p1 ). p0 ).( p2 < 0). and ∆Ac = ∆I If [Ac(δ 2 . Therefore the whole stack of the completed triggering item can be reduced and the active node of the result is updated to a node that precedes ∆In in the stack. ). p5 ) ∈ path2(δ 2 . p2 ) b) The reduction is performed by a single edge from the complement of the Active Node (∆Ac ) to a matching node of the initial node in the target combination item ∆I0 . ¯ Subcase 3. I(δ 0 . c) The completed item initial node and active node are equal (∆In = ∆Ac ). there ¯ ¯ is an edge ((δ 2 . p1 ). δ 2 ∈ I. (δ 0 . I(δ 0 . This is the base configuration to perform a Dyck reduction.p_1) I_3 + push edge Ac1: (d_1. )). This option is similar to the previous one.e. p2 ) = (δ 3 .p_1) I_0 + − reduced path Ac_2 = I_3 Ac_2 − Figure 5. −p0 . In other words.d Completer D: Push with Active Node in I. j] ∈ S i ¯ −p2 = p3 and δ 2 = δ 3 for edge((δ 3 . p1 ). The alternatives for performing a Dyck reduction on the graph are three: a) The reduction is performed by the path2 function: choose (δ 5 . which is ∆Ac1 . p5 . p1 )(δ 5 . (δ 1 . A → αB • β. I(δ 3 . + − i−edge Ac1: (d_1. (p2 < 0). p1 ). p0 ). add [Ac(δ 1 .16: Completer D The following Completer cases involve completed triggering items generated by pop productions. i.70 CHAPTER 5. The Active Node of the result item are updated. ∆I0 ) where ∆In = ∆Ac1 . and checked to verify that they satisfy the control properties required by the case 3. RECOGNITION AND PARSING OF GILS ¯ (δ 2 . −p2 ). the only difference is that ∆Ac was not completed yet at this stage (the path2 function requires completed nodes).e corresponds to edges (∆In . p3 ). A → α • Bβ.

which has not yet exceeded the position of its opening parenthesis. The Active node ∆Ac is updated according to the performed reduction. p5 ).f considers the combination of a pop item with a push item and checks the properties of the Active Node (∆Ac ) to verify that it satisfies the control properties required in 3. Pop items with Push items and graph reduction ¯ If [Ac(δ 2 .5. −p0 .2. δ 0 ∈ I and p2 > p3 4 There ¯ is a complete path of I elements that reaches the one that complements δ 0 . p2 < 0 : Compute path2 (δ 2 . p5 ) = (δ 0 . p0 )) where ¯ δ 3 = δ 1 . p3 . −p2 ).17: Completer E. −p0 ) 2 else if p2 = p3 . A → αB • β. p1 ).p_4) path + − + pop edge reduced graph Ac: (d_4. 5δ ¯2 6 An was introduced after δ 0 was reduced. (δ 0 . (δ 1 . δ 1 ∈ I. for [Ac(δ 1 . This case is relevant for the language Lgenabc edge to itself. p0 ). These two alternatives are allowed by p2 > p3 . −p0 )4 ¯ ¯ else if −p2 > p0 and there is an edge (δ¯ . 3.f Completer F. the Active Node is positive (∆Ac+ ). p0 ). alternatively. Pop items with Push items: p0 > 0. p2 ). and (δ 5 . ) add [Ac(δ 5 . The information that ∆In was completed is stored by the completed edge (∆In .e Completer E. p2 ) for edge((δ 3 .δ 2 = δ 3 for edge(δ 1 . p5 ) ∈ path2(δ 2 . p3 ).6 3. (∆Ac− ). Either the Active Node is a closing parenthesis. last case Subcase 3. ∆In ).p_4) + − I_3=A_2 Ac_2 − Figure 5. k] ∈ S j such that ¯ If p1 > p0 . ). Part of this constraint might be specified in the Completer Case G. p1 )(δ 5 . p3 = −p1 . and (δ 5 .c. j] ∈ S i such that δ 2 δ 3 ∈ I. A → α • Bβ. k] to S i I_0 5 71 + − i−edge Ac_1 I_0 (d_4. (δ 0 . I(δ 0 . p5 ). B → γ • . . p1 ). p5 ) ≥ (δ 0 . or exceeds it. and −p2 > p0 and (δ 5 . in other words ∆Ac > ∆In . I(δ 0 . p3 ). p2 ). I(δ 3 . δ 0 ∈ I and p0 > 0. GILS RECOGNITION USING EARLEY ALGORITHM the result.

. Therefore the target item has to have the same contents in the Initial and Active node as the completed item. p2 ). p0 )).g Completer G Pop items combine with Pop items7 ¯ If [Ac(δ 2 . ). Subcase 3. p2 ). k] ∈ S j : add [Ac(δ 2 .g combines completed items generated by pop productions with target items also generated by pop productions.3 predictor. p0 )) for [ . ( . A → α • Bβ.h combine completed items generated by the 1. p2 ). p0 ). k] ∈ S j add [Ac(δ 2 . A → αB • β. p3 ). ¯ for edge((δ 3 . Subcase 3. p3 ). I(δ 0 . 3. ). A → α • Bβ. p2 ). p3 )( ) I_0 + I_0 i−edge + I_3 − pop edge Ac_2 > I_3 Ac_2 + Ac_2 + − − Figure 5. ( . B → γ • . j] ∈ S i : such that p2 > p3 for edge((δ 2 . A → α • Bβ. δ 0 ∈ I for [ . I(δ 3 . (δ 0 . p2 ). or compute a graph reduction if the condition is not met. B → γ • . p3 ). p2 ). I(δ 3 . p3 ). j] ∈ S i such that δ 3 ∈ I. p3 ). I(δ 0 . k] ∈ S j add [Ac(δ 2 . RECOGNITION AND PARSING OF GILS If [Ac(δ 2 . I(δ 0 . k] to S i The following table summarizes the different Completer cases. p3 )( ) 3. I(cl(δ 3 ). p2 ). 7 Here we could state the constraint p2 > p0 . I(δ 0 . p0 ). A → αB • β. Completer H e-move If [Ac(δ 2 . p0 ). p2 ).72 CHAPTER 5. p3 ). B → γ • . (δ 3 . j] ∈ S i : for [Ac(δ 2 . k] to S i and pushC edge (δ 3 . (δ 0 . A → αB • β. k] to S i pushC edge (δ 3 . p0 ).18: Completer F The following subcases complete the remaining alternatives. (δ 3 .

therefore the pop procedure might take time O(i2 ) for each set S i . which may have O(i) active nodes. j] where: 0 ≤ j. For each active node there might be at most i edges. It has a maximum of n iterations where n is the length of the input.3.3 5. I(δ 2 .∆Ac + + +/-. A → α • Bβ.3. transmitted Specific Actions ∆I 0 ← ∆In pushC(∆In . Predictor pop. Each item in S i has the form: [Ac(δ 1 . p2 ).5.19: Completer G Summary of Completer Cases CASE A B C D E F G H COMPLETED ITEM +/+ + + transmitted ACTIVE NODE +/+ ¯ . Scanner. COMPLEXITY ANALYSIS I_0 73 − I_0 i−edge − I_3 Ac_2 − Ac_2 − Figure 5. ∆I0 ) ¯ check for ∆In reduce: ∆A ← ∆In − 1 reduce with path2 pushC(∆In . p2 . −) pushC(∆In .(∆A > ∆In ) +/ +/TARGET ITEM transmitted +/+/+/+/.(∆A = ∆I ) +/. . p1 . ≤ i Thus there might be at most O(i3 ) items in each set S i .1 Complexity Analysis Overview The algorithm presented above has one sequential iteration (a for loop). Predictor e-move and Predictor Push operations on an item each require constant time. −) 5. p1 ). might require O(i2 )..

.e. c. ≤ i with at most all [ . RECOGNITION AND PARSING OF GILS The computation of the Path function might require O(n3 ) also. B. #. }. d}. while the indexing is so to speak. p0 ). m + k ≥ n} . m ≥ 1} In this case.a to 3. p1 ). where 0 ≤ j ≤ i Languages that have this property will be called constant indexing languages. {a. m. {i. }.e. I(δ 3 . i. ≤ j such that there is an i−edge((δ 3 . then the complexity of this operation for each state set is O(i5 ). {a. where: 0 ≤ j. P ) where P is S → aSd i S → BC S → DE n m n n B → bB ¯ i B→b ¯ i C → cC E → cE ¯ i C→c E→c ¯ i D → bD D→b n n m n L(Gamb ) = {a b c d |n. In other words. d}. A → α • Bβ. Once the CF backbone chooses either the “BC” path or the “DE” path of the derivation. b. This is a general analysis. (δ 0 . b. B → α • γ. The required time for each iteration (S i ) is thus O(i5 ).C → cC 10.h ) can combine an item from S i : [Ac(δ 2 .B → b 9. m ≥ 1} ∪ {a b c d |n.B → bB ¯ i 4.C → c ¯ i 7. i. c. pj ]. the ambiguity resides in the CFG backbone. #.B → bB n k m n 8. B. only two dimensions are taken into account from the three dimensional table where i-edges and edges are stored. p0 )). p3 ). It can be observed that this algorithm keeps a CFG (O(n3 )) complexity if the values of p1 and p2 are dependent on i.B → b ¯ i 5. k] ∈ S j (i = j). S. There are at most O(j 2 ) such possible combinations. S. O(i) and the complexity of the algorithm is O(n3 ).S → BC 3. A different case of ambiguity is Gamb2 = ({S. I(δ 2 . There are S n iterations then the time bound on the entire 1-4 steps of the algorithm is O(n6 ). C → cC ¯ i 6. This is in general the case except for some restricted cases in which the node ∆Ac1 is bound to the node ∆In and therefore does not increase the combinatorial possibilities. p1 ) is not taken into account in the combination. deterministic.74 CHAPTER 5. Given that there are at most O(i3 ) items in each set. In such cases the number of items in each set Si is proportional to i. only one indexing alternative can apply at each step in the derivation. k. [Ac(δ. We consider in detail each subcase of the Completer in the next subsection. This is true even for some ambiguous grammars such as the following: Gamb = ({S. p0 . p2 ). provided the information in the node Ac1(δ 1 .S → aSd i 2. p3 ). C. The Completer Operations (3. p2 ).. I0(δ 0 . P ) where P is : 1. C}. p3 . A → α • Bβ. also in S j . k ≥ 1. j] where: 0 ≤ j. p2 . {i. D. C → c L(Gam2 ) = {a b c d |n. E}. if for each item there is only one value for p1 and p2 for each i.

k ≥ 0. In practice. {i. There are no mathematical average case results. O(n3 ) holds for grammars with constant or unambiguous indexing. O(n2 ) for unambiguous context free back-bone grammars with unambiguous indexing and O(n) for bounded-state8 context free back-bone grammars with unambiguous indexing. Unambiguous indexing should be understood as those grammars that produce for each string in the language a unique indexing derivation.3. most algorithms for CFGs. TAGs. Complexity results concerning formalisms related to Natural Language (including CFLs) mostly are worst case results (upper bounds) and they do establish polynomial parsing of these grammars. push. m + k = n} Therefore. 5. There is an important multiplicative factor on the complexity computed in terms of the input size which depends on the size of the grammar (see [6]). All average case results reported are empirical. 8 Context Free grammars where the set of items in each state set is bounded by a constant. #. 7 and 8 would be bounded by the square of the number of b’s scanned so far. The size of the grammar designated by |G| corresponds to the number of rules and the number of non-terminals. the sources of increase in the time complexity are a) ambiguity between mode of operation in the stack ( . so the following results hold: O(n6 ) is the worst case. Usually. b.3. P ) would produce items proportional to i in each set S i : S → aSd i S → BC B → bB ¯ i B→ C → cC ¯ i C→ L(Gam3 ) = {an bk cm dn |n ≥ 1. the similar grammar Gamb3 = ({S. d}. . In the analysis we present here. c. COMPLEXITY ANALYSIS 75 In this case (where the ambiguity is between a pop and an epsilon-move the number of items corresponding to the rules 3. or pop) through the same derivation CF path and b) a different index value used in the same type of stack operation. However. S. we keep separate the size of the context-free backbone and the indexing mechanism. the real limiting factor in practice is the size of the grammar. The properties of Earley’s algorithm for CFGs remain unchanged. and other grammar formalisms run much better than the worst case. C}. 4. The expensive one is the first case. m. }. {a.5.2 Time and Space Complexity In this subsection we compute the time and space complexities in terms of the length of the input sentence (n) and the size of the grammar. B. This will allow to compare what is the impact of the indexing mechanism as an independent multiplicative factor.

Completer Case 1. A → α • Bβ. Predictor Operations If [Ac(δ 1 . B → γ • . ∆I0 . j] ∈ S i and (A → γ) ∈ P : δ add every [(δ 2 . ∆I0 ) and item: for [ . The computation of the path in Predictor takes at most O(n3 ) for each vertex. A → α • aβ. The push (1. Scanner If [∆A . the complexity of the predictor operation is: O(|I|2 · |G| · n4 ). ∆3 . The same grammar rule may have different values for δ. j] ∈ S i and wi + 1 = a: add [∆A . Predict. . p1 ). there are at most O(|I| · n) edges in a path and we consider edges to two vertices: the active node and the initial node. The same grammar rules may apply at most n2 times (if it is a pop rule): there might be O(I ·n) possible values for Ac(δ 1 . k] ∈ S j add [∆Ac . ∆I0 . and for each value there might be O(I · n) path values. k are bounded by n. There might be O(I · ∆In − 1) possible values for each edge and ∆In . ∆In . ∆In . B → α • Aβ. C. We consider now the more simple cases of the Completer operation which have the following shape. A → • γ.2) and predictor 1. ∆In . p2 ). Given there are two stack possible values (∆Ac and ∆In ).3 operations take constant time regarding the input size. A → αa • β. It depends on k and p0 : O(|I| · |G| · n2 ). A → αB • β. It checks the current word (input aj ) against the terminal a expected by the scanner. RECOGNITION AND PARSING OF GILS Analysis of Scan. There is still the need to check for duplicates of the grammar rules. k] to S i The complexity is bound by the number of elements in S j that satisfy the edge condition.76 CHAPTER 5. j] ∈ S i : for every i-edge (∆In . p1 ). ∆0 . i] to S i A grammar rule is added to the state set. Complete The scanner operation requires constant time. no recalculation of ∆Ac (No reduction involved) If [∆Ac . j] to S i + 1 Predictor operations have in general the following shape.

Total complexity is then n × O(|I|2 · |G| · n3 ) × O(I · G · n2 ) = O(|I|3 · |G|2 · n6 ) The remaining cases of the Completer involve more complex operations because the value of ∆Ac has to be recalculated. A → α • Bβ.3. n. given the node ∆Ac1 has to be considered to compute the result item added to the S i set ( the values of ∆Ac . There are O(n) possible values for each ∆Ac . recalculation of ∆Ac : Completer D and Completer E ¯ 3. ∆Ac1 . ¯ ∆In = ∆Ac1 .d Completer D: Push with Active Node in I If [∆Ac . ∆I0 . ∆IO ∈ I such that ¯ ∆Ac = ∆I . ∆I0 . ∆Ac1 . A → α • Bβ. k] to S i ¯ In each set in S i there might be at most O(|I|·|G|·n2 ) items that satisfy the condition ∆Ac = ∆I . ∆In . k] ∈ S j such that the following conditions imposed on the edges are satisfied: ¯ if pAc1 > pI0 . So the total is n × O(|I| · n) × O(|I| · |G| · n2 ) × O(|I| · |G| · n2 ) = O(|I|3 · |G|2 · n6 ) 3. j] ∈ S i such that ∆Ac ∆In ∈ I. abs(pAc ). Pop items with Push items that re-compute the value Active node. k] ∈ S j such that: ∆0 ∈ I ∪ I.5. This requires the pA value of ∆Ac to be equal to −pI in ∆In (their integer values are opposites). ∆I0 ) where for [∆Ac1 . j] ∈ S i for edge(∆In . ¯ There are at most O(|I| · |G| · n2 ) items in S j that satisfy this condition. Each such item can be combined with at most O(|I|2 · |G| · n3 ) items in each set in S j . We will analyze each of them in turn. add [∆Ac1 . B → γ • . Subcase 1 ¯ If [∆Ac .e Completer E. pAc . performing reductions. abs(pIn ). Completer Case 2. pIn < 0 : Compute path2(∆Ac ) for edge(∆In .∆In and j : 0 ≤ j. ∆I0 . ∆0 ) and ¯ for [∆Ac1 . ∆I0 . A → αB • β. k] to S i Computing the set path2 for each ∆Ac takes O(|I| · n2 ) time. A → αB • β. ) is done in constant time. ∆IO and k produce give O(n3 )). ∆In . ∆I0 . These additional operations are performed provided certain constraints are met. ∆I0 . COMPLEXITY ANALYSIS 77 In each set in S i there might be at most O(|I|2 · |G| · n3 ) items. Checking if ∆I0 ∈ ¯ ¯ path2(∆Ac ) or there is an edge (∆Ac . and −pAc > pI0 and ∆I0 ∈ path2(∆Ac ) ¯ ¯ else if −pAc > pI0 and there is an edge (∆Ac . ∆Ac1 . so its bound is O(|I| · i3 ) for each set S i (∆Ac ) is bound by i). ) ¯ add [∆I0 . B → γ • .

k] to S i There are at most O(|I| · |G| · n2 ) items in each set S i that satisfy the condition ∆Ac = ∆In ¯ There are at most O(|I| · |G| · n2 ) items in each set S j that satisfy the condition ∆In = ∆Ac1 There are at most O(|I| · n) edges for each ∆Ac1 . We have seen then that O(|I|3 · |G|2 · n6 ) is the asymptotic bound for this algorithm. These can be done as a separate filtering on the completed items in S i . q. Total complexity is then n × O(|I| · n) × O(|I| · |G| · n2 ) × O(|I| · |G| · n2 ) = O(|I|3 · |G|2 · n6 ) ¯ Finally we have not considered the case of the path2 with different values than ∆I0 .e Completer E. ∆In .] → Γ1 • B[. i. k. Subcase 2 ¯ If [∆Ac . ∆I0 . q] [C → Γ4 • ..78 CHAPTER 5. k] ∈ S j for edge(∆Ac1 . p. i. r. rs] However the work load can be set either in the indexing mechanisms as is shown in the equivalent completor from [74]. Pop items with Push items that re-compute the value Active node. ∆5 . k. If we compare the algorithm with LIG algorithms. A → α • Bβ. where the set of nonterminals is {t. |C. |−. −] [B → Γ3 • . ∆Ac1 . |D. |D. The higher impact of the grammar size would be motivated in the following kind of completer required by LIGs (from [4]).. ) add [∆5 . η.] → Γ1 B[. −. j. A[. Therefore if the set of indices is relatively small there is not a significant change in the influence of the grammar size. within the same time bounds adding an operation to update the active node reducing all possible paths.}. B → γ • . the only change corresponds to the added size of I. s] [A[. η. j] ∈ S i such that ∆Ac = ∆In ∈ I: for edge(∆In .γ]Γ2 . the impact of the grammar size might be higher for the LIG algorithms and the impact of the indexing mechanism smaller... If we compare the influence of the grammar size on the time complexity of the algorithm for GIGs and the one for CFGs.γ]Γ2 .b. γ... used to parse TAGs. ∆I0 ) where ¯ ∆In = ∆Ac1 and items for [∆Ac1 . j. that involves the combination of three constituents: [A[. RECOGNITION AND PARSING OF GILS Total complexity is then n × O(|I|2 · |G| · n3 ) × O(|I| · |G| · n2 ) = O(|I|3 · |G|2 · n6 ) 3. ∆In . −.] → Γ1 • B[. p.γ]Γ2 . A → αB • β.

5.20: Earley CFG invariant .. q.4 Proof of the Correctness of the Algorithm The correctness of Earley’s algorithm for CFGs follows from the following two invariants (top down prediction and bottom-up recognition) respectively: Proposition 5 An item [A → α • β.. i] is inserted in the set S j if and only if the following holds: 1.ai Aγ 2. l A note on Space Complexity The space complexity is determined by the storage of Earley items...4. j. ai a i+1 . k. p. k t[η] → t[η r ] • . S ⇒ a1 . q. therefore it can be done in a n × n × n table.. Storing the combination of i-edges and edges involves three nodes. α ⇒ ai+1 . l b[η] → ∆ • . i.. Storage of the graph-structured stack takes O(n3 )..aj ∗ ∗ S γ A η α β a1 . t[. −. i t[η r ] → Θ • ... p. j. PROOF OF THE CORRECTNESS OF THE ALGORITHM Type 4 Completor: 79 t[η] → • t[η r ]. −. Given there are four parameter bound by n in each item. i.η] → t[. and the number of possible nodes is bound by n. i.ηη r ] 5. aj Figure 5.. its space complexity is O(n4 ).

.. #δ and w is in T ∗ .X k γ. #δx 2..) or pop : µ = x. If A → X 1 . and δ y ∈ C then: ¯ µ wAγ. µ = µ [x] or µ = [x]. 173-185 and [87] for a control language representation for LIGs.. x in I...... #δx ⇒ wX 1 ..X n γ. I. I(z.. #δxδ y ⇒ wX 1 .. #. #δx¯ x ¯ 4. L(G) to be: {w|#S ⇒ #w and w is in T ∗ }.) or push: µ = x. then: ¯ µ wAγ. # ⇒ a1 .. #δx ⇒ βX 1 . x ∈ I. Let β and γ be in (N ∪ T )∗ .X n is a production of type (b. #δxδ y¯ x Then.X n is a production of type (c.. x ∈ I. w be in T ∗ and X i in (N ∪ T ).) or pop : µ = x. #δ ⇒ waX k .1 Control Languages ∗ We defined the language of a GIG G. 9 See ∗ [25] for control languages pp. p0 ).) (i..4.. p1 ). RECOGNITION AND PARSING OF GILS The corresponding invariants of Earley’s algorithm for GIGs can be stated in a similar way. x ∈ I. δ is in C }. #δx 3. If A → aX 1 . y ∈ I. Assuming such an alternative definition of a GIG language. δ be in I ∗ .X n is a production of type (c. we address the correctness of the algorithm as follows: Proposition 6 (Invariants) . A → α • β. 1. If A → X 1 ... C): {w| S. #δ ⇒ βX 1 .X k γ...X n γ. S. It is apparent that both definitions of a GIG language are equivalent. T. i] is a valid item in the Set S j if and only if the following holds: ¯ 1. define the language of a GIG G to be the control language L(G. S. then: µ wAγ... x ∈ I) then: βAγ. P ) as follows.e.ai Aγ.X k is a production of type (a. #δ or βAγ.80 CHAPTER 5. This is specified in terms of the Dyck language over ¯ I ∪I 5.. #ν for some γ ∈ V ∗ and some ν ∈ (I ∪ I)∗ ..X n γ... We can obtain an explicit control language9 modifying the definition of derivation for any GIG G = (N. . taking into account the operations on the stack. # ⇒ w. Define C ¯ to be the Dyck language over the alphabet I ∪ I (the set of stack indices and their complements). ∗ An item [Ac(y. If A → X 1 .

Condition a. PROOF OF THE CORRECTNESS OF THE ALGORITHM 2. ¯ b. This framework enables the analysis of relations between different parsing . specifies the properties of information of the graph-structured stack encoded in the item. Condition b.aj . 5.5. specifies the properties for the different types of productions that generated the current item. y ∈ I ∪ I iff z = z .21 depicts the properties of the invariant. which naturally embed the invariant properties of the Earley algorithm for CFGs. specifies that the item has a transmitted node from the graph if the empty string was generated in the control language. It will also help to understand the implementation of the algorithm we detail in the appendix. y π A z ai a .21: GIG invariant We will use Parsing Schemata to prove this proposition. # γ . else δ = ¯ ¯ ¯ c. z. ν. The remaining conditions specify the properties of the string νz µy π relative to the control language C. i+1 aj ν z µ yπ Figure 5.. µπ ∈ (I ∪ I)∗ . z. ∗ S ν a 1 .α η β µ .4.4.. δ = z iff δ ∈ I ∪ I. Figure 5. #νδ ⇒ ai+1 . Condition c.. α. a framework that allows high-level specification and analysis of parsing algorithms [75.2 Parsing Schemata We use Parsing Schemata. y = y . #νz µy π Such that: a. 76]... specifies the constraints related to the position correlation with the strings in the generated language. ∈ cl(δ ). d. π ∈ C and νz µy πρ ∈ C for some ρ ∈ (I ∪ I)∗ . Condition d. δ ∈ DI iff z µy π = epsilon. (A → αβ) ∈ P δ 81 3. p0 ≤ i + 1 and p1 ≤ j..

i. j]}.. [a. C Earley = {[S → S • .an } The set of valid items is defined by the invariant of the algorithm. 0. 0. Parsing schemata are closely related to the deductive parsing approach (e.an ∈ Σ∗ by: I Earley = {[A → α • β.. say j. k. defined by I Earley below.. n]}. j. then the consequent ξ is generated by the parser. The input string is encoded by the set of hypothesis HEarley . DScan = {[A → α • aβ. i. i.ai Aγ ∧ ∗ ∗ α ⇒ ai+1 .an that conforms to the item in question. DPred . j. Parsing Schemata are generalizations (or uninstantiations) of a parsing system P.g. ξ which means that if all the required antecedents η i are present. represent the recognition of a [B → • γ. V(PEarley ) = {[A → α • β. Parsing Schema 1 (Earley Schema for CFGs) . j]} DInit = { [S → • S.an is composed of three parameters a) I as set of items that represent partial specifications of parse results b) H a finite set of items (hypothesis) encodes the sentence to be parsed and D a set of deduction steps that allow to derive new items from already known items. A Parsing schema extends parsing systems for arbitrary grammars and strings. i − 1.. DComp . j. F ∈ I. i..aj } ∗ . 0]}.[72]). RECOGNITION AND PARSING OF GILS algorithms by means of the relations between their respective parsing schemata.. j] DEarley = DInit ∪ DScan ∪ DPred ∪ DComp F Earley = {[S → S • .. DComp = {[A → α • Bβ. j]. as we already saw are stored in sets according to each... position in the string. j]|S ⇒ a1 .. A set of final items. A parsing system P for a grammar G and a string a1 .82 CHAPTER 5. Earley items. . i] | a = ai ∧ 1 ≤ i ≤ n}.. i.. n] |S ⇒ a1 . j + 1] DPred = {[A → α • Bβ. Deduction steps are of the form η 1 . We present parsing schemata rather informally here. A final item F(PEarley ) ∈ I is correct if there is a parse tree for any string a1 . j]}. The corresponding set of items in the Schema is encoded by an additional parameter in the items Schema items. As an example we introduce the Earley Schema for CFGs. j + 1]} such that A → αβ ∈ P and 0 ≤ i ≤ j HEarley = {[a. This parsing schema is defined by a parsing system PEarley for any CFG G and any a1 . Earley operations are defined by the allowed deductions: DScan . η k sentence. [B → γ • δ.. k]. [A → αB • β.. i.. 0. j] [A → αa • β.

DPath2 b . Items in IC EGIG will participate in some restricted deduction steps. The parsing schema for GIGs corresponds to the algorithm 6 presented in section 5. will represent edges and paths in the graph.4. η kj η ij ∧ η p This kind of deduction step can be understood as shortform for two deduction steps. DPath b . It can be observed that the major differences compared to the CFGs schema are the addition of different types of Prediction and Completer deduction steps. η ik .4. η kj Those deduction steps that compute the the Control language are DPath a . and they introduce completion items η p in IC EarleyGIG . Prediction Push and Pop deduction Steps. PROOF OF THE CORRECTNESS OF THE ALGORITHM 83 Definition 12 A parsing system (P) is sound if F(P) ∩ V(P) ⊆ C(P) (all valid final items are correct). will be used to perform the corresponding deduction steps.5. Predictor steps can be decomposed as: η ij η ij η jj ηp η ij ηp Completer Steps can be decomposed as: η ik . DPrPop1 .3 Parsing Schemata for GIGs The parsing schema for GIGs presented here is an extension of the parsing schema for CFGs given in the previous subsection. DPath2 a . Those items in IC EGIG . DPrPush . and DCompG have the following shape. Therefore IC EGIG . A parsing system (P) is complete if F(P) ∩ V(P) ⊇ C(P) (all correct final items are valid). and DPrPop2 have the following shape. DCompF . η kj η ik . A Parsing system is correct if F(P) ∩ V(P) = C(P) 5.2. and this corresponds to the control language. and they introduce prediction items η p in IC EarleyGIG . However there is an additional type of deduction step performed in this parsing schema. a different set of items. η ij η jj ∧ η p Completers DCompB .

A → αa • β. j. ∆I0 ] | δ 2 ∈ I}. p ≤ j and IC EGIG = {[P. push. ∆I0 )]} ∪ {[P. j. (δ 1 . P ) and any a1 . j] |ν = or ν = [δ Ac ]} ν DPrPush = {[∆Ac1 . j] [∆Ac . ∆In ∈ {(δ. ∆I0 . (#. p)|δ ∈ DI. i. A → α • β. 0). j + 1] [∆Ac . I. ∆Ac . 0. ∆Ac1 . i. A → αβ ∈ P 0 ≤ i. j]. j] ¯ ¯ [(δ 1 . B → • γ. p1 )+. ∆In . i − 1. (δ 1 . path. popC. [a. p1 ). 0]}. A → α • Bβ. ∆I0 . or δ = cl(δ )} . pushC. j]} such that ∆Ac . ∆I0 . S. (δ 2 . j + 1]} DPrE = {[∆Ac . ∆In . j. i. B → • γ. DPrPop1 = {[(δ 1 . This parsing schema is defined by a parsing system PEGIG for any GIG G = (N. #.. −p1 ). j. cl(∆)I0 . ∆I0 ] | δ ∈ I]}. ∆2 ]} such that ∆i ∈ {(δ. j + 1).an ∈ Σ∗ by: I EGIG = {[∆Ac . p)|δ ∈ DI ∧ 0 ≤ p ≤ j} and P is in {pop. i. (δ 1 . A → α • aβ. ∆Ac1 . i. j] ∧ δ2 [push. RECOGNITION AND PARSING OF GILS Parsing Schema 2 (Earley Schema for GIGs) . ∆In . B → • γ. j] [(δ 2 . −p1 ). DScan = {[∆Ac .. ∆1 . DInit = { [(#. j + 1). path2} HEGIG = {[a. A → α • Bβ. i] | a = ai ∧ 1 ≤ i ≤ n}. (δ 2 . −p1 ). j + 1). T. A → α • Bβ. S → • S$.84 CHAPTER 5. ¯ δ1 . i. j] ∧ ¯ ¯ [pop. 0).

[P. [∆In +. ∆R1 ]. ∆1 +. ∆I0 ]} DCompC = {[∆Ac −. [path. ∆2 −. ∆1 +. ∆1 +. ∆2 +. i. k. j] ∧ [pushC. k] [∆Ac . i. ∆Ac −. ∆1 +. ∆R2 = ∆R1 .5. ∆2 +. ∆In +. i. . [P. A → αB • β. ∆R2 ] | (∆R = ∆1 +. ¯ [P. j]. ∆I ] . ∆2 +. [pushC. ∆2 −. ¯ δ1 85 ¯ DPath c = {[pop. ∆I . k]. ∆I0 . ∆1 −. i. ∆I0 . ∆]. A → α • Bβ. [path. ∆R2 ] ¯ [path. ∆R3 ] | (∆R1 = ∆1 +. [path. j. ∆R ]. ∆R1 ]. ∆3 +. ∆In . ∆In +. [∆In +. ∆3 −. ∆1 −. ∆R3 = ∆R2 . CL(∆)I0 . [path. P = pushC)} DCompA = {[∆Ac . j. P = push) ∨ (∆R1 < ∆1 +. ∆R4 ] ¯ [path. PROOF OF THE CORRECTNESS OF THE ALGORITHM ¯ DPath a = {[pop. k] [∆Ac +. ∆]. A → α • Bβ. ∆3 −. ∆1 . j]. ∆I . ∆R ]. ∆3 − . ∆I0 ] ¯ ¯ [∆Ac1 . ∆R1 ] ¯ [path. ∆R1 ] ¯ ¯ ¯ ¯ [∆1 . ∆I0 ] [∆Ac1 . j]. ∆In +. j]}. ∆1 . ∆2 −. ∆R2 = ∆R . P = push) ∨ (∆R1 < ∆1 +. ∆1 −. ∆1 +. j]. ∆3 −. ∆R2 ] ¯ [path. ∆3 +. A → αB • β. ∆1 +. P = pushC)} ¯ DPath b = {[pop. ∆3 +. ∆1 +. ∆Ac −. [path. ∆1 +. ∆R ]. A → α • Bβ. ∆R3 = ∆R1 . j] ∧ [pop. B → γ • k. k. DCompB = {[∆Ac +. B → γ • . [∆In . i. B → • γ. ∆R3 ] | (∆R1 = ∆1 +. ∆1 −. ∆1 − . . ∆I ]|δ 1 ∈ I}. ∆1 +. ∆1 −. A → α • Bβ. ∆4 +. ∆R3 = ∆R1 . [P. ∆2 +. ∆R ].4. B → γ • . ∆R3 = ∆R4 . ∆1 − . P = pushC)} ¯ DPath d = {[pop. ∆R1 ] | − same conditions P atha } DPrPop2 = {[∆Ac −. . ∆I0 ] [∆Ac1 . ∆I0 . ∆1 − . P = push) ∨ (∆R < ∆1 +. ∆In . ∆2 −.

A → α • Bβ. j] ∧ [pushC. ∆I0 ] |∆Ac > ∆In } ¯ DPath2 a = [pushC. A → α • Bβ. ∆I0 . ∆I0 ]} DCompH = {[∆Ac1 . A → α • Bβ. i. i. ∆I0 ] ¯ [∆In −. [pushC. ∆I0 . i. ∆I0 ] [∆Ac1 . j]. [∆In +. j]. j]} ¯ DCompD = {[∆I −. ∆1 +. . k] [∆Ac1 . A → αB • β. ∆I0 . ∆3 −] ¯ [path2. j]. CL(∆)I0 . ∆Ac −. [∆In −. A → α • Bβ. ∆In +. i. [pushC. i. ∆1 − . ∆In −. k] [∆Ac1 . ∆In −. k] [∆Ac . [∆Ac1 . ∆3 −] DCompG = {[∆Ac . ∆I0 . ∆1 +]. i. B → γ • . ∆I0 +. A → αB • β. ∆1 +. ∆1 −. ∆In . ∆Ac2 −] [∆Ac2 −. j] } DCompF = {[∆Ac . ∆1 −. RECOGNITION AND PARSING OF GILS [∆Ac +. A → α • Bβ. k. i. ∆2 −] ¯ [path2. B → γ • . B → γ • . ∆1 −. ∆I0 . j]. j] ∧ [pushC. ∆2 −. i. j]. ∆In −. i. ∆2 −] ¯ DPath2 b = [pushC. A → αB • β. [∆In −. ∆I0 −. ∆I0 −] [∆Ac1 . A → αB • β. ∆In . [path2.86 CHAPTER 5. j]} ¯ DCompE = {[∆Ac −. k]. k] [∆Ac . j] } . k. k. . k. A → αB • β. ∆2 −]. i. [path2. [∆In −. ∆In −. B → γ • . ∆I0 . i. B → γ • . k. . ∆I0 . ∆I0 . ∆I0 +] [∆Ac1 . ∆1 +]. ∆I0 −. A → αB • β.

· · · . p2 > p1 ≥ p0 3. p0 )] is valid for a string a1 · · · aj if and only if the following holds: ¯ ¯ 1. An item [path. : W ⊆ I a set of items. #νx for some γ ∈ N V ∗ and some ν ∈ (I ∪ I)∗ and x ∈ I. and π ∈ C ∗ . Definition 13 (derivation length function ) 10 Let (P) be a parsing schema. then prove that all ξ with d(ξ) = m. p1 ). (z. ξ ∈ V(P). A function d : H ∪ W → N is a dlf if (i) d(h) = 0 for h ∈ H. PROOF OF THE CORRECTNESS OF THE ALGORITHM A correctness proof method for parsing schemata This method is defined in [76] 87 • Define the set of viable items W ⊆ I as the set of items such that the invariant property holds. # ⇒ a1 . IC EGIG . This proof uses a so-called deduction length function (dlf ). −p2 ).. it holds that ξ ∈ W . νx = µyπ such that y ∈ I. η k } ⊆ W and d(η i ) < d(ξ) for 1 ≤ i ≤ k. • Proof of soundness for all the deduction steps: V(P) ⊆ W. Because we introduced another class of items.. S. The derivation length function is defined according to the properties of the parsing algorithm.4. In other words that the deduction steps preserve the invariant property. the items corresponding to the control language. It has to be shown that for all η1 · · · ηk ξ ∈ D with η i ∈ H ∪ W. Show that all the viable items (all possible derivations are deduced by the algorithm). we need also an invariant for the computation of the control properties. to use in the induction proof. 1 ≤ i ≤ k. η k ξ ∈ D such that {η 1 .11 Proposition 7 (Invariant of the Path function) . 2. (x. (y. (ii) for each ξ ∈ W there is some η 1 .aj γ. Assume that any item η in W with derivation length less than m is obtained (if d(η) < m then η ∈ V(P)).5. • Proof of completeness: W ⊆ V(P). · · · .

Let G = (N. An item η j : [Ac(y. p0 ). b. α. I(z... j ≤ n. p1 ).. #νδ ⇒ ai+1 . for grammar G and input w and η i .22: Path invariant Lemma 7 (GIG items soundness is preserved under Scan. A → α • aβ. η j then η j is a correct • If η i . p0 ). Let 0 ≤ i. i] is in S j if and only if η j −1 : [Ac(y. V(P) ⊆ W.aj −1 . #νz µy π 10 From 11 The ∗ [76].ai Aγ. # µ y x γ ρ . then scan ηj ¯ a.88 CHAPTER 5. • If η i is a correct item for grammar G and input w and η i η j then η j is a correct item. µ y aj π π a j Figure 5. S) be a GIG and let w = a1 · · · an ... I. S. p1 ).. n ≥ 0 where each ak ∈ T for 1 ≤ k ≤ n. RECOGNITION AND PARSING OF GILS S z S zy y a1 # x γ ρ a 1 . 1 ≤ i ≤ k it holds that ξ ∈ W This can be rephrased as follows in terms of the algorithm presented in section 5. I(z. For all η 1 · · · η k ξ ∈ D with η i ∈ H ∪ W.. η k item. Scanner. P. A → αa • β. . #. correctness of the push items is straightforward.(A → αaβ) ∈ P δ ∗ c. η k are correct items. i] is in S j −1 and η j −1 Since η j −1 is correct. (the invariant property) holds. T. # ⇒ a1 .. Predict Completer) .2. Regarding the pop items it is derived from the path function. • Case 1. Proof . where correct means that the proposition 2. #ν for some γ ∈ V ∗ and some ν ∈ (I ∪ I)∗ .

p2 = j + 1 η ij predict η jj ∧ η push η push = [push. j + 1). . #νzµyπ y ¯ It should be noted also due to η pop is obtained in this derivation. # ⇒ a1 · · · ai ai+1 · · · aj Bβγ.. u = x.) and the following deduction steps apply according to the value of δ i. S. #νz µy π by b. (B → ξ) ∈ P such that δ Since η ij is correct. p1 ).aj . δ = x ∈ I. x = cl(z). and we conclude the proof for Case1. I(z. α. (z. z ) ¯ ..(A → αBβ) ∈ P δ c. δ = . p3 = −p1 . (z. η push η path [path. • Case 2. b. A → α • Bβ.. (y. the following derivations follow: η pop . allows us to conclude that η j is a correct item in S j . (y.aj .. −p1 ). This together with a. ∗ ¯ a. (¯. #νzµyπ from (B → ξ) ∈ P ii. #νzµyπ ⇒ x . #νδ ⇒ ai+1 . and c. p1 ). . # ⇒ a1 . i] is in S j . (x. p1 ). p0 )) y e.4. δ = y . PROOF OF THE CORRECTNESS OF THE ALGORITHM ∗ 89 Now αaj . x = y .ai Aγ. S. B → • ξ. #νzµyπ y ⇒ ¯ ∗ . p2 = −p1 ¯ ¯ ¯ η ij predict η jj ∧ η pop η pop = [pop.. p0 ). u = y. Predictors An item η jj : [Ac(u. p3 = j + 1. (B → aξ) ∈ P . p1 = p2 . and c. p3 ). y .. #ηδ ⇒ (ai+1 . #νzµyπx iii. (B → ξ) ∈ P . p3 = p0 . η e. j] is in S j if and only if: η ij : [Ac(y. ij predict η jj ∗ . #νzµyπ from η ∗ ij ∗ (a. #ν for some γ ∈ V ∗ and some ν ∈ (I ∪ I)∗ . x . #νzµy π Therefore: (this is common to all the subcases) d. p0 )) e. b. u = y .5. #νzµyπx ⇒ y ¯ ∗ . I(x. p2 ).

x ∈ I. S. (z. (x . ¯ ¯ It should be noted also that as a consequence of η pop . Therefore S. y ∈ I. I1(x. I(z.90 CHAPTER 5.. η path2 = [¯. p1 ). (B → ξ) ∈ P . z ) such that x ∈ I and z is either z or z . i] is in S j if and only if an item η an item η kj : ik : [Ac(y. z ] is correct. z ). y. y. η path1 = [path.. y. η push = [push. (y. x. the same deductions as in the previous case are triggered: η pop . x = x . # ⇒ a1 · · · ai ai+1 · · · aj Bβγ. p1 ). #νzµyπ = #ν x π such that π ∈ C. p2 = p3 . η path predict η jj ∧ η pop η path ((y. B → ξ • . I1(x. p0 )] where p is either push or pop. ¯ x η ij . x. δ = x . y. (¯. z ) η pop = [pop. (x . in the previous page) . −p3 ). (This item corresponds to the edges that relate the nodes in η ij and η kj Given η ik and η kj are valid items we obtain: ∗ ¯ a. ¯ by Dpath a or η pop . x . p1 ). p0 ). #νzµyπ x from (B → ξ) ∈ P ¯ δ such that #νzµyπ x = #ν xπ x from d. A → α • Bβ. p2 ). abs(p3 )). p1 ). z). k] is in S j and [Ac1(u. p3 ). z ]. p3 < 0. I(z. y . p2 ). #ν for some γ ∈ V ∗ and some ν ∈ (I ∪ I)∗ . #νz µy πδ ⇒ ∗ ∗ ij (a. ¯ ¯ ¯ y x. u = x. (y. y . Completer An item η ij : [Ac(y . η push η path1 Case 3. I(z. and c. ¯ ¯ ¯ iv. x . .ai Aγ. p3 ). η push η path1 η path2 by Dpath b where η pop = [pop. abs(p3 )). A → αB • β. b. p0 ). z ]. ∆Ac1 . #νzµyπ from η . i] is in S k and an item η p : [p. RECOGNITION AND PARSING OF GILS where η pop = [pop. z) and η push = [push. η push η path η path2 by Dpath b η pop . # ⇒ a1 . then d. p0 )] x Since η path = [path. x .

(z. Those conditions are checked as follows according to the corresponding deduction step: A.. x ∈ I and p2 ≥ p3 > 0 η pushC = [pushC. the control language spans in positions i. I(z. active node:-) if and only if: . α. k. therefore the Consequently the result subtree contains #ν xµ yπ = which is in the control language. prove that η j : [Ac(y. We need to check the information in the corresponding nodes to validate the substring properties. p0 )] therefore given #ν (xµ (yπ is in the control language for some ρ then #νzµuπxµ yπ is also in the control language for some ρ C. η p Complete η ij (η ik is a transmitted item). η kj . η kj .ak . p1 ). aj #νz µu πx µy π This derivation together with a.. αB. The crucial step is checking the consistency of: #νzµuπxµ yπ in f. Both substrings are substrings of the Control language but their concatenation might not be.. p2 ). #ν x µy π ∗ c. p0 ). #νz µu π for some (A → αBβ) ∈ P δ ∗ 91 from η ik and ⇒ ak +1 . η p .. if and only if: z ∈ cl(i). I1(x. p0 ) in η ik Ac(y. PROOF OF THE CORRECTNESS OF THE ALGORITHM b. ⇒ ai+1 · · · ak ak +1 · · · .5. p3 ) in η kj .. #νδ ⇒ ai+1 . B. ⇒ ai+1 · · · ak ξ. η kj . I(z. η ik .ak Bβ. η p Complete η ij ∧ η pushC (η kj has positive initial and active nodes) if and only if: y. #νδ ⇒ ai+1 .aj . (x. η ik . ηp Complete η ij (η kj initial node:+. p3 ).4. ξ. η ik . #ν δ for some (B → ξ) ∈ P δ Now compose some of the pieces: d. #νz µu π e. #νz µu πδ ∗ ∗ from (B → ξ) ∈ P δ f. A → αB • β. The individual properties of zµu and xµy are checked using the information stored at: Ac1(u.. p2 ). i] is a correct item in S j .

p0 < 0. Therefore: #νzµuπ(xµ y)π = #νzµuπ(xµ x)µ y)π ¯ D. (u. RECOGNITION AND PARSING OF GILS ¯ x ∈ I. (¯. . p2 = −p3 . η ik . p3 )] ¯ z ∈ I. η p Complete η ij (xµ yπ is in C. x ∈ I. −p3 ). p3 )] ¯ z. (z. Result is νzµuπx)µ y π H. (y . (¯. η ik . p0 )] u η path2 = [path2. y = x. The current active node is negative). (¯. p3 > 0. η ik . y ∈ I.) if and only if: x ∈ I. p2 )]. (y.92 CHAPTER 5. p3 = −p1 ¯ Result string: #νzµ(uπ u)µ y π which is equivalent to #νzµπ µ y π . p3 < 0. η ik . the initial node is a transmitted node. η kj . A reduction is performed. (x. p3 ). η kj . η ik . p1 ). p2 ). . p3 < p2 Result is νzµuπx)µ y π G. F. ηp Complete η ij if and only if x ∈ cl(DI). abs(p2 ) < p3 η p = [popC. ¯ Therefore #νzµuπ(xµ x)π = #νzµuπ ¯ E. −p1 ). η path2 Complete η ij ( x reduces u. if and only if: η p = [p. η kj . ηp Complete η ij ∧ η p if and only if: η p = [popC. η p and π ∈ C. (x. ¯ η path2 guarantees that the result is in the control language. η kj . x ∈ I. p3 > 0. ηp Complete η ij ∧ η p 2 if and only if η p 2 = [popC. (x. p3 ). −p3 )] x x requirement that x has to be reduced. (x. η kj . abs(p2 ) ≤ abs(p0 ) x = u.

p0 ). This lemma is equivalent to the following claim in terms of the algorithm presented in section 5.1: Conditions on the completer Deductions Lemma 8 (Second direction. (A → αβ) ∈ P δ ∗ ¯ 3. then an item ξ = [Ac(y.2 and Proposition 6. p1 ) I(z. #νδ ⇒ ai+1 · · · aj . It states that all the derivations in the grammar will have the corresponding item in the set of states. i] is inserted in the Set S j . A → α • β. p1 ). CASE A B C D E F G H COMPLETED ITEM I1(x. PROOF OF THE CORRECTNESS OF THE ALGORITHM cl(x)µ y π = Therefore the result is νzµuπ 93 The following table 5. #ν 2. p3 ) Ac(y. p2 ) +/+/+ –+ + – + -x=u ¯ cl(xµyπ ) = –: y=x ¯ +/. I(z.5. #νzν yν } where δ = z if δ ∈ I ∪ I else δ = ∗ ξ ∈ D such that {η 1 · · · η k } ∈ W and d(η i ) < d(ξ) for such that #νzν yν satisfies the conditions imposed in proposition 2. S. ¯ µ = µ x )µ reduce: #νz µ u π ¯ #νz µ(u π u )µ y π reduce: #νz µ y π #νz µu πx )µ y π pushC(∆In . For each ξ ∈ W there is some η 1 · · · η k 1 ≤ i ≤ k.(x < y) +/ TARGET ITEM Ac1(u. # ⇒ a1 · · · ai Aγ. Result x µy π #νz µu π(x µ (y π #νz µu π(x µ y )π . . α. p0 ) cl(z µu π) = +/+/+/+/+ +/-.1 summarizes the conditions specified by the Completer Operations. −) #νzµuπ +:u Table 5. Completeness) . If 1.4.

A → α • aβ. ν zν yν • Scanner: ξ = [Ac(y. # ⇒ a1 · · · ai Aγ . I(z. p1 ). I(z. such that the invariant holds for those items previously introduced in the item set. p1 ). I(z. A → α • β. #ν zν uν δ ⇒ aj +1 · · · ak . and 3. #νzν yν ∗ ¯ } if δ ∈ I ∪ I else δ = Then η = [Ac(y. • Completers: ξ = [Ac(y. i] in S k Let S. #ν ∧ δ. #ν µ λ π 12 ∧ } ⇒ ai+1 · · · aj . A → αB • β. p0 ). (A → αβ) ∈ P δ ∗ 3. RECOGNITION AND PARSING OF GILS The proof by induction on the derivation length function d applied to the derivations specified in 1. # ⇒ δAγ. # ⇒ a1 · · · ai Aγ . p2 ). η ξ. A → α • Bβ. #ν zν uν xµyπ with minimal µ + ρ ¯ then if δ = x ∈ I ∪ I η = [Ac(u. The modification of the Earley algorithm for GIGs does not modify the treewalk that the algorithm performs. i. #ν ⇒ a1 · · · ai . I(z. p1 ). 12 Notice that induction on the strict length of the derivation would not work. The derivation length function is based on the treewalk that the Earley algorithm performs. #ν 2. I(z. j]) = min{π + 2λ + 2µ + j | S. S. p1 ).94 CHAPTER 5. The conception of the derivation length function is similar to the kind of induction used by [39] on the order of the items to be introduced in the set S i . p0 ). Therefore the derivation length function is the same as defined by [76] as follows: d([Ac(y. α. #ν . #ν zν uν ⇒ γ. . d(η) = d(ξ) − 1 and ζ. i] Let 1. A → αa • β. i] is in S j . p0 ). p0 ). #ν zν uν B. #ν ⇒ ai+1 · · · aj . #ν α. #ν zν uν δ δ ρ µ ∗ and γ. α. p0 ). because of the Completer operation. i] is in S j −1 and from ζ = [a. j − 1. j] ∈ HGIG d(ζ) = 0. #νδ ⇒ ai+1 · · · aj .

(u. p2 ). B → • γ. (z. p3 ). p0 )] d(η) = d(ξ) − 1 = d(η p ) . p1 ). I(z. ζ if δ = ξ 95 and xµyπ = ζ = [Ac(u. A → α • Bβ. λ. p1 ). p1 ). (y. #ν δ δ λ π ∗ α. I(x. j] is in S k and d(η) < d(η ) < d(ζ) = d(ξ) − 1. p1 ). η. j] is in S k and d(η) = d(η ) − 1 < d(ζ) = d(ξ) − 1. #ν and A. p3 ). (x.4. PROOF OF THE CORRECTNESS OF THE ALGORITHM η = [p. p3 ). ν zν yν µ } with π + 2λ + 2µ minimal. p0 ). I(z. p0 ). #ν . p0 )] such that p = push or p = pop. µ such that S. p0 )] such that p = push or p = pop. B → γ • .5. #ν ⇒ a1 · · · ai . j] is in S k and d(η) < d(ζ) = d(ξ) − 1. j] in S j Let S. p1 ). (δ. # ⇒ δAγ . Then η = [Ac(y. I(cl(z). #ν ⇒ αBβ. p1 ). η. π. η . η . p3 ). p3 ). δ. η. B → γ • . η . γ . ζ = [Ac(y. #ν and let δ. j] η η ξ if δ = ξ ∧ ηp and η p = [p. (z. p2 ). ζ ξ • Predict: ξ = [Ac(y. I(x. p0 ). (u. ζ ξ if δ = and xµyπ = η = [p. ζ = [Ac(y. # ⇒ a1 · · · aj Bγ . B → γ • . (z. (x. #ν δ ⇒ ai+1 · · · aj .

Any new potential items are added to an agenda of items for temporarily recording items whose consequences under the inference rules have not been generated yet. each new item may itself generate new consequences. Those new potential items are triggered by items added to the chart. However. Items should be added to the chart as they are proved. Encodings of the parsing schema as inference rules are interpreted by the inference engine. Initialize the chart to the empty set of items and the agenda to the axioms of the deduction system. and Lemma 8 W ⊆ V(P). the parsing algorithm described in section 5. . (b) Add the trigger item to the chart. the inference engine provides the control and data types. we have proved the correctness of the Parsing Schema V(P) = W. the relation between the abstract inference rules described in the previous section as parsing schema and the implementation we used is extremely transparent. 5. Given that the parsing schema abstracts from implementation details of an algorithm. chart-based deduction procedure is as follows (from [72]): 1. The Prolog database is used as a chart which plays the same role as the state sets in Earley’s algorithm. called the trigger item. and remove it. When an item is removed from the agenda and added to the chart. the prototype is not particularly efficient. Repeat the following steps until the agenda is exhausted: (a) Select an item from the agenda. 2. This is performed using the subsumption capabilities of prolog: those items not already subsumed by a previously generated item are asserted to the database (the chart).5 Implementation In order to perform some tests and as a proof of concept.96 CHAPTER 5. The general form of an agenda-driven. its consequences are computed and themselves added to the agenda for later consideration. The chart holds unique items in order to avoid applying a rule of inference to items to which the rule of inference has already applied before. as a meta-interpreter.2 was implemented in Sicstus Prolog on top of a general-purpose. if necessary. Because the inference rules are stated explicitly. agenda-based inference engine described in [72]. RECOGNITION AND PARSING OF GILS Therefore from Lemma 7 ( V(P) ⊆ W). However.

• The mix language {w|w ∈ {a. The number of items generated for the Mix and the copy languages were as follows: . b. • Grammar Gamb5b which generates aacdbbcd and aadcbbdc but does not generate aacdbbdd nor aacdbbdc (a variation of Gamb5 presented above). IMPLEMENTATION 97 (c) If the trigger item was added to the chart. generate all items that are new immediate consequences of the trigger item together with all items in the chart. {an bn cm dm en f n g m hm in j n |n ≥ 1} • {an bn wwcn dn |n ≥ 1. (#.5. (#. • {an bn cm dm en f n g m hm |n ≥ 1}.5. 0. If a goal item is in the chart. c}∗ and |a|w = |b|w = |c|w ≥ 1} Critically the most demanding was the mix language due to the grammar we chose: Gmix presented in chapter 2. otherwise it is not. {an bn cn dn |n ≥ 1}. 0. b}+ } {an (bn cn )+ |n ≥ 1}. S → • S$. {an bn cn de n |n ≥ 1}. 3. The goal corresponds to the final item in the Parsing Schema: F EGIG = {[(#. {ww|w ∈ {a. which where performed by procedures which implemented the path function over the graph representation. b}∗ } • {w(cw)+ |w ∈ {a. In this implementation the control language was not represented by separate items but as side conditions on the inference rules. 0). 0). b}+ } • Grammar Gamb4 which generates aabbcdcd but does not generate aabbcddc nor aabbdccd. 0]} and the encoding of the input string. Tests on the following languages were performed: • {an bn cn |n ≥ 1}. S → S • . the goal is proved (and the string recognized). and add these generated items to the agenda. w ∈ {a. The axioms correspond to the initial item in the Parsing Schema: DInit = { [(#. This grammar has a high degree of ambiguity. 0). n]}. 0).

ai Aβ ⇒ δγ j a1 .100 MCopy L. The notion of valid items for GILs is more complex because a GIG LR-item has to encode the possible configurations of the auxiliary stack.500 ≈ 2. [80]). [41].6. ∗ ∗ rm rm ∗ .000 ≈ 28.6 LR parsing for GILs An LR parser for a CFL is essentially a compiler that converts an LR CFG into a DPDA automaton (cf.000 ≈6. This approach can be extended to a Generalized LR parsing approach. A → β 1 • β 2 ] where δ is in I ∪ {#} is valid for a viable GIG µ prefix αβ 1 if there is a derivation using the GIG context free backbone: S ⇒ αAw⇒ αβ 1 β 2 w and there is a GIG derivation S ⇒ γ i a1 .98 Length 6 9/10 12 15/16 18 CHAPTER 5. We say a GIG item index pair [ δ.976 Mix L. ≈ 300 ≈ 1. 5. ≈ 500 ≈ 2.000 Copy L. [2]). The similarities of Earley Parsing and LR parsing are made explicit in those transformations.625 104. [2]). The sets that define the states in GIG LR parsing are composed by a pair of sets (IT. the technique we present here converts an LR GIG into a deterministic LR-2PDA according to the definition presented in Chapter 2..1 LR items and viable prefixes We assume the reader has knowledge of LR parsing techniques (cf. In the GIG case. We will refer to the connections between Earley parsing and LR parsing to clarify this presentation.000 ≈ 9.800 5. IN ). RECOGNITION AND PARSING OF GILS n4 1296 10.100 ≈5.000 ≈ 16. The set of prefixes of right sentential forms that can appear on the stack of a shift-reduce parser are called viable prefixes in context free LR-parsing. We will do this in such a way that the set of items contain information not only of what possible items belong to the set but also of the possible indices that might be associated to the set of parsing configurations that the items describe. It is also more complex because GIL derivation requires leftmost derivation for the stack operations... Therefore the set of items has to encode the corresponding top-down prediction that affects the stack of indices.500 ≈2. An item A → β 1 • β 2 is valid for a viable prefix αβ 1 if there is a derivation S ⇒ αAw ⇒ αβ 1 β 2 w.736 50. ≈ 100 ≈ 400 ≈ 700 ≈ 1.000 20. if multiple values are allowed in the parsing table (cf. We use this notion of viable prefixes to describe the computation of the rm rm ∗ main stack in a LR-2PDA..aj β 2 β. Both [75] and [3] describe transformations of Earley Parsing Schemata to LR Parsing Schemata.

LR PARSING FOR GILS 99 5. Such productions are considered in case 2 of the Goto function. For the GIG algorithm the set of items and possible index values cannot be determined only by the Closure operation. Initially. For CFG parsing (cf. every item in IT is added to closure(IT ). R → Ra ¯ i 5. S → bS j 3.[3]). if the index operation is for instance ¯: ι δ(A → α • Bβ. However in Earley’s algorithm this computation is done in run-time while in LR parsing it is precompiled in the LR states. ) |B → γ is a production } (a PDA transition) ¯ ι ¯ ι It is apparent that the two items should not be conflated because there is a change in the stack configuration. S. They are also determined by the Goto operation. Apply this rule until no more new items can be added to the closure of IT . P ) and P is: 1. S → aS i 2.2 The Closure Operation. {a. {i. . The Closure operation is equivalent to the Predict function in Earley parsing (cf.5. R → [#] 4. Example 21 L(Gwcw ) = {wcw |w ∈ {a. [41]) the Closure operation is equivalent to obtaining the set of states of a NFA that recognizes the viable prefixes.The transitions of this NFA are of the following form: δ(A → α • Bβ. then closure(IT ) is the set of items constructed from IT by the two rules: 1. 2. j}. R}. ) = {B → • γ |B → γ is a production } (a NFA transition) In the GIG case the transitions should be as follows. the goto function and the parsing table.6. #. ¯ Note that the two conditions of the Closure operation rule out the possible index operations δ and [δ] when the right-hand side of the production starts with a non-terminal. If IT is a set of items for a grammar G. b}. S → cR 6. The following example uses a grammar for the language Lwcw to depict the construction of the set of items. or (ii) µ δ B → aγ then add the item B → • γ (case 1) or the item B → • aγ (case 2) to IT if it is not δ δ δ already there. b}∗ }. If A → α • Bβ is in closure(IT ) and (i) B → γ is a production where δ is in I ∪ { }. Gwcw = ({S. R → Rb ¯ j The set of states for the grammar Gwcw should encode the possible configurations of the stack of indices as follows: . ι) = {(B → • γ.6.

X). IN ) is defined to be the pair (IT 2 . X. The set I6 requires that the stack be empty. The CF function goto(IT. s) where i is an index symbol and s is a state defined by a set of items closure. if µ µ I is the set of items that are valid for some viable prefix γ. j. is defined to be the closure of the set of all items [A → αX • β] such that [A → α • Xβ] is in IT . RECOGNITION AND PARSING OF GILS I1 : i S → a•S i i I2 : j S → b•S j i I3 : I4 : I5 : I6 : I 10 : {i.100 I0 : # S → •S S → • aS i CHAPTER 5. We will describe the Goto function adding the possibility of computing the possible stack values of the PDA for each state. is the set of items that are valid of the viable prefix-index pairs (γX. the new sets I4 and I5 (as compared to context free sets) imply that an index i or j has been consumed from the stack. The CF Goto function is a DFA transition function where IT is in the state set and X is in the vocabulary.ιj ) in other words. #} {i. #} # # S → c•R R → • Ra R → • Rb ¯ j ¯ i S → • aS S → • bS j S → • aS S → • bS j S → • bS j S → • cR I7 : I 11 : # # S → aS • j S → • cR I8 : I 12 : # # S → bS • j S → • cR I9 : I 13 : # # S → cR • j R→ • [#] R → R•a ¯ i R → R• b ¯ j R → Ra • ¯ i R → Rb • ¯ j Figure 5. ι) = (I j .ι). X) is the set of items that are valid for the viable prefix γX. Intuitively.IN 2 ) where either 1 or 2 applies: . j. then goto(I. #} {i. then goto(I. The GIG function Goto has three parameters a) IT is a set of items b) X is a grammar symbol and c) IN is a set of pairs (i. In the GIG case. 5.3 The Goto Operation. ιj ). s) is in IN . if I is the set of items that are valid for some viable prefix-index pairs (γ. We will say an index i is in IN if (i. the Goto function in the GIG case is a PDA and the set of viable prefixes with associated indices is a context-free language. where IT is a set of items and X is a grammar symbol. j. X.6.23: Set of States for Gwcw In the same way that the dot implies that some input symbols have been consumed. The operation goto(IT.

µ In other words. IN 3 ). [A → a • β] is in IT 2 ): µ If µ is δ in I then (δ. Case C: If α is not X is a terminal a then IN = IN 2 (i. IT i ) is in IN 2 for every (δ.e. input (or ) and auxiliary stack. ¯ indicates a pop. [#] indicates a transition that requires an empty stack and indicates that i the content of the stack is ignored). LR PARSING FOR GILS 1.24 with a PDA. IT i ) in IN [B → [δ] • β] such that [A → α • Bβ] is in IT and δ is in IN and IN 2 is defined such that every µ (δ. the possible values are: a) pairs of shift action and operations on the auxiliary stack: push. IT 2 ). The action table has three parameters. IT 2 is the closure of the set of all items [B → ¯ δ • then goto(IT. IT i ) is in IN 2 .6. The indices associated in each state are those indices that are represented also in figure 5. The first element of the pair is the symbol X and the second indicates the operation on the PDA stack (e. state. If µ is then IN is in IN 2 If µ is [δ] and δ is in IN then every (δ.5.g. the auxiliary stack has the configuration corresponding to the completed item B. IN ) is defined to be: β] such that [A → α • Bβ] is in IT and δ is in IN and IN 2 is defined such that µ predecessor(δ. . The construction of an LR parsing table is shown in the following algorithm. (e. [A → αa • β] is in IT 2 ) µ When the second parameter of the Goto function is 2.: i indicates a push. IT 2 is the closure of the set of all items [A → αX • β] such that [A → α • Xβ] is in IT µ µ 101 and IN 2 is defined to be the set of indices with an associated state such that: Case A: α is and X is a terminal a (i.23.e.g. Case B: If X is a non-terminal B then IN 3 is in IN 2 such that [B → γ • ] is in (IT 3 . . The construction of the collection of sets of items for a GIG grammar is made following the algorithm used for context free grammars. IT i ) in IN is in IN 2 ¯ If µ is δ and δ is in IN then predecessor(δ. [2]). IT i ) in IN is in IN 2 The Goto function for the grammar Gwcw is depicted in figure 5. The only changes are those made to the Closure and Goto operations as described above. IT 2 ) is in IN 2 and IN is in predecessor(δ.

i) (c. j ) (ε .j.[#]) # I6 (R.i) (b. i ) (c. ε ) (ε . β is a possible empty sequence of non terminals and ¯ terminals. ε ) (b.# I3 (ε . RECOGNITION AND PARSING OF GILS (a.i) # I0 i I1 CHAPTER 5. ε) # I 12 ( ε. . δ. The notation used is a follows: capital letters (A.ε ) # I 13 (ε .24: Transition diagram for the PDA recognizing the set of valid prefixes. B) denote non-terminals lower case letters (a) terminals.j ) ( ε. ε ) # I9 Figure 5. ε) to I 1 to I 3 # I8 (ε .j) to I 2 to I 3 # I7 (c. annotated with indices for the grammar Gwcw pop or none.j. j ) (ε . α is a non empty sequence of non terminals and terminals. b) reduce action (in this case no operation on the auxiliary stack is performed).#) # I 11 to I 6 i.102 (a.j) (b.# I4 (R. ε ) (S.#) # I 10 to I 6 (a. i ) i. i ) (R. ε ) (S. and no operation on the auxiliary stack. δ is an index and µ is either δ. ε ) ( ε .# I5 (b.j. The Goto table has the usual properties.j) j I2 (a . [δ]. ε ) i.

. a. “push δ”). then set action[i. If [A → • Bβ] is in I i and goto(I i . Output. If [A → α • aβ] is in I i and goto(I i . $. If [A → • aβ] is in I i and goto(I i . e. This table is used with an obvious extension of the context free algorithm. IN j ). An augmented GIG grammar G’. -). 3. a. IN j ). and δ is in IN i and IN j [δ] then set action[i. the initial state of the parser is the one constructed from the set of items The output transition table for the grammar Gwcw is shown in figure 5. a. ] to (“shift j”.2.5. “pop δ”). adding the additional stack to compute the corresponding actions depicted in the table. Construct C = {I 0 . then ¯ δ set action[i. and δ is in IN i and IN j then [δ] set action[i. IN i ) = (I j . IN i ) = (I j .). IN i ) = (I j . . . A. IN j ). a. δ] to (“shift j”. a. i. the collection of sets of LR(0) items for G . IN j ). . If [A → β • ] is in I i . where A may not be S . we say the grammars is not SLR(1). IN j ). f. If [A → • aβ] is in I i and goto(I i . b. 4. a.6. If [A → • aβ] is in I i and goto(I i . The goto transitions for state i are constructed for all non-terminals A using the rule: If goto(I i . IN i ) = (I j . 2. IN i ) = (I j . then goto[i. Here a must be a terminal. The parsing actions for state i are determined as follows: a. and δ is in IN i . ] to “reduce A → α” for all a in µ µ FOLLOW(A). . for every index in IN j . a. I n }. Here a must be a terminal. h. ] to (“shift j”. then µ set action[i. . and δ is in IN i . δ] to (shift j. If [A → • aβ] is in I i and goto(I i .. then set action[i. δ] to (“shift j”. . The SLR parsing table functions action and goto 1. “pop δ”). If [A → • Bβ] is in I i and goto(I i . IN j ). I 1 . . IN j ). Here B must be a non-terminal. c. but it is GLR(1).-). State i is constructed from I i . then δ set action[i.. -). IN i ) = (I j . Here B must be a non-terminal. #] to “accept” If any conflicting actions are generated by the above rules. a. d. a. δ] to (shift j. and δ is in IN j . ] to (“shift j”. g. IN i ) = (I j . A. IN j ). then ¯ δ set action[i. If [S → S • ] is in I i then set action[i. IN i ) = (I j . inj ] = j. LR PARSING FOR GILS 103 Algorithm 7 (Constructing an SLR parsing table) Input. a. a. Here a must be a terminal and α must be non-empty.

) r4 r5 acc Table 5. ) ) ) ) ( . ) (s1. (s3. pop) r6 r6 (s5.j) ( . (s3. p i) (s1. pop) (s5. pop) (s4. p j) (c. We follow the notation from [2].2: Action/Goto Table for Gwcw The parsing algorithm for GIGs is essentially the same algorithm for CFGs.i) Goto (S. p j) (s2. pop) (s6. ) r6 r1 r2 r3 (s12. p j) (s2. pop) (s5.#) ($.#) 14 7 8 9 10 11 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 (a.#) (s4. RECOGNITION AND PARSING OF GILS Action ( . p i) (b. pop) (s4. ) (s6. (s3.104 State CHAPTER 5. The only difference is that it takes into account the operations on the auxiliary stack.#) (R. ) (s13. ) (s2. ) (s6. p i) (s1. .

6. An input string w and an LR parsing action − goto table for a grammar G. repeat forever begin let s be the state on top of the Stack1 and i the symbol on top of the Stack2 a the symbol pointed by ip. i] = reduce A → β then begin pop 2 ∗ |β| symbols from Stack1. a. else if action [s. i] = accept then return else error end The following table shows the moves of the LR parser on the input string abcab. advance ip to the next input symbol. (i ∪ )] = shift (s . i] = shift (s . else if action [s. A. if action [s. a.5. Initiate Stack2 with #. . push A then goto[s . pop) then begin push a then s on top of the Stack1 pop i from Stack2 else if action [s. ) then begin push a then s on top of the Stack1 advance ip to the next input symbol. a parse for w otherwise an error indication. Output. a. (i ∪ )] = shift (s . a. pi )then begin push a then s on top of the Stack1 push i on top of Stack2 . Input. LR PARSING FOR GILS Algorithm 8 (LR parsing for GIGs) . let s be the state now on top of the stack. pop) then begin push a then s on top of the Stack1 pop i from Stack2 advance ip to the next input symbol. Set ip to point to the first symbol of w$. else if action [s. i] = shift (s . Initiate Stack1 with s0 . If w is in L(G). i] on top of Stack1 output the production A → β µ 105 else if action [s. a. .

106 CHAPTER 5.3: Trace of the LR-parser on the input abcab and grammar Gwcw . RECOGNITION AND PARSING OF GILS 1 2 3 4 5 6 7 8 9 9 11 12 13 14 15 16 Stack 1 0 0a1 0a1b2 0a1b2c3 0a1b2c35 0a1b2c354 0a1b2c3546 0a1b2c354R10 0a1b2c354R10a 0a1b2c35R11 0a1b2c35R11b 0a1b2c3R9 0a1b2S8 0a1S7 0S14 - Stack2 # #i #ij #ij #i #i # # # # # # # # # # Remaining input abcab$ bcab$ cab$ ab$ ab$ ab$ ab$ ab$ b$ b$ $ $ $ $ $ $ Comments Initial ID Shift and push Shift and push Shift Shift and Pop Shift and Pop Shift Reduce by 6 Shift Reduce by 4 Shift Reduce by 5 Reduce by 3 Reduce by 2 Reduce by 1 Accept Table 5.

1 For the notion of dependent paths see for instance [82] or [44]. at the same computational cost in terms of asymptotic complexity. His discussion is addressed not in terms of weak generative capacity but in terms of strong-generative capacity. GIGs offer additional descriptive power as compared to LIGs (and weakly equivalent formalisms) regarding the canonical NL problems mentioned above. we review some of the abstract configurations that are argued for in [29]. They also offer additional descriptive power in terms of the structural descriptions they can generate for the same set of string languages.Chapter 6 Applicability of GIGs 6.1 Linear Indexed Grammars (LIGs) and Global Index Grammars (GIGs) Gazdar [29] introduces Linear Indexed Grammars and discusses their applicability to Natural Language problems. In this section. because they can produce dependent paths1 . The goal of this section is to show how the properties of GILs are related to the peculiarities of the control device that regulates the derivation. 107 . Similar approaches are also presented in [82] and [44] (see [56] concerning weak and strong generative capacity). However those dependent paths are not obtained by encoding the dependency in the path itself. the formalisms differ in the kid of trees they generate. Though this mechanism looks similar to the control device in Linear Indexed Grammars .

1 at the right. and every possible spine is independent. T. L.an | < S. δ is in C } ¯ C is defined to be the Dyck language over the alphabet I ∪ I (the set of stack indices and their complements).. wn >.. #δ and w is in T ∗ . as is depicted in the figure 6. (we follow Gazdar’s notation: the leftmost element within the brackets corresponds to the top of the stack). In other words. however those paths are connected transversely by the leftmost derivation order. the control of the derivation can be distributed over different paths. We gave an alternative definition of the language of a GIG in chapter 5 to be the control language: L(G. >⇒< a1 . C): {w | S..2 would be necessary to represent Scandinavian . B [. where G is a labeled grammar (cf..1. Gazdar suggests that the configuration in figure 6. < an .. and C is a control set defined by a CFG (a Dyck language): {a1 . .g.i] C [] push pop Figure 6.. C). the control strings wi are not necessarily connected to each other. S. ai ∈ T ∪ { }. the language {wwR |w ∈ Σ∗ }) only of the nested (center embedded) sort. wn ∈ C}.3. CFGs cannot generate the structural descriptions depicted in figures 6. Those control words describe the properties of a path (a spine) in the tree generated by the grammar G. [87]).] B ∗ ∗ A B pop push C A [] B [. In other words. w1 .1. but every substring encoded in a spine has to belong to the control set language.1: LIGs: multiple spines (left) and GIGs: leftmost derivation 6. It is easy to see that no control substring obtained in a derivation subtree is necessarily in the control language.108 CHAPTER 6. G = (N. Those control strings are encoded in the derivation of each spine as depicted in figure 6. w1 > . APPLICABILITY OF GIGS 6.2 and 6.. P ).2 The palindrome language CFGs generate structural descriptions for palindrome languages (e. # ⇒ w.1 at the left..1 Control of the derivation in LIGs and GIGs Every LIL can be characterized by a language L(G..

.2: A non context-free structural description for the language wwR unbounded dependencies. A.6.c. the structure of figure 6.] Figure 6.b. (i. [. in productions that are not in Greibach Normal Form).a] [d. The English adjective constructions that Gazdar uses to motivate the LIG derivation are generated by the following GIG grammar.. j}. AP.a] [a] [.a] [c. N P.] [a] [b.b.a] [a] [.c. Such an structure can be obtained using a GIG (and of course an LIG). c}. ¯ Gadj = ({AP.b.4 at the left.] a b c d d c b a Figure 6.. {i. #.a] [b..e.b.a] [c. {a. LINEAR INDEXED GRAMMARS (LIGS) AND GLOBAL INDEX GRAMMARS (GIGS) 109 [. The corresponding structural description is shown in figure 6.1.3: Another non context-free structural description for the language wwR However GIGs generate a similar structural description as depicted in figure 6. In such structure the dependencies are introduced in the leftmost derivation order.4: Example 22 (Comparative Construction) .b.b. But the exact mirror image of that structure. P ) where P is: AP → AP N P A→a i ¯ j ¯ AP → A A→c k ¯ ¯ A→AA NP → a NP ¯ i A→b j NP → b NP NP → c NP ¯ k .a] [b. b.a] [d. (i.a] [c. A}.e.] [a] a b c d d c b a [b.3) cannot be generated by a GIG because it would require push productions with a non terminal in the first position of the right-hand side.a] [c.

.d] [c. On the other hand.b. the introduction of indices is dependent on the presence of lexical information and its transmission is not carried through a top-down spine. [.d] b [d] c d Figure 6.d] [c..c.6 at the left. The structural description at the left can be generated by a GIG.b.] [a] a b c d [c.c] [c.d] a [b. The arrows show the leftmost derivation order that is required by the operations on the stack.a] [b. could . but not the one at the right. a similar one can be obtained using the same strategy as we used with the comparative construction.b.c.b.] a b c d a b c d [b.] NP NP c NP [.5). as in the LIG case.a] [.c] NP [d.. APPLICABILITY OF GIGS [.b.4: GIG structural descriptions for the language wwR It should be noted that the operations on indices are reversed as compared to the LIG case shown in figure 6.a] [d.c.] AP AP AP [..5: Two LIG structural descriptions for the copy language Gazdar further argues that the following tree structure.c..110 CHAPTER 6.] A NP b [c] [a] [b.c] a b A c [c] b Figure 6.] a A a b [.d] [d] [.3.a] [c.] [..] [b. 6.a] [a.a] [c.1.] A [b..b.b. However.a] c A A [a..a] [a] [b.3 The Copy Language Gazdar presents the following two possible LIG structural descriptions for the copy language (depicted in figure 6.a] [a] [.b. shown in figure 6..c.a] c d d a [b.] NP AP [..

c.a] a b c d [c. Such structure cannot be generated by a LIG. corresponding to the grammar shown in example 10.b.c.c.b.b.a] [a] [d.a] [b.a] [b.c.a] ε a d [b.a] [a] [a] [] [b.1.b. but they can generate the one presented in the figure 6.d] [a.7: A GIG structural description for the multiple copy language .a] [c. but can be generated by an IG.b.a] b c d ε a Figure 6.b.a] [d.a] [d.c.b.c.a] [a] a [] b Figure 6.b.c.b.6: An IG and GIG structural descriptions of the copy language GIGs cannot produce the structural description of figure 6.a] c [a] b [] a [d.6 (right).c.a] [a] a b a c [b. [] [a] [b.c.d] [] [d.b.a] [b.c.7.c.6.b.a] [d.a] [c.d] [a.d] [d] [d.a] [a.a] [b.c. GIGs can also produce similar structural descriptions for the language of multiple copies (the language {ww+ | w ∈ Σ∗ } as shown in figure 6.b.b.6 at the left either. [d] [c.b.a] [c.d] [c.b.b.a] [a] [] [d.a] [c.b.d] [b.d] b c [d] d [b.a] d c b [c.b.a] [c.d] [b.c.a] c d d [c. where the arrows depict the leftmost derivation order.d] a b c d [c.c. LINEAR INDEXED GRAMMARS (LIGS) AND GLOBAL INDEX GRAMMARS (GIGS) 111 be more appropriate for some Natural Language phenomenon that might be modeled with a copy language.b.

11.] [i] a a [i.i] d [i] b c d a a [i] b b [.. The relevant structures that can be produced by a LIG are depicted in figures 6.. F. Gsum = ({S.] [i.8: LIG and GIG structural descriptions of 4 and 3 dependencies [. GIGs can generate the same structures as in 6. e. [. APPLICABILITY OF GIGS 6. c. as we show in figures 6..i] [i] d [. f }.112 CHAPTER 6.] [.i] b [. P ) where P is: . It is mentioned in [82] in relation to the definition of composition in [79] Categorial Grammars.] [i] [. R. S.1. d. Example 23 (Dependent branches) .] c c b [i..8 and 6.i] [i] c c d [. L}.9 (right). which permits composition of functions with unbounded number of arguments and generates tree sets with dependent paths. b.. {a.i] d [i] b b [.] b Figure 6.] [i.] c [i] [i.] c c Figure 6.. L(Gsum ) = { an bm cm dl el f n | n = m + l ≥ 1}. The corresponding structure is depicted in the figure 6.. The following language cannot be generated by LIGs. {i}..4 Multiple dependencies Gazdar does not discuss of the applicability of multiple dependency structures in [29].10 and 6.8 and the somehow equivalent in 6.9: A LIG and a GIG structural descriptions of 3 dependencies GIGs can also produce other structures that cannot be produced by a LIG.10 (at the right).9 (left). #.i] [i...] d [.

i] [i. .1..] c [i] a [i.] [.i] [i.i] [i] a [i.6.] d d ε b Figure 6.] [i. GIGs can produce crossing dependencies with some alternative structures as depicted in the following structures.] d [i] a c d b d e Figure 6.i] a b b c [i] [.] [i] a [..] [.10: GIG structural descriptions of 4 dependencies [...i] f [. The first example is generated by the grammars Gcr presented in Chapter 3 and repeated here...5 Crossing dependencies Crossing dependencies in LIGs and TAGs have the same structural description as the copy language.i] a [i] [i] [i.] c [i.i] a c c [.i] [i.11: GIG structural descriptions of 3 dependencies 6.] [i] a f [i..i] b [i] [i] c [.1. LINEAR INDEXED GRAMMARS (LIGS) AND GLOBAL INDEX GRAMMARS (GIGS) 113 S → aSf |R i R→F L|F |L F → b F c |b c ¯ i L → d L e |d e ¯ i The derivation of aabcdef f : #S ⇒ i#aSf ⇒ ii#aaSf f ⇒ ii#aaRf f ⇒ ii#aaF Lf f ⇒ i#aabcLf f ⇒ #aabcdef f [...

{a.114 Example 24 (Crossing Dependencies) . {x}. S. d}. APPLICABILITY OF GIGS L(Gcr ) = {an bm cn dm | n. where Gcr = ({S. P ) and P is: S→AD A→aAc|aBc 3. f. #. L(Gcr8 ) = {an bn cm dm en f n g m hm | n. e. d. B. h}. A. The following kind of dependencies can be obtained: Example 25 (Crossing Dependencies 2) . #. {a. b. CHAPTER 6. C}. g. m ≥ 1}. where Gcr8 = ({S. B → b B | b x D→dD|d x ¯ [] [ii] [] a a a b [ii] b b [iii] [i] c [] c c d d d [i] [] Additional number of crossing dependencies can be obtained (pairs or triples). {x. A. m ≥ 1}. P ) and P is: S→AL A→aAf |aBf x B → b B e| b Ce x ¯ C → c C d| c d y L → g L h| g h y ¯ [i] a a b [ii] [i] [] e f f g g [k] h [] h b c [k] e d [kk] c d . S. y}. b. B. c. c. C}.

C. b2 . L2 }. B ∈ N. In this section we are going to address the issue of whether LILs and GILs are comparable under set inclusion. Definition 14 A LIG is in push Greibach Normal Formal if every push production is in Greibach Normal Form (where A. If an equivalence between LIGs and LIGs with push productions in GNF could be obtained.. L. m ≥ 1} 1 2 1 1 2 2 2 1 The language Lcrm is generated by the following GIG: Example 26 (Crossing Dependencies 3) . a2 . P ) and P is: S→AL x ¯ A → a1 A B 1 | a1 A2 B 1 L2 → C D A2 → a2 A2 y y ¯ B 1 → b B| b x L → c1 L d1 | c1 L2 d1 D → d2 d2 y ¯ C → b2 C C 2 | b2 C 2 C 2 → c2 C 2 y The derivation of a1 a1 a2 a2 a2 b1 b1 c1 c1 b2 b2 b2 c2 c2 c2 d2 d2 d2 d1 d1 S ⇒ AL ⇒ #a1 AB 1 L ⇒ #a1 a1 A2 B 1 B 1 L ⇒ yyy#a1 a1 a2 a2 a2 B 1 B 1 L ⇒ xxyyy#a1 a1 a2 a2 a2 b1 b1 L ⇒ yyy#a1 a1 a2 a2 a2 b1 b1 c1 c1 CDd1 d1 ⇒ #a1 a1 a2 a2 a2 b1 b1 c1 c1 b2 b2 b2 C 2 C 2 C 2 Dd1 d1 ⇒ yyy#a1 a1 a2 a2 a2 b1 b1 c1 c1 b2 b2 b2 c2 c2 Dd1 d1 ⇒ #a1 a1 a2 a2 a2 b1 b1 c1 c1 b2 b2 b2 c2 c2 c2 d2 d2 d2 d1 d1 ∗ ∗ ∗ ∗ ∗ ∗ 6. d1 . b1 .. {a1 . SET INCLUSION BETWEEN GIGS AND LIGS 115 Such structures might be relevant to be able to generate the following language(discussed in [86]). Gcrm = ({S. we could proceed as follows. LIGs and Greibach Normal Form The definition of GIGs requires push productions in Greibach Normal Form. D.6.2. S. c2 . c1 . A2 .2 Set Inclusion between GIGs and LIGs The last section showed similarities and differences between LIGs and GIGs in terms of the structural descriptions. B. #. d2 }. A. {x.i] γ . related to the operation of generalized composition in CCGs. Lcrm = {an am bn cn bm cm dm dn |n.] → a B[. a ∈ T and γ ∈ (N ∪ T )∗ : • A[. Our conjecture is that LILs are properly included in GILs. y}.

S) be obtained from G by deleting the production A → Bα2 from P and adding the productions A → β 1 α2 |β 2 α2 |β r α2 . Let G1 = (N ∪ {B}. P.] → B[]α be a production in P and B[.. I..γ i ] → αi ..γ i ] → β 1 |β 2 | · · · |β s be the remaining A−productions.. P 1. Let A[.. This is easy to prove. Lemma 11 Let G = (N. Let A[. The proof of this lemma holds for the GIG case because there is no stack information affected. index γ to I and replacing the A−productions by the productions: A[.γ 2 ]α2 | · · · |A[.] such that 1 ≤ i ≤ r . Let A[.γ 1 ]α1 |A[.3 in [41]. Then L(G) = L(G1 ).γ i ] → β i . An adaptation of the lemma 4. 6.. the proper inclusion of LILs in GILs would be obtained: • For any LIG there is an equivalent LIG in push-Greibach Normal Formal.. T. Let G = (N. S) be a LIG. I. S) be the LIG formed by adding the variable B to N . A[....1 LIGs in push-Greibach Normal Form We can apply the techniques for left recursion elimination used in the conversion to Greibach Normal Form in CFGs.]β 1 |β 2 | · · · |β r be the set of all B-productions (they do not affect the stack). from a LIG derivation to a GIG derivation and the equivalence is easy obtained.] → A[. as long as the left recursion involves the whole spine. Therefore. just a change in the interpretation of the derivation. S) be a LIG.γ r ]αr be the set of A-productions for which A is the leftmost symbol of the right hand side. P... I ∪ {γ }..4 in [41] as follows also holds for LIGs and it would allow to transform left recursion into right recursion.] such that 1 ≤ i ≤ s B[. Lemma 10 Define an A − production to be a production with variable A on the left. B[..γ i ] → β i B[. T. The following lemma applies to productions that do not carry stack information.116 CHAPTER 6. T. GILs contain languages which are proven not to be in the LIL set. However we show in the next section that such a claim does not seem to hold. A similar lemma for CFGs is lemma 4. T. P. APPLICABILITY OF GIGS Lemma 9 For any LIG in push-Greibach Normal Formal there is an Equivalent GIG that generates the same language.2. I. Let G1 = (N.γ i ] → αi B[.] → [. if a lemma such as the following statement could be proved.

b.a] [d.a] [b....2.a] [c.a] [a.] [b.] [.13: Left and right recursive equivalence in LIGs. .a] [a] [.a] [c.a] [b..c.d] [d] [.b.] [a] a b c d [c.a] [d.c.6. the equivalence of the structures in figure 6.. without some mayor changes in the mapping algorithm..a] [c. such as index renaming: [.] [a] a b c d d c b a [b.a] [d.] a b c d a b c d [b. because it would need some additional changes.a] [b.12: Left and right recursive equivalence in LIGs The previous lemma would not work in the following structure.b.a] [c. [.c.b.12 involving the palindrome language would be obtained.b.c.a] [a] [. second case The structures depicted in figure 6.c.d] a [b.b.b.b.14 would require even more additional machinery.d] b [d] c d Figure 6.] [a] [b.b.a] [a] a b c d d c b a Figure 6. There is no way that a LIG like the one generating the three dependencies could be transformed into a LIG in push-GNF.d] [c.d] [c.b.] [.c.a] [c. SET INCLUSION BETWEEN GIGS AND LIGS 117 In this way..

.] c c d d b Figure 6.] [i] [i.16 It seems that some of the above-mentioned issues would still arise if we try to obtain the inclusion of LILs by simulating either an EPDA or Becker’s 2-SA with a LR-2PDA. However. both right and left) for push productions. this alternative .e.118 [.] c c d CHAPTER 6.15: LIGs not in push-GNF II These languages do not seem to be obtainable with a LIG in push-GNF. APPLICABILITY OF GIGS [.i] [i] [. They are however generated by GIGs as shown in figure 6.] [i] b [i... The problem is that they require the two directions of recursion (i..14: LIGs not in push-GNF I Moreover some additional problems arise as in the following languages: {w1 w2 w1 w2 R |wi ∈ Σ∗ } {w1 w2 w2 w1 R |wi ∈ Σ∗ } which can be depicted by the following structures: push push push b1 b2 a1 push push push a2 b3 push a3 push push a1 a2 b1 b2 push push pop pop pop pop push a3 a3 a2 a1 pop b3 pop b3 b2 b1 pop pop pop b3 b 2 a3 a2 pop pop b1 a1 Figure 6.i] d [i] b b [.

[48].16: LIGs not in push-GNF II in GIGs should be considered in detail. and others which are beyond the descriptive power of LIGs and TAGs. This does not change the power of the formalism. [39]) to allow to push/pop several symbols from the stack. Also the symbols will be interpreted relative to the elements in the top of the stack (as a Dyck set). This follows from the ability of GIGs to capture dependencies through different paths in the derivation. [8]).6. we will show how the structural descriptive power of GIGs is not only able to capture those phenomena but also additional structural descriptions compatible with those generated by HPSGs [61] schemata. Such compilation process allowed the identification of significant parts of HPSG grammars that were mildly context-sensitive.3 GIGs and HPSGs We showed in the last section how GIGs can produce structural descriptions similar to those of LIGs.3.2 were correlated to the use of the SLASH feature in GPSGs and HPSGs. There has been some work compiling HPSGs into TAGs (cf. It is a standard change in PDAs (cf. by performing HPSG derivations at compile time. We will introduce informally some slight modifications to the operations on the stacks performed ¯ by a GIG. different derivations . In this section. One of the motivations was the potential to improve the processing efficiency of HPSG. Therefore. GIGS AND HPSGS 119 pop pop push b pop push 1 a1 a2 b2 push pop pop a3 pop b3 a3 a2 a1 push b 3 push b 2 push b1 Figure 6. 6. We will allow the productions of a GIG to be annotated with finite strings in I ∪ I instead of single symbols. Those structural descriptions corresponding to figure 6.

The arrows indicate how the transmission of features is encoded in the leftmost derivation order. Head-Subj-Schema Figure 6. according to what is on the top of the stack.120 CHAPTER 6. We will ignore many details and try give an rough idea on how the transmission of features can be carried out from the lexical items by the GIG stack. Example 27 (intransitive verb) XP → Y P XP XP → X YP →Y X→x nv ¯ Y →y n . obtaining very similar structural descriptions.18 shows an equivalent structural description corresponding to the GIG productions and derivation shown in the next example (which might correspond to an intransitive verb). This is exemplified with the productions X → x and X → x. in particular in the first three cases where nv ¯ [n]v different actions are taken (the actions are explained in the parenthesis) : nnδ#wXβ ⇒ vnδ#wxβ (pop n and push v) nv ¯ n¯δ#wXβ ⇒ δ#wxβ v nv ¯ (pop n and v ) vnδ#wXβ ⇒ v¯ vnδ#wxβ (push n and v) nδ#wXβ ⇒ ¯ n ¯ nv ¯ [n]v vnδ#wxβ ( check and push) We exemplify how GIGs can generate similar structural descriptions as HPSGs do in a very oversimplified and abstract way. APPLICABILITY OF GIGS might be produced using the same production. an how the elements contained in the stack can be correlated to constituents or lexical items (terminal symbols) in a constituent recognition process.17: Head-Subject Schema 2 2 33 HEAD 1 6 77 6 6 6 77 6 6 77 6 S 6 L | C 6SUBJ 6 77 6 6 4 55 6 4 6 3 6 COMPS 6 2 6 2 6 6 6 6 6 6 6 6 6 6 HEAD DTR 6 S | L | 6 6 6 6 6 6 4 6D 6 6 6 6 6 6 6   4 4 COMP-DTR S 2 2 3 7 7 7 7 7 7 7 7 2 3337 7 HEAD 1 77 7 6  7777 6 77 6 7777 6SUBJ 2 7777 6 7777 4 5577 77 COMPS 3 77 77 55 (1) Figure 6.17 depicts the tree structure corresponding to the Head-Subject Schema in HPSG [61]. HEAD 1 SUBJ < > H SUBJ 2 1 HEAD SUBJ < 2 > Figure 6.

3 n > Figure 6...] 121 YP [n.21.] XP [v. The following GIG productions generate the structural description corresponding to figure 6..] y [v.19: Head-Comps Schema tree representation Figure 6.18: Head-Subject in GIG format #XP ⇒ #Y P XP ⇒ #yXP ⇒ n#Y XP ⇒ n#yX ⇒ v#yx Head-Comps-Schema HEAD COMP 1 < 2 HEAD 1 6 77 7 6 6 7 6 S 4 L | C 4SUBJ 2 55 7 6 7 6 COMPS 3 6 2 2 2 3337 7 6 HEAD 1 7 6 6 6 6 6 7777 6 6 HEAD DTR 4 S | L | 4SUBJ 2 5577 6D 6 77 6 4 COMPS union 4 .] X x Figure 6.19 shows the tree structure corresponding to the Head-Complement schema in HPSG.. corresponding to the deriva- .3.6. 3 57 5 4 COMP-DTR S 4 2 2 33 3 2 > C n-2 3 n H C HEAD 1 COMP < 2 1 .20...] XP [v.] Y [n. XP → X CP The derivation: CP → Y CP X → x nv n ¯ ¯ CP → Y →y n n#XP ⇒ n#XCP ⇒ nv#xCP ⇒ nv#xY CP ⇒ v#xyCP ⇒ v#xy ¯ ¯ The productions of example 29 (which uses some of the productions corresponding to the previous schemas) generate the structural description represented in figure 6. GIGS AND HPSGS [. where the initial configuration of the stack is assumed to be [n]: Example 28 (transitive verb) .

We show the contents of the stack when each lexical item is introduced in the derivation.122 [n] CHAPTER 6.20: Head-Comp in GIG format tion given in example 29. XP → Y P XP CP → Y P CP X → know nv ¯¯ n XP → X CP X → hates nv n ¯ ¯ nv¯ ¯ v XP → X XP CP → X → claims Y P → Kim|Sandy|Dana|we A derivation of ‘Kim we know Sandy claims Dana hates’: #XP ⇒ #Y P XP ⇒ n#Kim XP ⇒ n#Kim Y P XP ⇒ nn#Kim we XP ⇒ nn#Kim we X XP ⇒ v n#Kim we know XP ⇒ ¯ v n#Kim we know Y P XP ⇒ ¯ n¯n#Kim we know Sandy XP ⇒ v n¯n#Kim we know Sandy X XP ⇒ v v n#Kim we know Sandy claims XP ⇒ ¯ v n#Kim we know Sandy claims Y P XP ⇒ ¯ n¯n#Kim we know Sandy claims Dana XP ⇒ v #Kim we know Sandy claims Dana hates Finally the last example and figure 6. ∗ .22 shows how coordination combined with SLASH can be encoded by a GIG. Example 29 (SLASH in GIG format) . APPLICABILITY OF GIGS XP [ v ] X [n v] [n v] CP [ v ] Y [v] CP x y ε Figure 6.

GIGS AND HPSGS [] 123 XP YP [n] [n] Kim YP [nn] we XP XP X [vn] know YP [nvn] Sandy XP XP X XP [vn] claims YP [nvn] Dana [] hates XP X CP ε Figure 6. XP → Y P XP CP → Y P CP X → talk to nv n ¯ ¯ XP → X CP CP → C → and X → did nv ¯¯ XP → X XP X → visit [n¯n]c v CXP → XP CXP Y P → W ho|you n CXP → C XP A derivation of ‘Who did you visit and talk to’: #XP ⇒ #Y P XP ⇒ n#W ho XP ⇒ n#W ho Y P XP ⇒ v n#W ho did XP ⇒ ¯ v n#W ho did Y P XP ⇒ n¯n#W ho did you CXP ⇒ ¯ v n¯n#W ho did you XP CXP ⇒ v cn¯n#W ho did you visit CXP ⇒ v cn¯n#W ho did you visit C XP ⇒ v n¯n#W ho did you visit and XP ⇒ v ∗ .21: SLASH in GIG format Example 30 (SLASH and Coordination2) .3.6.

22: SLASH and coordination in GIG format . APPLICABILITY OF GIGS [] YP [n] Who X [nv] did XP XP YP [nvn] you XP [cnvn] visit ε CXP CXP C [ n v n ] XP [] [ n v n] and talk to CP ε Figure 6.124 #W ho did you visit and talk to XP CHAPTER 6.

Finally. An Earley type algorithm for the recognition problem of GILs was presented with a bounded polynomial time result O(n6 ) and O(n4 ) space. We showed u the descriptive power of GIGs regarding the three phenomena concerning natural language context sensitivity: reduplication. However. We also showed that both the weak and the strong descriptive power of GIGs is beyond LIGs. time-complexity and space complexity properties. We introduced trGIGs (and sLR-2PDAs) which are more restricted than GIGs. We presented a comparison of the structural descriptions that LIGs and GIGs can be generate. However we did not discuss the (possible) equivalence of sLR-2PDAs and trGIGs. or it might not be the case and both languages turn out to be incomparable. We presented a Chomsky-Sch¨tzenberger representation theorem for GILs. A proof of semilinearity showed that GILs share mildly context sensitive properties. GIGs. We analyzed the algorithm providing an account of grammar-size.Chapter 7 Conclusions and Future Work We have presented LR-2PDAS. GILs and their properties. and that are more limited regarding crossed agreements. multiple agreements and crossed agreements. The proof of correctness of this algorithm was also presented using the Parsing Schemata framework. The strong similarity between GIGs and LIGs suggests that LILs might be included in GILs. We showed the equivalence of LR-2PDA and GIGs. We have shown that GIGs generate structural descriptions for the copy and multiple dependency languages which can not be generated by LIGs. We conjectured that trGIGs are not able to capture reduplication phenomena. we have shown also that the extra power that characterizes GIGs. it might be difficult to prove it. corresponds to the ability of GIGs to 125 .

We have established some coarse-grain relations with other families of languages (CFLs and CSLs). The relationships between GILs LILs and ILs is still an open question. GILs and GCSLs are incomparable but trGILs might be a properly included in GCSLs. We also mentioned the issue of ambiguity and we defined GILs with deterministic indexing. and the membership problem. which follows as a corollary from the semi-linearity property. we did not explore the properties of the class of deterministic GILs. it is harder to determine whether GILs with deterministic indexing are a proper subset of the Global Index Languages. exploiting the ability of GIGs to encode dependencies through connected dependent paths and not only through a spine.126 CHAPTER 7. We gave an Earley algorithm for GIGs . We have not addressed most of the decision problems. The similarity of GIGs and counter automata. We have shown also that those non-local relationships which are usually encoded in HPSGs as feature transmission can be encoded in GIGs using its stack. We mention now some of the issues that might be addressed in future research. They seem to be a proper subset of GILs and they also seem to be closed under complementation (which could be proved following the proof for CFLs). this class might not have any theoretical import besides the fact that the recognition problem is in O(n3 ). coupled context-free grammars among other formalisms. however it is not clear to us if such a pumping lemma would provide an additional tool beyond the result already obtained on semilinearity. and we gave an algorithm to parse LR(k) GILs. except the emptiness problem. the proof should be considered in detail. Although they do seem to be. In this case. However. however there are other variations on Earley’s algorithm that were not considered and that might improve the impact of the grammar size on the parsing . however. A candidate pumping lemma for GILs was suggested. 7. should be addressed. CONCLUSIONS AND FUTURE WORK generate dependent paths without copying the stack but distributing the control in different paths through the leftmost derivation order. We defined deterministic LR-2PDAs and deterministic GILs.1 Future Work The results described in the previous section are encouraging enough to continue further work concerning Global Index Languages.

7.1. FUTURE WORK

127

complexity. There are also some details on the introduction of indices which would improve its performance. Another alternative to be considered is extension of the LR(k) algorithm to generalized LR(k) ` la Tomita. If a Chomsky Normal Form for GILs is obtainable, a CYK bottom-up algorithm a could be considered. We considered some of the issues related to Natural Language from a formal and abstract point of view, i.e. language sets and structural descriptions. In the same perspective it might be interesting to see if GILs are able to describe some phenomena that are beyond mildly-context sensitive power (e.g. scrambling). Also, we only compared GILs with LIGs; there are other formalisms to be considered. Minimalist Grammars [78] share some common properties with GILs. It would be interesting to determine if minimalist grammars can be compiled into GILs. In the area of practical applications, it would be interesting to implement the HPSG compilation ideas. Another relevant question is how much of TAG systems can be compiled into GIGs and how do the performances compare. It should be noted that the capabilities of TAGs to define extended domains of locality might be lost in the compilation process. We mentioned in the introduction some of the approaches to use generative grammars as models of biological phenomena. The capabilities of GIGs to generate the multiple copies language (or multiple repeats in the biology terminology) as well as crossing dependencies (or pseudo-knots) might be used in the computational analysis of sequence data.

128

CHAPTER 7. CONCLUSIONS AND FUTURE WORK

Bibliography
[1] A. V. Aho. Indexed grammars - an extension of context-free grammars. Journal of the Association for Computing Machinery, 15(4):647–671, 1968. [2] A. V. Aho, R. Sethi, and J. D. Ullman. Compilers: Principles, Techniques, and Tools. AddisonWesley, Reading, MA, 1986. [3] M. A. Alonso, D. Cabrero, and M. Vilares. Construction of efficient generalized LR parsers. In Derick Wood and Sheng Yu, editors, Automata Implementation, volume 1436, pages 7–24. Springer-Verlag, Berlin-Heidelberg-New York, 1998. [4] M. A. Alonso, E. de la Clergerie, J. Gra˜a, and M. Vilares. New tabular algorithms for LIG n parsing. In Proc. of the Sixth Int. Workshop on Parsing Technologies (IWPT’2000), pages 29–40, Trento, Italy, 2000. [5] J. Autebert, J. Berstel, and L. Boasson. Context-free languages and pushdown automata. In A. Salomaa and G. Rozenberg, editors, Handbook of Formal Languages, volume 1, Word Language Grammar, pages 111–174. Springer-Verlag, Berlin, 1997. [6] G. Barton, R. Berwick, and E. Ristad. Computational Complexity and Natural Language. MIT Press, Cambridge, 1987. [7] T. Becker. HyTAG: a new type of Tree Adjoining Grammars for Hybrid Syntactic Representation of Free Order Languages. PhD thesis, University of Saarbruecken, 1993. [8] T. Becker and P. Lopez. Adapting HPSG-to-TAG compilation to wide-coverage grammars. In Proceedings of TAG+5, pages 47–54. 2000.

129

2003. GIGs: Restricted context-sensitive descriptive power in bounded polynomial-time. pages 15–22. Boullier. Philadelphia. Research Report RR-3614. [18] J. Comput. scrambling. pages 595–606. editors. In Proceedings of the Sixth International Workshop on Parsing Technologies (IWPT2000). 1998. The variable membership problem: Succinctness versus complexity. Confluent and other types of thue systems. Italy. 1994. J. A generalization of mildly context-sensitive formalisms. Trento. In Sandra K n ubler Kotaro Funakoshi and Jahna Otterbacher. Mexico City. Buntrock and G. [10] P. Assoc. January 1999. and range concatenation grammars. Boullier. Boullier. February 2000.130 BIBLIOGRAPHY [9] R. [13] G. [16] G. Buntrock and F. France. [19] J. pages 53–64. Mach. In Proceedings of the 12th Symposium on Theoretical Aspects of Computer Science.. In In Proceeding of CIAA 2003. On growing context-sensitive languages. Chicago Journal of Theoretical Computer Science. Proceedings of the ACL-2003 Student ¨ Research Workshop. 1992. On the applicability of global index grammars. Casta˜o. [15] G.. Weakly growing context-sensitive grammars. Casta˜o. In Automata. 14 pages. February 16-22. [12] P. 1982. 29:171–182. INRIA. 2003. Chinese numbers. of Cicling 2003. In Symposium on Theoretical Aspects of Computer Science. Buntrock and K. n In Proc. Range concatenation grammars. Lorys. Growing context sensitive languages and church-rosser languages. 1996. n Santa Barbara. Rocquencourt. . [14] G. Niemann. In TAG Workshop. 1995. Languages and Programming. pages 77–88. [11] P. volume 900. Lorys. Otto. [17] J. Lecture Notes in Computer Science. Buntrock and K. mix. Casta˜o. Book.CA. LR Parsing for Global Index Languages (GILs). 2003.

Grammars with controlled derivations. 1966. Handbook of Formal Languages. Breveglieri. New York. June. Linguistics and Philosophy. North-Holland. 1963. The algebraic theory of context-free languages. Multipushdown languages and grammars. Warmuth. Applicability of indexed grammars to natural languages. Springer. and S. Comp. P˘un. 8:345–351. K. Bloomington. 1970. of Mathematics of Language. In Colloquium on Trees in Algebra and Programming. Culy. a Heidelberg. 7(3):253–292. 1997. In u P. In G. Dordrecht. [26] J. Hotz. and A. Springer. Reghizzi. pages 69–94. Ginsburg. Rogers. [28] G. pages 205– 233. Chomsky and M. Natural Language Parsing and Linguistic Theories. Amsterdam. [24] E. Regulated Rewriting in Formal Language Theory. G. editors. The Netherlands. 1986. Citrini. 1989. [22] N. 1996. MOL 8. 1985. editors. Rozenberg a and A. Rohrer. Reidel. n Proc. Membership for growing context sensitive grammars is polynomial. The Mathematical Theory of Context Free Languages. 13:94– 102. Sch¨tzenberger. Berlin. Dassow and G. [21] A. Hirschberg. Pitsch G. Salomaa. P˘un. 1988. C. In U. [23] C. Gazdar. An Efficient Context-free Parsing Algorithm. Global index grammars and descriptive power. pages 118–161. Theor. 2. pages 85–99. Casta˜o. Salomaa. [29] G.BIBLIOGRAPHY 131 [20] J. [27] J. Braffort and D. Cherubini. editors. New York. In R. [25] J. 2003b. Dassow. The complexity of the vocabulary of bambara. Indiana. Mc Graw Hill. Sci. Dahlhaus and M. L. Vol. Communications of the ACM. D. Berlin. Reyle and C. editors. Earley. On parsing coupled-context-free languages. . International Journal of Foundations of Computer Science. 1996.-P. Oehrle and J.. [30] S. Computer Programming and Formal Systems.

2001. Addison-Wesley. Ibarra. Words. 2000. Mitrana. H. No. H. In Proceedings of the 7th EACL Conference. 1968. 1978. Spanier. [42] O. Journal of Computer and System Sciences. ISSN 0169-118X. 1995. AFL with the semilinear property. a morphisms and commutation of languages. [34] A. Salomaa. Dublin. In 104. and Computation. 2000. Groenink. Ibarra. Springer. Finite-turn pushdown automata. Ginsburg and E. Spanier. J. Formal language theory and dna: An analysis of the generative capacity of specific recombinant behaviors. [41] J. Languages. Reversal-bounded multicounter machines and their decision problems. A recognizer for minimalist grammars. Harrison. Reading. [40] T. [38] H. Head. MA. 3:428–446. Harrison. 1978. 1987. [35] A. and A. [33] S. 25(1):116–133. Karhum¨ki. page 579ff. Reading. Ullman. E. 15. Addison-Wesley Publishing Company. Groenink. H. Inc. Ginsburg and M. Decision questions concerning semilinearity. Berling. O. Hopcroft and Jeffrey D. Journal of the Association for Computing Machinery. Tokio. SIAM Journal on Control. [37] T. Bulletin of Mathematical Biology. pages 737–759. languages: where computer science. 30 1996. Literal movement grammars. 5(4):365–396. New York. Harbush. sequences. Massachusetts. 1995. . 1971. In LNCS 2076. [32] S. H. 1966. Mild context-sensitivity and tuple-based generalizations of context-free grammar. One-way nondeterministic real-time list-storage. Centrum voor Wiskunde en Informatica (CWI). In Martin-Vide and V. page 22. Ginsburg and E. Harju.132 BIBLIOGRAPHY [31] S. 1979. editors. Parsing contextual grammars with linear. 4(3):429–453. In IWPT 2000. regular and context-free selectors. Journal of the ACM (JACM). Introduction to Automata Theory. Harkema. biology and linguistics meet. [39] M. Introduction to Formal Language Theory. Springer. [36] K. University College..

3. Rozenberg and A. Weir. Deterministic techniques for efficient non-deterministic parsers. Saarbr¨cken. editors. MA. Handbook of Formal Languages.. 1997. B. Joshi and Y. K. Chicago University Press. [49] N. . and A. L. pages 92–99. In Automata. Local tree description grammars: A local extension of tag allowing underspecified dominance relations. Vijay-Shanker. In G. and Thomas Wasow. Khabbaz. Zwicky. Grammars. 8(2):142–157. Languages and Programming. Manning. 2nd Colloquium. pages 255–269. pages 206– 250. Schabes. volume 14 of Lecture Notes in Computer Science. 1974. K. A. Foundational issues in natural language processing. France. 1974. 1991. TUCS Technical Report No. Relationship between strong and weak generative power of formal systems. Kasper. [48] R. pages 31–81. Natural language processing: psycholinguistic. MIT Press. [51] B. [44] A. Netter. New York. The convergence of mildly context-sensitive grammatical formalisms. Joshi. 2000. pages 107–114. Parsing and hypergraphs.BIBLIOGRAPHY 133 [43] A. Joshi. In Proceedings of the Fifth International Workshop on Tree Adjoining Grammars and Related Formalisms (TAG+5). Kiefer. In Proceedings of the 7th International Workshop on Parsing Technologies. editors. Cambridge. 2001. Salomaa. Springer. and D. Cambridge. Berlin. 1995. March 1999. 2001. and K. A geometric hierarchy of languages. [45] A. computational and theoretical perspectives. Tree adjoining grammars: How much context-sensitivity is required to provide reasonable structural description? In D. In Proceedings of the 33rd Annual Meeting of the Association for Computational Linguistics. Compilation of HPSG into TAG. pages 85–137. 1985. Vijay-Shanker. [50] Dan Klein and Christopher D. In Peter Sells. Joshi. Paris. 257. Sewing contexts and mildly context-sensitive languages. Lang. Stuart Shieber. u [52] Carlos Mart´ ın-Vide and et al. Karttunen. Vol. Dowty. Journal of Computer and System Sciences. editors. [47] Laura Kallmeyer. [46] A. Tree-adjoining grammars. Mass.

Springer-Verlag. Journal of the Association for Computing Machinery. Derivational minimalism is mildly context-sensitive. On context-free languages. LNCS 1631. Michaelis. 25. A. In Rewriting Techniques and Applications: 10th International Conference. Alonso Pardo. 1998. An insertion into the chomsky hierarchy? 204–212. RTA-99. Sag. McNaughton. LACL’98. Otto. 1994. pages 243–257. CSLI Publications. [59] M. 2000. On the connections between rewriting and formal language theory. USA.A. Grenoble. pages 329–345. PhD thesis. 1999. Tree-adjoining language parsing in o(n6 ) time. Universidade da Coru˜a. Strong Generative Capacity. pages [54] J. Dept of CIS. 1994. Otto.134 [53] R. 1996. Michaelis and M. Semilinearity as a syntactic invariant. Interpretaci´n Tabular de Aut´matas para lenguajes de Adjunci´n de o o o ´ Arboles. Parikh. University of Pennsylvania. [62] S. [55] J. of Computation. BIBLIOGRAPHY In Jewels are Forever. 1999. Italy. Formal and Computational Aspects of Natural Language Syntax. [61] C. 1966. [63] O. 13:570–581. . University of Chicago Press. IL. Miller. Head-driven Phrase Structure Grammar. Niemann and F. e LACL’96: First International Conference on Logical Aspects of Computational Linguistics. [58] F. Philadelphia. 1997. Chicago. [57] G. n [60] Rohit J. Pollard and I. Stanford CA. SIAM J. editor. Berlin. Rajasekaran. Springer-Verlag. In Christian Retor´. In Proceedings of Logical Aspects of Computational Linguistics. The church-rosser languages are the deterministic variants of the growing context-sensitive languages. Stanford University. Rambow. Trento. PhD thesis. 1998. Kracht. In Foundations of Software Science and Computation Structure. 1999. [56] P.

Springer-Verlag. 1994. [76] K. 1999. Shieber. Rivas and S. 1995. Mol Biol. Searls. On multiple context-free grammars. Science. Shieber and Y. Schabes. pages 245–274. 1985. Paun S. Bioinformatics. Contextual grammars as generative models of natural languages. [66] Gh. Sikkel. Parsing schemata. Fujii. 1993. Formal language theory and biological macromolecules. [67] G. Theoretical Computer Science. Shieber. Tree-adjoining grammar parsing and boolean matrix multiplication. Hunter. pages 334–340. Theoretical Computer.B. Computational Linguistics. 1999. Kasami. J.M. AAAI Press. 20:91–124. In L. [69] D. 20. Marcus. pages 47–120. Searls. Satta. Journal of Logic Programming. Eddy.BIBLIOGRAPHY 135 [64] E. T. 24(1 and 2):73–102.M. DIMACS Series in Discrete Mathematics and Theoretical Computer Science. Linguistics and Philosophy. Matsumura. C. Martin-Vide. Principles and implementation of deductive parsing. Eddy. 8:333–343. 2000. M. [72] S. 1991. [68] D.R. The computational linguistics of biological sequences. A dynamic programming algorithm for rna structure prediction including pseudoknots. [70] D. 2. No. [71] H. 1994. Computational linguistics. Searls. 24:3–36. Artificial Intelligence and Molecular Biology. B. Seki. 1997. 1998. 199(1–2):87–103. Parsing schemata and correctness of parsing algorithms. An alternative conception of tree-adjoining derivation. and T. [74] S. and F. Sikkel. 1995. Computational Linguistics. [65] E.R. Schabes. Journal of Logic Programming. Evidence against the context-freeness of natural language. pages 2053–2068.B. Y. Rivas and S. The language of rna: A formal grammar that includes pseudoknots. Pereira. page 117ff. editor. [75] K. 1998. . String variable grammar: A logic grammar formalism for the biological language of DNA. pages 191–229. [73] S.

Vijay-Shanker. 1988. Theoretical Computer Science. PhD thesis. A tabular interpretation of a class of 2-stack automata. D. Information and Control. Derivational minimalism. of the 25th ACL. Computational linguistics. 1976. Tomita. Turn-bounded grammars and their relation to ultralinear languages. [83] D. [78] E. Introduction to the Theory of Computation. [87] D. Wartena.136 BIBLIOGRAPHY [77] M. Wartena. P. 32 No. Dependency and coordination in the grammar of dutch and english. . Steedman. 1992. [79] M. 17:41–61. 1999. Stabler. pages 523–568. Grammars. On the concatenation of one-turn pushdowns. [84] C. [85] Ch. Joshi. Weir. Sipser. Grenoble. A. 1998. Language. K. Characterizing mildly context-sensitive grammar formalisms. Weir. Workman. and A. 1328. V. [80] M. J. 104(2):235–261. A geometric hierarchy beyond context-free languages. Walters. A. Information and Control. J. 1997. 1987. In COLING-ACL. University of Pennsylvania. 13:31–46. In Proc. pages 1333–1339. Pardo. [86] D. [81] E. CA. 1987. Weir. de la Clergerie and M. Characterizing structural descriptions produced by various grammatical formalisms. Grammars with composite storages. pages 104–111. A. Boston. PWS Publishing Company. Lecture notes in computer science. pages 11–14. Stanford. [88] D. 1997. Massachusetts. 2:188–200. Deterministic context-sensitive languages: Part II. pages 259–269. [82] K. 1985. 1998. 1970. In Proceedings of the Conference on Logical Aspects of Computational Linguistics (LACL ’98). An efficiente augmented-context-free parsing algorithm.

Sign up to vote on this title
UsefulNot useful