You are on page 1of 37

American Journal of Computational Linguistics

Microfiche 7

H. William B u t t e l m a n n Ohio S t a t e university

C o g y r i g h t 1974

by t h e A s s o c i a t i o n for C o m p u t a t i o n a l L i n g u i s t i c s

ABSTRACT

A formal d e f i n i t i o n f o r t h e

semantics of a c o n t e x t free language,

c a l l e d a phrase-structure semantics., i s given.

The d e f i n i t i o n i s a model

of t h e n o t i o n t h a t i t i s phrases which have meaning and t h a t t h e meaning

of a phrase is a f u n c t i o n of i t s s y n t a c t i c s t r u c t u r e and of the meanings


of i t s c o n s t i t u e n t s . f r e e languages. Next w e give a d e f i n i t i m f o r t r a n s l a t i o n on context
W then study a c e r t a i n kind of t r a n s l a t i o n on cf 1 s e '.

which proceeds by t r a n s l a t i n g on t h e phrase t r e e s of t h e languages, and i s

s p e c i f i e d by a f i n i t e set of tree-replacement r u l e s .

W p r e s e n t a proe

cedure which, given a cfg and p h r a s e - s t r u c t u r e semantics f o r a source


language and a cfg and phrase-structure semantics f o r a t a r g e t language,
w i l l ( u s u a l l y ) produce t h e f i n i t e set of ttee-replacement rules for tne

t r a n s l a t i o n , i f the t r a n s l a t i o n e x i s t s .

The procedure may be viewed as a

computer program which i s a t r a n s l a t o r generator, and which produces

another program t h a t i s a t r a n s l a t o r .

TABLE OF CONTENTS

Abstract

............................ T a b l e o f Contents . . . . . . . . . . . . . . . . . . . . . . . .
1 Phrase Structure Syntax and Semantics

............ D e f i n i t i o n 1 (phrase-structure semantics) . . . . . . . . . Example 1 (cfg and phrase-s t r u c t u r e semantics) . . . . . . .


D e f i n i t i o n of semantic f u n c t i o n s 4: T(G)
-+

6
7

D e f i n k t i o n o f meaning function;:

L(G) + 2

CP U

. a . a . . . .8

........

2 T r a n s l a t i o n s as Tree Mappings
DefinitionofgenCT)

Dgfinition of general translation r: L(G1)

.... ....................
+

. . . . . . . . . . . . . . . . 12
2L(G.2)

12

13

Example2 (gen(T))

.....................
-t

D e f i n i t i o n of translatioh r: T G ) (

2T (G2)

Definition of t r a n s l a t i o n

7: L(G1)

2LCG2)

Example 3 ( f i n i t e l y s p e c i f i e d translation)

........ .........
. . . a . a . .

........

13 14

15
16

3 A Procedure f o r Finding Translations (Usually)


PROCEDURE

Proof t h a t translatiotl

......................... the function defined by PROCEDURE is a . . .

17
19

22
25

Figure 1
4

Translator Generator and Translator

. . . .
. a . m . .

. Sample Translations . . . . . a . a . . . . . . . . . . . . 27 .
TRANSLATION I (Postfix t o Precedence I n f i x ) TRANSLATION XI (Cxpliclt * t o I m p l i c i t *)
.

. . . . . . . . 27
. .

T R A N S L A T I O N I I I ( 2 . + t o 1 . +)
TRANSLATIONIV(1. + t 0 2 . + )

................ . .

31

32
33

5 Conclusion and Further Research


Selected Btbliography
a m a . . . a .

.............
. . a m . o * * . * . ~ .

33
36

t SEMANTIC DIRECTED TRANSLATION OF CONTEXT FREE LANGUAGES

H. William Buttelmam Department of Computer and Information Science Ohio S t a t e U n i v e r s i t y Columbus, Ohio 43210

0 .

Introduction. This paper p r e s e n t s a formal model of t h e t r a n s l a t i o n of context

f r e e languages.

The model i s a d m i t t e d l y inadequate t o provide f o r a l l

the i n t r i c a c i e s and complexities of t h e problem o f language t r a n s l a t i o n .


N e v e r t h e l e s s , I hope t h a t p r a c t i c i n g apfllied and computational. l i n g u i s t s

w i l l find i t i n t u i t i v e l y s a t i s f y i n g i n i t s s i m p l i c i t y .

A t t h e same time,

t h e model should g i v e u s a b a s i s f o r proving some t h e o r e t i c a l results

about t h e n a t u r e o f language t r a n s l a t i o n .
T r a n s l a t i o n i s n e c e s s a r i l y concerned w i t h b o t h s y n t a x and semantics,

so we begin with a formal d e f i n i t i o n of semantics f o r context f r e e grammars.


I n S e c t i o n 2 , a simple a l g o r i t h m f o r t r a n s l a t i n g from one c o n t e x t free language t o another i s given. The algorithm i s " c o n t r o l l e d " by a f i n i t e

set of r u l e s which s p e c i f y how t o r e p l a c e p h r a s e s i n t h e source language w i t h s e m a n t i c a l l y e q u i v a l e n t p h r a s e s i n t h e t a r g e t language. l a t i o n algorithm, i t t u r n s o u t , i s s t t a i g h t f o r w a r d . The transThe key p r o b l e ~ in is

"finding" t h e f i n i t e s e t of r u l e s which c a r r e c t l y s p e c i f y the t r a n s ' l a t i o n The main p a r t of t h i s paper, S e c t i o n 3, i s concerned w i t h t h a t problem.


& Throughout t

paper, w e assume t h a t grammars and semantics a r e given.

There i s nothing i n this paper t h a t t e l l s you. how t o go about w r i t i n g t h e


" r i g h t " grammar and semantics f o r a given cf 1.

A e a r l i e r v e r s i o n of t h i s paper was p r e s e n t e d t o t h e Eleventh Annual n Meeting of t h e Association f o r Computational L i n g u i s t i c s a t Ann Arbor, Michigan, August, 1973.
This r e s e a r c h was supported i n p a r t by NSF g r a n t GN-534.1.

M c of the presentation is formal. uh

Some readers may find i t helpful

t o read only through Example 1, and then t o peruse Section 4 (Sample Translations) t o pick up some i n t u i t i o n , before proceeding with t h e rest of the paper.

1. Phrase S t r u c t u r e Syntax and Semantics.


I assume t h e reader i s f a m i l i a r w i t h the notions of "derivation" and
I1

syntax tree1' ( a l i a s "derivation tree", a l i a s "phrase marker") f o r cf g ' s

Several good texts on t h e s e s u b j e c t s a r e l i s t e d i n the bibliography.

The d e f i n i t i o n of semantics which I am about t o give i s based oa


the following two simple notions: and 1) i t i s phrases which have m e w g (paragraphs, sentences, clauses, and morphs a r e s p e c i a l cases of' phrases) ,

2) the meaning of a phrase i s a function of i t s s y n t a c t i c s t r u c t u r e


Keeping i n mind t h a t a function

and of t h e meanings of i t s c o n s t i t u m t s .

is nothing but aq assignment of elements i n i t s csdemain t o elements i n its domain, t h i s d e f i n i t i o n w i l l provide for idiomatic and emotive meaning,

as well as denotative or referential meaning, provided such meanings are


s p e c i f i e d i n t h e universe of di,scourse.
I wish t o add before giving the

d e f i n s t i o n t h a t , although I have never seen i t i n t h i s form before, I d o not b e l i e v e t h i s d e f i n i t i o n of semantics i s o r i g i n a l w i t h me.

I believe

i t incorporates the notions of semantics i n Benson (1970), Knuth (1968,

1971), some statements attributed t o Thompson (cf Benson, 1970), and i n *


Tarski (1936). Nw t h e d e f i n i t i o n : o

D e f i n i t i o n 1.

