• Aucun résultat trouvé

Quantifier Scope

Dans le document Prolog and Natural-Language Analysis D (Page 98-106)

3.8 Problem Section: DCGs

4.1.6 Quantifier Scope

The DCG of Program 4.2 and those of Problems 4.6 and 4.7 have a serious deficiency in their handling of quantifier scope. For a sentence like

Every professor wrote a book.

the grammar assigns the single interpretation all(P, professor(P) =>

exists(B, book(B) & wrote(P, B))) ;

that is, for every professor there is a book that he or she wrote. Now, this wide scope interpretation of “every” might agree with our common sense, but it is not the only combinatorially possible one. In the other, less intuitive interpretation, there is a single book that every professor wrote:

exists(B, book(B) &

all(P, professor(P) => wrote(P,B)))

This narrow scope interpretation for “every” is in fact the more intuitive one in sentences like

Every student ran a program that the professor wrote for his dissertation.

4.1. Semantic Interpretation

This digital edition of Prolog and Natural-Language Analysis is distributed at no charge for noncommercial use by Microtome Publishing.

89

It is clear that decisions on the likelihood of differently scoped logical forms for a sentence depend on many sources of information, such as empirical knowledge about the kind of situation being described and the actual order of words in the sentence.

In any case, scope decisions are too subtle to be determined purely by the syntactic structure of sentences, as they are in the grammar of Program 4.2.

The overall issue of scope determination is therefore a very difficult open research question (Woods, 1977; Vanlehn, 1978; F. C. N. Pereira, 1982). Here, we will address the simpler question of scope generation: how to generate logical forms for a sentence with all combinatorially possible quantifier scopings. Such a generator could then be used to propose alternative scopings to scope critics that would use syntactic and empirical information to choose likely scopings.

A scope generator has to satisfy two major constraints:

Soundness: Every formula generated must be a closed well-formed formula (that is, without free variables) corresponding to a correct scoping of the sentence.

Completeness: Every combinatorially possible scoping will be generated.

A basic observation we need is that the meaning of a determiner is a function of a noun meaning and an intransitive verb phrase meaning, the range and scope respec-tively. Alternative quantifier scopings in the logical form correspond to alternative choices of range and scope for the quantifiers in the sentence meaning. The job of the scope generator is thus to consider the determiners in a sentence and generate all possible choices of range and scope for the corresponding quantifiers.

The method we will use here for scope generation relies on building an interme-diate representation, a quantifier tree, whose nonleaf nodes correspond to determiner meanings (quantifier nodes) or logical connectives (connective nodes) and whose leaf or predication nodes correspond to the translations of nouns, verbs and other content words in the input sentence. The daughters of a quantifier node include a determiner meaning and two subtrees from which the determiner meaning at the node will get its range and scope. The quantifier nodes thus represent delayed decisions as to the range and scope of their quantifiers. For example, the quantifier tree for

Every professor that wrote a book ran a program.

is shown in Figure 4.2.

In practice, we will represent a quantifier node by a term of the formq(D, R, S), where D is the expression representing the determiner meaning and R and S are the subtrees from which Ds range and scope will be obtained. A connective node is rep-resented by the connective itself applied to its arguments, and a predication node with contents P will be represented by‘P. The backquote (“ ‘ ”) is used as a prefix op-erator to syntactically distinguish predications that have not been scoped both from predications that have been scoped and from the quantifier and connective nodes. The use of the operator allows a simple check of the main functor to distinguish among the various cases.

The following grammar is a simple modification of that of Program 4.2 that builds a quantifier tree rather than a logical form directly.

Program 4.3

:- op(500,xfy,&).

q

P^Q^all(X,P Q) & q

professor(X) q T^U^exists(Z, T & U)

R^S^exists(Y, R & S) program(Z)

book(y) ran(X,Z)

wrote(X,Y)

Figure 4.2: Quantifier tree :- op(510,xfy,=>).

:- op(100,fx,‘).

