• No results found

Compositional Semantics for Linguistic Formalisms

N/A
N/A
Protected

Academic year: 2020

Share "Compositional Semantics for Linguistic Formalisms"

Copied!
8
0
0

Loading.... (view fulltext now)

Full text

(1)

Compositional Semantics for Linguistic Formalisms

S h u l y W i n t n e r *

I n s t i t u t e for R e s e a r c h in C o g n i t i v e Science U n i v e r s i t y of P e n n s y l v a n i a

3401 W a l n u t St., S u i t e 4 0 0 A P h i l a d e l p h i a , P A 19018 s h u l y @ : t ± n c , c i s . u p e n n , e d u

A b s t r a c t

In what sense is a g r a m m a r the union of its rules? This p a p e r a d a p t s the notion of com- position, well developed in the context of pro- gramming languages, to the domain of linguis- tic formalisms. We s t u d y alternative definitions for the semantics of such formalisms, suggest- ing a d e n o t a t i o n a l semantics that we show to be compositional and fully-abstract. This fa- cilitates a clear, m a t h e m a t i c a l l y sound way for defining g r a m m a r modularity.

1 I n t r o d u c t i o n

Developing large scale g r a m m a r s for natural languages is a complicated task, and the prob- lems g r a m m a r engineers face when designing broad-coverage g r a m m a r s are reminiscent of those tackled by software engineering (Erbach and Uszkoreit, 1990). Viewing c o n t e m p o r a r y linguistic formalisms as very high level declara- tive p r o g r a m m i n g languages, a g r a m m a r for a natural language can be viewed as a program. It is therefore possible to a d a p t m e t h o d s and techniques of software engineering to the do- main of n a t u r a l language formalisms. We be- lieve t h a t any advances in g r a m m a r engineering must be preceded by a more theoretical work, concentrating on the semantics of grammars. This view reflects the situation in logic program- ming, where developments in alternative defini- tions for predicate logic semantics led to im- plementations of various program composition operators (Bugliesi et al., 1994).

This p a p e r suggests a denotational seman- tics tbr unification-based linguistic formalisms and shows t h a t it is compositional and fully- *I a m g r a t e f u l t o N i s s i m F r a n c e z for c o m m e n t i n g o n a n em'lier v e r s i o n of t h i s p a p e r . T h i s work was s u p p o r t e d by a n I R C S F e l l o w s h i p a n d N S F g r a n t S B R 8920230.

abstract. This facilitates a clear, m a t h e m a t i - cally sound way for defining g r a m m a r m o d u - larity. While most of the results we report on are p r o b a b l y not surprising, we believe t h a t it is i m p o r t a n t to derive t h e m directly for linguis- tic formalisms for two reasons. First, practi- tioners of linguistic formMisms usually do not view t h e m as instances of a general logic pro- gramming framework, b u t rather as first-class programming environments which deserve in- d e p e n d e n t study. Second, there are some cru- cial differences b e t w e e n c o n t e m p o r a r y linguis- tic formalisms and, say, Prolog: the basic ele- ments - - t y p e d feature-structures - - are more general t h a n first-order terms, the notion of uni- fication is different, and c o m p u t a t i o n s a m o u n t to parsing, rather t h a n SLD-resolution. The fact t h a t we can derive similar results in this new domain is encouraging, and should not b e considered trivial.

Analogously to logic p r o g r a m m i n g languages, the d e n o t a t i o n of g r a m m a r s can be defined us- ing various techniques. We review alternative approaches, operational and denotational, to the semantics of linguistic formalisms in sec- tion 2 and show that they are "too crude" to s u p p o r t g r a m m a r composition. Section 3 presents an alternative semantics, shown to b e compositional (with respect to g r a m m a r union, a simple syntactic combination o p e r a t i o n on grammars). However, this definition is "too fine": in section 4 we present an adequate, compositional and fully-abstract semantics for linguistic formalisms. For lack of space, some proofs are omitted; an e x t e n d e d version is avail- able as a technical report (Wintner, 1999). 2 G r a m m a r s e m a n t i c s

(2)