Let. G = (V,

z,

P , S ) b e a c o n t e x t f r e e grammar where:

V i s t h e f i n i t e nonempty vocabulary,

C - V is the terminal alphabet, c


S (V

-t

C) i s t h e axiom, and

P is the finite nonempty set of grammar r u l e s , having the form


A

B,

f o r A (V

C) and B 6 V

+.

A phrase-structure semantics f o r G is a 7btuple

M, u, X, A , F, R), where: U i s a s e t , t h e u n i v e r s e of d i s c o u r s e ,

(u,

M - 2" i s a f i n i t e s e t of atomic morphemes, c M p : V + 2 i s t h e vocabulary meaning function,


TT

X = , 1, ,, xl, X29 , XRI ) f o r some i n t e g e r n , A is a f i n i t e s e t of n b e s of p a r t i a l r e c u r s i v e f u n c t i o n s , F i s a f i n i t e s e t of d e f i n i t i o n s f o r t h e p a r t i a l r e c u r s i v e f u n c t i o n s named i n A ,

...

R is

a finite set of semantic r u l e s , with the p r o p e r t y that

t o e a c h grammar r u l e A

-t

...Bn t h e r e i s a s s i g n e d one
A
+ B1.

s e m a n t i c r u l e , having t h e form r where p (M

UX

U A)

+, and

..Bn

(xl,*..,X ~l

= P,

rA + B1.

.B ( x ~ , ~n~ ~ , x 1=P n

s p e c i f i e s a p a r t i a l recursive function:

W a l s o r e q u i r e that X fI (M e

A) =

0.

There i s an example on t h e next page.

Example 1 .

Coxfsider a c f g and phrase-structure semantics f o r well-formed addition


expressions over t h e alphabet Z = {I, +).

L(G) = {I, I+I, I+I+I,

... I .

G = (V, Z, P, S), and

= (U,

M,

X, 4, F, R ) , where:

semantics

v
c

= {S, =

I, +)

U = N U {f } U { I } , where:
N

{I, +)

i s t h e s e t of non-aegatiue i n t e g e r s ,
3-

and f
M =

and

a r e r e c u r s i v e functions

defined i n F below,

+ t {N, 1, f 1

F contains just t h e following d e f i n i t i o n s :


1

( i d e n t i t y function on N + N):

(x) = x
x

(integer a d d i t i o n on N
1)

N) :
(' i s the successor

f+(x ,Y) =
=

(f+(X,Y))

f. n)

Note t h a t rS4+S (x1,x2,x3)

x 2 (X 1 ,X3) does indeed s p e c i f y a r e c u r s i v e function on v ( S ) xu(+) xv(S) -+ v ( S ) , s i n c e i f x, and x are i n p(S) = N and if , . + 1, then x2(x1,x3) = f+(X xI. ) i s i n N and f + i s defined is i n v(+) = {f X2 1 3 '
J

primitive recursive,
Before explaining t h e example, let's f i r s t consider what t h e semantics
i s used f o r .

We will need t h e following n o t a t i o n for t r e e s :

0) a i s a tree, f o r all a f C.

1) a c t 1

...tn > is a

tree, f o r all a

Z and trees tl,

..., tn .
--

t For r e a d a b i l i t y , we w r i t e t h e members of M without unnecessary braces


i . e . , "1" i n s t e a d of "{l)".

The above i n d u c t i v e d e f i n i t i o n gives a "standard" parenthebized n o t a t i o n

for trees.
fr(t).

Let us denote t h e r o o t of a tree t , r t ( t ) and t h e frontier,

W s h a l l a l s o need t h e f o l l o w i n g non-standard n o t a t i o n : e
t

0 1

It

...tn ]

i s a tree i f t

0 '

..., tn are trees and i f

Informally, t o [ tl.
+. I

..tn ]

i s the tree formed by "graf t i a g l ' each ti a t t h e


For example, t h e tree

i " '

node of t h e f r o n t i e r o f to, which can be done s i n c e t h i s node has the

same label as the root of ti.

-A
In

is denoted a<b<de>c>, and i t h a s a l l t h e f o l l o w i n g non-standard r e p r e s e n t a -

tions:

a<bc>[b<de>c], a<b<de> [dec] , and a [ a < b c > ][ b < d e > c L A s t h e r e a d e r c>

can see, t h e "box n o t a t i o n " i s u s e f u l f o r i s o l a t i n g any rooted s u b t r e e . t h e grammar of Example 1, with its dominating s u h t r e e S<S+S> isolated.

o p a r t i c u l a r , n o t e t h a t S<S+S> [s<I>+s<I>] i s t h e syntax tree S<S<I>+S<I>> f


The semantic rules R are used t o define a

Now back t o t h e semantics.


a semantic f u n c t i o n 4(t).

f u n c t i o n 4 on t h e trees of t h e grammar which a s s i g n s t o each syntax tree t Then 4 and t h e meaning f u n c t i o n p a r e used t o F i r s t , we define d e f i n e a meaning f u n c t i o n p on t h e s e n t e n c e s o f G.

4,

then

u.
To d e f i n e $, w e must first d e f i n e the codomain of @, @.

i s t h e set of a l l n-ary f u n c t i o n s on 2

X * * * X Z ~+

u, for

Informally,

arbitrary n.

Formally, l e t +n = {f:2 x * a * ~ 2 ~ 2 + Then @ =

U n=1,2,

... @n .

f i s a function of n arguments).
t

The f u n c t i o n @:T(G)

+ @ a s s i g n s t o each t i n

T(G)

a semantic f u ~ c t i o n

$ ( t ) on IJ(B~)x*.~x~(B) + p ( r t ( t ) ) , where B1...B n semantic f u n c t i o n w e w i l l use t h e n o t a t h n f(x t h e name of t h e f u n c t i o n , (xl,. domain, and C is t h e codomain. definition:

= fr(t).

To s p e c i f y a
+

..,x n)

1'

**8,\)

:D

C, where

f is

i s t h e v e c t o r o f arguments, D i s t h e

$ i s d e f i n e d by t h e following i n d u c t i v e

T(G)

is t h e s e t o f syntax t r e e s ( p a r t i a l and complete) of G.

= r

A+B1.. .B n
tO[t t

(xl,

...,xn ) : p ( ~1)x***xp(B a)
A
. +

+ p(A),

where

B1...B

n i s a grammar r u l e .

1) Let t

= f r ( t ) f o r j = 1, n , where i = 0. and l e t Bi j 0 j j -1 Then @(t0Itl...t n ])(x1, x ) : . ~ I ( B ~ ) x " * x ~)( B ~ ( r t ( t O ) ) v i n n

n +l...Bi

TG, ()

...,

...,

I n t u i t i v & l y , t h e semantic f u n c t i o n assigned t o each t r e e t i s t h e composit i o n of t h e semantic f u n c t i o n s assigned t o t h e s u b t r e e s of which t i s composed. function
W leave i t t o t h e r e a d e r t o v e r i f y t h a t $ i s well-defined. e

The meaning function p on sentences i s a s p e c i a l c a s e of t h e meaning

on a l a r g e r domain

--

t h e s e t of phrase forms of t h e grammar.

A phrase form i s s i m i l a r t o a s e n t e n t i a l form, except t h a t i t need n o t be derived from t h e axiom. Formally, t h e set o f phrase. forms of G i s t h e set
C V

P(G) = I w

Iv

* and A a w *

f o r some A 6

v).
The
1
..OW

The f u n c t i o n $ i s used t o d e f i n e t h e meaning function as follows.


f u n c t i o n p:P(G)

+ 2 u i s defined by t h e following rule:

a phrase form i n P (G) and l e t w have syntax trees tl,

..., tm .

Let w = w

n Then the

be

set of tueanings of w i s t h e set

L(G)

, the