s(T) --> np(VPˆS), vp(VP), {pull(S, T)}.

np(NP) -->

det(N2ˆNP), n(N1), optrel(N1ˆN2).

np((EˆS)ˆS) --> pn(E).

vp(XˆS) --> tv(XˆIV), np(IVˆS).

vp(IV) --> iv(IV).

optrel((XˆS1)ˆ(Xˆ(S1 & S2))) --> [that], vp(XˆS2).

optrel(NˆN) --> [].

det(LF) --> [D], {det(D, LF)}.

det( every, (XˆS1)ˆ(XˆS2)ˆ

q(PˆQˆall(X,P=>Q),S1,S2) ).

det( a, (XˆS1)ˆ(XˆS2)ˆ

q(PˆQˆexists(X,P&Q),S1,S2) ).

n(LF) --> [N], {n(N, LF)}.

n( book, Xˆ(‘book(X)) ).

n( professor, Xˆ(‘professor(X)) ).

n( program, Xˆ(‘program(X)) ).

n( student, Xˆ(‘student(X)) ).

pn(E) --> [PN], {pn(PN, E)}.

4.1. Semantic Interpretation

This digital edition of Prolog and Natural-Language Analysis is distributed at no charge for noncommercial use by Microtome Publishing.

91

pn( terry, terry ).

pn( shrdlu, shrdlu ).

tv(LF) --> [TV], {tv(TV, LF)}.

tv( ran, XˆYˆ(‘ran(X,Y)) ).

tv( wrote, XˆYˆ(‘wrote(X,Y)) ).

iv(LF) --> [IV], {iv(IV, LF)}.

iv( halts, Xˆ(‘halts(X)) ).

This grammar generates the following quantifier tree for the sample sentence above.

q(PˆQˆall(X,P=>Q),

‘professor(X)&q(RˆSˆexists(Y,R&S),

‘book(Y),

‘wrote(X,Y)), q(TˆUˆexists(Z,T&U),

‘program(Z),

‘ran(X,Z)))

This is just the term encoding of the tree of Figure 4.2.

In the first sentence rule, the extra conditionpull(S, T)invokes thepull predi-cate that defines the translation relation between quantifier trees and first-order formu-las. Thus the quantifier tree is translated into FOL to provide a logical form for the whole sentence.

The binary predicate pullis itself defined in terms of a ternary predicate, also calledpull, which defines the relation between a quantifier tree, a matrix, and a store of quantifiers. The matrix is a formula with free variables, and the store is a list of quantifiers whose ranges have been determined, but not their scopes. The name “pull”

suggests the idea of “pulling” quantifiers out of storage and applying them to a matrix to produce a closed formula. The quantifiers in storage are represented byλ-expression encodings. For example, the stored element for the noun phrase “every student” is the termPˆall(S, student(S) => P). Applying a quantifier to a matrix is thus simple function application with reduction.

The order of quantifiers in a store list indicates their relative scopes in the final result. The quantifiers that appear earlier in the list, i.e., farther towards the front, have been chosen to have wide scope over those at the back of the list.

The nondeterminism in the definition which produces alternative scopings comes from the uses of the predicatesshuffleandconcto operate on storage lists. These predicates were defined previously as Programs 3.3 and 3.4 in Section 3.4.1, where we noted thatshufflewas nondeterministic, as wasconcwhen used in its “reverse”

mode.

The ternary pullpredicate turns a simple predication node into a matrix with empty store.

pull(‘Predication, Predication, []).

A node with the conjunction connective&is treated as follows. Each conjunct is separately pulled, thereby obtaining a matrix and store for both the left and the right

conjunct. Now, we want to apply some of the remaining quantifiers in each of the stores, passing some on for application at a higher level. Theconcpredicate is used

“backwards” to break each store list into a front and a back, the back to be applied to the corresponding conjunct matrix and the front to be passed as part of the store of the whole conjunction. Note that since we apply the back part only, we maintain the condition that things earlier in the store have wider scope. After applying quantifiers to each of the conjuncts, we shuffle the remaining quantifiers (the fronts of the lists for both conjuncts) to form the store list for the whole conjunction.

