File Information
File: 05-lr/acl_arc_1_sum/cleansed_text/xml_by_section/intro/91/w91-0104_intro.xml
Size: 25,006 bytes
Last Modified: 2025-10-06 14:05:05
<?xml version="1.0" standalone="yes"?> <Paper uid="W91-0104"> <Title>Inherently Reversible Grammars, Logic Programming and Computability</Title> <Section position="2" start_page="0" end_page="24" type="intro"> <SectionTitle> 1 Introduction </SectionTitle> <Paragraph position="0"> From the linguist's point of view, a grammar is a formal device which defines a recursively enumerable set of well-formed linguistic structures, each having, among other aspects, a phonological content (or, when dealing with written text, a string content) and a semantic content. Such a device is completely neutral as regards its uses for parsing (recovering semantic content from string content) or generation (recovering string content from semantic content).</Paragraph> <Paragraph position="1"> From the computational linguist's point of view, on the other hand, the problem is how to implement such a grammar both as a parsing program and as a generation program, in such a way that these programs exactly reflect the content of the grammar. This we will call the reversibility problem. null Let us assume, for specificity, that the grammar has been presented as a definite program (a Prolog program)J Then the reversibility problem has a simple solution: use a complete interpreter for definite programs--for instance a top-down interpreter having a breadth-first search procedure2--and directly use the grammar as the program both for parsing and for generation. In the parsing mode, for any given string x, the program will enumerate all semantics Yl,Y2,... assigned to it by the grammar, and similarly, in the generation mode, for any given semantics y, the program will enumerate all semantics xl, x2,.., assigned to it by the grammar.</Paragraph> <Paragraph position="2"> This is a striking property of definite programs: they are reversible in the sense that they naturally lead to uniformity of implementation of the parsing and generation modes (see SS4).</Paragraph> <Paragraph position="3"> So the reversibility problem is solved, and we can spend the next few years skimming through Fodor's (not Jerry's) guides in travel bookstores? Not quite. First, the standard depth-first interpreter for definite programs is an incomplete one, and this problem must be circumvented in some way. Second, and more crucially, even when using a complete interpreter, parsing (and similarly generation) does not in general terminate: the program may well enumerate Yl,Y2,... ad infinitum.</Paragraph> <Paragraph position="4"> This is even true if, in fact, there are only a finite number of solutions Yl,Y2,..., Yk, or even, in the extreme case, no solution at all: the program may not be &quot;aware&quot; that it has at some point already exhausted all the solutions that it will eventually 1We could have made some other choice, for instance some unification grammar formalism. The advantage of using definite programs in the present discussion is that they embody the whole unification paradigm in its purest form, that unification of terms is conceptually simpler (and less prone to misunderstandings) than unification of DAGs, and that the denotational and operational semantics of definite programs have been thoroughly studied.</Paragraph> <Paragraph position="5"> 2See e.g. \[7, p. 59\] and section SS2.1.3. See also \[19\] in this volume for a related approach.</Paragraph> <Paragraph position="6"> find, and go on eternally looking for new solutions.</Paragraph> <Paragraph position="7"> The source of this problem can be more or less severe: It may simply be due to the grarnmar's implementation as,a certain program, or it may be intrinsic to the grammar.</Paragraph> <Paragraph position="8"> If it is not intrinsic to the grammar, one may attempt some kind of program transformation on the grammar--for qnstance a local transformation as goal reordering in clause bodies \[4, 16\], or a global transformation as left-recursion elimination \[5, 3\] 3 --in order 'to get a parsing program which displays a finite behavior. 4 If such a transformation is possible in principle, we say that, intrinsically, the grammar has a finitely enumerable parsing problem. 5 One.example of a class of grammars which respect this crucial condition is provided by offline-parsable DCGs, once compiled as definite programs (see \[9\]). 6 We have limited the former discussion to the case of parsing. The case of generation is treated in a parallel fashion, and one can similarly define the conditions in which a grammar is said to have an intrinsically finitely enumerable generation problem.</Paragraph> <Paragraph position="9"> When a grammar is such that it has a finitely enumerable parsing problem and a finitely enumerable generation problem, we call the grammar inherently finitely reversible.</Paragraph> <Paragraph position="10"> When this is the; case, it is by definition possible to find a program Pp for parsing and a (not necessarily identical) program Pa for generation such that, for any string z, Pp enumerates all associated semantics y and terminates, and, for any semantics y, Pg enumerates all associated strings z and terminates.</Paragraph> <Paragraph position="11"> Inherent finite reversibility is the concept which, in my opinion, permit us to capture formally the intuitive notion that a certain grammar is, or is not, &quot;reversible&quot;.</Paragraph> <Paragraph position="12"> 3Or more generally, any transformation exploiting theorerns provable of the: grammar. Another instance of this technique is provided by the addition of conservative guides in \[5\], which &quot;strengthen&quot; the grammar on the basis of properties inferable from &quot; ' its form.</Paragraph> <Paragraph position="13"> 4 Another popular approach is to use a special-purpose interpreter, exploiting\[ properties of the grammar known a priori. \[18\] and \[14\] use this approach in the case of generation (see below). :</Paragraph> <Section position="1" start_page="20" end_page="21" type="sub_section"> <SectionTitle> 2.1 Denotational and operational se- </SectionTitle> <Paragraph position="0"> mantics of a definite program; complete and incomplete interpreters null A definite program P is a finite set of clauses of the form (non-unit clauses): p(T1,..., T,) px(Tlx,... ,Tin,)'&quot; &quot;pro(Tin1,... ,Tmn.) or of the form (unit clauses): p(Tx,..., Tn) where the the P,Pi are predicate symbols and the Ti, T/j are terms over a certain Herbrand universe of ground terms H.</Paragraph> <Paragraph position="1"> We will suppose that, among the predicates p defined by P, one, r, is privileged and plays the role of the &quot;main predicate&quot; in the program. We will assume that r is of arity one. 7 The denotational, or declarative, semantics of program P can be defined as the least fixed point of a certain operator on Herbrand interpretations which we will not describe here (see \[7\]). Informally, the denotations of the predicate symbols p are defined as n-ary relations p(zx, ..., Xn) over H, built as the limit of a bottom-up process which starts from the unit clauses and uses the non-unit clauses to add new instances to each relation.</Paragraph> <Paragraph position="2"> In particular, this process defines the unary relation r(x) on H, which we shall call the denotational semantics of the main predicate r relative to program P.</Paragraph> <Paragraph position="3"> Let T be a term over H; We define the specialization of r(X) on T as the relation rT(x) on H defined by: def rT(~) =-- r(~) ^ x E Z where ff is the relation of subsumption. In case the term T is a variable X, we say that X is the trivial specialization, and we note that the relation rx(z) is identical to the relation r(z).</Paragraph> <Paragraph position="4"> 7This assumption permits to simplify tile exposition, but is not otherwise necessary.</Paragraph> <Paragraph position="5"> While the denotational semantics of P is an intrinsic property of P, its operational semantics is defined relative to some interpreter.</Paragraph> <Paragraph position="6"> For our purposes, we will informally define an interpreter as a computational mechanism:</Paragraph> <Paragraph position="8"> which is input a definite program P, as well as a query ?r(T)--where r is P's main predicate and T a term over H--and which outputs a finite or infinite &quot;list of answers&quot;: T1,T2,...,Tk ....</Paragraph> <Paragraph position="9"> The Tk's are terms over H, ground or not, whose ground instances provide the &quot;solutions&quot; to query ?r(T). If the list of answers is infinite, the interpreter will not stop; If it is finite the interpreter may or may not stop: if it does, we will say that the interpreter terminates on query ?r(T).</Paragraph> <Paragraph position="10"> Consider now the relation r~ on H defined by: r~(x) def _= xET1Vz~T2V...VxETk V...</Paragraph> <Paragraph position="11"> We say that r~r is the operational semantics of the main predicate r of P, for specialization T, relative to interpreter intpr.</Paragraph> <Paragraph position="12"> Keeping the same notations as above, consider now the denotational semantics r(x) of r relative to P, and consider its specialization rT(x).</Paragraph> <Paragraph position="13"> Interpreter intpr is said to be sound iff one has, for any P, r, T: w e H r (x) rr(x); and to be complete iff:</Paragraph> <Paragraph position="15"> Soundness is a minimal requirement for an interpreter, and we will always assume it, but completeness is a requirement which is not always met in practice.</Paragraph> <Paragraph position="16"> preters The &quot;standard&quot; interpreter for definite programs uses a top-down, depth-first search algorithm. It is sound but not complete. Its non-completeness is due to the fact that it is depth-first: if its search-tree contains infinite branches, the interpreter will be &quot;caught&quot; in the first one and will never explore the branches--maybe leading to success--to the right of this branch in the search-tree \[7, pp. 59-60\]. By contrast, a top-down, breadth-first interpreter, i.e. one which explores nondeterministic choices (between the different clauses competing for resolution of the same atomic goal) in parallel s is complete \[7, pp. 59\].</Paragraph> <Paragraph position="17"> The nffive bottom-up interpreter, which in essence directly calculates the denotational semantics of P, and filters a posteriori the semantics r(x) through the constraint that the solutions unify with T, is also a complete algorithm.</Paragraph> </Section> <Section position="2" start_page="21" end_page="22" type="sub_section"> <SectionTitle> 2.2 Computational behavior of a </SectionTitle> <Paragraph position="0"> definite program relative to an interpreter We now consider a program P, having r as main predicate, the denotation of r relative to P being the relation r(x) on H. We also consider a specialization T, i.e. a term on H.</Paragraph> <Paragraph position="1"> We will compare the denotational content of P to its computational behavior, and describe three possibilities: (i) P enumerates r on T, (it) P discovers r on T, and (iii) P finitely enumerates r on T. The interpreter is supposed to be fixed beforehand. null We say that:</Paragraph> <Paragraph position="3"> in other words, iff its list of answers: T1,T~,...Tk,...</Paragraph> <Paragraph position="4"> exactly &quot;covers&quot; the denotational semantics rT .9 * P discovers r on specialization Tiff: 1. P enumerates r on T; 2. If r T is the uniformly false relation on H, then P terminates on T. ldeg * P finitely enumerates r on specialization Tiff: 1. P enumerates r on T; s Or, alternatively, uses a .fair search rule, i.e. one which &quot;shares its attention&quot; among all paths in the search-tree.</Paragraph> <Paragraph position="6"> 2. P terminates on TJ 1 We simply say that P enumerates (discovers, finitely enumerates) r iff P enumerates (discovers, finitely enumerates) r on the trivial specialization X.</Paragraph> <Paragraph position="7"> We have the obvious entailments: P finitely enumerates r on T ~ P discovers (1) r on T ~ P enumerates r on T.</Paragraph> <Paragraph position="8"> It is often the case that one is interested in the computational properties of a given definite program relative to a certain class of specializations. For instance, when using a grammar--given as a definite program--for parsing, one will consider all queries where some' of the variables are ground (the string to parse) and others (the semantic form) are not, and one will want to consider the computational properties Of the program relative to this class of specializations. When using the definite program for generation, one will be interested in another class of specializations, and will want to consider the computational properties of the program relative to that class of specializations. Let S = {T} be a set of (not necessarily ground) terms on H, indePSed by a finite or infinite set I. We call S a class of specializations. We say that:</Paragraph> <Paragraph position="10"> P finitely enumerates r on T.</Paragraph> <Paragraph position="11"> The mutual entailments between these properties are similar to the ones given in (1).</Paragraph> </Section> <Section position="3" start_page="22" end_page="23" type="sub_section"> <SectionTitle> 2.3 Intrinsic : computational proper- </SectionTitle> <Paragraph position="0"> ties of a definite program Let S be a class of specializations, and let r(z) be an arbitrary unary relation on H. We suppose here that programs are evaluated with respect to a sound and compiete interpreter, which has been fixed once and for/all, and we say that: * r is enumerable on S iff there exists a definite program P which enumerates r on S.</Paragraph> <Paragraph position="1"> * r is discoverab!e on S iff there exists a definite program P which discovers r on S.</Paragraph> <Paragraph position="2"> llXn particular, the relation r T is, loosely speaking, &quot;finitely representable as a union of terms T1, T2,... Tk&quot; and the program is &quot;aware&quot;, at a certain point, that it has exhausted the possible answers.</Paragraph> <Paragraph position="3"> * r is finitely enumerable on Sq iff there exists a definite program P which finitely enumerates ton S.</Paragraph> <Paragraph position="4"> These three notions, taken together, constitute a &quot;computability hierarchy&quot; where enumerability is the weakest condition, discoverability is an intermediary condition, and finite enumerability is the strongest condition. These computability conditions can be described more intuitively in the following way: 12 * r is enumerable on S if there exists a program P such that, for any T E S, P is able, given infinite time, to find terms T1, T2, * * * such that: Vz e H r(z) ^ z E T zETlVz ET2V-..</Paragraph> <Paragraph position="5"> * r is discoverable on S if there exists a program P which is furthermore able to decide in finite time, for any T E S, if there actually exists an</Paragraph> <Paragraph position="7"> program P which is furthermore able to find in finite time, for any T E S, terms Ti,T2,'.. ,Tk such that:</Paragraph> <Paragraph position="9"> Let {X} be the set having for only element the trivial specialization X; {X} is called the trivial class of specializations. We will simply say that r is ennmerable (resp. discoverable, finitely enumerable) iff r is enumerable (resp. discoverable, finitely enumerable) on the trivial class {X}.</Paragraph> <Paragraph position="10"> Let ~ = H be the set of all ground terms of H.</Paragraph> <Paragraph position="11"> is called the class of ground specializations. The following properties--which we will not prove here-establish links between the notions that we have just defined and the classica} notions of recursively enumerable relations and recursive relations: r is a recursively enumerable relation on H iff r is enumerable on the trivial class of specializations {X}; if thiS is the case, then (2) for any class of specializations S, r is enumerable on S.</Paragraph> <Paragraph position="12"> 12Note that these definitions critically depend on the relative scopes of quantifiers 3P VT E S ... : it is essenti~d that program P be the same for all specializations T in S. r is a recursive relation on H iff r is discoverable on the class of ground specializations G iff r is finitely enumerable on the class of ground specializations G.</Paragraph> <Paragraph position="13"> (3) 3 Grammars and their com- null putational uses Let X#Y denote, in infix notation, the term #(X,Y). In the context of this paper, we take a grammar to be a definite program G having as its main predicate the unary predicate r, and we will assume that the clauses defining r are of the form: r(X#Y) ...</Paragraph> <Paragraph position="14"> X will be called the &quot;p-parameter&quot;, Y the &quot;gparameter&quot;. Generally, the p-parameter will represent a character string, and the g-parameter a semantic form. 13</Paragraph> </Section> <Section position="4" start_page="23" end_page="24" type="sub_section"> <SectionTitle> 3.1 Six computational problems </SectionTitle> <Paragraph position="0"> A grammar can be used either to enumerate well-formed structures or to check whether certain fully instantiated values of the parameters can be accepted. We distinguish six computational problems (grouped into four types) which can be solved with a grammar: p-enumeration, p-acceptation, g-enumeration, g-acceptation, bi-enumeration, biacceptation. These problems are defined, together with comments on their computational properties, using the terminology of SS2.3. This permits us to characterize the different positions a given grammar can occupy on the &quot;computability hierarchy&quot; ---enumerability/discover ability/finite enumerability--relatively to each of these problems. null 3.1.1 p-enumeratlon and p-acceptatlon The p-enumeration problem or parsing problem is the problem of enumerating, for any fixed ground term x, all ground terms y such that r(x#y). The p-acceptation problem or decision problem for parsing is the problem of checking, for any fixed ground term z, whether there exists a ground term y such that r(z#y) is true.</Paragraph> <Paragraph position="1"> The same specialization class is associated with both these problems, namely the class ~C'P = {z#Y}~eH consisting in all the terms ~#Y where 13We thus take r to be a unary relation which &quot;encodes&quot; a binary relation. This is unessential, but permits us to use the concepts of the previous section, developed for unary relations, without having to generalize them to n-ary relations. is any ground term, and Y is a certain variable (whose name is indifferent).</Paragraph> <Paragraph position="2"> Let's consider in turn, with respect to G~P, the different positions the grammar--or equivalently, its denotational semantics r--can occupy on the computational hierarchy, from strongest to weakest: null Finite enumerability When r is finitely enumerable on G7 ~, it is in theory possible to find a program P such that, for any given (ground) value x of the p-parameter (the string), the program enumerates all the solutions to the parsing problem and terminates. These solutions are given implicitly as a finite list of answers TY1,..., TYk: the TYi's are terms whose ground instances y are the looked-for values of the g-parameter (the semantics associated with string z by the grammar).</Paragraph> <Paragraph position="3"> We also say that, with the grammar at hand, p-enumeration is finitely enumerable, or simply, that parsing is finitely enumerable. This is an inherent property of the grammar, and, ill practice, this property does not necessarily entail that finding a program P to exploit will be obvious. 14 For instance, offiine-parsable grammars \[9\] can be shown to possess a finitely enumerable parsing problem, but algorithms which are able to make use of this property are by no means trivial \[9, 13, 3\]. 15 Discoverability If r is not finitely enumerable on GP, it may still be discoverable on G79. By definition, this means that it is possible to find a program P such that, for any given (ground) value z of the p-parameter, if there is no value y of the g-parameter corresponding to z, then the program will &quot;recognize&quot; this fact in finite time and terminate with an empty list of answers; if, on the other hand, there are solutions y corresponding to x, then the program will enumerate them, but maybe not terminate. If this property holds, we also say that with the grammar at hand, p-enumeration is discoverable, or, simply, parsing is discoverable. One can easily prove (although we will not do it here) that this property is equivalent to the decidability (in the classical sense) of the p-acceptation problem. In other words: 14See footnote 177.</Paragraph> <Paragraph position="4"> 15These papers do not use the concept (or, afortiori, the terminology) &quot;finite enumerabillty of parsing&quot;, which, to my knowledge, appears here for the first time (see however \[6\], for the related notion of &quot;Universal Parsing Problem&quot; ). ! p-enumeration is discoverable if and only if p-acceptation is decidable. 16 Enumerabillty By the definition of a grammar as being a recursively enumerable mechanism, and by property (2), r is enumerable on any specialization class, and in particular on G'P.</Paragraph> <Paragraph position="5"> The g-enumeration 'problem or generation problem is the problem of enu~ merating, for any fixed ground term y, all ground terms x such that r(x#y). The g-acceptation problem or decision problem for generation is the problem of checking, for any fixed ground term y, whether there exists a ground term x such that r(x#y)its true.</Paragraph> <Paragraph position="6"> The specialization class is associated with both these problems is the class G~ = {X#Y}ueH consisting in all the terms X#y where y is any ground term, and X is a certain variable (whose name is indifferent).</Paragraph> <Paragraph position="7"> The situation is e.xactly symmetrical to the case of p-enumeration and p-acceptation, and we can define, in the same way, the notions: &quot;generation is finitely enumerabie&quot; and &quot;generation is discoverable&quot; (which is equivalent to &quot;g-acceptation is decidable'). null 3.1.3 bi-enumeration The hi-enumeration,problem is the problem of enumerating all ground i terms x, y such that r(x#y). The specialization class associated with this problem is the class' 7rRZP = {X#Y} which contains the single term X#Y.</Paragraph> <Paragraph position="8"> For non-degenerate grammars, it is not the case that r is finitely enumerable on TRIP, for this would entail in particular that any string recognized by the grarnrnar is subsumed under one of the terms in a fixed finite set of terms T1,..., Tk. This is a slightly weaker property than saying that there are finitely many strings recognized by the grammar, but is stil! a very unlikely property for a grammar.</Paragraph> <Paragraph position="9"> On the other hand, by definition, r is enumerable on TRZP. It can be shown easily that it is also discoverable on 'TRT-'P. 17 16An immediate cons,~luenee of this property (linking the p-enumeration problem, with the p-acceptation problem) is the fact that a grammmr which is finitely enumerable for parsing has a decidable p-acceptation problem. The converse is clearly false (see SS6 for a counter-example). lr This is because: (i) In case the grammar generates nothing, there is a trivial program which, on query 3.1.4 bi-acceptation The bi-aceeptation problem is the problem of checking, for any fixed ground terms x and y, whether r(z#y) is true.</Paragraph> <Paragraph position="10"> The specialization class associated with this problem is the set ~ = {x#Y}~,v~n of ground specializations. null It can be shown that r is finitely enumerable on G iff it is discoverable on ~ iff the relation r on H is recursive in the classical sense. When this is the case, one says that bi-acceptation is decidable.</Paragraph> <Paragraph position="11"> Again, by property (2), r is enumerable on any specialization class, and in particular on G.</Paragraph> <Paragraph position="12"> REMARK. Suppose that parsing is finitely enumerable, that is, r is finitely enumerable on ~P. This obviously implies that r is also finitely enumerable on ~. Therefore, one has: parsing is finitely enumerable ::~ bi-acceptation is decidable; and, by the same reasoning: generation is finitely enumerable =V bi-acceptation is decidable.</Paragraph> <Paragraph position="13"> On the other hand, the weaker property that p-acceptation is decidable (or similarly, that g-acceptation is decidable) does not seem to entail that bi-acceptation is decidable.</Paragraph> </Section> </Section> class="xml-element"></Paper>