University of Pennsylvania ScholarlyCommons

IRCS Technical Reports Series Institute for Research in Cognitive Science

January 1999

Compostional Semantics for Unification-based Linguistics Formalisms

Shuly Wintner University of Pennsylvania, [email protected]

Follow this and additional works at: https://repository.upenn.edu/ircs_reports

Wintner, Shuly, "Compostional Semantics for Unification-based Linguistics ormalisms"F (1999). IRCS Technical Reports Series. 44. https://repository.upenn.edu/ircs_reports/44

University of Pennsylvania Institute for Research in Cognitive Science Technical Report No. IRCS-99-05.

This paper is posted at ScholarlyCommons. https://repository.upenn.edu/ircs_reports/44 For more information, please contact [email protected]. Compostional Semantics for Unification-based Linguistics ormalismsF

Abstract Contemporary linguistic formalisms have become so rigorous that it is now possible to view them as very high level declarative programming languages. Consequently, grammars for natural languages can be viewed as programs; this view enables the application of various methods and techniques that were proved useful for programming languages to the study of natural languages. This paper adapts the notion of program composition, well developed in the context of languages, to the domain of linguistic formalisms. We study alternative definitions for the semantics of such formalisms, suggesting a denotational semantics that we show to be compositional and fully-abstract. This facilitates a clear, mathematically sound way for defining grammar modularity.

Comments University of Pennsylvania Institute for Research in Cognitive Science Technical Report No. IRCS-99-05.

This technical report is available at ScholarlyCommons: https://repository.upenn.edu/ircs_reports/44

Comp ositional Semantics for

Uni cation-based Linguistic Formalisms

Shuly Wintner

Institute for Research in Cognitive Science

University of Pennsylvania

3401 Walnut Street, Suite 400A

Philadelphia, PA 19104-6228

[email protected]

Abstract

Contemp orary linguistic formalisms have b ecome so rigorous that it is now p ossible to view them

as very high level declarative programming languages. Consequently, grammars for natural languages

can b e viewed as programs; this view enables the application of various metho ds and techniques that

were proved useful for programming languages to the study of natural languages. This pap er adapts

the notion of program composition, well develop ed in the context of logic programming languages,

to the domain of linguistic formalisms. We study alternative de nitions for the semantics of such

formalisms, suggesting a denotational semantics that we show to b e comp ositional and fully-abstract.

This facilitates a clear, mathematically sound way for de ning grammar mo dularity.

1 Intro duction

The tasks of developing large scale grammars for natural languages b ecome more and more complicated:

it is not unusual for a single grammar to be develop ed by a team including a number of linguists,

computational linguists and computer scientists. The problems that grammar engineers face when they

design a broad-coverage grammar for some natural language are very reminiscent to the problems tackled

by software engineering see Erbach and Uszkoreit 1990 for a discussion of some of the problems involved