language of G, i s a s u b s e t of P(G)
+ 2

sentences, p:L(G)

u, is

, so

t h e meaning f u n c t i o n on.

j u s t the r e s t r i c t i o n of p t o L(G)

Since t h e t h r e e functions

v,

y, and II have d i s j o i n t domains, they can

never be confused, s o w e s h a l l w r i t e

f o r all t h r e e .

) . I

i s the meaning

function, which assigns t o each sentence, phrase form, and symbol, one o r more meanings according t o the semantics

d.

Thus, we are assigning

meaning t o a sentence by assigning t o i t t h e meanbgs which a r e computed by


the semantic functions specified by i t s phrase s t r u c t u r e s , taking a s a r g u ~ ments t h e meanings of t h e c o n s t i t u e n t s of t h e sentence.
T h e most elementary
One

c o n s t i t u e n t s of a sentence a r e the members of C which c o n s t i t u t e i t .

.may think of these as the l e x i c a l items of the language.


of t h e language

Their meanings,
the morphemes

wMch a r e t h e arguments of t h e semantic function, a r e among

-- those morphemes which

cannot be furthe-r separated i n t o

morphemes ( t h i s i s the s e t of "atomic morphemes", M) of a sentence i s a function of i t s morphemes. determined by i t s s y n t a c t i c s t r u c t u r e . s t i t u e n t s is semantically ambiguous.

Thus, the meaning

l h i c h function t o use tq

A s e n t e n c e can be semantically am-

biguous i f i t has more than one syntax t r e e o r if a t l e a s t one of i t s con-

W retyrn t o Example 1 on t h e next page. e

Now consider Example 1. L e t w b e the sentence "L the syntax tree

+ I' + I".

It has

One meaning oE w i s 4 (t) ( ( ) P (+I, P (I), IJ (+.I, P (). P I, I)


picture.

F o r notational

purposes, l e t tl, tq, 3, and t 4 be t h e s u b t r e e s of t c i r c l e d i n the

Now compute this member o f P (w) :

Note that "I

+ I + I" a l s o

has t h e syntax tree

b u t t h e sentenge i s n o t s e m a n t i c a l l y ambiguous since

2.

Translation9 A s Tree Mappings. Consider now any two c f g ' s and t h e i r a s s o c i a t e d semantics,

9, l d

and G2,
T:

J2.
+ 2

A t r a n s l a t i o n of L(G1)

tjo L(G ) is a function

L(G,)

L (G*)

defined a s f o l l e w :

The codomain of a t r a n s l a t f o n must be t h e power set of t h e t a r g e t language,


s i n c e every sentence i n L(G ) may have many semantically equivalent sen-

tences i n L(G2).

I n t h i s paper wel focus on b a n s l a t i o n s which a r e speciFor these t r a n s l a t i o n s , t h e r e i s a simple

fied by a f i n i t e set of r u l e s .

algorithm f o r computing t h e trans lati011 of any sentence. algorithm f o r computing t h e t r a n s l a t i o n .

This s e c t i o n

p r e s e n t s th2 bethod f o r giving the f i n i t e s p e c i f i c a t i o n of T and the I n f a c t , i n s t e a d of s p e c i f y i n g a t r a n s l a t i o n on t h e languages, we s p e c i f y a t r a n s l a t i o n on t h e t r e e s of t h e syntaxes. To make p r e c i s e what i s meant by " t r a n s l q t i o n s which a r e s p e c i f i e d by

a f i n i t e set of r u l e s " we S n t r o d u c e t h e concept of a generating set f o r


trees.

Let T

and T2 be two sets bf trees with l a b e l s from some alphabet

0 t o b e t h e s e t of all t r e e s w i t h single nodes and C Informally, T i s a generating. set l a b e l s from g, i . e . , = { a I a E E}. 1


C.

Define the set T

0 f o r T j u s t i n case every tree i n T7 i s e i t h e r i n T o r i s constructed of a 2 C and j u s t i n case every t r e e s o constructed is f i n i t e number of trees of T 1' in T t . Formally, l e t T be a s e t of trees w i t h l a b p l s from Z. The set

gen(T) of trees generated by


0)

T is defined inductively

%asfol'lows:

0 TI:- gen(7) C

and T c gen(T),

1) tO[tl.. tn ] E gen(T) if i t i s defined, for a l l p o s i t i v e integer$. n ,


and for all trees to,
T i s a generating s e t for gen(T).
n

..., tn

gen(T).

We leave i t to the reader t o verify that

every tree i n gen(T) can be written in the f orin to[ tl.


t

0 (T U T;) and each

t i

gen(T), f o r i = 1,

....

..tn] , where

s. t

Example 2 .

The s e t of production.trees of a cfg i s a generating set f o r the set of all the syntax trees of the grammar. L e t G = (V, C, P, S ) , l e t P B (i) contain k rules, and l e t P = -{ A (i) , ( i ) ( i ) 1 *2 .. n4 1 i E 1 , 2 , m . a , k l . .B Then the set of production t r e e s of G i s the .set

The set T(G) of a l l syntax t r e e s of G i s the s e t gen(T,).


A s a more concrete example, consider the cfg G given by the following

Tp i s the s e t { S<OS>, S<B2, B<O>, Bcl> 1, or w r i t t e n p i c t o r i a l l y :

T(G) = gen(Tp) contains all trees of the following forms::

s (COS)" (>p

n >- , 0

The tree t = S<OS<OS<B>>>s 11 T(G) = gm(Tp) s i n c e t = S ~ O S ~ [ O S ~ O S ~ B ~ ~ } i 1


and S<OS> Tp; 0 gen(Tp), and ScOS<B>> ges(Tp).
0 f gen(Tp) , and S<B> g e n ( ~ ~ ) . To s p e c i f y a t r a n s l a t i o n from T(G ) t o T ( G ~ ) e proceed as fallows: w 1 L e t r be any p a r t i a l f u n c t i o n on VN V , a n d l e t T b e a g e n e r a t i n g set
-+

Note t h a t t can a l s o

be written as t = s<OS<OS>> [OOS<B>], and again, S<OScOS>> gen

mp),

for T(GI).

Let

;be

N,L

a f u n c t i o n on T

T(Gp)

N0

++

which s a t i s f i e s the

following p r o p e r t i e s : i f ;(t) i) ii) iii) iv)


= (t',

) then n r t { t ' ) = ; ( r t (t)), and

xl...x

n =

1 f r ( t t ) 1,
1

and

0 < x . < I f r ( t ) I , f o r i = 1, -

xi # 0 * f r ( t r ) i = r ( f r ( t )

..., n, and

), f o r i = 1,

..., n.

T(Gg)
Then we d e f i n e the funktion r: T(G1)
+

by t h e following i n d u c t i v e

definition:

0)

t T -r(t)

= t

, where

;(t)

= (' t,

x).

where

i) ;(to) =
ii)

(T ( t o ) , XI-

) 9 and

any member of

Note t h a t t h e codomain of T i s the power set of T(G2) because t h e r e may be