pull(QuantTree1 & QuantTree2, Formula1 & Formula2, Store) :-pull(QuantTree1, Matrix1, Store1), pull(QuantTree2, Matrix2, Store2), conc(Pass1, Apply1, Store1), conc(Pass2, Apply2, Store2),

apply_quants(Apply1, Matrix1, Formula1), apply_quants(Apply2, Matrix2, Formula2), shuffle(Pass1, Pass2, Store).

Finally, a quantifier node with quantifier Q is similar in its handling to a connective node except that instead of two conjuncts, we have the range and scope of the quantifier to scope recursively. Recursive calls topulldeliver a matrix and a store for both the range and the scope trees of the quantifier. The range store list is split byconcinto a front and a back, the front quantifiers outscoping Q and the back quantifiers to be applied to the range matrix to form the range of Q. Then, the front quantifiers are concatenated with the singleton list[Q], because they have been chosen to have wider scope than Q. Finally, the result is shuffled with the scope store to make the store for the whole node. Note that it is not necessary to split the store associated with the scope subtree, because the shuffle determines the position of Q in the overall store.

pull(q(Quantifier, RangeTree, ScopeTree), Matrix, Store)

:-pull(RangeTree, RangeMatrix, RangeStore), pull(ScopeTree, Matrix, ScopeStore), conc(RangePass, RangeApply, RangeStore), apply_quants(RangeApply, RangeMatrix, Range), reduce(Quantifier, Range, StoreElement), conc(RangePass, [StoreElement], Pass), shuffle(Pass, ScopeStore, Store).

The predicateapply_quantstakes a store list and applies all its quantifiers in order to a matrix to produce a new matrix.

apply_quants([], Formula, Formula).

apply_quants([StoreElement|Elements], Matrix, Formula)

:-apply_quants(Elements, Matrix, SubFormula), reduce(StoreElement, SubFormula, Formula).

4.1. Semantic Interpretation

This digital edition of Prolog and Natural-Language Analysis is distributed at no charge for noncommercial use by Microtome Publishing.

93

The binarypullpredicate itself merely scopes its quantifier-tree argument, yield-ing a matrix and a store, and then usesapply_quantsto apply all the outstanding quantifiers to the matrix, resulting in a closed formula.

pull(QuantTree, Formula)

:-pull(QuantTree, Matrix, Store), apply_quants(Store, Matrix, Formula).

As an example of the operation ofpull, we will consider the possible scopings of the quantifier tree for the sample sentence

Every professor that wrote a book ran a program.

The binary predicatepullfirst generates a matrix and a store from the tree by applying some quantifiers in the tree and storing the rest. The outermost quantifier correspond-ing to “every professor. . .” is dealt with by recursively pullcorrespond-ing its range and scope. We consider each of these recursive calls in order.

The range

‘professor(X)&q(RˆSˆexists(Y,R&S),

‘book(Y),

‘wrote(X,Y))

might be decomposed into matrix and store by placing the single quantifier into stor-age, yielding the matrix

professor(X) & wrote(X,Y) with store

[Sˆexists(Y, book(Y) & S)] ,

thereby leading to the wide-scope reading for the existential. Alternatively, the quan-tifier might be applied directly, rather than stored, leading to the matrix

professor(X) & exists(Y, book(Y) & wrote(X,Y))

with empty store. We will pursue the former possibility here to demonstrate how the wide-scope reading is achieved.

Once the range is pulled, the scope must be as well. Again, let us suppose that the quantifier in the scope is placed in storage, so that the matrix

ran(X,Z)

is associated with the store

[Uˆexists(Z, program(Z) & U)] .

Now, to form the matrix for the whole tree (recall that the main quantifier we are trying to scope is the universal for “every professor”), we take the store of the range and decide which quantifiers should be applied to the range matrix (thereby taking

narrow scope relative to the universal) and which should take wide scope. Again, let us suppose the single element in the range store is to take wide scope. Then the formula that serves as the range of the main quantifier is

