The Cmplexity f Traslati Membership fr Macr Tree Trasducers Kazuhir Iaba The Uiversity f Tky kiaba@is.s.u-tky.ac.jp Sebastia Maeth NICTA ad Uiversity f New Suth Wales sebastia.maeth@icta.cm.au ABSTRACT Macr tree trasducers (mtts) are a useful frmal mdel fr XML query ad trasfrmati laguages. I this paper e f the fudametal decisi prblems traslatis, amely the traslati membership prblem is studied fr mtts. Fr a fixed traslati, the traslati membership prblem asks whether a give iput/utput pair is elemet f the traslati. Fr call-by-ame mtts this prblem is shw t be NP-cmplete. The mai result is that traslati membership fr call-by-value mtts is i plymial time. Fr several extesis, such as additi f regular lk-ahead r the geeralizati t multi-retur mtts, it is shw that traslati membership still remais i PTIME. 1. INTRODUCTION Macr tree trasducers (mtts) [6] are a ppular frmal mdel fr XML query ad trasfrmati laguages (cf., e.g., [4, 13, 15]. They are pwerful eugh t represet a wide rage f practical trasfrmatis, ad they subsume varius wellkw mdels f tree traslatis such as attribute grammars, MSO-defiable tree traslatis [2], r pebble tree trasducers [16]. Yet, mtts have may decidable prperties such as exact typecheckig r emptiess ad fiiteess ad membership f their dmais ad rages. These make mtts a useful device fr static verificati f XML traslati prgrams. I the algrithms that decide such prperties, we smetimes ecuter as a sub-prblem the traslati membership prblem [11]. Fr a fixed traslati, the traslati membership prblem asks whether a give iput/utput pair is elemet f the traslati. Althugh the prblem itself seems simple, it is far beyd trivial t slve the prblem efficietly, i particular if we csider determiistic mtts. Ndetermiism is useful whe usig the mtt t apprximate the behavir f a real (Turig-cmplete) prgrammig laguage (viz. a cmplicated if-the-else expressi; it is traslated it a mtt that determiistically chses e f the cditial braches). Depedig the rder f Cpyright is held by the authr/wer(s). Iteratial Wrkshp Prgrammig Laguage Techiques fr XML (PLAN-X 2009), Jauary 24, 2009, Savaah, Gergia. evaluati, there are tw differet mdels f determiistic mtts, amely, call-by-value (als called iside-ut r IO fr shrt) ad call-by-ame (utside-i r OI). Nte that i the limit, t e give iput tree f size a mtt ca assciate at mst 2 22 -may differet utput trees, if the mtt perates i OI mde. I ctrast, the limit fr mtts i IO mde is at mst 2 2 differet utput trees fr a give iput tree f size. Csider the fllwig fur rules f a mtt. start(a(x 1 )) duble(x 1, duble(x 1, e)) duble(a(x 1 ), y 1 ) duble(x 1, duble(x 1, y 1 )) duble(e, y 1 ) f(y 1, y 1 ) g(y 1, y 1 ). Fr a iput tree f the frm s = a(a( a(e) )) with a-des, this mtt geerates a full biary tree f height 2 (ad thus f size 2 2 ). If the mtt perates i OI derivati mde, the each de f the biary utput tree is determiistically labeled either f r g; thus, there are 2 22 -may utput trees assciated t the iput tree s. If, hwever, the mtt with the same rules perates i IO derivati mde, the fr iput s it geerates ly 2 2 may differet utput trees (the des e level f a utput tree all have the same label). Thus, mtts i OI derivati mde (callby-ame) have much mre determiism tha mtts i IO derivati mde (call-by-value). This differece suggests that traslati membership is cmputatially harder fr OI-mtts tha fr IO-mtts. I this paper, we first shw that fr OI-mtts, traslati membership is NP-cmplete, ad s is fr cmpsitis f multiple IO-mtts (Secti 3). We the preset ur mai result: traslati membership fr IO-mtts is slvable i plymial time (Secti 4). Our algrithm fr IO traslati membership is based a techique called iverse type iferece. Fr a mtt M ad a give utput type, i.e., a regular tree laguage L f utput trees, iverse type iferece cstructs a descripti f the crrespdig iput type, i.e., f the regular tree laguage M 1 (L). Nte that, iverse type iferece basically takes expetial time, because the size f the iverse-type autmat itself ca be that large [16, 15, 17]. T avid this, we cstruct the autmat -thefly ad btai the PTIME efficiecy. Our techique is the geeralized t several extesi f IO-mtts, such as additi f regular lk-ahead r the geeralizati t multi-retur mtts. I fact, we eve csider a mre pwerful lk-ahead mechaism that is based tree autmata with equality ad disequality cstraits betwee sibligs [1]. Nte that, fr ttal determiistic mtts: OI equals IO, ad
by Therem 15 f [12], give a iput tree s, the utput tree τ(s) ca be cmputed i time O( s + t ), eve fr a -fld cmpsiti f ttal determiistic mtts. Hece, by simply cmputig the utput, traslati membership ca be slved i liear time fr this class f traslatis. The result ca easily be exteded t determiistic but partial mtts (i either IO r OI derivati mde), as metied at the ed f Secti 4. 2. DEFINITIONS Fr a fiite set A, we dete by A the umber f its elemets. A fiite set Σ with a mappig rak : Σ N is called a raked alphabet. We fte write σ (k) t idicate that rak(σ) = k ad write Σ (k) t dete the subset f Σ f rak-k symbls. The prduct f Σ ad a set B is the raked alphabet Σ B = { σ, b (k) σ (k) Σ, b B}. Thrughut the paper, we fix the sets f iput variables X = {x 1, x 2,... }, parameters Y = {y 1, y 2,... }, ad letvariables Z = {z 1, z 2,... }, which are all f rak 0. We assume ay ther alphabet t be disjit with X, Y, ad Z. The set X i is defied as {x 1,..., x i }, ad Y i ad Z i are defied similarly. The set T Σ f trees t ver a raked alphabet Σ is defied k z } { by the BNF t ::= σ( t,..., t) fr σ Σ (k). We fte mit paretheses fr rak-0 ad rak-1 symbls. We recursively defie the fucti label frm T Σ N t Σ as fllws. Fr t = σ(t 1,..., t k ), σ (k) Σ, k 0, ad t 1,..., t k T Σ, label(t, ϵ) = σ ad label(t, i.ν) = label(t i, ν). Thus, the empty list ϵ detes the rt de ad ν.i detes the i-th child f ν. We defie the set ps(t) = {ν N label(t, ν) is defied}. We dete by t the umber f des i the tree t. Fr a de v f t, t v detes the subtree f t rted at the de v. Fr trees t, t 1,..., t T Σ ad σ 1,..., σ Σ (0), we dete by t [σ 1 /t 1,..., σ /t ] the simultaeus substituti f the σ i by the t i. Let Σ ad be raked alphabets. A relati τ T Σ T is called a tree traslati (ver Σ ad ) r simply a traslati. We defie rage(τ) = {b a : (a, b) τ}. Fr tw traslatis τ 1 ad τ 2, their sequetial cmpsiti τ 1 ; τ 2 (τ 1 fllwed by τ 2 ) is the traslati {(a, c) b : ((a, b) τ 1, (b, c) τ 2 )}. Fr tw classes T 1 ad T 2 f traslatis, we defie T 1 ; T 2 = {τ 1 ; τ 2 τ 1 T 1, τ 2 T 2 }. The k-fld cmpsiti f the class T f traslatis is deted by T k. Defiiti 1. A macr tree trasducer (mtt) M is a tuple (Q, Σ,, q 0, R), where Q is the raked alphabet f states, Σ ad are the iput ad utput alphabets, q 0 Q (0) is the iitial state, ad R is the fiite set f rules f the frm q, σ(x 1,..., x k ) (y 1,..., y m ) r where q Q (m), σ Σ (k), ad r is a tree i T (Q Xk ) Y m. Rules f such frm are called q, σ -rules, ad the set f righthad sides f all q, σ -rules is deted by R q,σ. We defie the size f the mtt by M = P { r r R q,σ, q Q, σ Σ}. Fr the remaider f this secti, let M be a mtt as i Defiiti 1. A state q f a macr tree trasducer ca be regarded as a (determiistic) fucti i fuctial prgrammig laguages. Depedig the rder f evaluati, tw differet sematics ca be csidered: call-by-value (r iside-ut, IO) ad call-by-ame (r, utside-i, OI). Let {IO, OI}. Fr the tree u T (Q TΣ ) Y, its meaig with respect t M u M T Y is iductively defied as fllws y i M = {y i } δ(u 1,..., u ) M = {δ(t 1,..., t ) t i u i M fr all i} q, σ(s 1,..., s k ) (u 1,..., u m ) M = [ r[x1 /s 1,..., x k /s k ] M ( u 1 M,..., u m M ) r R q,σ where ad dete IO- ad OI-substituti, respectively, ad are defied as fllws fr L, L 1,..., L T Y. IO OI L (L 1,..., L ) = [ «t (L 1,..., L ) t L y i OI δ(t 1,..., t m ) t IO (L 1,..., L ) = {t[y 1/t 1,..., y /t ] (L 1,..., L ) = L i OI (L 1,..., L ) = {δ(t 1,..., t m) t i t i (L 1,..., L ) OI t i L i fr all i} fr all i}. The differece f IO- ad OI- sematics lies i the iterpretati f state calls. I IO-sematics we use IO-substituti fr parameters; each parameter y i is bud t sme fixed (but determiistically chse) tree i u i M IO, ad every ccurrece f y i is replaced with the same sigle tree. O the ther had, i OI-sematics, each parameter is bud t the set f trees u i M OI, ad at every ccurrece f y i we determiistically chse sme tree i u i M OI, idepedet frm the chices made at ther ccurreces f y i. As a example f the defiiti f u, csider the example frm the Itrducti. Nte that there we used slightly differet tati: the right-had side duble(x, duble(x, e)) is w writte as duble, x 1 ( duble, x 1 (e)), i.e., we distiguish the first parameter which is the special parameter that is bud t a iput tree i T Σ frm thers bud t utput trees i T, by eclsig it with agle brackets. Nw, let us cmpute start, a(a(e)). start, a(a(e)) = duble, a(e) ( duble, a(e) (e)) = duble, e ( duble, e (y 1 )) duble, a(e) (e) = {f(y 1, y 1 ), g(y 1, y 1 )} duble, e (e) duble, a(e) (e) = {f(y 1, y 1), g(y 1, y 1)} {f(y 1, y 1), g(y 1, y 1)} duble, a(e) (e) Here, we ecutered the -substituti L L fr L = {f(y 1, y 1), g(y 1, y 1)}. Nw, if = IO the L L = {f(f(y 1, y 1 ), f(y 1, y 1 )), g(f(y 1, y 1 ), f(y 1, y 1 )), f(g(y 1, y 1 ), g(y 1, y 1 )),
g(g(y 1, y 1 ), g(y 1, y 1 ))}; the size f the set is 2 2 = 4. O the ther had, if = OI the we btai L L = {f(f(y 1, y 1), f(y 1, y 1)), f(f(y 1, y 1), g(y 1, y 1)), f(g(y 1, y 1), f(y 1, y 1)), f(g(y 1, y 1), g(y 1, y 1)), g(f(y 1, y 1), f(y 1, y 1)), g(f(y 1, y 1), g(y 1, y 1)), g(g(y 1, y 1), f(y 1, y 1)), g(g(y 1, y 1), g(y 1, y 1))}; the size is 2 2 2 = 8 where the expet 2 cmes frm the umber f ccurreces f the parameter y 1 i each target term f the substituti. We defie the traslati realized by M i -mde by the relati τ,m = {(s, t) T Σ T t q 0, s }. The class f all traslatis realized by all mtts i -mde is deted by MTT. A mtt is called determiistic (respectively, ttal) if fr every q, σ, the umber f rules R q,σ is at mst (at least) 1; the crrespdig classes f traslatis are deted by prefix D (t). A mtt is called liear (i the iput variables) if i every right-had side f the rules, each iput variable x i appears at mst ce; the crrespdig class f traslati is deted by prefix L. Fr example, the class f traslatis realized by liear, determiistic, ad ttal mtts i OI mde is deted by LDtMTT OI. Fr a traslati τ T Σ T, the traslati membership prblem fr τ is a decisi prblem that determies, give a tree s T Σ ad a tree t T, whether (s, t) τ. I the rest f the paper, we fcus the data cmplexity f this prblem. That is, we measure the cmplexity i terms f s + t, regardig the traslati τ t be fixed. We will always assume that the iput ad utput tree that are iputs t the prblem are deted by s ad t. 3. NP-COMPLETE CLASSES The first result is that traslati membership fr OI-mtts is NP-hard, eve fr liear mtts. The prf is based the reducti t 3-SAT, which resembles [18] which shws NP-cmpleteess f the membership prblem fr idexed laguages. I fact, the idexed laguages ca be btaied as yields (strigs f leaves frm left t right) f utput laguages f liear mtts (by the fact that each idexed laguage is the yield f sme OI ctext-free tree laguage [7] ad each OI ctext-free tree laguage is equivalet t the rage rage(τ) f sme τ LMTT OI by Crllary 6.13 i [6]). Hwever, give a wrd w as iput fr the membership prblem f a idexed laguage L, it is t clear hw t cstruct a pair (s, t) such that (s, t) τ OI,M fr sme liear mtt if ad ly if w is i L. We ca chse s = a with = legth(w) ad a LMTT which prduces trees t which have as yield the wrd w. But hw t select such a tree t as iput fr the traslati membership prblem? Nte that it is easy t cstruct frm w a iput fr traslati membership fr a tw-fld cmpsiti f mtts: the secd trasducer realizes yield, i.e., it turs a tree t it a madic tree that represets t s yield (such a trasducer is eve ttal determiistic). Thus, it fllws that traslati membership fr tw-fld cmpsitis f mtts is NP-hard. This was metied already i [11]. The ext lemma shws that eve traslati membership fr a sigle liear mtt is NP-hard. Lemma 1 Traslati membership fr LMTT OI (ad hece MTT OI ) is NP-hard. Prf. We cstruct a mtt M = (Q, q 0, Σ,, R) s that it geerates the parse-trees f all satisfiable blea frmulas i 3-cjuctive rmal frm, give the umber f variables ad clauses m as the iputs. We slightly abuse ur tati ad write y v, y t, y f i place f y 1, y 2, y 3, respectively. Let Q = {q (0) 0, q(2) c, q (3) }, Σ = {a (1), b (3), c (1), d (0) }, = { (2), (3), (1), v (1), e (0) }, ad R the fllwig set f rules: q, b(x 1, x 2, x 3) (y v, y t, y f ) q 0, a(x 1) q, x 1 (v(e), e, (e)) q 0, a(x 1) q, x 1 (v(e), (e), e) q, x 1 (v(y v), q c, x 2 (y t, y v), q c, x 3 (y f, (y v))) q, b(x 1, x 2, x 3) (y v, y t, y f ) q, x 1 (v(y v ), q c, x 2 (y t, (y v )), q c, x 3 (y f, y v )) q c, d (y 1, y 2 ) y 1 q c, d (y 1, y 2 ) y 2 q, c(x 1 ) (y v, y t, y f ) ( (y t, y t, y t ), q, x 1 (y v, y t, y f )) q, c(x 1 ) (y v, y t, y f ) ( (y t, y t, y f ), q, x 1 (y v, y t, y f )) q, c(x 1 ) (y v, y t, y f ) ( (y t, y f, y t ), q, x 1 (y v, y t, y f )) q, c(x 1) (y v, y t, y f ) ( (y f, y t, y t), q, x 1 (y v, y t, y f )) q, c(x 1) (y v, y t, y f ) ( (y t, y f, y f ), q, x 1 (y v, y t, y f )) q, c(x 1) (y v, y t, y f ) ( (y f, y f, y t), q, x 1 (y v, y t, y f )) q, c(x 1) (y v, y t, y f ) ( (y f, y t, y f ), q, x 1 (y v, y t, y f )) q, d (y v, y t, y f ) (y t, y t, y f ). (same as the ( ) part f q, c -rules) q, d (y v, y t, y f ) (y f, y t, y f ). z } { Frm a iput tree a( b(b( b( c m d, d, d) ), d, d)) f size 3 + m +2, it geerates all satisfiable blea frmulas i 3- cjuctive rmal frm with variables ad m cjucts. The utput laguage ecdes blea frmulas as fllws: a blea variable p i fr 0 i < is represeted as v i e, ad three blea peratis,, ad are represeted as they are. Fr example, the frmula (p 0 p 1 p 2 ) ( p 0 p 1 p 2 ) is ecded as ( (e, ve, vve), ( e, ve, vve)). Ituitively, whe the mtt reads the rt de f the iput, it determiistically assigs a truth-value t the first variable p 0. The first q 0, a -rule is the case whe it assiged true ad the ther rule is fr false. Three parameters are passed t the state q. Ituitively, the first parameter y v detes the ame f the ext variable t be assiged a truthvalue. The secd (ad the third, respectively) parameter y t (y f ) detes the set f true ( false ) literals (amely, variables r egated variables) that have bee cstructed up t w. While readig b des i the state q, the mtt determiistically assigs a truth-value t each variable p 1 t p 1, similarly t p 0. Here, OI-determiism is crucially used t represet arbitrary chice f psitive ad egative literals; each time y t ad y f are cpied t the utput, they ctai uevaluated cmbs f q c-calls ( d-des). Each such cmb represets the determiistic chice f ay f the psitive (y t) r egative (y f ) literals that have bee geerated s far. The state q c meas a ui f tw sets, by takig tw parameters ad determiistically returs
either e f them. The parameter y t is assiged a uevaluated expressi, e.g., like q c, d ( q c, d ( p 0, p 1 ), p 2 ), ad each time the value f y t is eeded, it is determiistically evaluated t either p 0, p 1, r p 2. The, while readig c des i the iput, the trasducer geerates m cjuctis f true clauses. Sice we geerate 3-CNF frmulas, each clause csists f a disjucti f exactly three literals. There are seve pssibilities (all cmbiatis f y t ad y f, except (y f, y f, y f )), which are geerated by the q, c -rules f the trasducer. It shuld be clear fr the reader that this mtt geerates all (ad ly) satisfiable 3-CNF frmulas; it determiistically cstructs ay f the 2 pssible assigmets t the variables p 0,..., p 1, ad uder each assigmet, geerates ay f the pssible 7 m types f true frmulas. The pit is, the chices at q c, d fr eumeratig all pssible literals are determiistically evaluated each time geeratig a disjuct, while the chices at q 0, a ad q, b fr eumeratig all pssible truth-value assigmets are evaluated ad uifrmly determied prir t the geerati f all cjucts. It is als bvius that, give ay 3-CNF frmula, we ca i plymial time ecde the frmula t the abve explaied ecdig t btai t, ad cut the umber f variables ad clauses t btai s. The, (s, t) τ M if ad ly if the rigial frmula is satisfiable. It is well kw that the satisfiability f 3-CNF is NP-cmplete (see, e.g., [8]). I [11], we have prved tw clsely related results; e is that the abve NP-hard lwerbud is tight, i.e., the traslati membership fr LMTT OI ca be determied i NP time cmplexity. The ther is that the cmplexity f membership prblem f the utput laguage is i NP, eve fr fiitely may cmpsitis f MTT OI s. Altgether, we have the fllwig therem. Therem 2 Traslati membership fr MTT OI fr 1 is NP-cmplete. Prf. NP-hardess fllws frm the precedig lemma. Let τ MTT OI. We ca easily cstruct a traslati τ = {(s, π(s, t)) (s, t) τ} i MTT OI where π is a ew biary symbl. This is de by chagig the first mtt M 1 (with iput alphabet Σ ad iitial state q 0) f the cmpsiti as fllws. Replace fr σ Σ (k) every q 0, σ -rule with right-had side t by the ew rule q 0, σ(x 1,..., x k ) π(σ( q id, x 1,..., q id, x k ), t) ad itrduce q id, σ(x 1,..., x k ) σ( q id, x 1,..., q id, x k ) fr the ew state q id f rak 0. The, the subsequet mtts M i (2 i ) are augmeted by the ew rule q 0, π(x 1, x 2 ) π( q id, x 1, q 0, x 2 ) ad q id rules as fr M 1. Nte that (s, t) τ if ad ly if π(s, t) rage(τ ). Sice by Therem 8 f [11] the cmplexity f the membership test f rage(τ ) is i NP, we ca als check (s, t) τ i NP. Nte that cmpsitis f tw MTT IO s ca simulate all MTT OI traslatis (Therem 6.10 f [6]), ad cversely, cmpsitis f MTT IO s ca be simulated by cmpsitis MTT OI s (Therem 7.8 f [6]). Therefre, we w have the NP-cmpleteess fr cmpsitis f MTT IO s. Crllary 3 Traslati membership fr MTT IO fr 2 is NP-cmplete. 4. TRACTABLE CLASSES I this secti, we first prve that IO-mtts have plymialtime traslati membership, ctrary t OI-mtts. The we exted the result t several ther extesis f IO-mtts, ad t sme restricted subclasses f OI-mtts. The idea f the prf is based iverse type iferece fr mtts M (Therem 7.4 f [6]); give a fiite tree autmat B (acceptig utput trees), we ca effectively cstruct a fiite tree autmat that recgizes the crrespdig iput trees τ 1 M (L(B)). Give a utput tree t, by cstructig its miimal dag represetati (i.e., the piter represetati f t such that all ismrphic subtrees are shared), we ca simply csider it as the trivial determiistic autmat B t with at mst t -may states which recgizes {t}. Oce we have cstructed the autmat A fr τ 1 M (L(B t)), we merely eed t check whether s L(A), i rder t slve traslati membership fr (s, t). Hwever, the autmat A ca be very large: its wrst case umber f states is expetial i B t. Thus, we must avid t fully cstruct A i rder t btai PTIME cmplexity. Our idea is t cstruct A demad, while ruig it the tree s. Nte that iverse type iferece f a IO-mtt cstructs a iput type autmat which has states that are fuctis p frm Q t (V m 2 V ) where V is the set f states f B t, Q is the set f states f M, ad m is the maximum rak f states i Q. Such a state p tells us fr each q Q, which state f B t is btaied if we apply the state q t a iput tree. That is, if A reaches the state p after readig a tree s, it meas that ruig B t utput trees i q, s (t v1,..., t vm ) btais the states (p(q))(v 1,..., v m ). Therem 4 Let M be a mtt. Traslati membership fr τ IO,M ca be determied i time O( s t 2m+2 M ) where m is the maximum rak f M s states. Prf. Let t dag be the miimal dag represetig t. It is flklre that t dag ca be cmputed i amrtized liear time i t, usig hashig, ad eve i liear time usig pseud radix srtig, see [3]. Let V t be the set f des f t dag. We defie label(v) t dete the label i Σ f the de v V t, ad child(v, i) t dete the i-th child de f v. Assumig a stadard piter structure represetig dags, we regard each executi f label ad child takes O(1) time. Let be a elemet distict frm V t. Let V = V t { } ad label( ) t be udefied. Let ru : T Σ A with A = 2 S i Q(i) V i V be the fucti defied iductively as fllws ru(σ(s 1,..., s k )) = tr(σ, ru(s 1),..., ru(s k )) where tr is defied belw. The set A ctais the states f the determiistic bttm-up autmat f τ 1 (t), tr is the trasiti fucti, ad ru cmputes the ru f the autmat. The ituiti f the set f states A is, that (q, v, v ) ru(s ) meas that if q is applied t the iput subtree s with utput subtrees rted at v as parameters, the it may geerate a utput subtree rted at v. The special value V is used t dete a tree that is t
a subtree f t. That is, fr example, (q, v, ) ru(s ) meas that a applicati f q t s with parameters v may yield a tree that is t a subtree f t. The trasiti fucti tr : ( S i Σ(i) A i ) A is defied as fllws tr(σ, a) = (q, v, v ) [ i Q (i) V i V r R q,σ : f v, a (r, v ) where f v, a : T (Q X) Y V {true, false} is defied iductively right-had sides f the rules: f v, a (y i, v ) = true f v, a (y i, v ) = false f v, a (δ(r 1,..., r ), v ) = label(v ) = δ ^ f v, a (r i, child(v, i)) 1 i if v = v i if v v i if v V t f v, a (δ(r 1,..., r ), ) = ` u V : ^ f v, a (r i, u i ) ` u V t : `label(u ) = δ 1 i ^ child(u, i) u i 1 i f v, a ( q, x j (r 1,..., r ), v ) = u V : (q, u, v ) a j ^ 1 i f v, a (r i, u i ). The relati f v, a (r, v ) shuld be uderstd as: evaluati f r will yield the utput subtree at v, uder the assumpti that the parameters y are bud t v ad the effects f applicati f a state t each child is as described by a. Fr a tree t T, let ρ(t ) be v V t if t = t v, ad ρ(t ) = therwise. We als defie ρ(t ) fr T T as {ρ(t) t T }. The crrectess f the abve cstructi is verified by the fllwig claim. Nte that the claim is just rephrasig the ituiti f the set f states A explaied abve, i a frmal way. Claim Fr every iput tree s, we have the fllwig equati fr all q Q, r i T (Q TΣ ), ad a evirmet Γ: ρ q, s (r 1,..., r ) M IO = v (q, (v1,..., v ), v ) ru(s ), v i ρ( r i M IO) fr all i By applyig the claim fr q = q 0 ad s = s, we kw that t q, s M IO is equal t (q 0, (), v ϵ) ru(s) where v ϵ is the rt de f t dag. Hece, the traslati membership ca be determied by cmputig the set ru(s). The prf f the claim is by ested iducti first structure f s, ad the the structure f right-had sides f the rules. Let s = σ(s 1,..., s k ) (the base case is the case k = 0). By defiiti f the IO-sematics we have ρ q, s (r 1,..., r ) M IO = [ r R q,σ ρ(t [y 1 /t 1,..., y /t ]) t r[ x/ s] M IO, t i r i M IO fr all i ad by defiiti f ru, we have v (q, v, v ) ru(s ), v i ρ( r i M IO) = [ v f v, a (r, v ), v i ρ( r i M IO) r R q,σ where a = (ru(s 1 ),..., ru(s k )). T shw these tw sets are equal, it is sufficiet t prve the the fllwig statemet: if ρ(t i ) = v i the {ρ(t [ y/ t]) t r[ x/ s] M IO} = {v f v, a (r, v )}. The prf is by ested iducti the structure f r. Fr example, if r = q, x i (r 1,..., r ), we have {v f v, a ( q, x i (r 1,..., r ), v )} = {v (q, u, v ) a i, f v, a (r i, u i ) fr all i}, which is by ier iducti hypthesis equal t {v (q, u, v ) a i, u i ρ( r i [ x/ s, y/ t] M IO) fr all i}, ad the by uter iducti hypthesis it is equal t ρ( q, s i (r 1[ x/ s, y/ t],..., r [ x/ s, y/ t]) M IO) = {ρ(t [ y/ t]) t r[ x/ s] M IO}. The ther cases are prved similarly. The time cmplexity fr testig (q 0, (), v ϵ) ru(s) is cmputed as fllws. The value ru(s) fr the whle iput tree s ca be cmputed by executig the tr fucti each de f s. The cmputati is de i bttm-up fashi as bttm-up tree autmata des, s that the states i a are already cstructed. The umber f executi f the tr fucti is s. The set tr(σ, a) ca be cstructed by simply testig all cmbiatis f (q, v, v ) S i Q(i) V i V (which is f size Q V m+1 ) ad r R q,σ by f v, a. Nte that f v, a may receive r V differet pairs f argumets, ad the cmputati f each value f v, a (r, v ) takes O( V m ) time i the wrst case (the f v, a ( q, x j ( )) case) assumig the values f f v, a are already cmputed fr all subexpressis f r. Hece, O( r V m+1 ) time is sufficiet here. Nte that the f v, a (δ( ), ) case ca be cmputed efficietly i O( V ) time by rememberig the umber {v f v, a (r, v)} fr each sub-expressi r : the existece f u ca be checked by verifyig the umber is -zer, ad the check child(u, i) u i is replaced with either t f v, a (r, child(u, i)) r the umber is mre tha e. Sice it is ly required t cmpute the f v, a (δ( ), ) cases at mst r times, the time cmplexity fr the cases is O( r V ), which is subsumed by O( r V m+1 ). Altgether, multiplyig all f them yields the desired cmplexity bud O( s t 2m+2 M ). Nte that we have V t + 1 by defiiti, ad that the parameter M subsumes Σ q Q,r Rq,σ r. The reader may wder why the same apprach des t wrk fr OI-mtts, whse iverses als preserve the regular tree laguages. The prblem is, fr OI, the states f the iferred autmata are i A = 2 S i Q(i) (2 V ) i V istead f A = 2 S i Q(i) V i V. The differece is ituitively explaied as fllws: i IO-mtts, every cpy f a same parameter is a idetical utput tree ad thus crrespds t a sigle de i V, while i OI-mtts, each cpy is evaluated idepedetly ad thus may crrespd t differet utput des. T capture this pheme i the iverse type iferece, each parameter must be represeted by a set f des rather tha a sigle utput de. The additial expetial implies that a sigle state i A (a subset f S i Q(i) (2 V ) i V ) ca already be expetially large. Therefre, -the-fly cstructi des t help t btai a PTIME algrithm. Of curse, Lemma 1 implies that there is PTIME algrithm fr traslati membership fr OI-mtts (uless NP=P).
Nevertheless, sme subclasses f OI-mtts still admit PTIME traslati membership. Nte that the essetial difficulty f OI-traslati membership cmes frm the cpyig f parameters. Csider, fr example, a OI-mtt that is liear i the parameters (i.e., i every right-had side each parameter y i ccurs at mst ce); the each parameter is either used ce r is ever used. I this case, it ca be represeted i the iverse-type autmat by a set f size 1. Mre geerally, if a OI-mtt is fiite cpyig i the parameter, its traslati membership ca be tested i plymial time. A mtt is fiite cpyig i the parameter if there exists a cstat c such that fr ay q, s, ad u q, s (y 1,..., y k ), the umber f ccurreces f y i i u is mre tha c; the umber c is called a (parameter) cpyig bud by M. Nte that liear-i-parameter mtts are a special case f fiite cpyig mtts; they are t ly fiite cpyig with cpyig bud 1, but als the fiiteess ca be kw by simply cutig the umber f sytactic ccurreces f each variable i the rules, while fiite cpyig i geeral is a sematic prperty f mtts. Als te that fiite cpyig is a decidable prperty, ad the cpyig bud ca be effectively btaied. (See Lemma 4.10 f [5]. Althugh it is prved ly fr ttal determiistic mtts, the same techique als wrks fr IOad OI- determiistic mtts.) Therem 5 Let M be a mtt that is fiite cpyig i the parameters with cpyig bud c. The, traslati membership fr τ OI,M ca be determied i time O( s t c(2m+2) c M ) where m is the maximum rak f M s states. Prf. Let t dag be the miimal dag represetig t. Let V be the set f des f t dag. We defie label(v) t dete the label i Σ f the de v V, ad child(v, i) t dete the i-th child de f v. Let A = 2 S i Q(i) P c (V ) i V where P c (V ) = {S V S c} ad the fucti ru be defied as fllws: ru(σ(s 1,..., s k )) = tr(σ, ru(s 1 ),..., ru(s k )). The trasiti fucti tr : ( S i Σ(i) A i ) A is defied as fllws tr(σ, a) = (q, β, v ) [ Q (i) P c (V ) i V i r R q,σ : f β, a (r, v ) where f β, a : T (Q X) Y V {true, false} defied as fllws: f β, a (y i, v ) = true if v β i f β, a (y i, v ) = false if v β i f β, a (δ(r 1,..., r ), v ) = ^ f β, a (r i, child(v, i)) 1 i f β, a (δ(r 1,..., r ), v ) = false f β, a ( q, x j (r 1,..., r ), v ) = if label(v ) = δ if label(v ) δ γ : ((q, γ, v ) a j ad fr all i ad u γ i : f β, a (r i, u)). Nte that we d t have the elemet i V this time. Istead, the empty set plays the same rle. The cmplexity f this algrithm is cmputed similarly t the case f IO-mtts: we eed t test by f β, a all cmbiatis f a S i Q(i) P c(v ) i V (which is f size O( Q V cm+1 ) this time) ad r R q,σ, the f β, a receives r V differet pairs f argumets, ad fially the cmputati f f v, a ( q, x j ( )) takes O( V cm c) time where V cm cmes frm the part γ ad c cmes frm the part u γ i. The crrectess is shw by prvig the fllwig claim. Claim Fr every iput tree s, t q, s (u 1,..., u ) M OI if ad ly if there exist subtrees t 1,1,..., t 1,l1,..., t,1,..., t,l f t such that {t i,1,..., t i,i } u i M OI with l i c ad (q,({ρ(t 1,1 ),..., ρ(t 1,l1 )},..., {ρ(t,1 ),..., ρ(t,l )}), ρ(t )) ru(s ), where ρ is defied as i the prf f Therem 4. The prf is by iducti, t. The fiite-cpyig prperty esures that i the sematics f the mtt, OI-substituti is de ly parameters y i whse umber f ccurrece is less tha r equal t c. It justifies that ur algrithm ly csiders sets f size c as parameter represetati. O the ther had, the PTIME result fr IO-mtts ca be geeralized t a mre pwerful extesi f IO-mtts. Oe ppular way t exted mtts is by regular lk-ahead. Mtts with regular lk-ahead are equipped with e determiistic bttm-up tree autmat ad are allwed t select a rule with respect t the state f the tree autmat, i additi t the curret state ad the label f the curret de. Sice ay MTT IO s with regular lk-ahead ca be simulated by a rmal MTT IO (Therem 5.19 f [6]), the traslati membership fr MTT IO with regular lk-ahead is als i PTIME. I fact, we ca further exted the mdel t use a mre expressive mdel f lk-ahead, amely, tree autmata with equality ad disequality cstraits [1], while still preservig the PTIME traslati membership. Defiiti 2. A bttm-up tree autmat with equality ad disequality cstraits (TAC) is a tuple B = (P, Σ, δ), where P is the set f states, Σ the iput alphabet, ad δ is a set f trasitis f the frm (σ (m), p 1,..., p m, E, D, p) where E, D {1,..., m} 2 are the sets f equality ad disequality cstraits, respectively. A list f trees t 1,..., t m is said t satisfy the cstraits if (i, j) E : t i = t j ad (i, j) D : t i t j. We defie δ iductively as fllws: δ(σ(t 1,..., t m)) = {p P (σ, p 1,..., p m, E, D, p) δ : p i δ(t i ) fr all i ad t 1,..., t m satisfy E ad D}. A TAC is ttal ad determiistic if fr ay σ Σ, p 1,..., p m P, ad t 1,..., t m T Σ, there exists e uique trasiti (σ (m), p 1,..., p m, E, D, p) δ such that t 1,..., t m satisfies the cstraits E ad D. Fr a ttal determiistic TAC, we abuse the tati ad dete by δ(t) the uique elemet f itself. Nte that, as well as a rmal bttm-up tree autmat, we ca ru a TAC a tree i (amrtized) liear time, by first cmputig the miimal dag represetati f the iput tree; due t its miimality, the equality (r disequality) test f tw subtrees ca be carried ut i cstat time, by a sigle piter cmparis. Als te that ttal determiistic
TACs are equally expressive as its determiistic versi (as shw i Prpsiti 4.2 f [1] by a variat f usual pwerset cstructi). Hece, we adpt ttal determiistic TACs as ur lk-ahead mdel fr mtts, withut sacrificig the expressiveess. Defiiti 3. A mtt with TAC lk-ahead is a tuple M = (Q, q 0, Σ,, R, B) where B = (P, Σ, δ) is a ttal ad determiistic TAC, ad all ther cmpets are defied as fr mtts, except that the frm f rules are as fllws: q, σ(x 1,..., x k ) (y 1,..., y m) r (p 1,..., p k, E, D). The set f right-had side f all rules f such frm is deted by R q,σ,p1,...,p k,e,d. The size M is defied as fr rmal mtts. The sematics f mtts with TAC lk-ahead differs frm rmal mtts ly i the side-cditi f state applicati, which is defied as fllws: q, σ(s 1,..., s k ) (u 1,..., u m ) M = [ r[x1/s 1,..., x k /s k ] M ( u1 M,..., u m M ) r R where R = R q,σ, δ(s1 ),..., δ(s k ),E,D such that s 1,..., s k satisfies E ad D. I a wrd, rules i R q,σ,p1,...,p k,e,d are used whe the state q is applied t a de satisfyig all the fllwig three cditis: (1) labeled σ, (2) the child subtrees s 1,..., s k f the de satisfy the cstraits E ad D, ad (3) δ(s i ) = p i fr all i. Mtts with TAC lk-ahead are strictly mre expressive tha rmal mtts. Fr example, the traslati {(π(s, s), e) s T Σ} where π is a symbl f rak 2 ad e is f rak 0, ca be de by a trasducer with TAC lk-ahead. But mttcmpsiti ca realize this traslati because the dmai is t regular (by Crllary 5.6 f [6], the dmai f ay mtt must be a regular tree laguage). Nevertheless, the PTIME traslati membership fr MTT IO ca be exteded t mtts with TAC lk-ahead. Therem 6 Let M be a mtt with TAC lk-ahead. Traslati membership fr τ IO,M ca be determied i time O( s t 2m+2 M ) where m is the maximum rak f M s states. Prf. The basic idea is agai the -the-fly cstructi f the iverse-type autmat, but this time, t deal with the lk-ahead, we ru parallely the lk-ahead autmat. Let s dag be the miimal dag represetati f s, which ca be cmputed i O( s ) time. As explaied befre, the equality (r disequality) test f tw subtrees f s dag ca be carried ut i cstat time. Let V s be the set f des f s dag. Let V t be the set f des f t dag ad V = V t { }. The fuctis label(v), child(v, i), ad ρ(t) are defied as i the prf f Therem 4. Let A = 2 S i Q(i) V i V ad ru : T Σ V s P A (te the differece f the retur value f ru, cmpared t that i Therem 4) be the fucti defied as fllws ru(s ) = tr(s, σ, ru(s 1 ),..., ru(s k )) where the fucti tr is: with s = σ(s 1,..., s k ) tr(s, σ, (s 1, p 1, a 1 ),..., (s k, p k, a k )) = s, δ(s ), (q, v, v ) [ Q (i) V i V r R q,σ,p1,...,p k,e,d : i (s 1,..., s k ) satisfies E, D ad f v, a (r, v ). The defiiti f f v, a remais the same as i Therem 4. The lk-ahead state δ(s ) ca be cmputed frm σ, p 1,..., p k, ad s 1,..., s k i cstat time. By the same argumet as the case f rmal mtts, we btai the O( s t 2m+2 M ) time cmplexity. The crrectess f the cstructi is prved als i the same way as fr rmal mtts. That is, we ca prve the fllwig claim by ested iducti structure f s, ad the the structure f right-had sides f the rules. Claim Fr every iput tree s, we have the fllwig equati fr all q Q, r i T (Q TΣ ) Y, ad a evirmet Γ: ρ q, s (r 1,..., r ) M IO = v (q, (v1,..., v ), v ) ru(s ), v i ρ( r i M IO) fr all i Agai, applyig the claim t ρ( q 0, s M IO), we kw that the traslati membership is equivalet t (q 0, (), v ϵ) ru(s) where v ϵ is the rt de f t dag. Hece, the traslati membership ca be determied by cmputig the set ru(s). Ather extesi f mtts that admits a plymial time traslati membership is multi-retur mtts (mr-mtts) [9, 10]. I a mr-mtt, states may retur multiple trees (with the iitial state returig exactly e tree). Mr-mtts are strictly mre expressive tha rmal mtts, ad furthermre, have better clsure prperties uder cmpsiti with tpdw tree trasducers [10]. Defiiti 4. A multi-retur macr tree trasducer (mtt) M is a tuple (Q, Σ,, q 0, R, D), where Q, Σ,, ad q 0 are defied as fr mtts, D : Q N is the dimesi such that D(q 0 ) = 1, ad R is the fiite set f rules f the frm q, σ(x 1,..., x k ) (y 1,..., y m) r where q Q (m), σ Σ (k), ad r rhs D(q) X k where fr e 1 ad a set Q, the set rhs e W is defied as: r ::= l 1... l (u 1,..., u e ) ( 0) l ::= let (z j+1,..., z j+d(q )) = q, x i (u 1,..., u ) i (j N, q Q (), x i W ) with u 1, u 2,... T Ym Z. We usually mit paretheses arud tuples f size e, i.e., write like let z j = i u 1.
We require ay rule t be well-frmed, that is, the leftmst ccurrece f ay variable z i must appear at a bidig psiti (betwee let ad = ), ad the ext ccurrece (if ay) must appear after the i crrespdig t the bidig ccurrece. The set f right-had sides f such rules is deted by R q,σ. The size M f the mr-mtt is defied t be the sum f the size f right-had sides, i.e., the umber f δ, Y, Z, ad Q X des. The IO-sematics f mr-mtts is iductively defied as fllws. Fr u T Ym Z, u M IO T Y Z is δ(u 1,..., u k ) M IO = {δ(t 1,..., t e ) t i u i M IO fr all i} y i M IO = {y i} z i M IO = {z i } ad fr κ rhs e T Σ, κ M IO T e Y Z is (u 1,..., u e ) M IO = {(t 1,..., t e ) t i u i M IO fr all i} let (z 1,..., z d ) = q, σ(s 1,..., s m ) (u 1,..., u k ) i κ M IO = ξ[z 1 /t 1,..., z d /t d ] ξ κ M IO, r R q,σ, (t 1,..., t d ) r[x 1/s 1,..., x m/s m] M IO ( u 1 M IO IO,..., u k M IO). The traslati τ IO,M T Σ T realized by M is the set {(s, t) t let z = q 0, s i z } M IO. Here is a example f a mr-mtt, which is used i [9] as a cuterexample that cat be realized i rmal mtts: q 0, s(x) () let (z 1, z 2 ) = q 1, x (A(E)) i r(a(z 1 ), z 2 ) q 0, s(x) () let (z 1, z 2 ) = q 1, x (B(E)) i r(b(z 1 ), z 2 ) q 0, z () r(e, E) q 1, s(x) (y 2 ) let (z 1, z 2 ) = q 1, x (A(y 2 )) i (a(z 1 ), z 2 ) q 1, s(x) (y 2 ) let (z 1, z 2 ) = q 1, x (B(y 2 )) i (b(z 1 ), z 2 ) q 1, z (y 2 ) (e, y 2 ) This determiistic traslati takes as iput madic trees f the frm s(s( s(z) )) ad prduces utput trees f the frm r(t 1, t 2 ) where t 1 is a madic tree ver a s ad b s (ad a leaf e), ad t 2 is a madic tree ver A s ad B s such that t 2 is the reverse f t 1, ad bth have the same size as the iput. Fr istace, r(a(a(b(e))), B(A(A(E)))) is a pssible utput tree fr the iput s(s(s(z))). Csider the retur value f the state call q 1, s(z) (E) : it is the set {(a(e), A(E)), (b(e), B(E))} f pairs f trees. I a wrd, the state q 1 returs ly mutually reverse pairs f madic trees. This is impssible i rmal mtts, i which we must carry ut tw state calls i rder t btai tw utput trees; tw determiistic state calls are evaluated idepedetly, ad cat avid geeratig urelated pairs f trees. Despite their expressive pwer ver rmal mtts, mr-mtts still have a similar cmplexity fr iverse type iferece. Therefre the traslati membership remais i PTIME. Therem 7 Let M be a mr-mtt. Traslati membership fr τ IO,M ca be determied i time O( s t 2m+2d M ) where m is the maximum rak f the states ad d is the maximum dimesi. Prf. Fr mr-mtts, we take the set A f iverse-type autmat as A = 2 S i,j Q(i,j) V i V j where Q (i,j) is the set f states q f rak(q) = i ad D(q) = j. The ituiti f the set f states A is similar t the case f rmal mtts. That is, (q, v, w) ru(s ) meas that if q is applied t the iput subtree s with utput subtrees rted at v as parameters, the it may retur a tuple f utput subtrees w. The cstructi is quite similar t that f the prf f Therem 4. As a fial remark we wuld like t meti the cmplexity f traslati membership fr determiistic mtts; it ca be determied i liear time. Sice dmais f cmpsitis f mtts are regular, we ca factr ut the partiality ad have the fllwig decmpsiti: fr {IO, OI}, DMTT FTA ; DtMTT where FTA is the class f partial idetities whse dmai is regular (aalgus t Therem 6.18 f [6]). Therefre, t cmpute the traslati membership fr a cmpsiti f determiistic mtts, we first check i O( s ) time whether the give iput s is ctaied i the dmai f the traslati, ad the check the traslati membership fr cmpsiti f determiistic ad ttal mtts. Here, by Therem 15 f [12], fr a traslati τ DtMTT we ca cmpute the uique utput tree t τ(s) frm the iput s i time O( s + t ), ad durig the cmputati, the size f every itermediate tree is less tha r equal t 2 t. Hece, fr testig (s, t) τ, we simply cmpute τ(s); if the size f ay itermediate tree exceeds 2 t the (s, t) cat be a elemet f τ, ad therwise, we cmpare the cmputed tree τ(s) with t. The time cmplexity f the abve prcedure is O( s + 2 t ). Therem 8 Let {IO, OI} ad 1. membership fr DMTT is i O( s + 2 t ). Traslati 5. FUTURE WORK The cmplexity f the traslati membership prblem remais pe fr several iterestig subclasses ad extesis f mtts. Oe example is the mtt with hles [14] i IO mde. Nte that, similar t Therem 4.6 f [14], hle-mtts i IO mde are equal t MTT IO ; YIELD, which is icluded i MTT IO ; LDtMTT. A algrithm based iverse type iferece des t wrk, because the parameter part f the states f the iverse-type autmat is a set f fuctis [V V ], which is expetial i size with respect t the utput tree t. O the ther had, it is t clear either whether it is NP-hard. Nte that mtts with hles i OI mde ca simulate all OI-mtts, ad therefre their traslati membership is NP-cmplete. Ather iterestig class is that f 1-parameter mtts i OI mde. Our ecdig f 3-SAT used three parameters. I fact, the umber f parameters ca be reduced t tw by embeddig the ecdigs f blea variables i the iput tree s. Ca we ecde 3-SAT it a 1-parameter mtt? Or, d 1-parameter mtts actually have PTIME traslati membership? (Agai, the iverse-type autmat techique used i this paper fr IO-mtts des t seem t wrk i this case, because the autmat gets t large.) Ackwledgmets This wrk was partly supprted by Japa Sciety fr the Prmti f Sciece.
6. REFERENCES [1] B. Bgaert ad S. Tis. Equality ad disequality cstraits direct subterms i tree autmata. I Sympsium Theretical Aspects f Cmputer Sciece (STACS), 1992. [2] B. Curcelle. Madic secd-rder defiable graph trasductis: A survey. Theretical Cmputer Sciece, 126:53 75, 1994. [3] P. J. Dwey, R. Sethi, ad R. E. Tarja. Variatis the cmm subexpressi prblem. Jural f the ACM, 27:758 771, 1980. [4] J. Egelfriet ad S. Maeth. A cmparis f pebble tree trasducers with macr tree trasducers. Acta Ifrmatica, 39:613 698, 2003. [5] J. Egelfriet ad S. Maeth. Macr tree traslatis f liear size icrease are ms defiable. SIAM Jural Cmputig, 32:950 1006, 2003. [6] J. Egelfriet ad H. Vgler. Macr tree trasducers. Jural f Cmputer ad System Scieces, 31:71 146, 1985. [7] M. J. Fischer. Grammars with Macr-Like Prductis. PhD thesis, Harvard Uiversity, Cambridge, 1968. [8] M. R. Garey ad D. S. Jhs. Cmputers ad Itractability: A Guide t the Thery f NP-Cmpleteess. Freema, 1979. [9] K. Iaba ad H. Hsya. XML trasfrmati laguage based madic secd rder lgic. I Prgrammig Laguage Techlgies fr XML (PLAN-X), pages 49 60, 2007. [10] K. Iaba, H. Hsya, ad S. Maeth. Multi-retur macr tree trasducers. I Cferece Implemetati ad Applicati f Autmata (CIAA), 2008. [11] K. Iaba ad S. Maeth. The cmplexity f tree trasducer utput laguages. I Fudatis f Sftware Techlgy ad Theretical Cmputer Sciece (FSTTCS), 2008 (Available at http://arbre.is.s.u-tky.ac.jp/ kiaba/fst.pdf). [12] S. Maeth. The cmplexity f cmpsitis f determiistic tree trasducers. I Fudatis f Sftware Techlgy ad Theretical Cmputer Sciece (FSTTCS), 2002. [13] S. Maeth, A. Berlea, T. Perst, ad H. Seidl. XML type checkig with macr tree trasducers. I Priciples f Database Systems (PODS), 2005. [14] S. Maeth ad K. Naka. XML type checkig fr macr tree trasducers with hles. I Prgrammig Laguage Techlgies fr XML (PLAN-X), 2008. [15] S. Maeth, T. Perst, ad H. Seidl. Exact XML type checkig i plymial time. I Iteratial Cferece Database Thery (ICDT), 2007. [16] T. Mil, D. Suciu, ad V. Viau. Typecheckig fr XML trasfrmers. Jural f Cmputer ad System Scieces, 66:66 97, 2003. [17] T. Perst ad H. Seidl. Macr frest trasducers. Ifrmati Prcessig Letters, 89:141 149, 2004. [18] W. C. Ruds. Cmplexity f recgiti i itermediate-level laguages. I Fudatis f Cmputer Sciece (FOCS), 1973.