n a t u r a l to consider t h e n o t i o n of semantics of ratification-based formalisms. We review in this se(:tion t h e o p e r a t i o n a l definition of Shieber et a,1. (1995) a n d t h e d e n o t a t i o n a l definition of, e.g., P e r e i r a a n d Shieber (1984) or C a r p e n t e r (1992, pp. 204-206). We show t h a t these def- initions are equivalent a n d t h a t n o n e of t h e m s u p p o r t s c o m p o s i t i o n a l i t y .

2.1 B a s i c n o t i o n s

W(, a s s u m e f a m i l i a r i t y w i t h theories of f e a t u r e s t r u c t u r e based u n i f i c a t i o n g r a m m a r s , as for- m u l a t e d by, e.g., C a r p e n t e r (1992) or Shieber (1992). G r a m m a r s are defined over typed fea- twre .structures (TFSs) which c a n be viewed as g e n e r a l i z a t i o n s of first-order t e r m s ( C a r p e n t e r , 1991). T F S s are p a r t i a l l y o r d e r e d by s u b s u m p - tion, w i t h ± t h e least (or m o s t general) T F S . A multi-rooted structure (MRS, see Sikkel (1997) ()r W i n t n e r a n d Francez (1999)) is a sequence of T F S s , w i t h possible r e e n t r a n c i e s a m o n g dif- fi;rent e l e m e n t s in t h e sequence. Meta-variables A , / 3 r a n g e over T F S s a n d a, p - over MRSs. M R S s are p a r t i a l l y o r d e r e d by s u b s u m p t i o n , de- n()ted '__', w i t h a least u p p e r b o u n d o p e r a t i o n ()f 'an'llfication, d e n o t e d 'U', a n d a g r e a t e s t lowest t)(mnd d e n o t e d 'W. We a s s u m e the existence of a. fixed, finite set WORDS of words. A lexicon associates w i t h every word a set of T F S s , its cat- egory. M e t a - v a r i a b l e a ranges o v e r W O R D S a n d .w -- over strings of words (elements of W O R D S * ) .

G r a m m a r s are defined over a signature of t y p e s a n d features, a s s u m e d to be fixed below.

D e f i n i t i o n 1. A r u l e is an M R S of length greater than or equal to 1 with a designated (fir'st) element, the h e a d o.f the rule. The rest of the elements .form the rule's body (which may be em, pty, in which case the rule is depicted a.s' a TFS). A l e x i c o n is a total .function .from WORDS to .finite, possibly empty sets o.f TFSs. A g r a m m a r G = (T¢,/:, A s} is a .finite set of ,rules TO, a lexicon £. and a s t a r t s y m b o l A s that is a TFS.

F i g u r e 1 depicts a n e x a m p l e g r a m m a r , 1 sup- pressing t h e u n d e r l y i n g t y p e hierarchy. 2

T h e d e f i n i t i o n of u n i f i c a t i o n is lifted to MRSs: let a , p be two M R S s of t h e s a m e length; t h e 'Grammars are displayed using a simple description language, where ':' denotes feature values.

2Assmne that in all the example grammars, the types s, n, v and vp are maximal and (pairwise) inconsistent.

A '~ = (~:at : .~)

{ ( c a t : s ) -+ (co, t : n ) ( c a t : v p ) ] 7~ = ( c a t : vp) ---> (c.at: v) ( c a t : n)

vp) + .,,)

Z2(John) = Z~(Mary) = { ( c a t : 'n)}

£(sleeps) = £(sleep) = £(lovcs) = {(co, t : v)}

F i g u r e 1: A n e x a m p l e g r a m m a r , G

unification of a a n d p, d e n o t e d c, U p, is t h e m o s t general M R S t h a t is s u b s m n e d by b o t h er a n d p, if it exists. O t h e r w i s e , t h e u n i f i c a t i o n .fails.

D e f i n i t i o n 2. A n M R S (AI,...,A~:) reduces to a T F S A with respect to a gram, m a r G (de- noted ( A t , . . . , A k ) ~(-~ A ) 'li~' th, ere exists a rule p E T~ such, that ( B , 1 3 1 , . . . , B ~ : ) = p ll

(_L, A1,...,

Ak) and B V- A. Wll, en G is under- stood from. the context it is om, itted. Reduction can be viewed as the bottom-up counterpart of derivation.

I f f , g, are f l m c t i o n s over t h e s a m e (set) do- m a i n , .f + g is )~I..f(I) U .q(I). L e t ITEMS = { [ w , i , A , j ] [ w E

WORDS*,

A is a T F S a n d i , j E { 0 , 1 , 2 , 3 , . . . } } . L e t Z = 2 ITEMS. M e t a - variables x, y r a n g e over i t e m s a n d I - over sets of items. W h e n 27 is o r d e r e d b y set inclusion it forms a c o m p l e t e lattice w i t h set u n i o n as a least u p p e r b o u n d (lub) o p e r a t i o n . A f l m c t i o n T : 27 -+ 27 is m o n o t o n e if w h e n e v e r 11 C_/2, also T(I1) C_ T(I2). It is c o n t i n u o u s i f t b r every chain I1 C_ /2 C_ . . . , T ( U j < ~/.i) = U j < ~ T ( I j ) . I f a f u n c t i o n T is m o n o t o n e it has a least fixpoint ( T a r s k i - K n a s t e r t h e o r e m ) ; if T is also continu- ous, t h e fixpoint c a n be o b t a i n e d by i t e r a t i v e a p p l i c a t i o n of T to t h e e m p t y set (Kleene the- orem): lfp(T) = T S w , where T I " 0 = 0 a n d T t n = T ( T t ( n - 1)) w h e n 'n is a succes- sor o r d i n a l a n d (_Jk<n(T i" n) w h e n n is a limit ordinal. [image:2.612.308.522.89.184.2]
(3)

be correct (observables-preserving): if G1 - G 2 , then Ob(G1) = Ob(G2).

Let 'U' be a composition operation on gram- mars and '•' a combination o p e r a t o r on deno- rations. A (correct) semantics ' H ' is compo- .s'itional (Gaifinan and Shapiro, 1989) if when-

ever ~ 1 ~ : ~G2~ a n d ~G3] -- ~G4], also ~G, U G3~ = [G2 U G4]. A semantics is com- m u t a t i v e (Brogi et al., 1992) if ~G1 U G 2 ] = ~G,~ • [G2~. This is a stronger notion t h a n (:ompositionality: if a semantics is c o m m u t a t i v e with respect to some o p e r a t o r then it is compo- sitional.

2.2 A n o p e r a t i o n a l s e m a n t i c s

As Van E m d e n and Kowalski (1976) note, "to define an operational semantics for a program- ruing language is to define an implementational i n d e p e n d e n t interpreter for it. For predicate logic the p r o o f p r o c e d u r e behaves as such an in- terpreter." Shieber et al. (1995) view parsing as a. deductive process t h a t proves claims a b o u t the g r a m m a t i c a l s t a t u s of strings from assumptions derived from the grammar. We follow their in- sight and n o t a t i o n and list a deductive s y s t e m for parsing unification-based grammars.

D e f i n i t i o n 3. The deductive parsing s y s t e m associated with a g r a m m a r G = (7~,F.,AS} is defined over ITEMS and is characterized by:

A x i o m s : [a, i, A, i + 1] i.f B E Z.(a) and B K A ; [e, i, A , i] if B is an e-rule in T~ and B K_ A

Goals: [w, 0, A, [w]] where A ~ A s

I n f e r e n c e rules:

[wx , i l , A1, i l l , . . . , [Wk, ik, Ak , Jk ] [Wl " " " Wk, i, A , j]

if .'h = i1,+1 .for 1 <_ l < k and i = il and J = Jk and ( A 1 , . . . , A k ) =>a A

W h e n an item [ w , i , A , j ] can be deduced, applying k times the inference rules associ- z~ted with a g r a m m a r G, we write F-~[w, i, A, j]. W h e n the n u m b e r of inference steps is irrele- vant it is omitted. Notice that the domain of items is infinite, and in particular that the num- ber of axioms is infinite. Also, notice t h a t the goal is to deduce a T F S which is s u b s u m e d by the start symbol, and when T F S s can be cyclic, there can be infinitely many such T F S s (and, hence, goals) - see W i n t n e r and Francez (1999).

D e f i n i t i o n 4. The operational d e n o t a t i o n o.f a g r a m m a r G is EG~o,, = { x IF-v; :,:}. G1 - o p

G2 iy ]C1 o, = G2Bo ,

We use the operational semantics to de- fine the language generated by a g r a m m a r G: L ( G ) = { ( w , A } [ [w,O,A,l',,[] E [ G ] o , } . Notice that a language is not merely a set of strings; rather, each string is associated with a T F S through the d e d u c t i o n procedure. Note also t h a t the start s y m b o l A ' does not play a role in this definition; this is equivalent to assuming that the start s y m b o l is always the most general TFS, _k.

The most natural observable for a g r a m m a r would be its language, either as a set of strings or a u g m e n t e d by TFSs. T h u s we take Ob(G) to be L ( G ) and by definition, the operational semantics '~.] op' preserves observables.

2.3 D e n o t a t i o n a l s e m a n t i c s

In this section we consider d e n o t a t i o n a l seman- tics through a fixpoint of a t r a n s f o r m a t i o n a l op- erator associated with grammars. -This is es- sentially similar to the definition of Pereira and Shieber (1984) and C a r p e n t e r (1992, pp. 204- 206). We then show t h a t the d e n o t a t i o n a l se- mantics is equivalent to the operational one.

Associate with a g r a m m a r G an o p e r a t o r 7 ~ that, analogously to the i m m e d i a t e conse- quence o p e r a t o r of logic programming, can be thought of as a "parsing step" o p e r a t o r in the context of g r a m m a t i c a l formalisms. For the following discussion fix a particular g r a m m a r G = ( n , E , A ~ ) .

D e f i n i t i o n 5. Let T c : Z -+ Z be a trans- f o r m a t i o n on sets o.f items, where .for every I C_ ITEMS, [ w , i , A , j ] E T(~(I) iff either

• there exist Y l , . . . , y k E I such that Yl = [w1,,iz,Al,jt] .for" 1 < 1 <_ k and il+l = jz f o r 1 < l < k and il = 1 and j k = J and

( A 1 , . . . , A k ) ~ A and w = "w~ .. • wk; or • i = j a n d B is an e-rule in G a n d B K A

and w = e; or

• i + l = j and [w[ = 1 a n d B G 12(w) and B K A .

(4)

of logic p r o g r a m m i n g languages, define a fix- point semantics for unification-based grammars by taking the least fixpoint of the parsing step o p e r a t o r as the d e n o t a t i o n of a grammar. D e f i n i t i o n 6. The f i x p o i n t d e n o t a t i o n of a g r a m m a r G is ~G[.fp = l.fp(Ta).

G1

=--.fp G2 iff ~ti,( T<; ~ ) = l fp(Ta~).

The denotational definition is equivalent to the operational one:

T h e o r e m 1. For x E ITEMS,

X E lfp(TG) iff

~-(? x.

The p r o o f is t h a t [ w , i , A , j ] E T a $ n iff F-7;,[w, i, A, j], by induction on n.

C o r o l l a r y 2. The relation '=fp' is correct: whenever G1 =.fp G2, also Ob(G1) = Ob(a2).

2 . 4 C o m p o s i t i o n a l i t y

While the operational and the denotational se- mantics defined above are s t a n d a r d for com- plete grammars, they are too coarse to serve as a model when the composition of grammars is concerned. W h e n the denotation of a gram- mar is taken to be ~G]op, i m p o r t a n t character- istics of the internal s t r u c t u r e of the g r a m m a r are lost. To d e m o n s t r a t e the problem, we intro- duce a natural composition o p e r a t o r on gram- mars, namely union of the sets of rules (and the lexicons) in the c o m p o s e d grammars.

D e f i n i t i o n 7. / f GI = <T¢1,

~1,

A~) and

G2

=

(7-~2,E'2,A~) are two grammars over the same signature, then the u n i o n of the two gram- mars, denoted G1 U G2, is a new grammar G = (T~, £, AS> such that T~ = 7~ 1 (.J 7"~2, ft. = ff~l + ff~2 and A s = A~ rq A~.

Figure 2 exemplifies g r a m m a r union. Observe that for every G, G', G O G' = G' O G.

• P r o p o s i t i o n 3. The equivalence relation '=op' is not compositional with respect to Ob, {U}.

Proof. Consider the grammars in figure 2.

~a:~o,, = l a d o . = {["loves",/, ( c a t : v ) , i + 1]l i > 0} b u t tbr I = {["John loves John", i, ( c a t : s ) , i + 3 I i >_ 0}, I C_

[G1UG4]op

whereas

I ~ [G1UGa~op. Thus Ga =-op G4 b u t

(Gl (2 Go) ~op (G1 tO G4), hence

'~--Op'

is not compositional with respect to Ob, {tO}. []

G1 : A s = (cat :.s)

(co, t : s) -+

(c.,t:

,,,,) (co, t : vp)

C(John) = {((:.t : n)}

a 2 : A s = (_1_)

(co, t : vp) -+

(co, t: v)

(cat : vp) -+ ( c a t : v ) ( c a t : n ) /:(sleeps) = / : ( l o v e s ) = { ( c a t : v)} G o : A s = (&)

/:(loves) = { ( c a t : v)} G 4 : A s = (_1_)

( c a t : v p )

-+ (co, t: v )

( c a t : n )

C(loves) = {(cat: v)}

G1 U G2 : A s = (cat : s)

(co, t : ~) -+

(~:o,t: ,,,,)

(~.at : vp) (cat : vp) -~ (co, t : v)

(cat: vp) --+ (cat: v) ( c a t : n) /:(John) = { ( c a t : n)}

£(sleeps) = £(loves) = { ( c a t : v)} G 1 U G a : A s = (cat : s)

(cat: s) --+ ( c a t : n) (cat: vp)

C(John) = {(cat: ',,,)}

£(loves) = { ( c a t : v)} GI U G4 : A s = (cat : s)

(co, t : ~) +

(co.t: ,,,.) (cat: vp)

(co, t : vp) -~

( c a t : , , )

(co, t : ~) /:(John) = { ( c a t : n)}

/:(loves) = { ( c a t : v)}

Figure 2: G r a m m a r union

The implication of the above proposition is that while g r a m m a r union might be a natural, well defined syntactic operation on grammars, the s t a n d a r d semantics of grannnars is too coarse to s u p p o r t it. Intuitively, this is because when a g r a m m a r G1 includes a particular rule p that is inapplicable for reduction, this rule contributes nothing to the d e n o t a t i o n of the grammar. B u t when G1 is combined with some other grammar, G2, p might be used for reduction in G1 U G2, where it can interact with the rules of G2. We suggest an alternative, fixpoint based semantics for unification based g r a m m a r s that naturally s u p p o r t s compositionality.

3 A c o m p o s i t i o n a l s e m a n t i c s

[image:4.612.309.531.86.428.2]
(5)

tion of a g r a m m a r .

D e f i n i t i o n 8. The a l g e b r a i c d e n o t a t i o n o.f G is ffGffa I = T a . G1 - a t G2 iff Tal = TG2.

Not only is the algebraic semantics composi- tionM, it is also c o m m u t a t i v e with respect to g r a m m a r union. To show t h a t , a composition o p e r a t i o n on d e n o t a t i o n s has to be defined, and we tbllow Mancarella a n d Pedreschi (1988) in its definition:

Tc;~ • To;., =

),LTc,

(~) u Ta2 ( 5

T h e o r e m 4. The semantics '==-at ' is commuta- tive with respect to grammar union and '•': for e, vcry two grammars G1, G2, [ a l f f a t " ~G2ffal =

: G I [-J G 2 ff (tl .

Proof. It has to be shown that, for every set of items L Tca~a., (I) = T a , ( I ) u Ta.,(I).

• if x E TG1 (I) U TG~, (I) t h e n either x G Tch (I) or x E Ta.,(I). From the definition of g r a m m a r union, x E T G 1 u G 2 ( I ) in any case.

• if z E Ta~ua.,(I) t h e n x can be added by either of the three clauses in the definition of Ta.

- if x is a d d e d by the first clause t h e n

there is a rule p G 7~1 U T~2 t h a t li- censes the derivation t h r o u g h which z is added. T h e n either p E 7~1 or p G T~2, b u t in any case p would have licensed the same derivation, so either

~ Ta~ (I) or • ~ Ta~ (I).

- if x is a d d e d by the second clause t h e n

there is an e-rule in G1 U G2 due to which x is added, a n d by the same rationale either x C TG~(I) or x E TG~(I).

- if x is a d d e d by the t h i r d clause t h e n

there exists a lexical category in £1 U £2 due to which x is added, hence this category exists in either £1 or £2, and therefore x C TG~ (I) U TG2 (I).

[]

Since '==-at' is c o m m u t a t i v e , it is also compo- sitional w i t h respect to g r a m m a r union. In- tuitively, since TG captures only one step of

the c o m p u t a t i o n , it cannot capture interactions among different rules in the (unioned) g r a m m a r , and hence taking To: to be the d e n o t a t i o n of G yields a compositional semantics.

T h e Ta operator reflects the s t r u c t u r e of the g r a m m a r b e t t e r t h a n its fixpoint. In other words, the equivalence relation induced by TG is finer t h a n the relation induced by lfp(Tc). T h e question is, how fine is the ' - a l ' relation? To make sure t h a t a semantics is not too fine, one usually checks the reverse direction.

D e f i n i t i o n 9. A f u l l y - a b s t r a c t equivalence relation ' - ' is such that G1 =- G'2 'i,.[.-f .for all G, Ob(G1 U G) = Ob(G.e U G).

P r o p o s i t i o n 5. Th, e semantic equivalence re- lation '--at' is not fully abshuct.

Proof. Let G1 be the g r a m m a r A~ = ± ,

£1 = 0,

~ = { ( c a t : ~) -~ (~:.,t : ,,,,p) (c.,t : vp), ( c a t : up) -~ (,:..t : ',,.p)}

and G2 be the gramm~:r A~ = 2 ,

Z:2 = O,

n ~ = {(~at : .~) -~ (~,.,t : .,p) ( . a t : ~p)}

• G1 ~ a t G2: because tbr I = {["John loves M a r y " , 6 , ( c a t : np),9]}, T(;I(I ) = I b u t To., (I) = O

• for all G, Ob(G U G~) = Ob(G [3 G2). T h e only difference between GUG1 a n d GUG2 is the presence of the rule (cat : up) -+ (cat : up) in the former. This rule can c o n t r i b u t e n o t h i n g to a d e d u c t i o n procedure, since any item it licenses m u s t already be deducible. Therefore, any item deducible w i t h G U G1 is also deducible with G U G2 a n d hence Ob(G U G1) ---- Ob(G U G,2).

[]

A b e t t e r a t t e m p t would have been to con- sider, instead of TG, the fbllowing o p e r a t o r as the d e n o t a t i o n of G: [G]i d = A I . T a ( I ) U I. In other words, the semantics is T a + Id, where I d is the identity operator. Unfortunately, this does not solve the problem, a s '~']id' is still not

fully-abstract.

(6)

4 A f u l l y a b s t r a c t s e m a n t i c s

We have shown so far t h a t ' H f p ' is not com- positional, and t h a t ' H i d ' is compositional b u t not fully abstract. T h e "right" semantics, there- fore, lies somewhere in between: since the choice of semantics induces a natural equivalence on grammars, we seek an equivalence that is cruder thzm ' H i d ' b u t finer t h a n 'H.fp'. In this section we a d a p t results from Lassez and Maher (1984) a.nd Maher (1988) to the domain of unification- b~Lsed linguistic formalisms.

Consider the following semantics for logic programs: rather t h a n taking the operator asso- d a t e d with the entire program, look only at the rules (excluding the facts), and take the mean- ing of a program to be the function that is ob- tained by an infinite applications of the opera- tor associated with the rules. In our framework, this would a m o u n t to associating the following operator with a grammar:

D e f i n i t i o n 10. L e t RG : Z -~ Z be a trans- f o r m a t i o n on sets o.f items, where .for every [ C ITEMS, [ w , i , A , j ] E R G ( I ) iff there exist Y l , . . . , Y k E I such that yl = [ w z , i t , A l , j d .for 1 _ < l _ < k and il+t = jl .for 1 < l < k and i, = 1 a n d . j k = J and ( A 1 , . . . , A k ) ~ A and

"~1) ~ 'tl) 1 • • • ? U k .

Th, e f u n c t i o n a l denotation of a g r a m m a r G is /[G~.f,,, = ( R e + I d ) ~ = End-0 (RG + I d ) n. Notice that R w is not R G "[ w: the f o r m e r is a f u n c t i o n " d f r o m sets of i t e m s to set of items; the latter is

a .set of items.

Observe that R c is defined similarly to Ta (definition 5), ignoring the items added (by Ta) due to e-rules and lexical items. If we define the set of items I ' n i t c to be those items that are a.dded by TG i n d e p e n d e n t l y of the argument it operates on, then for every g r a m m a r G and ev- ery set of items I, T a ( I ) = R a ( I ) U I n i t a . Re- lating the functional semantics to the fixpoint one, we tbllow Lassez and Maher (1984) in prov- ing that the fixpoint of the g r a m m a r transfor- mation o p e r a t o r can be c o m p u t e d by applying the fimctional semantics to the set I n i t G . D e f i n i t i o n 11. For G = ( h g , £ , A ~ ) , I n i t c = {[e,i,A,i] [ B is an e~-rule in G and B E_A} U { [ a , i , A , i + 1J I B E £ ( a ) .for B E A }

T h e o r e m 6. For every g r a m m a r G,

(R.c + fd.) (z',,.itcd = tb(TG)

Proof. We show that tbr every 'n., ( T ~ + I d ) n = (E~.-~ ( R e + Id) ~:) (I'nit(;) by induction on

Tt.

For n = 1, ( T c + I d ) ~[ 1 = (Tc~ + I d ) ( ( T a + I d ) ~ O) = (Tc, + Id)(O). Clearly, the only items added by TG are due to the second and third clauses of definition 5, which are exactly I n i t a . Also, ( E ~ = o ( R a + Id)~:)(Initc;) = ( R a + I d ) ° ( I n i t c ) = I'nitc;.

Assume that the proposition holds tbr n - 1, that is, ( T o + Id) "[ (',, - 1) = t~E'"-2t~'a:=0 txta + I d ) k ) U n i t e ) . T h e n

( T a + I d ) $ n = definition of i"

(TG + I d ) ( ( T a + I d ) ~[ (v, - 1)) = by the induction hypothesis

~n--2

( T a + I d ) ( (

k=0(RG +

I d ) k ) ( I n i t a ) ) = since T a ( I ) = R a ( I ) U I n i t a

E n - 2

( R a + I d ) ( ( k=Q(Rc; + I d ) ~ ' ) ( I n i t a ) ) U I n i t a =

(Ra

+ (Ra + Id) k) (1',,,its,)) = ( y ] n - 1 / R k=0 ~, ,

Id)h:)(Init(:)

, G - I -

Hence (RG + I d ) ~ ( I n i t ( ; = (27(; + I d ) ~ w =

lfp( TG ) . []

The choice of 'Hfl~' as the semantics calls for a different notion of' observables. The denota- tion of a g r a m m a r is now a flmction which re- flects an infinite n u m b e r of' applications of the g r a m m a r ' s rules, b u t completely ignores the e- rules and the lexical entries. If we took the ob- servables of a g r a m m a r G to be L ( G ) we could in general have ~G1].f,. = ~G2]fl~. b u t Ob(G1) 7 ~ Ob(G2) (due to different lexicons), that is, the semantics would not be correct. However, when the lexical entries in a g r a m m a r (including the e- rules, which can be viewed as e m p t y categories, or the lexical entries of traces) are taken as in- put, a natural notion of observables preservation is obtained. To guarantee correctness, we define the observables of a g r a m m a r G with respect to a given input.

D e f i n i t i o n 12. Th, e o b s e r v a b l e s of a gram- m a r G = ( ~ , / : , A s} with respect to an in- put set of items I are Ot, (C) = {(',,,,A) I

(7)

C o r o l l a r y 7.

The semantics '~.~.f ' is correct:

'llf G1 =fn G2 then .for every I, Obl(G1) =

Ol, ( a,e ).

The above definition corresponds to the pre- vious one in a n a t u r a l way: when the input is taken to be

Inita,

the observables of a g r a m m a r are its language.

T h e o r e m 8.

For all G, L(G) = Obinita(G).

P'moJ:

L(G) =

definition of

L(G)

{ (',,,, A) I [w, O, A,

I 1] e I[C]lo,,}

=

definition 4

{(w,

A) [ F-c [w, O, A,

=

by t h e o r e m 1

{<w, A> I [,w, 0, A,

Iwl]

e

l.fp(Ta)} =

by t h e o r e m 6

{(,w,

A)

I

[w, O, A, [wl]

e [ G ] f n ( I n i t G ) } = by definition 12

Obt,,,~tc; (G)

[]

.To show t h a t the semantics

'Hfn'

is composi- tional we must define an o p e r a t o r for combining denotations. Unfortunately, the simplest oper- ator, ' + ' , would not do. However, a different o p e r a t o r does the job. Define

~Gl~.f~ • [G2~f~

to 1)e ([[G1]l.fn +

[G2~f~) °'.

T h e n

'H.f~'

is c o m m u t a - tive (and hence compositional) with respect to ~•' a n d 'U'.

T h e o r e m 9. fiG1 U

G2~fn = ~Gl]fn " ~G2~.fn.

The p r o o f is basically similar to the case of logic p r o g r a m m i n g (Lassez and Maher, 1984) and is detailed in W i n t n e r (1999).

T h e o r e m 10.

The semantics '~'[fn' is fully

abstract: ,for every two grammars G1 and G2,

'llf .for" every grammar G and set of items I,

Obr(G1 U G) = ObI(G2 U G), then G1 =fn G2.

T h e p r o o f is constructive: assuming that G t ~f;~ G2, we show a g r a m m a r G (which de- t)ends on G1 and G2) such t h a t

Obt(G1 U G) ¢

Obr(G2 U G).

For the details, see W i n t n e r (1999).

5 C o n c l u s i o n s

This p a p e r discusses alternative definitions for the semantics of unification-based linguistic for- malisms, culminating in one that is b o t h com- positional and fully-abstract (with respect to g r a m m a r union, a simple syntactic c o m b i n a t i o n operations on grammars). This is mostly an a d a p t a t i o n of well-known results from h)gic pro- gramming to the ti'amework of unification-based linguistic tbrmalisms, and it is encouraging to see that the same choice of semantics which is compositional and fiflly-abstra(:t for Prolog t u r n e d out to have the same desirable proper- ties in our domain.

The functional semantics '~.].f,' defined here assigns to a g r a m m a r a fimction which reflects the (possibly infinite) successive application of g r a m m a r rules, viewing the lexicon as input to the parsing process. We, believe that this is a key to m o d u l a r i t y in g r a m m a r design. A gram- mar m o d u l e has to define a set of items t h a t it "exports", and a set of items t h a t can be "imported", in a similar way to the declaration of interfaces in p r o g r a m m i n g languages. We are currently working out the details of such a definition. An i m m e d i a t e application will fa- cilitate the i m p l e m e n t a t i o n of g r a m m a r devel- opment systems t h a t s u p p o r t m o d u l a r i t y in a clear, m a t h e m a t i c a l l y sound way.

The results r e p o r t e d here can b e e x t e n d e d in various directions. First, we are only con- cerned in this work with one c o m p o s i t i o n oper- ator, g r a m m a r union. B u t alternative o p e r a t o r s are possible, too. In particular, it would b e in- teresting to define an o p e r a t o r which combines the information encoded in two g r a m m a r rules, for example by unifying the rules. Such an op- erator would facilitate a separate development of g r a m m a r s along a different axis: one m o d u l e can define the syntactic c o m p o n e n t of a gram- mar while another m o d u l e would account for the semantics. T h e composition o p e r a t o r will unify each rule of one m o d u l e with an associated rule in the other. It remains to be seen w h e t h e r the g r a m m a r semantics we define here is composi- tional and fully a b s t r a c t with respect to such an operator.

(8)

over a given signature, it is more realistic to as- sume separate, interacting signatures. We hope to be able to explore these directions in the fu- ture.

R e f e r e n c e s

Antonio Brogi, Evelina Lamina, and Paola Mello. 1992. Compositional model-theoretic semantics for logic programs. New Genera- tion Computing, 11:1-21.

Michele Bugliesi, Evelina Lamina, and Paola Mello. 1994. Modularity in logic pro- gramming. Journal of Logic Programming, 19,20:443 502.

Bob Carpenter. 1991. T y p e d feature struc- tures: A generalization of first-order terms. In Vijai Saraswat and Ueda Kazunori, edi- tors, Logic Programming - Proceedings of the 1991 International Symposium,, pages 187- 201, Cambridge, MA. MIT Press.

Bob Carpenter. 1992. The Logic of Typed Fea- ture Structures. Cambridge Tracts in Theo- retical C o m p u t e r Science. Cambridge Univer- sity Press.

Gregor Erbach and Hans Uszkoreit. 1990. G r a m m a r engineering: Problems and prospects. CLAUS report 1, University of the Saarland and German research center for Artificial Intelligence, July.

Haim Gaifman and Ehud Shapiro. 1989. Fully abstract compositional semantics for logic programming. In 16th Annual A C M Sym- posium on Principles o.f Logic Programming, pages 134-142, Austin, Texas, January. J.-L. Lassez and M. J. Maher. 1984. Closures

and fairness in the semantics of programming logic. Theoretical computer science, 29:167- 184.

M. J. Maher. 1988. Equivalences of logic pro- grams. In .Jack Minker, editor, Foundations of Deductive Databases and Logic Program- rain.q, chapter 16, pages 627-658. Morgan Kaulinann Publishers, Los Altos, CA.

Paolo Mancarella and Dino Pedreschi. 1988. An algebra of logic programs. In Robert A. Kowalski and Kenneth A. Bowen, edi- tors, Logic Programming: Proceedings of the F@h international conference and sympo-

,sium,

pages 1006-1023, Cambridge, Mass. MIT Press.

Fernando C. N. Pereira and Stuart M. Shieber.

1984. The semantics of g r a m m a r formalisms seen as computer languages. In Proceedings of the lOth international con.ference on compu- tational linguistics and the 22nd annual meet- ing o.f the association .for computational lin- guistics, pages 123-129, Stantbrd, CA, July. Stuart Shieber, Yves Schabes, and Fernando

Pereira. 1995. Principles and implementation of deductive parsing. Jo'wrr~,al o]" Logic Pro- gramming, 24(1-2):3-36, J u l y / A u g u s t . Stuart M. Shieber. 1992. Constraint-Based

Grammar Form, alism, s. MIT Press, Cam- bridge, Mass.

Klaas Sikkel. 1997. Par'sing Schemata. Texts in Theoretical C o m p u t e r Science - An EATCS Series. Springer Verlag, Berlin.

M. H. Van E m d e n and Robert A. Kowalski. 1976. The semantics of predicate logic as a programming l a n g u a g e . . I o u r n a l of the Asso- ciation .for Ccrmputing Machinery, 23(4):733- 742, October.

Shuly Wintner and Nissim Francez. 1999. Off- line parsability and the well-tbundedness of subsumption. Journal of Logic, Language

and In.formation, 8(1):1-16, January.

Figure

Figure 1: An example grammar, G
Figure 2: Grammar union

References

Related documents