professor(X) & wrote(X,Y)

and, applying the quantifer to the range, the appropriate store element corresponding to the quantifier is

Qˆall(X, (professor(X) & wrote(X,Y)) => Q) .

We now place this element in the store after the range quantifier we are passing on, yielding thePassstore

[Sˆexists(Y, book(Y) & S),

Qˆall(X, (professor(X) & wrote(X,Y)) => Q)] .

This is shuffled with the store from the scope. The one element in the scope store can be placed in any of three places in the combined store corresponding to its possible scopings relative to the other two quantifiers in the sentence. We will choose the placement of the scope store at the front of the list giving it widest scope. The full store is then

[Uˆexists(Z, program(Z) & U), Sˆexists(Y, book(Y) & S),

Qˆall(X, (professor(X) & wrote(X,Y)) => Q)]

and the matrix, recall, is ran(X, Z) .

This decomposition of the quantifier tree into range and scope is only one of seven non-deterministic possibilities. The binarypullpredicate successively applies the three quantifiers remaining in store to the matrix, the last getting narrowest scope as it is applied first. This first application yields the formula

all(X, (professor(X) & wrote(X,Y)) =>

ran(X,Z)) . The next derives

exists(Y, book(Y) &

all(X, (professor(X) & wrote(X,Y)) =>

ran(X,Z))) .

Finally, the last quantifier is applied, giving the fully scoped form exists(Z, program(Z) &

exists(Y, book(Y) &

all(X, (professor(X) &

wrote(X,Y)) =>

4.1. Semantic Interpretation

This digital edition of Prolog and Natural-Language Analysis is distributed at no charge for noncommercial use by Microtome Publishing.

95

ran(X,Z)))) .

In all, seven fully scoped forms can be generated for this sentence—corresponding to the seven decompositions of the quantifier tree into matrix and store—as can be seen by backtracking through the solutions.

?- s(LF, [every,professor,that,wrote,a,book, ran,a,program], []).

LF = exists(Z,program(Z)&

all(X,professor(X)&

exists(Y,book(Y)&

wrote(X,Y))=>

ran(X,Z))) ; LF = all(X,professor(X)&

exists(Y,book(Y)&

wrote(X,Y))=>

exists(Z,program(Z)&

ran(X,Z))) ; LF = exists(Z,program(Z)&

all(X,exists(Y,book(Y)&

professor(X)&

wrote(X,Y))=>

ran(X,Z))) ; LF = all(X,exists(Y,book(Y)&

professor(X)&

wrote(X,Y))=>

exists(Z,program(Z)&

ran(X,Z))) ; LF = exists(Z,program(Z)&

exists(Y,book(Y)&

all(X,professor(X)&

wrote(X,Y)=>

ran(X,Z)))) ; LF = exists(Y,book(Y)&

exists(Z,program(Z)&

all(X,professor(X)&

wrote(X,Y)=>

ran(X,Z)))) ; LF = exists(Y,book(Y)&

all(X,professor(X)&

wrote(X,Y)=>

exists(Z,program(Z)&

ran(X,Z)))) ; no

The solution illustrated above is the fifth of the seven as listed in this query.

The quantifier scoping method outlined here is sound with respect to the quan-tifier trees that are the output of the presented grammar. However, certain quanquan-tifier trees involving nested quantifiers are not correctly handled by the algorithm; ill-formed scopings are generated in which quantifiers do not outscope all variable occurrences they were intended to bind. Such quantifier trees do not arise with the particular gram-mar given here, although more complete gramgram-mars including both relative clause and PP modifiers for nouns would exhibit the problem. Thus, the presented algorithm is only an approximation to a fully general sound scoping mechanism. For a full discus-sion of this issue and a particular solution (including a Prolog implementation), see (Hobbs and Shieber, 1987).

Dans le document Prolog and Natural-Language Analysis D (Page 98-106)