in developing large-scale grammars. It is p ossible { and, indeed, desirable | to adapt metho ds and

techniques of software engineering to the domain of natural language formalisms.

The departure p oint for this work is the b elief that any advances in grammar engineering must be

preceded by a more theoretical work, concentrating on the semantics of grammars. This view re ects

the situation in logic programming, where developments in alternative de nitions for the semantics of

predicate logic led to implementations of various program comp osition op erators. Viewing contemp orary

linguistic formalisms as very high level declarative programming languages, a grammar for a natural

language can b e viewed as a program. The execution of a grammar on an input sentence yields an output

which represents the sentence's structure.

This pap er adapts well-known results from logic programming languages semantics to the framework

of uni cation-based linguistic formalisms. While most of the results we rep ort on are probably not

surprising, we b elieve it is imp ortant to derive them directly for linguistic formalisms for two reasons.

First, practitioners of linguistic formalisms usually do not view them as instances of a general logic

programming framework, but rather as rst-class programming environments which deserve indep endent

study. Second, there are some crucial di erences b etween linguistic formalisms and, say, : the basic

elements|typ ed feature structures | are more general then rst-order terms, the notion of uni cation 1

is di erent, and computations amount to parsing, rather than SLD-resolution. The fact that we can

derive similar results in this new domain is encouraging, and should not b e considered trivial.

In the next section we review the literature on mo dularity in logic programming. We discuss alter-

native approaches, b oth op erational and denotational, to the semantics of uni cation-based linguistic

formalisms in section 3. In section 4 we show that the standard semantics are \to o crude" and present

an alternative semantics, whichwe show to b e comp ositional with resp ect to grammar union, a simple

syntactic combination op eration on grammars. However, this de nition is \to o ne": we show that it is

not fully-abstract, and in section 5 we present an adequate, comp ositional and fully-abstract semantics

for uni cation-based linguistic formalisms. We conclude with suggestions for further research.

2 Mo dularity in logic programming

The seminal work in the semantics of logic programming is Van Emden and Kowalski 1976, where three

alternative de nitions for the meanings of predicate logic sentences are given and proven equivalent: the

mo del theoretic de nition, viewing the denotation of the program as its minimal mo del, the intersection

of all its Herbrand mo dels; the op erational de nition, viewing the denotation of a program as the set

of consequences derivable from the data structures it manipulates; and the xp oint semantics, by which

the meaning of a program is the least xp oint of its immediate consequence op erator. These results are

elab orated up on by Apt and Van Emden 1982, further exploiting the application of xp oints by relating

them to SLD resolution and accounting also to nite failure.

A di erent approach is pursued by Lassez and Maher 1984: viewing a logic program as the set of

its rules, distinct from the facts, they de ne an immediate consequence op erator for the rules only. The

denotation of a grammar is the xp oint of this op erator, starting from the set of facts. This approach

facilitates comp osition of programs, as the meaning of any comp osite sentence can b e expressed in terms

of the meanings of its immediate constituents.

Gaifman and Shapiro 1989 observe that the classical Herbrand-base semantics of logic programs is

inadequate, as it identi es programs that should b e distinguished and vice versa. They de ne the notions

of comp ositional semantics and fully-abstract semantics and show that the reason for the inadequacy of

the standard mo del-theoretic semantics lies in the fact that it captures only the derivable atoms in its

Herbrand base, whereas a query can intro duce new function symb ols that are not part of the program's

signature. Rather than resort to a solution that incorp orates a \universal" signature for logic programs,

they change the notion of program equivalence by taking as invariant the set of all most general atomic

logical consequences of the program. This de nition of semantics is shown to b e b oth comp ositional and

fully-abstract.

Gaifman and Shapiro 1989 de ne comp ositional semantics as follows: let P b e a class of programs or

program parts; let Ob b e a function asso ciating a set of ob jects, the observables, with a program P 2P.

Let Com be a class of comp osition functions over P such that for every n-ary function f 2 Com and

every set of n programs P ;:::;P 2P, f P ;:::;P  2P. A comp ositional equivalence with resp ect

1 n 1 n

to Ob; C om is an equivalence relation ` ' that preserves observables i.e., whenever P Q, ObP =

ObQ, and for every f 2 Com, if for all 1  i  n, P Q then f P ;:::;P  f Q ;:::;Q .

i i 1 n 1 n

The need for a mo dular extension for logic programming languages has always b een agreed up on, as

relations were viewed as providing to o ne-grained abstraction for the design of large programs. Two

ma jor tracks were taken: one, referred to as programming in the large and inspired by O'keefe 1985,

suggests a meta-linguistic mechanism: mo dules are viewed as sets of Horn clauses and their comp osition

is mo deled in terms of op erations on the comp onents such as union, deletion, closure etc. The other

approach, known as programming in the smal l and originating with Miller 1986; 1989, enhances logic

programming with linguistic abstraction mechanisms that are richer than those o ered by Horn clauses

see Bugliesi, Lamma, and Mello 1994 for a review of mo dularity in logic programming.

Unlike O'keefe 1985, who de nes the denotation of a program to be the transformation op erator 2

obtained by applying deduction steps arbitrarily many times, Mancarella and Pedreschi 1988 move

from an ob ject level to a function level and interpret a logic program as its immediate consequence

op erator, mo deling a single deduction step. They de ne an algebra over op erators, suitable for de ning

a union comp osition op erator over sub-programs. These results are extended in Brogi et al. 1990,

where an additional op erator, intersection, is added to the union op erator. The comp osition op erators

are characterized b oth mo del-theoretically and using meta-interpreter techniques; b oth approaches are

shown to b e equivalent to each other and to the original algebraic characterization.

A di erent approach is taken by Brogi, Lamma, and Mello 1992, who observe that the reason for

the inadequacy of the standard Herbrand mo del semantics for comp ositionality stems from the adoption

of the closed world assumption. When program comp osition is to b e supp orted, programs should b e view

as open, to b e completed by additional knowledge. Viewing the denotation of a program as the set of

all its Herbrand mo dels is inadequate; rather, program meaning is de ned to b e a subset of its mo dels,

namely its admissible mo dels { those that are supp orted by the assumption of a set of hyp otheses. A

natural notion of program comp osition is thus obtained. This work is extended by Brogi, Lamma, and

Mello 1993, adding a close op erator and exemplifying its usage.

The notion of comp ositionality employed in these twoworks is slightly di erent: given a program P ,

let [[P ]] b e the denotation of P . Let [ b e a comp osition op erator on programs, and  b e a comp osition

op erator on denotations. A semantics is comp ositional if [ and  commute, that is, if [[P [ Q]]= [[P ]]  [[Q]].

To avoid confusion, we say that a semantics is commutative with resp ect to the op erator  i it is

comp ositional by this de nition. Commutativity is a stronger notion than the de nition of Gaifman and

Shapiro 1989 ab ove: if a semantics is commutative with resp ect to some op erator then it is comp ositional

with resp ect to a singleton set containing the same op erator.

Prop osition 1. Let P be a class of programs, [[]] a denotation operator, [ a combination operator on

programs and  acombination operator on denotations. For P; Q 2P, let P Q i [[P ]] = [[Q]]. If [[]]

is commutative with respect to [; , then is compositional with respect to [.

Proof. Assume that P P and Q Q .

1 2 1 2

[[P [ Q ]] = [[P ]]  [[Q ]] commutativityof[[]]

1 1 1 1

= [[P ]]  [[Q ]] since P P

2 1 1 2

= [[P ]]  [[Q ]] since Q Q

2 2 1 2

= [[P [ Q ]] commutativityof[[]]

2 2

3 Semantics of linguistics formalisms

Viewing grammars as formal entities that share many features with computer programs, it is natural

to consider the notion of semantics of uni cation-based formalisms. Analogously to logic programming

languages, the denotation of uni cation based grammars can be de ned using various techniques. We

review in this section the op erational de nition of Shieb er, Schab es, and Pereira 1995 and the deno-

tational de nition of, e.g., Pereira and Shieb er 1984 or Carp enter 1992, pp. 204-206. We show that

these de nitions are equivalent and that none of them supp orts comp ositionality.

3.1 Basic notions

We assume familiarity with theories of feature structure based uni cation grammars, as formulated by,

e.g., Carp enter 1992 or Shieb er 1992. Grammars are de ned over typed feature structures TFSs

which can b e viewed as generalizations of rst-order terms Carp enter, 1991. TFSs are partially ordered

by subsumption, with ? the least or most general TFS. A multi-rooted structure MRS, see Sikkel 3

1997 or Wintner and Francez 1999 is a sequence of TFSs, with p ossible reentrancies among di erent

elements in the sequence. Meta-variables A; B range over TFSs and ; {over MRSs. MRSs are partially

ordered by subsumption, denoted `v', with a least upp er b ound op eration of uni cation, denoted `t',

and a greatest lowest b ound denoted `u'. We assume the existence of a xed, nite set Words of words.

A lexicon asso ciates with every word a set of TFSs, its category. Meta-variable a ranges over Words



and w {over strings of words elements of Words . Grammars are de ned over a signature of typ es

and features, assumed to b e xed b elow.

De nition 1 Grammars. A rule is an MRS of length greater than or equal to 1 with a designated

 rst element, the head of the rule. The rest of the elements form the rule's body which may be

empty, in which case the rule is depicted as a TFS. A lexicon is a total function from Words to nite,

s

possibly empty sets of TFSs. A grammar G = hR; L;A i is a nite set of rules R, a lexicon L and a

s

start symbol A that is a TFS.

1 2

Figure 1 depicts an example grammar, suppressing the typ e hierarchy on which it is based. When

the initial symb ol is not explicitly depicted, it is assumed to b e the most general feature structure that

is subsumed by the head of the rst listed rule.

s

A =cat : s

8 9

cat : s ! cat : n cat : vp

< =

cat : vp ! cat : v  cat : n

R =

: ;

cat : vp ! cat : v 

L John=LMary = fcat : ng

L sleeps=L sleep = Lloves=fcat : v g

Figure 1: An example grammar, G

The de nition of uni cation is lifted to MRSs: let ; be two MRSs of the same length; the uni cation

of  and , denoted  t , is the most general MRS that is subsumed by b oth  and ,ifsuchanMRS

exists. Otherwise, the uni cation fails.

De nition 2 Reduction. An MRS hA ;:::;A i reduces to a TFS A with respect to a grammar G

1 k

denoted hA ;:::;A i A i there exists a rule  2R such that hB; B ;:::;B i =  th?;A ;:::;A i

1 k G 1 k 1 k

and B v A. When G is understood from the context it is omitted. Reduction can be viewed as the

bottom-up counterpart of derivation.

For two functions f , g ,over the same set domain, f + g is de ned as I :f I  [ g I . Let IN denote

0



the set f0; 1; 2; 3;:::g. Let Items b e the set f[w ; i; A; j ] j w 2 Words , A is a TFS and i; j 2 IN g. Let

0

Items

I =2 . Meta-variables x; y range over items and I {over sets of items. When I is ordered by set

inclusion it forms a complete lattice with set union as a least upp er b ound lub op eration. A function

T : I ! I is monotone if whenever I I , also T I  T I . It is continuous if for every chain

1 2 1 2

S S

I I , T  I  = T I . If a function T is monotone it has a least xp oint Tarski-

1 2 j j

j

Knaster theorem; if T is also continuous, the xp oint can b e obtained by iterative application of T to

the empty set Kleene theorem: lfp T = T " ! , where T " 0= ; and T " n = T T " n 1 when n is

S

a successor ordinal and T " n when n is a limit ordinal.

k

1

Grammars are displayed using a simple description language, where `:' denotes feature values and `,' denotes conjunction.

2

Assume that in all the example grammars, the typ es s, n, v and vp are maximal and pairwise inconsistent. 4

3.2 An op erational semantics

As Van Emden and Kowalski 1976 note, \to de ne an op erational semantics for a programming language

is to de ne an implementational indep endentinterpreter for it. For predicate logic the pro of pro cedure

b ehaves as suchaninterpreter." Shieb er, Schab es, and Pereira 1995 view parsing as a deductive pro cess

that proves claims ab out the grammatical status of strings from assumptions derived from the grammar.

We follow their insight and notation and list a deductive system for parsing grammars formalized as in

the previous section. As the sp ecial prop erties of di erent parsing algorithms are of little interest here,

we limit the de nition to a simple b ottom-up pro cedure.

De nition 3 Deductive parsing. The deductive parsing system associated with a grammar G =

s

hR ; L;A i is de ned over Items and is characterized by:

Axioms:

[; i; A; i] if B is an -rule in R and B v A

[a; i; A; i +1] if B 2La and B v A

Goals:

s

[w; 0;A;jw j] where A w A

Inference rules:

[w ;i ;A ;j ];:::;[w ;i ;A ;j ] if j = i for 1  l

1 1 1 1 k k k k l l+1

i = i and j = j and

1 k

[w w ;i;A;j] hA ;:::;A i A

1 k 1 k G

Notice that the domain of items is in nite, and in particular that the numb er of axioms is in nite.

Also, notice that the goal is to deduce a TFS which is subsumed by the start symb ol, and when TFSs can

b e cyclic, there can b e in nitely many such TFSs and, hence, goals { see Wintner and Francez 1999.

When an item [w ; i; A; j ] can be deduced, applying k times the inference rules asso ciated with a

k

grammar G,we write ` [w ; i; A; j ]. When the numb er of inference steps is irrelevant it is omitted.

G

De nition 4 Op erational semantics. The operational denotation of a grammar G is [[G]] =

op

fx j` xg. G G i [[G ]] = [[G ]] .

G 1 op 2 1 2

op op

We use the op erational semantics to de ne the language generated by a grammar G. The language

of a grammar G is LG=fhw; Aij[w; 0;A;jw j] 2 [[G]] g. Notice that a language is not merely a set

o p

of strings; rather, each string is asso ciated with a TFS through the deduction pro cedure. Note also that

s

the start symbol A do es not play a role in this de nition; this is equivalent to assuming that the start

symb ol is always the most general TFS, ?.

The most natural observable for a grammar would be its language, either as a set of strings or

augmented by TFSs. Thus we take ObGtobeLG and by de nition, the op erational semantics `[[]] '

op

preserves observables.

3.3 Denotational semantics

As an alternative to the op erational semantics discussed ab ove, we consider in this section denotational

semantics through a xp oint of a transformational op erator asso ciated with grammars. This is essentially

similar to the de nition of Pereira and Shieb er 1984 and Carp enter 1992, pp. 204-206. We then show

that the algebraic semantics is equivalent to the op erational one.

Asso ciate with a grammar G an op erator T that, analogously to the immediate consequence op erator

G

of logic programming, can be thought of as a \parsing step" op erator in the context of grammatical

s

formalisms. For the following discussion x a particular grammar G = hR; L ;A i. 5

De nition 5. Let T : I ! I be a transformation on sets of items, where for every I Items,

G

[w ; i; A; j ] 2 T I  i either

G

 there exist y ;:::;y 2 I such that y =[w ;i ;A ;j ] for 1  l  k and i = j for 1  l

1 k l l l l l l+1 l

i =1 and j = j and hA ;:::;A iA and w = w w ;or

1 k 1 k 1 k

 i = j and B is an -rule in G and B v A and w = ;or

 i +1 = j and jw j =1 and B 2Lw  and B v A.

Theorem 2. For every grammar G, T is monotone.

G

Proof. Supp ose I I . If x 2 T I  then x was added by one of the three op erations in the de nition

1 2 G 1

of T . Notice that the last two clauses of de nition 5 are indep endent of I : they add the same items

G

in each application of the op erator. If x 2 T I  due to them, then x 2 T I , to o. If x was added

G 1 G 2

by the rst clause, then there exist items y ;:::;y in I to which this op eration applies. Since I I ,

1 k 1 1 2

y ;:::;y are in I , to o, and hence x 2 T I , to o.

1 k 2 G 2

Theorem 3. For every grammar G, T is continuous.

G

S

Proof. First, T is monotone. Second, let I = I I ::: beachain of items. If x 2 T  I  then

G 0 1 G i

i0

S

there exist y ;:::;y 2 I as required, due to which x is added. Then there exist i ;:::;i such that

1 k i 1 k

i0

y 2 I ;:::;y 2 I . Let m b e the maximum of i ;:::;i . Then y ;:::;y 2 I , x 2 T I  and hence

1 i k i 1 k 1 k m G m

1

k

S

x 2 T I .

G i

i0

S S

If x 2 T I  then there exists some i that x 2 T I . I I and since T is monotone,

G i G i i i G

i0 i0

S S

T I  T  I , and hence x 2 T  I . Therefore T is continuous.

G i G i G i G

i0 i0

Corollary 4. For every grammar G, the least xpoint of T exists and lfp T =T " ! .

G G G

Following the paradigm of logic programming languages, de ne a xp oint semantics for uni cation-

based grammars by taking the least xp oint of the parsing step op erator as the denotation of a grammar.

De nition 6 Fixp oint semantics. The xpoint denotation of a grammar G is [[G]] = lfp T .

G

fp

G G i lfp T =lfp T .

1 2 G G

1 2

fp

The denotational de nition is equivalent to the op erational one:

Theorem 5. For x 2 Items, x 2 lfp T  i ` x.

G G

Proof.

n

 If ` [w ; i; A; j ] then [w ; i; A; j ] 2 T " n. By induction on n: if n = 1 then [w ; i; A; j ] is an axiom

G

G

and therefore either jw j =1,j = i + 1 and B 2Lw  for B v A;orw = , i = j and B is an -rule for

B v A. By the de nition of T , T ;=f[; i; A; j ] j B v A is an -ruleg[ f[w ; i; A; i +1] jjw j =1

G G

and B 2Lw  for B v Ag,sowehave[w ; i; A; j ] 2 T " 1.

G

n

[w ; i; A; j ] for n>1. Then the inference Assume that the hyp othesis holds for n 1; assume that `

G

rule must b e applied at least once, i.e., there exist items [w ;i ;A ;j ];:::;[w ;i ;A ;j ] such that

1 1 1 1 k k k k

j = i for 1  l

l l+1 1 k 1 k 1 k

n1

for every 1  l  k , the item [w ;i ;A ;j ] can b e deduced in n 1 steps: ` [w ;i ;A ;j ]. By

i l l l l l l l

G

the induction hyp othesis, for every 1  l  k ,[w ;i ;A ;j ] 2 T " n 1. By the de nition of T ,

l l l l G G

applying the rst clause of the de nition, [w i; A; j ] 2 T T " n 1 = T " n.

; G G G 6

n

 If [w ; i; A; j ] 2 T " n then ` [w ; i; A; j ]. By induction on n: if n = 1, that is, [w ; i; A; j ] 2 T " 1,

G G

G

then either i = j , w =  and B v A is an -rule in G,ori +1 = j and B 2Lw  for B v A. In the

1 1

rst case, ` [w ; i; A; j ]by the rst axiom of the deductive pro cedure; in the other case, ` [w ; i; A; j ]

G G

by the second axiom.

Assume that the hyp othesis holds for n 1 and that [w ; i; A; j ] 2 T " n = T T " n 1. Then

G G G

there exist items y ;:::;y 2 T " n 1 such that y =[w ;i ;A ;j ] for 1  l  k and i = j

1 k G l l l l l l+1 l

for 1  l

1 k 1 k 1 k

n1

hyp othesis, for every 1  l  k , ` [w ;i ;A ;j ], and the inference rule is applicable, so by an

l l l l

G

n

additional step of deduction we obtain ` [w ; i; A; j ].

G

Corollary 6. The relation ` 'preserves observables: whenever G G , also ObG =ObG .

1 2 1 2

fp fp

3.4 Comp ositionality

While the op erational and the denotational semantics de ned ab ove are standard for complete grammars,

they are to o coarse to serve as a mo del when the comp osition of grammars is concerned. When the

denotation of a grammar is taken to be [[G]] , imp ortant characteristics of the internal structure of

op

the grammar are lost. To demonstrate the problem, we intro duce a natural comp osition op erator on

grammars, namely union of the sets of rules and the lexicons in the comp osed grammars.

s s

i are two grammars over i and G = hR ; L ;A De nition 7 Grammar union. If G = hR ; L ;A

2 2 2 1 1 1

2 1

the same signature, then the union of the two grammars, denoted G [ G , is a new grammar G =

1 2

s s s s

hR ; L;A i such that R = R [R , L = L + L and A = A u A .

1 2 1 2

1 2

Figure 2 exempli es the union op eration on grammars. Observe that G [ G = G [ G .

1 2 2 1

s

G : A =cat : s

1

cat : s ! cat : n cat : vp

LJohn = fcat : ng

s

G : A =?

2

cat : vp ! cat : v 

cat : vp ! cat : v  cat : n

Lsleeps = Lloves=fcat : v g

s

G [ G : A =cat : s

1 2

cat : s ! cat : n cat : vp

cat : vp ! cat : v 

cat : vp ! cat : v  cat : n

LJohn = fcat : ng

Lsleeps = Lloves=fcat : v g

Figure 2: Grammar union

Prop osition 7. The equivalencerelation ` ' is not compositional with respect to Ob; f[g.

op 7

Proof. Consider the following grammars:

s

G : A =cat : s

1

cat : s ! cat : n cat : vp

L John=fcat : ng

s

G : A =?

2

L loves=fcat : v g

s

G : A =?

3

cat : vp ! cat : v  cat : n

L loves=fcat : v g

s

G [ G : A =cat : s

1 2

cat : s ! cat : n cat : vp

L John=fcat : ng

L loves=fcat : v g

s

G [ G : A =cat : s

1 3

cat : s ! cat : n cat : vp

cat : vp ! cat : v  cat : n

L John=fcat : ng

L loves=fcat : v g

Note that

[[G ]] =[[G ]] = f[\loves";i;cat : v ;i +1] j i  0g

2 3

op op

but

f[\John loves John";i;cat : s;i +3 j i  0g [[G [ G ]]

1 3

op

f[\John loves John";i;cat : s;i +3 j i  0g6 [[G [ G ]]

1 2

op

Thus G G but G [ G  6 G [ G , hence ` ' is not comp ositional with resp ect to

2 op 3 1 2 op 1 3 op

Ob; f[g.

The implication of the ab ove prop osition is that while grammar union might be a natural, well

de ned syntactic op eration on grammars, the standard semantics of grammars is to o coarse to supp ort

it. Intuitively, this is b ecause when a grammar G includes a particular rule  that is inapplicable for

1

reduction, this rule contributes nothing to the denotation of the grammar. But when G is combined

1

with some other grammar, G ,  might be used for reduction in G [ G , where it can interact with

2 1 2

the rules of G . The question to ask is, then, in what sense is a grammar a union of its rules? We

2

suggest an alternative, xp oint based semantics for uni cation based grammars that naturally supp orts

comp ositionality.

4 A comp ositional semantics

Toovercome the problems delineated ab ove, we follow Mancarella and Pedreschi 1988 in moving one

step further, considering the grammar transformation op erator itself rather than its xp oint as the

denotation of a grammar.

De nition 8 Algebraic semantics. The algebraic denotation of a grammar G is [[G]] = T .

G

al

G G i T = T .

1 al 2 G G

1 2

Not only is the algebraic semantics comp ositional, it is also commutative with resp ect to grammar

union. To show that, a comp osition op eration on denotations has to b e de ned, and we follow Mancarella

and Pedreschi 1988 in its de nition:

I  I  [ T = I :T  T T

G G G G

2 1 2 1 8

Theorem 8. The semantics ` 'iscommutative with respect to grammar union and `': for every two

a l

grammars G , G ,[[G ]]  [[G ]] = [[G [ G ]] .

1 2 1 2 1 2

al al al

I . I  [ T I =T Proof. It has to b e shown that for every set of items I , T

G G G [G

2 1 1 2

 if x 2 T I  [ T I  then either x 2 T I orx 2 T I . From the de nition of grammar union,

G G G G

1 2 1 2

x 2 T I inany case.

G [G

1 2

 if x 2 T I  then x can b e added by either of the three clauses in the de nition of T .

G [G G

1 2

{ if x is added by the rst clause then there is a rule  2R [R that licenses the derivation

1 2

through which x is added. Then either  2 R or  2 R , but in any case  would have

1 2

I . I orx 2 T licensed the same derivation, so either x 2 T

G G

2 1

{ if x is added by the second clause then there is an -rule in G [ G due to which x is added,

1 2

and by the same rationale either x 2 T I orx 2 T I .

G G

1 2

{ if x is added by the third clause then there exists a lexical category in L [L due to which

1 2

x is added, hence this category exists in either L or L , and therefore x 2 T I  [ T I .

1 2 G G

1 2

Since ` ' is commutative, by prop osition 1 it is also comp ositional with resp ect to grammar union. Intu-

al

itively, since T captures only one step of the computation, it cannot capture interactions among di erent

G

rules in the unioned grammar, and hence taking T to b e the denotation of G yields a comp ositional

G

semantics.

The T op erator re ects the structure of the grammar b etter than its xp oint. In other words, the

G

equivalence relation induced by T is ner than the relation induced by lfp T . The question is, how

G G

ne is the ` ' relation? To make sure that a semantics is not too ne, one usually checks the reverse

al

direction.

De nition 9 Full abstraction. A semantic equivalencerelation ` 'is fully-abstract i

P Q i for al l R , ObP [ R =ObQ [ R 

As it turns out, the selection of T as the denotation of G is to o ne: ` ' is not fully-abstract. To

G al

show that, one must provide two grammars, say G and G , such that G 6 G that is, T 6= T ,

1 2 1 al 2 G G

1 2

but still for every grammar G, ObG [ G =ObG [ G .

1 2

Prop osition 9. The semantic equivalencerelation ` ' is not ful ly abstract.

al

Proof. Let G b e the grammar

1

s

A = ?; L = ;; R = fcat : s ! cat : npcat : vp; cat : np ! cat : npg

1 1

1

and G b e the grammar

2

s

A = ?; L = ;; R = fcat : s ! cat : npcat : vpg

2 2

2

 G 6 G : b ecause

1 al 2

f[\John loves Mary"; 6; cat : np; 9]g= f[\John loves Mary"; 6; cat : np; 9]g T

G

1

but

T f[\John loves Mary"; 6; cat : np; 9]g= ;

G

2 9

 for all G, ObG [ G =ObG [ G . The only di erence b etween G [ G and G [ G is the presence

1 2 1 2

of the rule cat : np ! cat : np in the former. This rule can contribute nothing to a deduction

pro cedure, since any item it licenses must already b e deducible. Therefore, any item deducible with

G [ G is also deducible with G [ G and hence ObG [ G =ObG [ G .

1 2 1 2

A simple solution to the problem would have b een to consider, instead of T , the following op erator

G

as the denotation of G:

[[G]] = I :T I  [ I

G

id

In other words, the semantics is T + Id, where Id is the identity op erator. Evidently, for G and G of

G 1 2

the ab ove pro of, [[G ]] =[[G ]] , so they no longer constitute a counter example. Also, it is easy to see

1 2

id id

that the pro of of theorem 8 requires only a slight mo di cation for it to hold in this case, so T + Id is

G

commutative and hence comp ositional.

Unfortunately, this do es not solve the problem. Let t ;t ;t be pairwise inconsistent typ es i.e.,

1 2 3

t t t = t t t = t t t = >. Let G b e the grammar

1 2 2 3 1 3 1

s

= ?; L = ;; R = ft  ! t ; t  ! t ; t  ! t g A

1 1 1 2 2 3 3 1

1

and G b e the grammar

2

s

A = ?; L = ;; R = ft  ! t ; t  ! t ; t  ! t g

1 2 1 3 2 1 3 2

1

To see that [[G ]] 6=[[G ]] , observe that

1 2

i d id

T f[w; i; t ;j]g=f[w; i; t ;j]; [w; i; t ;j]g

G 1 1 3

1

but

T f[w; i; t ;j]g=f[w; i; t ;j]; [w; i; t ;j]g

G 1 1 2

2

To see that ObG [ G =ObG [ G  for every G, consider how a derivation in, say, G [ G can make use

1 2 1

of, say, the rule t  ! t . For this rule to b e applicable, t must b e deducible; hence, by application

1 2 2

of the rules t  ! t  and t  ! t , t  is deducible in G [ G . Every rule application in either G

3 2 1 3 1 2 1

or G can b e mo deled bytwo rule applications in the other grammar, and hence every TFS deducible in

2

G [ G is deducible in G [ G and vice versa.

1 2

5 A comp ositional, fully abstract semantics

We have shown so far that `[[]] ' is not comp ositional, and that `[[]] ' is comp ositional but not fully

i d

fp

abstract. The \right" semantics, therefore, lies somewhere in between: since the choice of semantics

induces a natural equivalence on grammars, we seek an equivalence that is cruder than `[[]] ' but ner

id

than `[[]] '. In this section we adapt results from Lassez and Maher 1984 and Maher 1988 to the

fp

domain of uni cation-based linguistic formalisms.

Consider the following semantics for logic programs: rather than taking the op erator asso ciated with

the entire program, lo ok only at the rules excluding the facts, and take the meaning of a program to

b e the function that is obtained by an in nite applications of the op erator asso ciated with the rules. In

our framework, this would amount to asso ciating the following op erator with a grammar:

De nition 10. Let R : I ! I be a transformation on sets of items, where for every I Items,

G

[w ; i; A; j ] 2 R I  i there exist y ;:::;y 2 I such that y =[w ;i ;A ;j ] for 1  l  k and i = j

G 1 k l l l l l l+1 l

for 1  l

1 k 1 k 1 k

! 1 n

The functional denotation of agrammar G is [[G]] =R + Id = R + Id . Notice that

G G

n=0

fn

!

R is not R " ! : the former is a function from sets of items to set of items; the latter is a set of items.

G

G 10

Observe that R is de ned similarly to T de nition 5, ignoring the items added by T  due

G G G

to -rules and lexical items. If we de ne the set of items I nit to be those items that are added by

G

T indep endently of the argument it op erates on, then for every grammar G and every set of items I ,

G

T I  = R I  [ I nit . Relating the functional semantics to the xp oint one, we follow Lassez and

G G G

Maher 1984 in proving that the xp oint of the grammar transformation op erator can b e computed by

applying the functional semantics to the set I nit .

G

s

De nition 11. For every grammar G = hR ; L;A i, let

I nit = f[; i; A; i] j B is an -rule in G and B v A g[f[a; i; A; i +1] j B 2La for B v Ag

G

!

Theorem 10. For every grammar G, R + Id I nit =lfp T .

G G G

n1

k

Proof. We show that for every n,T + Id " n = R + Id I nit by induction on n.

G G G

k =0

For n = 1, T + Id " 1 = T + IdT + Id " 0 = T + Id;. Clearly, the only items

G G G G

added by T are due to the second and third clauses of de nition 5, which are exactly I nit . Also,

G G

0 k 0

 R + Id I nit =R + Id I nit =I nit .

G G G G G

k =0

n2

k

Assume that the prop osition holds for n 1, that is, T + Id " n 1= R + Id I nit .

G G G

k =0

Then

T + Id " n = T + IdT + Id " n 1 de nition of "

G G G

n2

k

= T + Id R + Id I nit  by the induction hyp othesis

G G G

k =0

n2

k

= R + Id R + Id I nit  [ I nit since T I =R I  [ I nit

G G G G G G G

k =0

n2

k

= R + Id R + Id I nit 

G G G

k =0

n1

k

=  R + Id I nit 

G G

k =0

!

Hence R + Id I nit =T + Id " ! = lfp T .

G G G G

The choice of `[[]] ' as the semantics calls for a di erent notion of observables. The denotation of a

f n

grammar is now a function which re ects an in nite numb er of applications of the grammar's rules, but

completely ignores the -rules and the lexical entries. If we to ok the observables of a grammar G to b e

LGwe could in general have[[G ]] =[[G ]] but ObG  6= ObG  due to di erent lexicons, that is,

1 2 1 2

f n f n

the semantics would not preserve observables. However, when the lexical entries in a grammar including

the -rules, which can b e viewed as empty categories, or the lexical entries of traces are taken as input,a

natural notion of observables preservation is obtained. To guarantee that the semantics is Ob-preserving,

we de ne the observables of a grammar G with respect to a given input.

s

De nition 12 Observables. The observables of a grammar G = hR; L;A i with respect to an input

set of items I are Ob G=fhw; Aij[w; 0;A;jw j] 2 [[G]] I g.

I

fn

Corollary 11. The semantics `[[]] ' is Ob -preserving: if G G then for every I , Ob G  =

I 1 2 I 1

f n fn

Ob G .

I 2

The ab ove de nition corresp onds to the previous one in a natural way: when the input is taken to b e

I nit , the observables of a grammar are its language.

G

Theorem 12. For every grammar G, LG=Ob G.

I nit

G

Proof.

LG = fhw; Aij[w; 0;A;jw j] 2 [[G]] g de nition of LG

op

= fhw; Aij` [w; 0;A;jw j]g de nition 4

G

= fhw; Aij[w; 0;A;jw j] 2 lfp T g by theorem 5

G

= fhw; Aij[w; 0;A;jw j] 2 [[G]] I nit g by theorem 10

G

fn

= Ob G by de nition 12

I nit

G 11

To show that `[[]] ' is comp ositional wemust de ne an op erator for combining denotations. Unfor-

f n

tunately, the simplest op erator, `+', would not do. To see that, consider the following grammars, where

the typ es s, vp and v are pairwise incompatible:

s

G : A = ?; L = ;; R = fcat : s ! cat : vpg

1 1 1

1

s

G : A = ?; L = ;; R = fcat : vp ! cat : v g

2 2 2

2

Observe that, for x =[w; i; cat : v ;j],

[[G ]] fxg=fxg

1

f n

[[G ]] fxg=fx; [w; i; cat : vp;j]g

2

f n

[[G [ G ]] fxg=fx; [w; i; cat : vp;j]; [w; i; cat : s;j]g

1 2

f n

That is, [[G ]] +[[G ]] fxg=[[G ]] fxg [ [[G ]] fxg 6=[[G [ G ]] fxg.

1 2 1 2 1 2

f n f n fn fn fn

!

However, a di erent op erator do es the job. De ne [[G ]]  [[G ]] to b e [[G ]] +[[G ]]  . Then

1 2 1 2

f n f n fn fn

`[[]] ' is commutative with resp ect to `' and `['. This pro of is slightly more involved.

f n

Lemma 13. For every grammar G,[[G]] is increasing: [[G]] I  I for al l I .

fn fn

!

Proof. Since R + IdI  I , also R + Id I  I .

G G

De nition 13. If f; g are two functions over the same domain and range, let f  g i for al l I ,

f I  g I . Let f  g denote function composition.

Lemma 14. For every two grammars G ;G , [[G ]] + [[G ]]   [[G ]]  [[G ]] .

1 2 1 2 1 2

f n f n fn fn

Proof. [[G ]]  [[G ]] I =[[G ]] [[G ]] I . [[G ]] I  I , hence [[G ]] [[G ]] I  [[G ]] I .

1 2 1 2 1 1 2 2

f n fn f n fn fn f n fn f n

From lemma 13 and monotonicity, also [[G ]] [[G ]] I  [[G ]] I . Hence [[G ]]  [[G ]] I 

1 2 1 1 2

f n fn fn fn f n

[[G ]] [ [[G ]] I  and [[G ]] +[[G ]]   [[G ]]  [[G ]] .

1 2 1 2 1 2

f n fn fn fn f n f n

Lemma 15. For every grammar G,[[G]] is idempotent: [[G]]  [[G]] = [[G]] .

fn f n f n f n

! !

Proof. Lassez and Maher, 1984 For every I , [[G]]  [[G]] I  = R + Id  R + Id I  =

G G

fn fn

i+j 1 j 1 i 1 ! ! 1

R + Id I  =  R + Id I  =  R + Id  R + Id R + Id I  = 

G G G G G

j =0 i=0 j =0 i=0

1 m !

 R + Id I =R + Id I =[[G]] .

G G

m=0

fn

Theorem 16. [[G [ G ]] = [[G ]]  [[G ]] .

1 2 1 2

fn fn fn

Proof. Lassez and Maher, 1984

!

[[G [ G ]] = R + Id + R + Id

1 2 G G

1 2

f n

! ! ! !

 R + Id +R + Id  since R + Id  R + Id for every G

G G G G

1 2

! ! !

 R + Id  R + Id  by lemma 14

G G

1 2

! ! !

 R + Id  R + Id  since G [ G G and G [ G G

G [G G [G 1 2 1 1 2 2

1 2 1 2

!

= [[G [ G ]]  [[G [ G ]]  de nition of [[]]

1 2 1 2

fn f n fn

!

= [[G [ G ]]  by lemma 15

1 2

fn

! ! !

= [[G [ G ]] since f  = f

1 2

f n

! ! !

+ Id  = + Id +R Thus all the inequations are equations, and in particular [[G [ G ]] =R

G 1 2 G

2 1

fn

! !

!

[[G ]] +[[G ]]  =[[G ]]  [[G ]] .

1 2 1 2

f n f n fn fn 12

Since `[[]] ' is commutative, it is also comp ositional. For logic programs, Maher 1988 shows that

fn

this choice of semantics is also fully abstract, but this pro of is not carried out in the algebraic domain.

Rather, Maher 1988 shows that two programs are fn-equivalent i they have the same Herbrand mo del,

and then uses logical equivalence to derive full abstraction. A similar technique, using the logical domain,

is employed by Bugliesi, Lamma, and Mello 1994 to prove the same result. We pride a more direct,

constructive pro of b elow.

Theorem 17. The semantics `[[]] ' is ful ly abstract: for every two grammars G and G , if for every

1 2

fn

grammar G and set of items I , Ob G [ G=Ob G [ G, then G G .

I 1 I 2 1 2

f n

Proof. Assume that [[G ]] 6= [[G ]] . Without loss of generality, assume that there exist an item

1 2

fn f n

x =[w ; i; A; j ] and a set I such that x 2 [[G ]] I  but x 62 [[G ]] I . x is added to [[G ]] I  through

1 2 1

fn fn fn

successive applications of the rules in R to items in I . Let fy ;:::;y g I b e the input items that

1 1 k

0

partake in this sequence. For every 1  i  k , let A b e the TFSs included in y ; let y =[a; i 1;A ;i],

i i i

i

for some a 2 Words.

Recall from the de nition of R that applicability of a rule to a set of items dep ends b oth on the TFSs

G

and on the indices of the items; however, when a rule is applicable to some sequence of items, the same

rule is also applicable to di erent items, with identical TFSs, as long as their indices are consecutive. In

other words, the requirement that the indices of an item sequence b e consecutive is indep endent of the

requirement that the TFSs in the sequence b e uni able with the rule.

0 0 0 k 0

Now consider the set J = fy ;:::;y g and the item x =[a ; 0;A;k]. We claim that x 2 [[G ]] J 

1

1

k

f n

0 0

but x 62 [[G ]] J . x 2 [[G ]] J  for the same reason that x 2 [[G ]] I  { exactly the same rules can

2 1 1

f n fn fn

0 0

b e applied in order to generate x . Now assume x 2 [[G ]] J ; by the same rationale, the same rules

2

f n

0

that are applied in order to generate x , starting from J , could have b een applied in order to generate x

starting from I , contradicting the assumption that x 62 [[G ]] I . Thus we p osit a set of items, J , such

2

fn

0 0 k k

that x 2 [[G ]] J  but x 62 [[G ]] J . Hence ha ;Ai2Ob G  but ha ;Ai62 Ob G .

1 2 J 1 J 2

fn f n

6 Conclusions

This pap er discusses alternative de nitions for the semantics of uni cation-based linguistic formalisms,

culminating in one that is b oth comp ositional and fully-abstract with resp ect to grammar union, a simple

syntactic combination op erations on grammars. This is mostly an adaptation of well-known results from

logic programming to the framework of uni cation-based linguistic formalisms, and it is encouraging to

see that the same choice of semantics which is comp ositional and fully-abstract for Prolog turned out to

have the same desirable prop erties in our domain.

The functional semantics `[[]] ' de ned here assigns to a grammar a function which re ects the

f n

p ossibly in nite successive application of grammar rules, viewing the lexicon as input to the parsing

pro cess. We b elieve that this is a key to mo dularity in grammar design. A grammar mo dule has to

de ne a set of items that it \exp orts", and a set of items that can b e \imp orted", in a similar way to the

declaration of interfaces in programming languages. We are currently working out the details of sucha

de nition. An immediate application will facilitate the implementation of grammar development systems

that supp ort mo dularity in a clear, mathematically sound way.

The results rep orted here can be extended in various directions. First, we are only concerned in

this work with one comp osition op erator, grammar union. But alternative op erators are p ossible, to o.

In particular, it would b e interesting to de ne an op erator which combines the information enco ded in

two grammar rules, for example by unifying the rules. Such an op erator would facilitate a separate

development of grammars along a di erent axis: one mo dule can de ne the syntactic comp onent of a

grammar while another mo dule would account for the semantics. The comp osition op erator will unify 13

each rule of one mo dule with an asso ciated rule in the other. It remains to b e seen whether the grammar

semantics we de ne here is comp ositional and fully abstract with resp ect to such an op erator.

A di erent extension of these results should provide for a distribution of the typ e hierarchy among

several grammar mo dules. While we assume in this work that all grammars are de ned over a given

signature, it is more realistic to assume separate, interacting signatures. We hop e to b e able to explore

these directions in the future.

This pap er is an extended version of Wintner 1999. I am grateful to Nissim Francez for commenting

on an earlier version. This work was supp orted byanIRCS Fellowship and NSF grant SBR 8920230.

References

Apt, Krzysztof R. and M. H. Van Emden. 1982. Contributions to the theory of logic programming.

Journal of the Association for Computing Machinery, 293:841{862, July.

Brogi, Antonio, Evelina Lamma, and Paola Mello. 1992. Comp ositional mo del-theoretic semantics for

logic programs. New Generation Computing, 11:1{21.

Brogi, Antonio, Evelina Lamma, and Paola Mello. 1993. Comp osing op en logic programs. Journal of

Logic and Computation, 34:417{439.

Brogi, Antonio, Paolo Mancarella, Dino Pedreschi, and Franco Turini. 1990. Comp osition op erators for

logic theories. In J. W. Lloyd, editor, Computational Logic { Symposium Proceedings, pages 117{134.

Springer, Novemb er.

Bugliesi, Michele, Evelina Lamma, and Paola Mello. 1994. Mo dularity in logic programming. Journal of

Logic Programming, 19,20:443{502.

Carp enter, Bob. 1991. Typ ed feature structures: A generalization of rst-order terms. In Vijai Saraswat

and Ueda Kazunori, editors, Logic Programming { Proceedings of the 1991 International Symposium,

pages 187{201, Cambridge, MA. MIT Press.

Carp enter, Bob. 1992. The Logic of TypedFeature Structures. Cambridge Tracts in Theoretical Computer

Science. Cambridge University Press.

Erbach, Gregor and Hans Uszkoreit. 1990. Grammar engineering: Problems and prosp ects. CLAUS

rep ort 1, University of the Saarland and German research center for Arti cial Intelligence, July.

Gaifman, Haim and Ehud Shapiro. 1989. Fully abstract comp ositional semantics for logic programming.

In 16th Annual ACM Symposium on Principles of Logic Programming, pages 134{142, Austin, Texas,

January.

Lassez, J.-L. and M. J. Maher. 1984. Closures and fairness in the semantics of programming logic.

Theoretical computer science, 29:167{184.

Maher, M. J. 1988. Equivalences of logic programs. In Jack Minker, editor, Foundations of Deductive

Databases and Logic Programming. Morgan Kaufmann Publishers, Los Altos, CA, chapter 16, pages

627{658.

Mancarella, Paolo and Dino Pedreschi. 1988. An algebra of logic programs. In Rob ert A. Kowalski and

Kenneth A. Bowen, editors, Logic Programming: Proceedings of the Fifth international conference

and symposium, pages 1006{1023, Cambridge, Mass. MIT Press.

Miller, D. 1986. A theory of mo dules in logic programming. In Proceedings of the symposium on logic

programming, pages 106{114. 14

Miller, D. 1989. A logical analysis of mo dules in logic programming. Journal of Logic Programming,

6:79{108.

O'keefe, R. 1985. Towards an algebra for constructing logic programs. In J. Cohen and J Conery, editors,

Proceedings of IEEE symposium on logic programming, pages 152{160, . IEEE Computer

So ciety Press.

Pereira, Fernando C. N. and Stuart M. Shieb er. 1984. The semantics of grammar formalisms seen as

computer languages. In Proceedings of the 10th international conferenceoncomputational linguistics

and the 22nd annual meeting of the association for computational linguistics, pages 123{129, Stanford,

CA, July.

Shieb er, Stuart, Yves Schab es, and Fernando Pereira. 1995. Principles and implementation of deductive

parsing. Journal of Logic Programming, 241-2:3{36, July/August.

Shieb er, Stuart M. 1992. Constraint-BasedGrammar Formalisms. MIT Press, Cambridge, Mass.

Sikkel, Klaas. 1997. Parsing Schemata. Texts in Theoretical Computer Science { An EATCS Series.

Springer Verlag, Berlin.

Van Emden, M. H. and Rob ert A. Kowalski. 1976. The semantics of predicate logic as a programming

language. Journal of the Association for Computing Machinery, 234:733{742, Octob er.

Wintner, Shuly. 1999. Comp ositional semantics for linguistic formalisms. In Proceedings of ACL'99, the

37th Annual Meeting of the Association for Computational Linguistics, June.

Wintner, Shuly and Nissim Francez. 1999. O -line parsability and the well-foundedness of subsumption.

Journal of Logic, Language and Information, 81:1{16, January. 15