t ] a r e n o t unique. t r e e s i n T(G ) whose n o n - t r i v i a l f a c t o r i n g s into t [ t 1 0 1 m For t h e s e t r e e s , ~ ( t ) = { +(t0 [ t1. . . t m ] ) t O [ t l . . . t 1 is a r e p r e ~ e n t a t i m m of t ). A s with languages, w e w i l l c a l l a t r a n s l a t i o n only i f i t preT(G2) i s a t r a n s P a t i o n i f f f o r every s e r v e s semantics, t h a t i s , T: T(G1) + 2

. ..

t r e e t 6 T ( G ~ ) and f o r every t r e e t ' E T ( G ~ ) ,i f f r ( t ) = wl...w


fr(tt) = w ;

...w', n

and

then

t N i s t h e set of non-negative i n t e g e r s . 0

W will c a l l r f i h i t e l y s p e c i f i e d ( s p e c i f i e d by a f i n i t e set of r u l e s ) i f f e

the g e n e r a t i n g set T is f i n i t e .
F i n a l l y , r is used t o d e f i n e a t r d n s l a t i o n r: L(G1)

L e t w L(Gl)

have s y n t a x trees tl,

.... \.

-+

L(%)

as follows:

Then

r(w) = { w '

3 t ' i n T(G2) and 3 t i n T(G1) such that


t' is a s y n t a x tree of w' and
t

i s a s y n t a x tree of w

and

t t ~ ( t ) I.

It follows from t h e d e f i n i t i o n s t h a t

.w' and l e t w' E T(w). n m sy&tax trees t of w and t ' of w' such t h a t t ' C df). L e t

thtis, l e t w = wl.. .w and w' = wi

..

7 is

a translation i f r is.

To see

Then there exist Then from


a

= @(t)(ul(wl)9".9u

1(wm ) ) and E 2 = ( t f ) ( 2 , . . , 2 ( w ) .
and
) c2 -

t h e d e f i n i t i o n of translation, then translation.

11, c1 - II 1(w) G
fl

E2 # 0,

s o <(w)

fl

- -

= (

I r is

V~(T(W))

0, and s o r i s a

The f u n c t i o n s

;and i

a r e t h e method f o r s p e c i f v i n g t h e f u n c t i o n r.

The s p e c i f icati.cn i s f i n i t e j u s t i n case t h e g e n e r a t i n g set T i s f i n i t e .


The i n d u c t i v e d e f i n i t i o n f o r T gives the a l g o r i t h m f o r computing t h e tpans-

l a t i o n of any tree in T(G ) , and the definition of y, t o g e t h e r w i t h t h i s 1 algorithm and a g e n e r a l c o n t e x t f r e e p a r s e r such as Floyd's o r E a r l y ' s

algorithm, g i v e s the algorithm f o r computing t h e t r a n s l a t i o n of any sentence in L(G ) . The next example illustrates.

(In t h e following and i n a l l subsequent examples, w e s h a l l g i v e ex-

p l i c i t l y o n l y the grammar r u l e s , t h e right-hand s i d e of t h e semantic r u l e s ,


t h e u n i v e r s e s o f d i s c o u r s e , the meaning function, and those d e f i n i t i o n s of

p a r t i a l recursive f u n c t i o n s t h a t are necessary. he wishes.

The r e a d e r can e a s i l y

determine t h e rest of t h e s p e c i f i c a t i o n s f o r t h e grammars and semantics, i f For c f g ' s we s h a l l f o l l o w t h e u s u a l convention t h a t a l l symbols left-hand side o f some grammar r u l e are termiwhich do n o t appear on t h e

nal symbols, and t h a t t h e axiom i s t h e f i r s t symbol appearing in t h e f i r s t

rule. )

Example 3.
W present two c f g ' s and their semantics, and a finitely specified e translation T on T(G ) + 2T(G2) T h e l p the i n t u i t i o n , consider that o
G1, 1 describes well-parenthesized subtract ion expressions, and G2, 1

d2

descrfbes subtraction expressions in Polish p o s t f i x notation.

E-E

x2(x1,x3)

U1 = U2 = N U {f-1, where

i s the set o f integers and


x b + N is

f-: N

ordinary subtracfion

The translation i s s p e c i f i e d by:

?(E) = S

The sentence 1-2-3 i s semantically ambiguous ( i t s meanings are O and -4).

and its two translations are given by:

contains 12-39

E - E
1 O

'

A
I

i e

. ., T 1 2 3 )

contains 1239-

the other hand the sentence 1- (2-3) d s

and is translated:

i . e . , ~(1-(2-3)) contains 123--

3.

A Pr-ocedure f o r Finding Trznslations (Usually).


..

S u p p o s e an oracle presents us with two cfg's G r e s p e c t i v e semantics

translation froq T(G1)

and d2. 1 t o T(G2) e x i s t s .

2 Suppose also that a f i n i t e l y s p e c i f i e d

and G

and t h e i r

Can w e find i t ?

That i s , can we

produce t h e f l n i t e s e t ofr r u l e s a e f i n i n g t h e f u n c t i o n s ? and ? ;

Xn this s e c t i o n we c o n s i d e r a procedure which a c c e p t s two a r b i t r a r y


d c f g ' s and t h e i r p h r a s e s t r u c t u r e semantics and tries t o f i ~ a descript i o n of such a t r a n s l a t i o n . The procedure may n o t always work, i n thata
T

i t may n o t h a l t o r t h e Function
T

i t d e s c r i b e s may.be only p a r t i a l .
-

Kt

i s guaranteed t o be c o r r e c t ; t h a t i s , t h e d e f i n i t i o n s of i and
+
A

; pro-

duced s p e c i f y a p a r t i a l f u n c t i o n r: T(G,.)

2T(G2) which i s a t r a n s l a t i o n

in t h e s e n s e t h a t , f o r any t T(G ), i f ~ ( t ) s d e f i n e d t h e n ~ ( t ) i s a i 1 t r a n s l a t i o n of t. F i r s t , t h e procedure i s p r e s e n t e d ; then we g i v e t h e


arguments t h a t t i s
3

(partial) translation. W try t o find a f i n i t e e and a p a i r of f u n c t i o n s

I n t u i t i v e l y , t h e procedure works as follows: g e n e r a t i o g set T f o r T(G1)


A

i: V N q + V
I

which have the p r o p e r t y that f o r every t r e e t E T, i f 0 0 ' r ( t O ) = ( t , x , then t 0 and t 0 r e p r e s e n t t h e same semantic f u n c t i o n . What i s meant by IIto and t r e p r e s e n t t h e same semantic function" is i u s t t h i s : ;
A

T T + T(G2) x N :

N. .L

and

I f ;(to)

= Ct&

5 ...xn )

then 4 ( t O ) ( ~ 1 , e a m s ~ m )( t b ) ( ~ i , a a a ~ ' ) , = 4

provided y ' = i

I n g e n e r a l , t o g e t semantic e q u i v a l e n c e , one h a s t o b e c a r e f u l how the a r e a s s o c i a t e d by t h e s t r i n g x 0 ;, with t h e s y n t a c t i c v a r i a b l e s on t h e f r o n t i e r of t) s i n c e these r e p r e s e n t p o s s i b l e t r e e s w i t h mceming, and hence t h e domains of t h e semantic f w c and t' I f such a g e n e r a t i n g set T and f u n c t i o n s i and ;can 0 0' be found, t h e job i s f i n i s h e d , s i n c e i t can then be shown t h a t t h e f u n c t i o n tions for t
T

s y n t a c t i c v a r i a b l e s on t h e f r o n t i e r of t

d e f i n e d by i and

;i s

a translation.

The procedure b e g i n s w i t h t h e set Tp of production t r e e s o f G1 which ' I f t h e procedure can f i n d a is indeed a f i n i t e g e n e r a t i n g s e t f o r T(G1) ?? i t w i l l be successful, and w i l l h a l t and t r a n s l a t i o n " for each t i n T
a

output T, in T

and

;.

P, The procedure s y s t e m a t i c a l l y p i c k s successive t r e e s t 0

and s e a r c h e s T(G ) f o r a s e m a n t i c a l l y e q u i v a l e n t tree t;) whose fron2 t i e r i t can roatch up by some r u l e x. If i t@a f i n d s one, i t o u t p u t s the

d e f i n i t i o n ;(to) = i n g trees.

from T and tries one of t h e remain0 P If i t succeeds in exhausting TP i t i s s u c c e s s f u l . ' x), deletes t

(tb,

Suppose, however, t h a t f o r some to i n Tp, t h e p r o c e d u r e can't find a " t r a n s l a t i o n " i T(G2). n t h e case t h a t t Then i f w e assume t h a t

7 does

exist, i t must be

i s p a r t of a l a r g e r t r e e ( o r of e a c h of a set of larger
Furthermore, i f w e a l s o assume t h a t Thus, the procedure tries
OS

trees) which can be " t r a n s l a t e d " .


t o c o n s t r u c t a new set of trees,

r i s f i n i t e l y s p e c i f i e d , this s e t i s f i n i t e . T1

, not

containing t

which i s a f i n i t e

g e n e r a t i n g set f o r T(G ) - { t o } . It cannot be t h e case t h a t t h e f r o n t i e r 1 of to is a s e n t e n c e i f we a l s o assume t h a t t h e e x i s t i n g ' i s t o t a l on ;


il

So, l o s i n g t o from T(G ) cannot delete any s e n t e n c e s from the

lang,uage r e p r e s e n t e d by T(G1).

The procedure takes t h e set T

as

a new

g e n e r a t i n g s e t t o work w i t h a n d b e g i n s a g a i n .

I t turns o u t t h a t f i n d i n g T depends h e a v i l y an t h e sequence i n which


s u c c e s s i v e trees a r e chosen f o r t r a n s l a t i o n a t t e m p t s . i b l e sequences af t r e e s .
I1

Therefore, t o

guarantee t h a t T will be found if i t e x i s t s , the procedure tries all possThe procedure has t h e g e n e r a l s t e u c t u x e of a t r e e search", and i s r e p r e s e n t e d by t h e s e a r c h t r e e p i c t u r e d . below.

Each

node i n t h e t r e e r e p r e s e n t s a subprocedure which i s d e s c r i b e d below the

tree.

and t h e i r r e s p e c t i v e phrase2 s t r u c t u r e s e m a n t i c s J1 and J2,, x e c u t e t h e s e a r c h tree below f a r a14 e


1

Given two reduced

-F

cfg's G

and G

i n t e g e r p a i r s ( m a x i , m a x s ) = (1,

11, (1, 21, (2, 11,


It

(2, 2),

... .

Iffor

any p a i r s t e p 1 halts and o u t p u t s

success",

then h a l t .

t Reduced in t h e s e n s e t h a t each n o n t e r m i n a l symbol i s d e r i v a b l e from t h e


axiom an'd derives t e m i n a l . s t r i n g s . be p u t i n t o t h i s form.
I t is well-known t h t every cfg rlfm

step 1:

Set i

Ci.

Define the ( f i n i t e ) set of trees

Define t h e ( f i n i t e ) set of a l l possible p a r t i a l - functions

i,,
N,

. ..., ; } such k
J

that for
2

each j = 1, 2,

..., k,
pl

+ VN, and ;.(S1) = S . a n d f o r all A VN


3
1

Execute s t e p 2 f o r each f u n c t i o n

(i.e.,

f o r each j = 1, 2,
11

...,

k).

; J

If f o r

some j the execution


11

of s t e p 2 r e t u r n s

success", t h e n h a l t

and o u t p u t

success".

If

s t e p 2 r e t u r n s " f a i l " , i n c r e a s e j and c o n t i n u e .

If step 2 returns

"fail" f o r a
step 2:

( i e , f o r a l l j ) , t h e n h a l t and output " f a i l " .

(Nab.. T , is a f i n i t e set)

If Ti = (8 then r e t u r n I t success".
If i > maki t h e n return " f a i l t t .

Othewise

I f t h e execution of e x e c u t e step 3 f o r each t T i ' 11 step 3 returns success", then r e t u r n "success". If step 3

returns "fail",

t h e n pick t h e

next t

i n Ti and execute step 3

againr

If step 3 returns " f a i l " for all t in Ti, then return

"fail".
step 3:

Execute search.
If search returns "fail" then execute expand. If expand returns "fail" then return "fail" t o step 2.
If either search or expand returns
11
II

success" then return

success" to s t e p 2.

search:

Generate the first (maxs) trees of T(G2) :

maxs I * Test each tree t ' i n T t t o s e e i f i t s a t i s f i e s each of the

T~ = {ti, ti,

me a ,

t'

following properties :
i ;(rt (t)) )
=

rt(tl)

if) There is a string of non-negative integers x = , 1 2 .xn x x such that each of the following i s true:

..

b) xi # O = , f r ( t t ) i = ; ( f r ( t )
X4

) for i =

1, 2 , . . . , n

for i = 1, 2 ,

..., n

provided

If no such t r e e t ' exists i n T , then return '

r1

fail" t o step 3.

If such a tree t t does e x i s t i n T then '

define ;(t) s e t J . + i+l

= ( t t , x)

define the set T i = (Ti-l

- it))
I1

execute a new version o f step 2 . If step 2 returns


If s t e p 2 returns
II

success" return

success" t o step 3.

1I

fail" return "fail" t o step 3.

expand:

rn

Let Dam(;) denote the domain of t h e c u r r e n t v e r s i o n of the f u n c t i o h ?, i . e . , ~ o r n ( ? ) = { t

? i t ) has been d e f i n e d by-

some e x e c u t i o n of s e a r c h i n t h e c u r r e n t p a t h of t h e search
L e t T$' denote t h e ( f i n i t e ) s e t (T. U ~ o m ( i ) ) .Define i 1 t h e s e t T t o be t h e s m a l l e s t s e t of trees which i s a g e n e r a t i n g t s e t f o r (gen(~;) I t ) ) , and which c o n t a i n s t h e set (TI It}). i (Note t h a t Tt does n o t c o n t a i n t.)

tree).

If T

is not f i n i t e , return

II

f a i l " t o step 3.

S e t i + i+l.

Set T

- i + Tto
11

Execute a new v e r s i o n of s t e p 2.
I f step 2 returns

success" r e t u r n
1I

11

success" t o s t e p 3.

If step 2 retums "fail" return

f a i l " t o s t e p 3.

END OF PROCEDURE
Now w e want t o e x p l a i n how t h e PROCEDURI$ d e f i n e s f u n c t i o n s ( p o s s i b l y p a r t i a l f u n c t i o n s ) on T(G1)
-+ 2 T(G2)

the functions are translations. conditions.

and on L(G6 ) + 2 L(G2' , and prove that 1 W s h a l l a l s o show t h a t i f t h e PR0CEDZl.G e

h a l t s , t h e t r a n s l a t i o n i t t o t a l , e x c e p t under c e r t a i n e a s i l y i d e n t i f i a b l e Consider any p a t h i n t h e s e a r c h t r e e .


It l o o k s l i k e t h i s :

F
step 3

=?
step 1

( ;

i s d e f i n e d h e r e .)
= Tp i s d e f i n e d here.)

(To

( ( t ) = (t' , x) i s d e f i n e d h e r e i f ; t h e node i s s e a r c h . )

0
step 2

(T1

i s defined here.)

(T

is defined here.)

W need t o i d e n t i f y two p a r t i c u l a r s e t s of trees a s s o c i a t e d w i t h t h i s path. e

Both are f i n i t e .

The f i r s t i s t h e domain of t h e f u n c t i o n i, and t h e second

i s t h e set o f trees "excluded" by the s u c c e s s i v e e x e c u t i o n s o f expand.


Note that each e x e c u t i o n of t h e s u b r o u t i n e s e a r c h adds one i t e m t o the d e f i n i t i o n of t h e function,

?,

and t h e e n t i r e d e f i n i t i o n of

;i s

given by

t h e s e t of a l l t h e s e items d e f i n e d by e x e c u t i o n s of s e a r c h i n t h e p a t h .

The domain of ?, then, i s t h e s e t


~orn(;) =

{k

;(t)

i s d e f i n e d by some e x e c u t i o n o f t h e

s u b r o u t i n e s e a r c h i n t h e path}. S i m i l a r l y , each e x e c u t i o n of t h e s u b r o u t i n e expand, i n i t s f i r s t s t e p , d e f i n e s a new set, which daes n o t c o n t a i n t h e t r e e t . T h i s s t e p has Tts t h e e f f e c t of excluding t h e tree t from any f u r t h e r c o n s i d e r a t i o n i n t h e The s e t of a l l such trees i s t h e s e t

t r a n s l a t i o n process.

Excl = { t

i s d e f i n e d by some e x e c u t i o n of t h e

s u b r o u t i n e exclude i n the path}. Wow, t h e s e t


) is a f i n i t e generating set f o r t h e s e t n (T(G1) - E x c l ) , s o t h e f u n c t i o n s i and ? d e f i n e a p a r t i a l f u n c t i o n T(GZ) T : - T ( G ~ )+ 2 according t o t h e d e f i n i t i o n i n Section 2 . Furthermore,

om(;) U T

if T = b t h e n ;is t o t a l on .the g e n e r a t i n g s e t , and s o T i s t o t a l on n (T (GI) - Excl) , and t h i s i s j us t t h e case when t h e PROCEDURE h a l t s . Since
Excl i s a f i n i t e s e t , we have t h e r e s u l t that T i s defined on a l l b u t a

finite number of elements i n T ( G ~ ) , when t h e PROCEDURE h a l t s .


Since
T

is. a p a r t i a l f u n c t i o n on T(G )

-+

T(G2)

, it

f o l l o w s from t h e
p (G2)

d e f i n i t i o n of

7 in

S e c t i o n 2 t h a t ? i s a p a r t i a l f u n c t i o n on P(G ) + 2
+

and t h e r e f o r e on L(G1) of t h e t r e e s of Excl. follows t h a t

L(G*)

Lett P(Excl) denote t h e s e t of f r o n t i e r s

Note t h a t each member of P(Exc1) i s a p h r a s e form.


T

Then when t h e PROCEDURE h a l t s , s i n c e

i s t o t a l on (T(G,)
A

- Exc~, it )
P (Excl) )

Thus,

i s t o t a l on (P ( G ~ ) P (Excl) ) and on (L(G1) -

i s t o t a l on L(G1)

i f PROCEDURE halts and i f none of t h e trees

excluded by exclude are complete syntax trees.

I f complete syntax trees

are excluded, then t h e i r s e n t e n c e s are t h e only ones f o r which

7 is

not

defined.

W have l e f t only t o show t h a t T i s a t r a n s l a t i o n . e form f o r which lations.

The r e a d e r may

r e c a l l t h a t t h e r e may be s e v e r a l n o n t r i v i a l f a c t o r i n g s of trees i n t o a
T

i s defined, and t h a t t h i s may l e a d t o non-unique transThese

Furthermore, t h e languages may be s e m a n t i c a l l y ambiguous.

condi.tions make t h e proof t h a t r i s a t r a n s l a t i o n l e s s l u c i d , s o w e s h a l l g i v e h e r e t h e proof f o r t h e c a s e where r i s defined f o r only one f a c t o r i n g of each tree and t h e r e i s no ambiguity. t o have t h e following n o t a t i o n :
t ' C T(G2) have f r ( t l ) = It w i l l be h e l p f u l i n t h e proof

Let t T(G1) have f r ( t ) = wl. Then by a ( t ) :$ ( t l ) w e mean

w i ...wn. '
..

..wm and l e t

N w t o t h e proof. o Since t gen

Let ~ ( t = t'. )

W wish t o show t h a t $ ( t ) r $(tl). e

t can b e w r i t t e n a s t [ t t ] where t o C om(;) 0 1 m and each of the t r e e s t ,, t m C g e n ( ~ o m ( i ) ) . Let ; ( t o ) = (tb, xl. .X n ) 1' ) ' . ' Then fram t h e d e f i n i t i o n of T , ~ ( t = t 0 [ t '1. . t n] , where f o r each

om(;)),

...

For i n d u c t i v e h y p o t h e s i s , assume t h a t f o r each j = 1,.


t ( t
J

..,m,

Then w e have:

For r

1,

...,m
...,n

l e t y r = $(t rj ( v 1 (W jrm1+l*
), )( l e t y'i = $ ( y !1 y 2 (v' kiWl+l

jr 1
(w'

, and
Then, if w e

f o r i = 1,
define j

...,u

) ki

= kg = 0, t h e r e s u l t above demonstrates t h a t

Thus, by t h e d e f i l i i g i o n of

in s e a r c h ,

= $(t')(p2(~i),...,~2(~A)),

o r + ( t )E $ ( t ' ) .

Thus r i s a t r a n s l a t i o x .

F i n a l l y , as w e showed in S e c t i o n 2 , s i n c e T i s a t r a n s l a t i o n (on the. s y n t a x trees), r is a t r a n s l a t i o n (on t h e languages).


I n programming terminology a g e n e r a t o r i s a program whose i n p u t i s a

s e t of parameters and whose o u t p u t i s a s p e c i a l i z e d program (cf Brooks and


I v e r s o n (1969), p . 365). generator": Then PROCEDURE c o n s t i t u t e s a
II

translator

i t s i n p u t i s two c f g ' s and t h e i r a s s o c i a t e d p h r a s e s t r u c t u r e


The t r e e mapping program i s designed t o

semantics, and i t s o u t p u t i s a t a b l e of tree t r a n s f o r m a t i o n s which "drives"


a s&andard tree-mapping program.
be p a r t of a t r a n s l a t o r system composed of a p a r s e r , t h e tree mapper, and

a f r o n t i e r s t r i p p e r (see Figure 1 )
G

and

a1 b e t h e cfg and s e m a n t i c s f o r

T r a n s l a t i o n proceeds as follows:

Let

t h e s o u r c e language, L1, and G2 a d

the c f g an& semantics f o r t h e t a r g e t language L3.


L.

The t r ~ n s l a t o ris

The p a r s e r produces a p a r s e tree t < w ) f o r w. ( I f 1' w i s s y n t a c t i c a l l y ambiguous, t h e p a r s e r may produce all t h e p a r s e t r e e s of given a s e n t e n c e w i n 7 L

w.) I f t(w) i s i n t h e domain of tihe f u n c t i o n T d e f i n e d by t h e tree mapper, t h e tree mapper w i l l produce ~ ( t ( w ) ) whose f r o n t i e r i s a s e n t e n c e u i n L
2'

r --transformation table ( and i) ;

TRANSLATOR

-1
FRONTIER

I I
I

F i g u r e 1.

-------------T r a n s l a t o r g e n e r a t o r and t r a n s l a t o r .
MPSPER

* T&K 9I

The importance of t h e argument t h a t the f u n c t i o n d e f i n e d By t h e PROCEDURE i s a t r a n s l a t i o n , i s just t h a t w and u are guaranteed t o have t h e sgne
meaning. i f they are unambiguous, and i f thev are ambiguous, w and u are guaranteed t o have meanings i n common

-- i .e ., t h a t

u i s , a bona f i'de

--

t r a n s l a t i o n of w, i n t h e o r d i n a r y s e n s e of t h e word
The u s e f u l n e s s of such a method of t r a h s l a t i n g i s t h a t the generator,

which has t o c o n s i d e t a l l i s s u e s of syntax and semantics, and t h e r e f o r e

runs very slowly, need o n l y run once.

The t r a n s l a t o r which it produces

should run very f a s t , s i n c e , o t h e r than p a r s i n g , i t bhly h a s t o t r a n s f o r m

trees according t o t h e f i n i t e set of rules i n t h e t r e e t r a n s f o r m a t i o n


table time. ( t h e funct"ion ;).

No seman&c computing i s r e q u i r e d a t t r a n s l o t o

This saction presents some examples of translations on context free languages.

The tree search procedure outlined i n Section 3 i s programmed


A l l of these trans-

a i n CPS and runs on the IBM ~/370/165 t Ohio State.

lations were "found" by the program.


TRANSLATION I (Postfix t o Precedence Infix)

Postfix:

Infix:

Grammar Rules

Semantic Rules
x3 (*l,x2)

Grammar Rules

Semantic Rules

S -, sso

EOT

Universe of discourse
R = real numbers =

I R ~ , R2,

Rg,

...1

F = ~ f + ~ f * , 'I f-,

Meaning function assigning atomic morphemes t o lexicaL items and s v n t a c t i c variables:

A1

= A2 = {I}, and F = F contains j u s t t h e d e f i n i t i o n : 1 2

I:

N: ~ ( x ) x. =

The reader should be a b l e to f i g u r e o u t , a f t e r reading t h e d e f i n i t i o n i n

Section 1, t h a t M l a H 2 = {R, R1,

%I

R3, F, f

, f ,*f , f / 1

and

A number of finite s p e c i f i c a t i o n s f a r t r a n s l a t i o n s are possible.

One

is:

T A A, ,
s s J=( o
E o T

91002)

;(AJ=(?!
s s o
E O T

yl~~]9

A ( E

A E

It i s i n t e r e s t i n g t o n o t e t h a t the PROCEDURE does n o t have t o know how

t o corppute t h e f u n c t i o n s f translation.

+, ,

* , and

i n order t o discover t h i s

A l l t h a t i s needed i s t o assume t h a t i f a symbol appears

i n both semantics, i t r e p r e s e n t s t h e same semantic e n t i t y i n each, whatever that e n t i t y is. For example, consider t h e two t r e e s i n the
t r a n s l a t i o n involving

"+".

Let t = S<S%O<+>>,

and t ' = E<EO<+>T<F<(E)>>>.

A l l w need t o know i s t h a t @(t) :(g(tl>, and i t t u r n s o u t we can f i n d e

t h a t out without computing f :

t h a t , (g(t) :+ ( t l ) .

Consider now the translation of ABC+*.

T(ABc+*) A*(w(c)): =

The following shows that

30

I F I
1

T C F

IE l (
1

TRANSLATION I1 ( E x p l i c i t

to i m p l i c i t *)

This translation i s i n t e r e s t i n g because i t shows t h e procedure has

the a b i l i t y t o "iiiscover" that a word (*) i n L(C1)


to a phrase f o m in L(G2). Explicit

has no translation.

But ,it can findsa phrase form involving that word which can b e translated

*:
x2(xI,5Lj)

-t

EOE

~ ~ ( = f* 0 )

The translation i s given by:

(+)=
E O E

(i+

13)

A ;.PAEi m 1 1 R r * * 1 1 1 1 1 1 If
A *

A
B *

I-

A
B

n
A

TRANSLATION 111 (2,

+ to

1, +)
the

L(G 1) is the language of all addition expressions with 2, i.e.,


s e t of a l l strings of t h e form 2

+2+

s t r i n g s of the form 1

+ 1+

... + 1.

.. . + 2 .

L(GZ) i s the s e t of a l l

Under a s t a n d a r d semantics, L(G )

expresses t h e even i n t e g e r s and L(G ) the integers. The procedure 2 1 1 I! "discovers" t h a t t h e - 2 in L(G ) must be translated as t h e phrase word 1

X = positive integers = 11, 2,

...)

F1 = F2, which coptains t h e following d e f i n i t i o n

1)
I

f+(x' ,y) = (f (x, Y))

+
I

'

( ' is t h e suc-

cessor fn+>

:N

(identity) :

(x) = x

The translation is specified by:

Note t h a t t o "discover1' t h i s t r a n s l a t i o n , t h e procedure must' b e a b l e t o compute t h e f u n c t i o n f

+, s i n c e

i t needs t o know t h a t 2 = 1+1. Consider,


=
I

fat example, @(S<2>) ( ~ ~ ( 2 = )rS+2(p1(2)) )

(2) = 2 , b u t

To g e t t h e l a s t s t e p i n t h e 'S+I+S e v a l u a t i o n of t h e second semantic f u n c t i o n , t h e procedure must b e a b l e t o compute f ( 1 , l ) .

( l ) , ( f ) I ( ) = f ( 1 , = 2

TRANSLATION IV (1 t o 2 ,+) ,+
Suppose t h e procedure were asked t o t r a n s l a t e from L(G 2 ) t o L(G 1 i n ) t h e previous example i . e . , from t h e i n t e g e r s t o the even i n t e g e r s . It

would never h a l t , b u t i t would "discover" t h a t t h e phrase "1 + 1" is t o be t r a n s l a t e d a s t h e word "2",

"1 + 1 + 1 + I" a s "2

+ 2",

etc.

I t wotild

d e f i n e a t r a n s l a t i o n which i s t o t a l on t h e s t r i n g s in L(G ) whose v a l u e s 2 a r e even, and i t would continue t o look f0reve.r f o r p o s s i b l e t r a n s l a t i o n s f o r t h e odd-valued s t r i n g s . g i v e the f u n c t i o n s W l e a v e i t a s an e x e r c i s e f o r t h e r e a d e r t o e define t h i s p a r t i a l translation.

;and ;which

5.

Conclusion and F u r t h e r Research.


A t t h e p r e s e n t time what i s needed more t h a n anything else i n t h e a r e a

of language t r a n s l a t i o n i s an understanding of t h e fonnal n a t u r e of semantics, i t s r e l a t i o n t o syntax i n language d e s c r i p t i o n , and i t s r o l e

in translation.
understanding.

I b e l i e v e t h i s paper provides some of t h e b a s i s f o r t h a t

I n c i d e n t a l l y , the r e a d e r might have observed t h a t t h e

d e f i n i t i o n of phrase-s t r u c t u r e semantics i n S e c t i o n 1 p r o v i d e s f o r s o l u t i o n s t o t h e semantic p r o j e c t i o n problem (cf Katz and Fodor (1964), and
Langendoen (1969))

.
A f t e r having played

The reqder i s c e r t a i n l y aware by now, i f n o t b e f o r e , t h a t t h e w are

many grammars and semantics f o r a given language.

with w r i t i n g grammars and semantics f o r simple languages f o r q u i t e a while


nov, I b e l i e v e t h a t , f o r most languages a t l e a s t , t h e r e a r e " b e t t e r " grammars and semantics and elegsnt
11

worse" ones.

Some j u s t seem t o b e more But I

o r simple, o r

11

n a t u r a l " than o t h e r s , f o r a given language.

c a n ' t say much of a s p e c i f i c n a t u r e about what i t means f o r a grammar and semantics t o be "elegant", "simple", or
It

natural".

It seems t h a t s m o e

s t u d y ih t h i s a r e a might g i v e u s i n s i g h t i n t o c e r t a i n s k i l l s f o r maklng i t e a s i e r t o w r i t e l i n g u i s t i c d e s c r i p t i o n s s u i t a b l e for. t r a n s l a t i o n . One phenomenon t h i s model explains is why i t i s s o d i f f i c u l t t o compute an i n v e r s e t r a n s l a t i o n and g e t a n y t h i n g l i k e t h e original.

That

i s , if one $ t a r t s with sentence w i n L and t r a n s l a t e s t o w i n L2, then 1 t r a n s l a t e s w ' t o w" back in L one would l i k e f o r - w and w" t o have the 1' same meaning. But t h e s c u t t 1 e b u t . t says i t i s n ' t s o , and t h i s model shows
why.

Note t h a t all t h a t is r e q u i f e d f o r T:

is t h a t i f w' i s a tran&@ion
-r

Ll of w, then pl(w) f l v 2 ( w t )

2L2 t o B e a t r a n s l a t i o n

# fl, i . e . , t h a t
Now

t h e s o u r c e s e n t e n c e and i t s t r a n s l a t i o n have some commo'n meaning.


L

suppose

T: '

have pl(w) that u1(w)

n n

-+

2 1 i s a l s o a t r a n s l a t i o n and t h a t w" E r'(wl).

y (wf)

2 b1(w1')

# 0 and

-y

@. I n

(wi!)

n u 1(w") # 0,

Then we b u t 3t does n o t f o l l o w ----

~ d e tro g e t back t o the o r i g i n a l meaning,

each t r a n s l a t o r must produce the e n t i r e s e t ~ ( w ) ,r a t h e r t h a n j u s t some sentence i n T (w),


f o r t h a t matter!

and then a l l of t h e s e must be r e t r a n s l a t e d i n e n t i r e t y . Neither do human t r a n s l a t o r s , A l t e r n a t i v e l y , t h e t r a n s l a t o r should be a b l e t o give with

T r a n s l a t i o n programs don' t u s u a l l y do t h a t .

the t r a n s l a t i o n , its p a r s e and t h e atomic morphemes a s s o c i a t e d w i t h t h e


sentence. The 7rocedure i n t h i s paper p r o v i d e s f o r doing t h a t .
The same d e f i n i t i o n of t r a n s l a t i o n , i f i t i s a c c u r z t e , a l s o explains

another phenomenon of language t r a n s l a t - i o n t r a n s l a t i o n s o r w, then we have ul(w)

-- haw
8-

i t i s t h a t two very

d i f f e r e n t t r a n s l a t i ~ n scan corn from t h e same source.

If w t and w" are

p 2 ( w t ) f (b and ul(w) fl u2Cwff) C fi,

but i t doe; not follaw t h a t p 2 ( ~ ' ) fl v2(wvt) #

For n a t u r a l language, one would l i k e t,opexte i t h e theory in t h i s paper t o a r b i t r a r y phrase s t r u c t u r e grammars and t o t r a n s f o r m a t i o n a l
grammars.

The ewlarlsion t o transformational gramanrs r e q u i r e s only

3-

The " l o r e " h a s i t t h a t someone f e d . t h e f o l l o w i n g s e n t e n c e t o a t r a n s l a t o r from L t o Lp:

"The s p i r i t indeed i s w i l l - i n g , but t h e f l e s h i s weak." Then l e took t h e t r a n s l a t i o n and fed i t i n t o a t r a n s l a t o r froui L,L t o i LI, and g o t : "The l i q u o r i s a l l r i g h t , b u t t h e meat i s s p o i l e d . "

f o r m a l i z i n g t h e n o t i o n of t h e t r a n s f o r m p f a s e m a n t i c f u n c t i o n t o be a s s o c i a t e d w i t h each syntax t r a n s f o r m a t i o n . (For t r a n s f o r m a t i o n a l semantic t h e o r i e s which do n o t allow semantic change i n t h e t r a n s f o r m a t i o n s , t h e e x t e n s i o n t o a r b i t r a r y p h r a s e s t r u c t u r e grammars i s s u f f i c i e n t , of course.)

The e x t e n s i o n t o a r b i t r a r y p h r a s e s t r u c t u r e grammars r e q u i r e s f i r s t a
formal statement o.f the "phrase s t r u c t u r e s " of u n r e s t r i c t e d grammars,
s i n c e these s t r u c t u r e s are n o t t r e e s . f o r u n r e s t r i c t e d languages in d e t a i l . The a u t h o r ' s forthcoming paper, l i s t e d i n t h e b i b l i o g r a p h y , covers t h e s u b j e c t of t h e s y n t a c t i c s t r u c t u r e s

There are, of course, schemes f o r t r a n s l a t i o n other than: t h e one


i n t h i s paper.

One might t h i n k of computing t h e meaning of a The scheme i n t h i s paper,


I believe I translate

s o u r c e s e n t e n c e , and then having some e f f e c t i v e way of g e n e r a t i n g the

target s e n t e n c e d i r e c t l y from the meaning.


t h r e e reasons: 1)

however, i s more a t t r a c t i v e a t present than such a " d i r e c t " scheme, for


It i s i n t u i t i v e l y s a t i s f y i n g .

by f i r s t t r a n s l a t i n g simple p h r a s e s and then p u t t i n g their s e p a r a t e t r a n s l a t i o n s together according t o some r e s t r u c t u r i n g r u l e s t h a t are

guaranteed t o p r e s e r v e seaantics
of a s e n t e n c e r e c u r s i v e l y .

Thus, one "builds up" t h e t r a n s l a t i o n

I a m more l i k e l y t o c a l l t h e r e s u l t which I

g e t by f i r s t computing t h e whole meaning and t h e n producing a sentence

(often it i s a sequence of s e n t e n c e s ) with t h e same meaning, a "paraphrase"


o r an
lI

interpretation",

r a t h e r t h a n a t f t ~ a n s l a t i o n " . 2)

I f used much,

thss scheme i s l i k e l y t o be more e f f i c i e n t than t h e " d i r e c t " scheme, since


n o - s e m a n t i c computation i s r e q u i r e d a t t r a n s l a t e t-ime.

AJl the semantic

problems are examined once and for a l l i n t h e t r a n s l a t o r g e n e r a t o r ; a t t r a n s l a t i o n t i m e , only a sequence of t r e e mappings i s performed a s t r u c t u r e matching and r e p l a c i n g technique.

- simply

3)

The " d i r e c t " scheme

r e q u i r e s knowing how to s p e c i f y l i n k u i s t i c d e s c r i p t i o n s i n such a way that, given a meaning i n semantic n o t a t i o n , one can produce a sentence having t h a t meaning. T h i s problem Ts a d i f f i c k l t one not y e t w e l l understood.

Presumably, the research c u r r e n t l y under way i n t h e f i z l d of g e n e r a t i v e


semantics w i l l e x p l i c a t e t h e i s s u e s involved.

Selected Bibliography. Bbnson, D. B. (1970). Syntax and semantics: a categorial view. Information - Control, - ~ p 738-773. and 16, . Benson, D. B. (forthcoming) Semantic ,preserving translations. Brooks, F. P., Jr., and Iverson, K. E. (1969'). Automatic Data Processing. New ~drk: Wiley. Buttelmann, H. W. (forthcoming). On the syntactic structures of Unreand stricted gramark In Information - Control. Katz, 3 0 , and Fodor, 3. A. (1964). The structure of a semantic theory. In Language, - pp. 170-210. Reprinted in Fodor and Katz 39, (eds.) - Structure of Language. Englewood Cliffs, New The Jersey: 479-518.

In

renti ice- all^^^.

of KBtz, J., and Postal, P. (1964). An Integrated TKeory - ~inguistic Descriptions. cambridge? MIT Press.

and Hopcroft, J. and Ullmann, J. (1967). Formal Language-s- their Relatioh to - AutomaIt;,a. Reading, Mass: Addison-Wesley.

The of Free Languages. Ginsburg, S (1963) - Mathematical Theory - c o i t e x t -New York: McGrw-Hill. Knuth, D. E. ( 9 6 ) 1.8. Semantics b f context-free languages. - MatheIn mattea1 Sys-terns Theory, 2_, pp. 127-146. (1971). Examples of formal semantics. Symposium on Semantics of Algorithmic Languages. Engelor, ed. Lecture Notes i< Math #188. New York: Springer-'Jarlag, p p . 212-235
,

Langendoen, D. T. (1969). - Study - Syntax. New york: The of hart and ::lington.

Holt, Rine-

Tarski, A. (1936). Der Wwheitsbergriff in den f~rmalasiertenSprachen. I n Squdia Philosophica, I , pp. 261-304. Originally published in 1933.

You might also like