Automata for Analyzing and Querying Compressed Documents
|
|
- Ophelia Powers
- 6 years ago
- Views:
Transcription
1 Automt or Anlyzin nd Queryin Compressed Douments Brr Fil, Siv Annthrmn To ite this version: Brr Fil, Siv Annthrmn. Automt or Anlyzin nd Queryin Compressed Douments. Projet PRV (du LIFO), CATz. Rpport de reherhe LIFO <hl v3> HAL Id: hl Sumitted on 15 De 2006 HAL is multi-disiplinry open ess rhive or the deposit nd dissemintion o sientii reserh douments, whether they re pulished or not. The douments my ome rom tehin nd reserh institutions in Frne or rod, or rom puli or privte reserh enters. L rhive ouverte pluridisiplinire HAL, est destinée u dépôt et à l diusion de douments sientiiques de niveu reherhe, puliés ou non, émnnt des étlissements d enseinement et de reherhe rnçis ou étrners, des lortoires pulis ou privés.
2 Automt or Anlyzin nd Queryin Compressed Douments Brr FILA, LIFO, Orléns (Fr.) Siv ANANTHARAMAN, LIFO, Orléns (Fr.) Rpport N o
3 Automt or Anlyzin nd Queryin Compressed Douments Brr Fil, Siv Annthrmn LIFO - Université d Orléns (Frne), e-mil: {il, siv}@univ-orlens.r Astrt. In irst prt o this work, tree/d utomt re deined s extensions o (unrnked) tree utomt whih n run indierently on trees or ds; they n thus serve s tools or nlyzin or queryin ny semi-strutureddoument,whetherornotiveninompressedormt. In seond prt o the work, we present method or evlutin positive unry queries, expressed in terms o Core XPth xes, on ny d t representin n XML doument possily iven in ompressed orm; the evlution is done diretly on t, without unoldin it into tree. To eh Core XPth query o ertin si type, we ssoite word utomton; these utomt run on the rph o dependeny etween the non-terminls o the miniml strihtline reulr tree rmmr ssoited to the iven d t, or lon omplete silin hins in this rmmr. AnyivenpositiveCoreXPthquerynedeomposedintoquerieso the si type, nd the nswer to the query, on the d t, nthene expressed s su-d o t whose nodes re suitly leled under the runs o suh utomt. Keywords: Tree utomt, Tree rmmrs, Ds, XML, Core XPth. 1 Introdution Severl lorithms hve een optimized in the pst, y usin strutures over ds insted o over trees. Tree utomt re widely used or queryin XML douments (e.., [8, 9, 15, 16]); on the other hnd, the notion o ompressed XML doument hs een introdued in [2, 7, 12], nd possile dvnte o usin d strutures or the mnipultion o suh douments hs een rouht out in [12]. It is leitimte then to investite the possiility o usin utomt over ds insted o over trees, or queryin ompressed XML douments. D utomt (DA) were irst introdued nd studied in [5]; DA ws deined there s nturl extension o tree utomton, i.e. s ottom-up tree utomton runnin on ds; nd the lnue o DA ws deined s the set o ds tht et epted under (ottom-up) runs, deined in the usul sense; the emptiness prolem or DAs ws shown there to e NP-omplete, nd the memership prolem proved to e in NP; ut the prolem o stility under omplementtion o the lss o d utomt losely linked with tht o determiniztion ws let open. These two issues hve sine een settled netively in [1]: the reson is tht the set o ll terms (trees) represented y the set o ds epted y non-deterministi DA is not neessrily reulr tree lnue; onsequene is tht the lss o tree lnues reonized y DAs (s sets o epted ds) is strit superlss o the lss o reulr tree lnues. It is well-known however, tht nswers to MSO-deinle queries on (semi-)strutured trees orm reulr tree lnues ([18]); it is thus neessry to deine the lnues o DAs in mnner dierent rom tht o [5, 1], i they re to serve s tools or nlyzin nd queryin doument, independently o whether it is iven in (prtilly or ully) ompressed ormt, or s tree. Our irst im in this work is thereore to redeine the notion o the lnue o DA suitly, with suh n ojetive. 2
4 For hievin tht, we irst present (in Setion 2) the notion o ompressed doument s tree/d (trd, or short), desintin direted yli rph tht my e prtilly or ully ompressed. The terminoloy trd hs een hosen to distinuish it rom tht o td employed in [1]; this ltter term will e employed in this pper when reerrin to ully ompressed d. A Tree/D utomton (TDA, or short) is then deined s n utomton whih runs on trds. The essentil dierenes with the DAs o [1] re the ollowin: (i) our TDAs n e unrnked, nd (ii) lthouh the trnsition rules o TDA look quite like those o the DAs in [1], or those o TAs, run o TDA on ny iven trd t will rry with it not only ssinments o sttes to the nodes o t, ut lso to the edes o t; runs will e so deined tht TDA epts ny iven trd t i nd only i it epts the tree ˆt otined y unompressin t, stree utomton runnin on the tree ˆt, in the usul sense. In the seond prt o the pper, we present n pproh sed on word utomt or evlutin queries on trds tht represent XML douments in prtilly or ully ompressed ormt; the terms trd nd doument will thereore e onsidered synonymous in the sequel. Any iven trd t is irst seen s equivlent to miniml strihtline reulr tree rmmr L t, tht one n nturlly ssoite with t,. e.., [3, 4]. From the rmmr L t,weonstrut the rph o dependeny D t etween its non-terminls, nd lso the hilins (liner rphs ormed o omplete hins o silin non-terminls) o L t.the word utomt tht we uild elow will run on D t or the hilins o L t,rther thn on the doument t itsel. We shll only onsider positive unry queries expressed in terms o Core XPth xes. (The view we dopt llows us to deine the vrious xes o Core XPth on ompressed douments, in mnner whih does not modiy their semntis on trees.) For evlutin ny suh query on ny doument (trd) t, we proeed s ollows. We irst rek up the iven query into si su-queries o the orm Q= //*[xis::] where xis is Core XPth xis o ertin type. To eh suh si query Q, we ssoite word utomton A Q.The utomton A Q runs on the rph D t when xis is non-silin, nd on the hilins o L t when xis is silin xis. An essentil point in our method is tht the runs o A Q re uided y some well-deined semntis or the nodes trversed, inditin whether the urrent node nswers Q, or is on pth ledin to some other node nswerin Q. The utomton is not deterministi, ut its runs re mde eetively unmiuous y deinin suitle priority reltion etween the trnsitions, sed on the semntis. A si query Q n then e evluted in one sinle top-down pss o A Q, under suh n unmiuous run. An ritrry positive unry Core XPth query n e evluted on t y ominin the nswers to its vrious si su-queries, nd its nswer set is expressed s su-trd o t, whose nodes et leled in onormity with the semntis. It is importnt to note tht the evlution is perormed on the iven trd t; s suh, on two dierent trds orrespondin to two dierent ompressions o sme XML tree, the nswers otined my not e the sme, in enerl. The pper is strutured s ollows: Setion 2 presents the notions o trds, nd o Tree/D utomt. In Setion 3, we onstrut rom ny trd t its normlized strihtline reulr tree rmmr L t, s well s the dependeny rph D t nd the hilins o L t ; these will e seen s rooted leled yli rphs (rls, or short); the si notions o Core XPth re lso relled. Setion 4 is devoted to the onstrution o the word utomt or ny si Core XPth query, sed on the semntis, nd n illustrtive exmple. In Setion 5 we prove tht the runs o these utomt, uniquely nd eetively determined under mximl priority ondition, enerte the nswers to the queries. Setion 6 shows how non si (omposite, or imrited) Core XPth query n e evluted 3
5 in stepwise shion. In Setion 7, we show how to reine our pproh, so s to derive rom the nswer or ny iven Core XPth query Q on trd t, the nswer set or the sme query Q on the tree-equivlent ˆt o t (without resortin to ny unompressin opertion). In the ppendies, we show how to trnslte the usul Core XPth queries into one in stndrd orm on whih our pproh is pplile; this trnsltion is done in liner time on the size o the iven query; we lso present n lorithm or onstrutin the mximl priority run, or ny si query utomton over ny iven doument (trd), with omplexity ound o O(m), where m is the numer o edes o the rl D t ssoited to the trd. (Note: the numer m o edes on D t n e exponentilly smller thn the numer o edes on the trd t. Whent is tree, D t is isomorphi to t, sothe omplexity o our lorithm redues to O(n), where n is the numer o nodes on the tree t.) A omplete illustrtive exmple, on omposite imrited query, is iven in the lst ppendix. 2 Tree/D Automt Deinition 1 A tree/d (trd or short) over not neessrily rnked lphet Σ is rooted d (direted yli rph) t =(Nodes(t),Edes(t)), where, or ny node u Nodes(t): - u hs nme nme t (u) =nme(u) Σ; - the edes oin out o ny node re ordered; -ndinme(u) is rnked, then the numer o outoin edes t u isthernkonme(u). (Itisssumedthtnytrdtis onneted, nd hs unique root node.) Given ny node u on trd t, the notion o the su-trd o t rooted t u is deined s usul, nd denoted s t u.iv is ny node, γ(v) =u 1...u n will denote the strin o ll its not neessrily distint hildren nodes; or every 1 i n, the i-th outoin ede rom v to its i-th hild node u i γ(v) will e denoted s i e(v, i); we shll lso write then v u i ; the set o ll outoin (resp. inomin) edes t ny node v will e denoted s Out v (t), or Out v (resp. In v (t), or In v ); nd or ny node u, weset:prents(u) ={v Nodes(t) u is hild o v}. Atrdt is sid to e tree i In v (t) isemptyiv is root, nd In v (t) is sinleton otherwise. On ny trd t, wedeinethesetpos(t) stheseto ll the positions pos t (u) o ll its nodes u, these ein deined reursively, s ollows: i u is the root node on t, thenpos t (u) =ɛ, otherwise,pos t (u) ={α.i α pos t (v),v is prent o u, u is n i-th hild o v}. ThesetPos(t) onsists o (some o the) words over nturl inteers. To ny ede e : u i v on trd t, is nturlly ssoited the suset pos t (e) =pos t (u).i o Pos(t). The untion nme t is extended nturlly to the positions in Pos(t) sollows: or every u Nodes(t) ndα pos t (u), we set nme t (α) =nme t (u). Given trd t, we deine its tree-equivlent s tree ˆt suh tht: Pos(ˆt) = Pos(t), nd or every α Pos(t) wehvenme t (α) =nmeˆt (α). It is immedite tht ˆt is uniquely determined, up to tree isomorphism; it n tully e onstruted nonilly (. [7]), y tkin or nodes the set Pos(t), nd or direted edes the set {(α, α.i) α, α.i Pos(t)}, ehnodeα ein nmed with nme t (α). There is then nturl, nme preservin, surjetive mp rom Nodes(ˆt) ontonodes(t); it will e reerred to in the sequel s the ompression mp, nd denoted s. A trd is sid to e td,orully ompressed, i or ny two dierent nodes u, u on t, the two su-ds t u nd t u hve non-isomorphi tree-equivlents; otherwise, the trd is sid to e prtilly ompressed when it is not tree. For exmple, the tree to the let o Fiure 1 is the tree-equivlent o the prtilly 4
6 ompressed trd to the riht, nd lso to the ully ompressed td to the middle. Tree Fully Compressed Prtilly Compressed Fi. 1. tree, td, nd trd We deine now the notion o Tree/D utomton, irst over rnked lphet Σ, to ilitte understndin. The deinition is then esily extended to the unrnked se. Deinition 2 A Tree/D utomton (TDA, or short) over rnked lphet Σ is tuple (Σ,Q,F,Δ), whereq is inite non-empty set o sttes, F Q is the set o inl (or eptin) sttes, nd Δ is set o trnsition rules o the orm: (q 1,..., q k ) q, where Σ is o rnk k, ndq 1,...,q k,q Q. It will e onvenient to write the trnsition rules o TDA in dierent (ut equivlent) orm: trnsition o the orm (q 1,...,q k ) q is lso written s (,q 1...q k ) q, whereq 1...q k is seen s word in Q,olenth=rnk() in the rnked se. The notion o TDA is then extended esily to the unrnked se, i.e., where the sinture symols nmin the nodes re not ssumed to e o ixed rnk: it suies to deine the trnsitions to e o the orm (,ω) q, where ω is reulr expression on the lphet set Q. A TDA is sid to e ottom-up deterministi i whenever there re two trnsition rules o the orm (,ω) q, (,ω ) q,withq q,wehve neessrily ω ω = ; otherwise it is sid to e non-deterministi. We lso ree to denote the trnsitions o the orm (, ) q simply s q, ndreerto them s initil trnsitions. For deinin the notion o runs o TDAs on trd in ottom-up style, we need some preliminries. Let A e TDA with stte set Q nd trnsition set Δ. Suppose t is trd nd ssume iven mp M : Edes(t) Q. Iu is ny node on t with u 1...u n s the strin o ll its (not neessrily distint) hildren, the strin M(e(u, 1))...M(e(u, n)) Q, ormed o sttes ssined y M to the outoin edes t u, will e denoted s M(Out u ). We then deine, reursively in ottom-up style, inry reltion t u on the sttes o Q, with respet to (w.r.t. or wrt, or short) the iven mp M; this reltion, denoted s M u = u,is deined s ollows: Deinition 3 Let A,t,M e s ove, nd u ny iven node on the trd t. I u is le with nme(u) =,thenq u q i whenever q Δ we lso hve q Δ; otherwise q u q i: (i) (nme(u),m(out u )) q is n instne o trnsition rule in Δ; i.e., Δ hs rule (nme(u),ω) q suh tht M(Out u ) is in ω; (ii) there exists mp q : Q Q, suh tht: 5
7 - q (q) =q,ndtherule(nme(u), q (M(Out u ))) q is lso n instne o trnsition rule in Δ; - or ny ede e : u i u Out u, we hve: M(e) u q (M(e)). Deinition 4 Let A =(Σ,Q,F,Δ) e ny iven TDA, nd t ny iven trd. A run o A on t is pir (r, M ), wherer : Nodes(t) Q nd M : Edes(t) Q re mps suh tht the ollowin onditions hold, t ny node u on t: (1) i nme(u) =, then the rule (,M(Out u )) r(u) is n instne o trnsition rule in Δ; (2) thereisninominedee In u with M(e) =r(u); nd or every e In u suh tht M(e )=q q = r(u), we hve q M u q Arun(r, M ) is eptin on trd t i r(ɛ) F, i.e, r mps the root-node o t to n eptin stte. A trd t is epted y TDA i there is n eptin run on t. The lnue o TDA is the set o ll trds tht it epts. Remrk 1. i)notethtit is tree, then In u is sinleton t every non-root node u on t, sorun(r, M )onytdaont n e identiied with its irst omponent r; we et then the usul notion o runs o tree utomt on trees. Exmple 1. Over the unrnked sinture {,, } onsider TDA A, withthe ollowin trnsitions: p, q, p, q, (, p) q, (, q) p, (, q ) q, (, q Q ) q, (, p q) p, (, q pq) q in, (, pq ) q in, with Q = {p, q, q,q in },ndq in s the unique eptin stte. An eptin ottom-up run o A on td is depited on the let o Fiure 2, nd on its riht, the sme run s seen on the tree equivlent o the td. q in q in p q p p p q q p q p q q p q q q q p Fi. 2. A ottom-up eptin run o the TDA o Exmple 1 on trd, nd the sme seen on its tree equivlent. A ew omments on the ove run my e o help: we strt with ssinin stte q to the le node, under r; the ssinments o stte q under M to ll the inomin edes t this node poses no prolem; we n then ssin stte p to node, nd susequently lso p to the node, under r, vi the trnsition rule (, pq) p; we then ssin p under M to the irst inomin ede t ; tossin stte q under M to the seond inomin ede t, we just need to hek tht: - or mp : Q Q suh tht (p) =q, (q) =p,therule(, (p)(q)) q is n instne o trnsition rule o the TDA; 6
8 - or the outoin ede, leled with p y M, wehvep q = (p); - or the outoin ede, leled with q y M, wedohveq p = (q); rehin q in t the root-node is trivil vi the lst trnsition rule. (Note tht we ould hve s well ssined p under M to the seond inomin ede t, with no onditions to hek, then reh q in.) Remrk 1 (ontd.). ii) Unlike the DAs o [5] or [1], the ollowin ottom-up non-deterministi TDA: q 1, q 2,(q 1,q 2 ) q,withq 0,q 1,q s sttes where q is eptin, hs non-empty lnue: s TDA it epts (, ). For deterministi TDA, we hve the ollowin result (s expeted): Proposition 1 Let A e ottom-up deterministi TDA, nd t ny iven trd; then there is t most one run o A on t. Proo. Let Q e the set o sttes o A, ndm : Edes(t) Q ny iven mp ssinin sttes to the edes on t. We shll show y indution tht the hypothesis o determinism on A implies tht, t ny node u on t, the inry reltion M u = u deined ove (Deinition 3), w.r.t. the mp M, istheidentity reltion on the set Q. The proposition will then ollow rom onditions (1) nd (2) on runs,. Deinition 4; we will et, in prtiulr, tht or every inomin ede e t u, M(e) must e the sme s r(u); so the run n e identiied with its irst omponent r (s on tree). The indution will e on non-netive inteer d u, tht we deine t ny node u o t ndreertositsheiht on t s the mximl numer o rs on t rom u to the le nodes. I d u =0,thenu is le node; tht u is the identity reltion on Q in this se is immedite, rom the determinism o A, nd the deinition o u. So, ssume tht d u > 0, nd let v 1...v n e the strin o ll the hildren nodes o u on t. By the indutive hypothesis, or every i, 1 i n, the reltion vi is the identity reltion on Q; it ollows then, rom the onditions (i) nd(ii) onthereltion u (Deinition 3), tht this ltter must lso e the identity reltion on Q. We my now ormulte the prinipl result o the irst prt o this pper: Proposition 2 A TDA epts trd t i nd only i it epts the tree equivlent o t. Proo. Let ˆt e the tree equivlent o the trd t, nd the nturl surjetive ompression mp rom Nodes(ˆt) onto Nodes(t). For provin the only i prt o the ssertion, one uses the ollowin resonin, oupled with indution on the heiht untion t the nodes o t (deined in the proo o the previous proposition): Let (r, M ) e n eptin run o the iven TDA on the trd t; onsider node s on the tree equivlent ˆt, owhih the node u on t is the ime under the ompression mp ; letr(u) =q under the iven run o the TDA on t; then, or every stte q o the TDA suh tht q M u q, one n onstrut prtil run o the TDA seen s usul tree utomton on the tree ˆt, limin up rom le elow s on ˆt to the node s, nd ssinin the stte q to this node (or n illustrtive exmple, see the tree to the riht o Fiure 2). Provin the i prt o the ssertion is little more omplex. We strt with iven eptin run ˆρ o the iven TDA, s ottom-up tree utomton runnin in the usul sense on the tree ˆt; rom this run ˆρ, we shll onstrut run (r, M ) o the TDA on the trd t, y n indutive, top-down trversl o the td t; or this top-down trversl, we will e usin n inteer vlued untion deined t ny node u o t nd reerred to s its depth on t s the mximl numer o rs on t rom the root node on t to the node u. We shll lso use the t tht the 7
9 nodes o ˆt re in nturl ijetion with the set Pos(t) o positions on t. The topdown onstrution o the run (r, M ) is done y the ollowin pseudo-lorithm, where d stnds or the mximl depth on t t its le nodes. BEGIN /* deine irst r t the root node on t, nd M on its outoin edes */ r(ɛ t )=ˆρ(ɛˆt ); For every outoin ede e j, 1 j k, t ɛ t, set M(e j )=ˆρ(ɛ.j); i =1; /* Now o down */ while (i <d) do { For every node u t depth i do { hoose e In u (t), nd α pos t (e) suh tht M(e) =ˆρ(α); set r(u) =M(e); For every e j Out u (t), 1 j m, outoin rom u, set M(e j )=ˆρ(α.j); } i = i +1; } END. It is not diiult to hek then, tht y onstrution, the pir o mps (r, M ) ives n eptin run o the TDA on the trd t. We illustrte here the resonin employed in the proo o the i prt o the ove proposition, with the td t o Exmple 1. We strt with the run ˆρ on its tree-equivlent ˆt, s depited to the riht o Fiure 2. At strt, to the root node on t (t depth 0) is ssined the stte q in, nd to its three outoin edes, re ssined the three sttes p, q, q respetively; t, whih is the only node on t t depth 1, we hoose the irst inomin ede (o position 1, nd leled with p y M), nd set r(u) =ˆρ(1) = p; the two outoin edes t on t hve s positions the sets {11, 21}, {12, 22} respetively; to these two outoin edes t on t, we ssin the sttes tht ˆρ ssins to the two sons o the node t position 1 on ˆt, nmelyp, q respetively (this mens in essene tht we hve seleted the positions 11 nd 12 on the two outoin edes t on t); next, we o to depth 2 on t, where is the unique node, to whih we then hve to ssin the stte ˆρ(11) tht M hs lredy ssined to its inomin ede; the rest o the resonin is ovious, so let out. Remrk 2. i)lett t e two iven trds suh tht Pos(t )=Pos(t), nd there is nme preservin surjetive mp rom Nodes(t )ontonodes(t). We n then deine t to e ompression, or ompressed orm, o t ;ndreertot s n unompressed equivlent o t, nd to the surjetive mp on Nodes(t ) s ompression mp. It is esily heked tht t nd t hve then the sme tree-equivlent; nd it ollows rom Proposition 2 ove tht ny iven TDA A epts t i nd only i it epts t. It is leitimte then, to deine the lnue o TDA s the set o ll tds tht it epts (or trees tht it epts), or s the set o ll trds epted, up to tree-equivlene. ii) Unrnked trees re oten studied in the literture y trnsormin them into rnked inry trees, usin the well-known irst-hild, next-silin enodin or the trnsormtion (done in liner time wrt the numer o nodes o the iven tree). However, suh n enodin is meninless on trds, sine node n stnd or severl distint nodes o its tree-equivlent, nd the notions o irst-hild nd next-silin n e meninul on trds only when reerrin to the position sets o the nodes. Wht the ove proposition sys is tht tree utomt n run on trds without ny need or trnsormin the trd into (rnked) tree, 8
10 or trnsormin the utomton itsel in some wy. In prtiulr, the unrnked query utomt, e.., s deined in [8], n e used or queryin semi-strutured douments tht re iven in the orm o trds. However, we shll propose, in the setions to ome. n entirely dierent pproh or query evlution on trds. 3 Queryin Compressed Douments: Preliminries Given trd t, one n nturlly onstrut reulr tree rmmr ssoited with t, whihisstrihtline (. [4]), in the sense tht there re no yles on the dependeny reltions etween its non-terminls, nd eh non-terminl produes extly one su-trd o t. Suh rmmr will e denoted s L t,iitis normlized in the ollowin sense: (i) or every non-terminl A i o L t, there is extly one prodution o the orm A i (A j1,...,a jk ), where i<j r or every 1 r k; weshllthenset Sons(A i )={A j1,...,a jk },ndsym Lt (A i )=; (ii) the numer o non-terminls is the numer o nodes on t. Suh normlized rmmr L t is uniquely deined up to renmin o the nonterminls. For instne, or the trd t to the let o Fiure 3 we et the ollowin normlized rmmr: A 1 (A 2,A 3,A 4,A 5,A 2 ), A 2, A 3 (A 5 ), A 4, A 5. Suh rmmr is esily onstruted rom t, or instne y usin stndrd lorithm whih omputes the depth o ny node (s the mximl distne rom the root), to numer the non-terminls so s to stisy ondition (i) ove. t: D t : A _ 1 (, ) A 2 (, _ ) A (, _ 3 ) A, _ 4 ( ) A 5 (, F 1 : A 2 (, _ ) A (, _ 3 ) A, _ 4 ( ) A 5 (, A 2 (, _ ) F 0 : A 1 (, F3: A 5 (, Fi. 3. trd t, ssoited rl D t, nd hilins o L t The dependeny rph o the normlized rmmr L t ssoited with t, nd denoted s D t, onsists o nodes nmed with the non-terminls A i, 1 i n, nd one sinle direted r rom ny node A i tonodea j whenever A j is son o A i. The root o D t is y deinition the node nmed A 1. The notion o Sons o the nodes on D t is derived in the ovious wy rom tht deined ove on L t. Furthermore, to ny prodution A i (A j1,...,a jk )ol t, we ssoite rooted liner rph omposed o k nodes respetively nmed A j1,...,a jk,with root t A j1 nd suh tht or ll l {2,...,k} the node nmed A jl is the son o the node nmed A jl 1. This rph will e lled the hilin o L t ssoited with the (unique) A i -prodution; it is denoted s F i. We lso deine urther hilin denoted F 0, s the liner rph with sinle node nmed A 1,whereA 1 is the xiom o L t. In the sequel, we desinte y G either D t or ny o the hilins F o L t. We omplete ny o these yli rphs G into rooted leled yli rph (rl, or short), y tthin to eh node u on G, withnme(u) =A i,lel denoted lel(u),nddeinedslel(u)=(sym Lt (A i ), );. Fiure 3. 9
11 3.1 Positive Core XPth Queries on trds In this pper we restrit our study to positive Core XPth queries on trds. Rell tht Core XPth is the nvitionl sement o XPth, nd is sed on the ollowin xes o XPth (. [10, 19]): sel, hild, prent, nestor, desendnt, ollowin-silin, preedin-silin. A lotion expression is deined s predite o the orm [xis::], wherexis is one o the ove xes, nd is symol o Σ. Given ny trd t over Σ, ontext node u on t nd Σ, thesemntisorxis is deined y evlutin this predite t u. Thesemntisorthexessel, hild, desendnt re esily deined, extly s on trees (. [19]). For deinin the semntis o the reminin xes, we irst rell tht Prents(u) ={v Nodes(t) u is hild o v}. Deinition 5 Given ontext node u on trd t, nd Σ: i) [prent::] evlutes to true t u, i nd only i there exists -nmed node in Prents(u); ii) [nestor::] evlutes to true t u, ieither[prent::] evlutes to true t u, orthereexistsnodev Prents(u) suh tht [nestor::] evlutes to true t v; iii) [ollowin-silin::] evlutes to true t u, i there exists -nmed node u,ndnodev on t suh tht γ(v) is o the orm...u...u...; iv) [preedin-silin::] evlutes to true t u, i there exists -nmed node u,ndnodev on t suh tht γ(v) is o the orm...u...u... For the omposite xes desendnt-or-sel nd nestor-or-sel, the semntis re then dedued in n ovious mnner. We shll lso need position predites o the orm [position()= i]; their semntis is tht the expression [hild:: [position()= i]] evlutes to true t ontext node u, i: [hild::] evlutes to true t u, ndu is n i-th hild o some prent. Positive Core XPth query expressions re usully deined in the literture (. e.., [7]), s those enerted y the ollowin rmmr: A ::= sel hild desendnt prent nestor preedin-silin ollowin-silin S n ::= A:: position()= i S n nd S n S n or S n E n ::= A:: [S n ] E n [E n ] Q n ::= /S n /E n Q n /Q n We shll reer to the query expressions enerted y this rmmr s nonil; they n e shown to e o the type /C 1 /C 2 /.../C n,whereehc i is o the orm A::[X n ],orotheorma::[x n ] onn A :: [X n ],with onn {nd, or}, ndx n,x n {S n,e n,true}; we ree here to identiy A::[true] with A::. Any suh positive Core XPth query expression n e trnslted into one tht is in stndrd orm, i.e., where the ormt o the su-queries is o the type xis:: ; we ormlize this ide now. We shll reer to the xes sel, hild, desendnt, prent, nestor, preedin-silin, ollowin-silin s si. A si Core XPth query is query o the orm //*[xis::], where xis is si xis. More enerlly, the queries we propose to evlute on trds re deined ormlly s the expressions Q std enerted y the ollowin rmmr, where stnds or ny node nme on the douments, or or (menin ny ): A ::= sel hild desendnt prent nestor preedin-silin ollowin-silin S ::= A:: position()= i S nd S S or S Root E ::= A:: [S] E[E] Q std ::= //* //*[S] //*[E] Core XPth queries Q std o the ormt enerted y this rmmr re sid to e in stndrd orm; to e le to hndle ny positive Core XPth query with 10
12 suh rmmr, we hve introdued speil predite lled Root, deemed true only t the root node o the trd onsidered. By the evlution o iven query expression Q on ny trd t, wemen the ssinment: t the set o ll ontext nodes on t where the expression Q evlutes to true (ollowin the onventions o Deinition 2); this ltter set is lso lled the nswer or Q on t. TwoivenqueriesQ 1,Q 2 re sid to e equivlent i, on ny trd t, the nswer sets or Q 1 nd Q 2 re the sme. Any positive Core XPth query Q n n e trnslted into n equivlent one in stndrd orm; e.., /[ollowin-silin::]/d is equivlent to //*[sel::d nd prent::*[root nd sel:: [ollowin-silin::]]] in stndrd orm. An indutive proedure perormin suh trnsltion in the enerl se (o liner omplexity w.r.t. the numer o lotion steps in Q n ) is iven in Appendix I. The ollowin proposition results rom Deinition 5. Proposition 3 (1) For ny set o nodes X on trd t, ndnyxisa, we hve: A(X) = {/hild:: [position()= i 1 ]/.../hild:: [position()= i k ]/A:: } x X, α pos t (x) α = i 1...i k (2) For ny trd t, nd ny node with nme on t, we hve: (i) //*[preedin::] = {desendnt-or-sel(ollowin-silin( u //*[sel::u nd(desendnt:: or sel::)] ))} (ii) //*[ollowin::] = {desendnt-or-sel(preedin-silin( u //*[sel::u nd(desendnt:: or sel::)] ))} Finlly, ollowin [2], or ny set S o nodes on t, the sets o nodes ollowin(s) nd preedin(s) n now e deined ormlly, s ollows: ollowin(s) = desendnt-or-sel(ollowin-silin(nestor-or-sel(s))), preedin(s) = desendnt-or-sel(preedin-silin(nestor-or-sel(s))). Note: Unlike on tree, the nestor, desendnt, ollowin, sel nd preedin xes do not prtition the set o nodes on trd t, in enerl. 4 Automt or the Bsi Core XPth Queries 4.1 The Semntis o the Approh We irst onsider si Core XPth queries. Composite or imrited queries will susequently e evluted in stepwise shion; see Setion 6. To ny si query Q = //*[xis::], we shll ssoite word utomton (tully trnsduer), reerred to s A Q. It will run top-down, on the rl D t i xis is non-silin, nd on eh o the hilins F o L t otherwise. In either se, run will tth, to ny node trversed, pir o the orm ( l,x), where the omponent l o the pir hs the intended semntis o seletion or not, y Q, o the orrespondin node on t, nd the omponent x will e 1 or 0, with the intended semntis tht x = 1 i the orrespondin node on t hs desendnt nswerin Q. At the end o the run, lel(u), t ny node u o D t, will e repled y new lel derived rom the ll-pirs tthed to u y the run. To ormlize these ides, we introdue set o new symols L = {s, η,, } reerred to s llels (the term llel is used so s to void onusion with the term lel). We deine ll-pirs s elements o the set L {0, 1}, nd the sttes o 11
13 A Q s elements o the set {init} (L {0, 1}). For ny Q, the utomton A Q is over the lphet Σ {s, η}, hsinit s its initil stte, nd hs no inl stte. The set Δ Q o trnsitions o A Q will onsist o rules o the orm (q, τ) q where q {init} (L {0, 1}), q (L {0, 1}), nd τ Σ {s, η}. For ny rl G, we deine untion ll: Nodes(G) Σ {s, η}, y settin ll(u) =π 1 (lel(u)), the irst omponent o lel(u). The utomton A Q ssoited to si query Q =//*[xis::] will run top-down on the rl G, where G is D t i xis is si non-silin xis, nd G is ny hilin F o L t i xis is si silin xis. A run o A Q on G is mp r : Nodes(G) L {0, 1}, suh tht, or every u Nodes(G), the ollowin holds: -iu is root G, then the rule (init, ll(u)) r(u) isinδ Q ; - otherwise, or every v γ(u) therules(r(u), ll(v)) r(v) rellinδ Q. (Note: when xis is non-silin, this mounts to requirin tht, or ny node v, the stte r(v) must e in onormity with the sttes r(u) orevery prent node u o v, with respet to the rules in Δ Q.) From the run o the utomton A Q nd rom the sttes it tthes to the nodes o D t, we will dedue, t every node u o t, well-determined ll-pir s ( new) lel t u, vi the nturl ijetion etween Nodes(t) ndnodes(d t ). The ll-pirs thus tthed to the nodes o t will hve the ollowin semntis (where x stnds or the nme o the node u on t, orrespondin to the urrent node on D t ): -(, 1) : x =, urrent node on t is seleted y (i.e., is n nswer or) Q; -(, 1) : x =, urrent node is not seleted, ut hs seleted desendnt; -(, 0) : x =, urrent node is not seleted, nd hs no seleted desendnt; -(s, 1) : x, urrent node is seleted; -(η, 1) : x, urrent node is not seleted, ut hs seleted desendnt; -(η, 0) : x, urrent node is not seleted, nd hs no seleted desendnt. Only the nodes on D t, to whih the run o A Q ssoites the lels (s, 1) or (, 1), orrespond to the nodes o t tht will et seleted y the query Q. The ll-pirs with oolen omponent 1 will lel the nodes o D t orrespondin to the nodes o t whihreonpthtonnswerorthequeryq; thusthe utomt A Q will hve no trnsitions rom ny stte with oolen omponent 0 to stte with oolen omponent 1. Moreover, with view to deine runs o suh utomt whih re unique (or unmiuous in sense tht will e presently mde ler), we deine the ollowin priority reltions etween the llpirs: (η, 0) > (η, 1) > (s, 1), nd (, 0) > (, 1) > (, 1). A run o the utomton A Q will lel ny node u on G with n ll-pir either rom the roup {(, 0), (, 1), (, 1)} or rom the roup {(η, 0), (η, 1), (s, 1)}; nd this roup is determined y ll(u). For ese o presenttion, we ree to set η := s, nd oten denote either o the ove two roups o ll-pirs under the uniorm nottion {(l, 0), (l, 1), (l, 1)}, where l {η, }, with the orderin (l, 0) > (l, 1) > (l, 1). We shll onstrut run r o A Q on G tht will e uniquely determined y the ollowin mximl priority ondition: (MP): t ny node v on G, r(v) is the mximl ll-pir ( l,x)ortheorderin> in the roup {(l, 0), (l, 1), (l, 1)} determined y ll(v), suh tht A Q ontins trnsition rule o the orm (r(u), ll(v)) ( l,x), or every prent u o v. Suh run will ssin lel with oolen omponent 1 only to the nodes orrespondin to those o the miniml su-trd t ontinin the root o t nd ll the nswers to Q on t. 12
14 4.2 Re-lelin o D t y the Runs o A Q We irst onsider non-silin si query Q on iven doument t, ndiven run r o the utomton A Q on the D t ; t the end o the run, the nodes on D t will et re-leled with new ll-pirs, omputed s elow or every u Nodes(D t ): l r (u) =(s, 1) i r(u) {(s, 1), (, 1)}, l r (u) =(η, 1) i r(u) {(η, 1), (, 1)}, l r (u) =(η, 0) i r(u) {(η, 0), (, 0)}. The rl otined in this mnner rom D t, ollowin the run r nd the ssoited re-lelin untion l r, will e denoted s r(d t ). For si query Q over silin xis, the sitution is little more omplex, euse severl dierent nodes on one hilin o L t n hve the sme nme (non-terminl), or severl dierent hilins n hve nodes nmed y the sme non-terminl, or oth. Thus, to ny node o D t, nmed with non-terminl A, will orrespond in enerl set o ll-pirs, ssined y the vrious runs o A Q to the A-nmed nodes on the vrious hilins o L t. We thereore proeed s ollows: or every omplete set r o runs o A Q,ormedoonerunr F on eh hilin F, we will deine r(d t ) s the re-leled rl derived rom D t, under r. With tht purpose we ssoite to r nd ny u Nodes(D t ), set o ll-pirs: ll r (u) = {r F (v) v Nodes(F), nd nme(v) =nme(u)}. r F r We then derive, t eh node o D t unique ll-pir in onormity with the semntis o our pproh, y usin the ollowin untion: λ r (u) =s ll r (u) {(s, 1), (, 1)}, λ r (u) =η ll r (u) {(s, 1), (, 1)} =. From D t nd this untion λ r, we next derive n rl λ r (D t ) y re-lelin eh node u on D t with the pir (λ r (u), ). And inlly we deine r(d t )sthe rl otined rom λ r (D t ), y runnin on it the utomton or the si nonsilin query //*[sel::s], s indited t the einnin o this susetion. In prtil terms, suh run mounts in essene to settin, s the seond omponent o lel(u) t ny node u,theoolen1iuison pth to some node with ll s, nd 0 otherwise. All these detils re illustrted with n exmple in the ollowin susetion. 4.3 The Automt We irst present the utomt or the si queries //*[sel::] nd or //*[ollowin-silin::], nd ive n illustrtive exmple usin the ormer or = s, nd the ltter or =. The utomt or the other si queries re iven ter the exmple. Automt: or //*[sel::] nd or //*[ollowin-silin::] γ= init γ= η, 1 γ= γ= γ= γ= η, 0 T, 1 γ= init T, 1 η, 0 T, 0 s, 1 Fiure 4 elow illustrtes the evlution o Q = //*[ollowin-silin::], on the trd t o Fiure 3. We irst use the utomton or the si query 13
15 //*[ollowin-silin::] with =, nd then the utomton or //*[sel::] with = s. The su-trd o t, ormed o nodes orrespondintothoseo r(d t ) with lels hvin oolen omponent 1, ontins ll the nswers to Q on t. r 1 on F 1 : A 2 (, _ ) A (, _ 3 ) A, _ 4 ( ) A 5 (, A 2 (, _ ) ( s, 1 ) ( s, 1) (T,1) ( T, 0) ( η, 0) r0 on F0 : A _ 1 (, ) (η, 0) r 3 on F 3 : A 5 (, ( T, 0) r 0 r 1, r 3, on D t : (η, 0) A 1 (, A 2 (, _ ) A (, _ 3 ) A, _ 4 ( ) ( s, 1 ) ( s, 1) (T,1) ( η, 0) ( T, 0) A 5 (, D t ) λ r ( : A 1 ( η, _ ) run o the utomton or //*[sel : : s] on ( η, 1) A 1 ( η, _ ) inl re leled λ r ( D ): t rl:r(d t ) A 1 ( η, 1) A 2 (, _ ) s A 3 (, s _ ) A 4 (s, (, _ ) A 2 s (T,1) A 3 s (T,1) (, _ ) A 4 ( s, A2 (,) s 1 A 3 (,) s 1 A 4 ( s, 1) (T,1) A 5 (η _, ) (η, 0) A 5 (η _, ) A 5 (η, 0) Fi. 4. Automton or the query //*[prent::] init η, 1 η, 0 T, 0 T, 1 s, 1 T, 1 14
16 Automton or the query //*[nestor::] T, 1 γ= γ= γ= T, 1 η, 1 init T, 0 γ= s, 1 γ= γ= γ= η, 0 γ= γ= Automton or the query //*[hild::] T, 1 init T, 0 η, 0 η, 1 T, 1 s, 1 Automton or the query //*[preedin-silin::] s, 1 η, 1 init T, 1 T, 0 η, 0 T, 1 15
17 Automton or the query //*[desendnt::] init γ= γ= T, 1 T, 0 γ= η, 0 γ= γ= γ= s, 1 γ= γ= A ew words on some o the utomt y wy o explntion. First, the reson why the utomton or sel does not hve the sttes (, 0), (, 1), (s, 1): or (, 0), (, 1), y the semntis o susetion 4.1 wemusthvex =, where x is the nme o the urrent node on t, ut then the query //*[sel::] should selet the urrent node, so one nnot e t suh stte; s or (s, 1), the resonin is just the opposite. Next, the reson why the utomton or desendnt does not hve the sttes (η, 1), (, 1): i the semntis ttriute one o these pirs to ny node u, tht would men the node u hs seleted desendnt u ; whih mens tht u hs some -desendnt node, whih would then e -desendnt or u too, so Q should selet u. 5 Mximl Priority Runs o Bsi Query Automt Note tht the ollowin properties, required y our semntis o susetion 4.1, hold on the utomt A Q onstruted ove, or ny si Core XPth query Q = //*[xis::]: i) There re no trnsitions rom ny stte with oolen omponent 0 to stte with oolen omponent 1; ii) The -trnsitions hve ll their tret sttes in {(, 0), (, 1), (, 1)}; nd or ny γ, the tret sttes o γ-trnsitions re ll in {(η, 0), (η, 1), (s, 1)}. Theorem 1 Let Q e ny si Core XPth query, t ny iven trd, nd let G denote either the rl D t, or ny iven hilin F o L t. Assume iven lelin untion L romnodes(g) into the set o ll-pirs, whih is orret with respet to Q, i.e., in onormity with the semntis o susetion 4.1. Then there is run r o the utomton A Q on G, suh tht : i) r is omptile with L; i.e., r(u) = L(u) or every node u on G; ii) r stisies the mximl priority ondition (MP) osusetion4.1. Proo. We irst onstrut, y indution, omplete run (i.e., deined t ll the nodes o G) stisyin property i). For tht, we shll employ resonins tht will e speii to the xis o the si query Q. We ive here the detils only or the xis prent; they re similr or the other xes. Q = //*[prent::]: (The xis onsidered is non-silin so G = D t here.) At the root u node o D t,wesetr(u) = L(u); we hve to show tht there is trnsition rule in A Q o the orm (init, ll(u)) L(u). Oviously, or the xis prent, the root node u nnot orrespond to node on t seleted y Q, sothe only ll-pirs possile or L(u) re(l, 0), (l, 1), with l {η, }; or eh o these hoies, we do hve trnsition rule o the needed orm, on A Q. Consider then node v on D t suh tht, t eh o its nestor nodes u on D t, the prt o the run r o A Q hs een onstruted suh tht r(u) = L(u); 16
18 ssume tht the run nnot e extended t the node y settin r(v) = L(v). This mens tht there exists prent node w o v, suh tht ( L(w), ll(v)) L(v) is not trnsition rule o A Q ; we shll then derive ontrdition. We only hve to onsider the ses where the oolen omponent o L(w) is reter thn or equl to tht o L(v). The possile ouples L(w), L(v) re then respetively: L(w) :(, 0) (, 1) (, 1) (, 1) (, 1) L(v) : (η, 0) (, 1) (η, 1) (, 1) (η, 1) In ll ses, we hve ll(w) = euse o the semntis, so the node (on t orrespondin to the node) v hs -prent, so must e seleted; thus the ove hoies or L(v) re not in onormity with the semntis; ontrdition. We now prove tht the omplete run r thus onstruted, stisies property ii). For this prt o the proo, the resonin does not need to e speii or eh Q; so, write Q more enerlly, s //*[xis::] or some iven. Suppose the run r does not stisy the mximl priority ondition t some node v on G; ssume, or instne, tht the run r mde the hoie, sy o the ll-pir (l, 1), lthouh the mximl lelin o the node v, in mnner omptile with the ll-pirs o ll its prents, ws the ll-pir (l, 0). Sine L is ssumed orret, nd r is omptile with L, the mximl possile lelin (l, 0) would men tht the node (on t orrespondin to the node) v hs no desendnt seleted y Q; wheres, the hoie tht r is ssumed to hve mde t v, nmely the ll-pir (l, 1), hs the opposite semntis whether or not ll(v) =; in other words, the lelin L would not e orret with respet to Q; ontrdition. The other possiilities or the d lelins under r lso et eliminted in similr mnner. Theorem 2 Let Q, t, D t, F, G e s ove. Let r e (omplete) run o the utomton A Q on G, whih stisies the mximl priority ondition (MP) o susetion 4.1. Then the lelin untion L onnodes(g), deined s L(u) =r(u) or ny node u, is orret with respet to the semntis o susetion 4.1. Proo. Let us suppose tht the lelin L dedued rom r is not orret with respet to Q; we shll then derive ontrdition. The resonin will e y se nlysis, whih will e speii to the xis o the si query Q onsidered. We ive the detils here or Q = //*[desendnt::]. The xis is non-silin, so we hve G = D t here. The sets Nodes(t),Nodes(D t ) re in nturl ijetion, so or ny node u on D t we shll lso denote y u the orrespondin node on t, in our resonins elow. We sw tht the utomton A Q or the desendnt xis does not hve the sttes (η, 1), (, 1). Consider then node u on D t suh tht: or ll nestor nodes w o u, the llel r(w) is in onormity with the semntis, ut the ll-pir r(u) is not in onormity. Now, A Q hs only 5 sttes: (init), (, 1), (s, 1), (, 0), (η, 0), o whih only the lst our n llel the nodes. So the possile d hoies tht r is ssumed to hve mde t our node u, re s ollows: () r(u) =(, 1), ut the node u is not n nswer to the query Q. Here nme(u) muste, so the hoie o r ouht to hve een (, 0); () r(u) =(s, 1), ut the node u is not n nswer to the query Q. Here nme(u), so the hoie o r ouht to hve een (η, 0); () r(u) = (η, 0), ut the node u is n nswer to the query Q. Here nme(u), so the hoie o r ouht to hve een (s, 1); (d) r(u) = (, 0), ut the node u is n nswer to the query Q. Here nme(u) muste, so the hoie o r ouht to hve een (, 1). In ll the our ses, we hve to show: i) tht the ouht-to-hve-een hoie ll-pir is rehle rom ll the prent nodes o u; ii) nd tht, with suh new nd orret hoie mde t u, r n e ompleted rom u, intorunontheentiredd t. 17
19 The resonin will e similr or ses (), (), nd or the ses (), (d). Here re the detils or se (): Tht u is not n nswer to Q mens tht u hs no -desendnt node, so or ll nodes v elow u on D t,wehvell(v). Thereore, ssertions i) nd ii) ove ollow rom the ollowin oservtions on the utomton or Q= //*[desendnt::]: i) i r ould reh the stte (, 1) t node u (vi -trnsition) rom ny prent node o u, then(, 0) is lso rehle thus t u, romnyothem; ii) i, romthestte(, 1), r ould reh ll the nodes on D t elow u (with stte (η, 0)), vi trnsitions over γ, then it n do extly the sme now, with the orret hoie ll-pir (, 0) t u. As or se (): Node u is n nswer to Q here, so u hs -desendnt; let v e -node elow u on D t ; the ll-pir r(v) thtr ssins to v must then e either (, 1) or (, 0); this implies tht r pssed rom the stte (η, 0) supposedly ssined y r to u to(, 1) or (, 0) somewhere etween u nd v; whih is impossile, s is esily seen on the utomton A Q or the xis desendnt onsidered. The resonin or se (d) is even esier: rom stte (, 0), no stte with n outoin -trnsition is rehle. 6 Evlutin Composite Queries A omposite query is query in stndrd orm, ut is not si. We propose to evlute suh query inrementlly. For this, it suies to onsider queries tht re o the orm //*[A::x onn A ::x ],whereonn {nd, or}, oro the orm //*[A 1 ::*[A 2 ::]]. For those o the ormer type, we oserve irst tht the omponents in disjuntion (resp. onjuntion) under * ne evluted seprtely. Indeed, the nswer or Q = //*[A::x onn A ::x ] n e otined s union (resp. intersetion) o the nswers or the two omponent queries //*[A::x], nd//*[a ::x ],whenonn is n or (resp. n nd). We pply the method desried erlier, seprtely or Q 1 = //*[A::x] nd or Q 2 = //*[A ::x ], thus ettin two respetive evlutin runs r 1,r 2. Any node u o the d D t will then e re-leled, y the omposite query Q, with ll-pirs omputed y untion AND when onn = nd (resp. OR when onn = or), in onormity with the semntis presented in the Setion 4.1: AND(u) =(s, 1) i r 1 (u) =(l, 1) = r 2 (u); AND(u) =(η, 0) i r 1 (u) =(l, 0) or r 2 (u) =(l, 0); AND(u) =(η, 1) otherwise. OR(u) =(s, 1) i r 1 (u) =(l, 1) or r 2 (u) =(l, 1); OR(u) =(η, 0) i r 1 (u) =(l, 0) = r 2 (u); OR(u) =(η, 1) otherwise. Fiure 5 elow illustrtes the ove resonin, or the evlution o the omposite query Q = //*[sel:: ndprent::], on the trd t o Fiure 3: We next onsider the queries o the orm Q = //*[A 1 ::*[A 2 ::]], with imrited predites. For their evlution, we irst onsider mximl priority run evlutin r 2 (resp. set o runs r 2 ) o the utomton ssoited to the inner query //*[A 2 ::], ond t (resp. the set o ll hilins o L t ). This run (resp. set o runs) will output the rl r 2 (D t )(resp. r 2 (D t )), s desried in Setion 4.2. Evlutin the imrited query Q on the d t is then done y runnin the utomton or the si outer query //*[A 1 ::s] on r 2 (D t )(resp. r 2 (D t )). Finlly, the nswer or query o the type Q = //*[hild::x[position()= k]], is the suset o the nodes nswerin //*[hild::x], whih orrespond to k-thnodeonsomehilin. 18
20 ( η,1) //*[sel : : ] //*[prent : : ] nd(d t ) A 1 (, ( η,1) A 1 (, A 1 (η,1 ) A2(, _ ) A (, _ 3 ) A, _ 4 ( ) ( η,0) ( η,1) ( T, 1) A 2 (, _ ) A (, _ 3 ) A, _ 4 ( ) η,0 ( η,0) ( ) ( T, 1) A 2 (,) η 0 A 3 (,1 η ) A 4( η, 0) ( T, 1) A 5 (, ( s,1) A 5 (, A 5 ( s, 1 ) Fi Derivin the Answer on the Tree-Equivlent GivenCoreXPthqueryQ nd its nswer set on trd t, weshowherehow to derive the nswer or the sme query Q on the tree-equivlent ˆt o t; thisis o importne, sine the stndrd model or n XML doument (even when iven in ompressed orm) is enerlly onsidered s the tree representtion o the doument. We oserve, to strt with, tht the nswer set or Q on t is in enerl superset o the nswer set or Q on the tree-equivlent ˆt. This n e so or the ollowin two resons: (i) I ertin node u on t is seleted y Q, not ll o the nodes u on ˆt, tht re lits o u under the ompression mp on Nodes(ˆt), my nswer the query Q on the tree ˆt, evenwhenq is si query. For instne, onsider the si query //*[prent::]; on the ully ompressed td ((),()), the (unique) node nmed is n nswer; it hs two -nmed nodes s lits on the tree-equivlent ˆt, o whih only one is n nswer or the query. (ii) A node u on trd t my nswer omposite query Q, ut none mon the lits o u on ˆt my nswer the sme query Q on the tree ˆt. For instne, the unique -nmed node on the ompressed td ((),()) nswers the query //*[prent:: nd prent::], ut there is no node on the tree-equivlent nswerin this query. Atully, suh situtions rise only or queries involvin the upwrd xes prent, nestor, whih deine reltions tht re less trivil on trds thn on trees. We n ormulte this oservtion more preisely, s ollows: Lemm 1. Let A e one o the xes sel, hild, desendent, Q the si query //*[A::x], t ny iven trd, ˆt its tree-equivlent, u ny iven node on t, nd u 1 (u) ny node lit o u on ˆt. Then: wrt the mximl priority runs o the utomton or the xis A, respetively on D t nd Dˆt, the nodes u on t, ndu on ˆt, et leled y the sme ll-pir; in prtiulr, the node u nswers Q on t i nd only i the node u nswers thesmequeryq on the tree ˆt. Proo. Follows y oservin tht the semntis o Setion 4.1 hve een deined in mnner whih is top-down, nd tht the ompression mp : Nodes(ˆt) Nodes(t) mpsthesetnodes(ˆt u ), o nodes elow u on ˆt, ontothesetonodes o the su-trd t u. The ove lemm is irst step towrds the ojetive o this setion. As seond step, we propose to distinuish, on the utomt or the two si queries 19
21 //*[prent::], //*[nestor::], two speil types o trnsitions, esides the usul ones. (i) Type oret: The trnsitions tht will not e irle on tree; suh trnsitions will e represented y dotted rs on the utomton. The trnsitions onerned re the ones rom (η, 1) to (, 1) nd to (s, 1) on the utomt or prent nd desendnt, swellstheonerom(s, 1) to (, 1) on the prent utomton. A word o explntion miht help here: or instne, in order tht the trnsition rom stte (η, 1) to stte (, 1) e irle on the prent utomton, we hve to reh node orrespondin to -nmed node on the trd, whih must then lso hve s (unique) prent on the tree i.e., the node rom whih the trnsition is to e ired -nmed node; this prent node nnot orrespond then to node leled with (η, 1). The resonin is similr, lthouh not identil, or the nestor utomton. In reoverin the nswer or iven (si) query Q on the tree equivlent ˆt, the role plyed y the dotted r trnsitions is s ollows: i the urrent node on ˆt orresponds to position α on D t tht is rehed (y the utomton or Q) vi dotted trnsition, then the position α does not nswer Q on ˆt. Theide then is tht suh position α n then e orotten lon iven run, while lookin or nodes nswerin Q. Nevertheless, suh position nnot e orotten orever, in enerl: onsider or instne, the si query //*[nestor::] on trdt ontinin (mon others) two nodes u, v suh tht v is hild o u, u with -nestor, nd the nme t u is ; then the run o the utomton or this query must ttriute the lel (, 1) to u, nd(s, 1) to v; ndinsuh se, ll the positions o v tht extend the positions o u on t hve to e kept s nswers, even i some o the trnsitions o the utomton hve een dotted on the wy rom the root o D t to the prent node u. This remrk leds us to distinuish seond type o trnsitions: (ii) Type restore: Trnsitions tht restore ll the positions urrently visited t node, inludin the ones ontinin preixes orotten erlier under the iven run; suh trnsitions will e represented y thik rs on the utomton. The utomt thus revised or the two upwrd xes, re s ollows: Automton or the query //*[prent::] -revised init η, 1 η, 0 T, 0 T, 1 s, 1 T, 1 20
22 Automton or the query //*[nestor::] -revised T, 1 γ= γ= γ= η, 1 T, 1 init T, 0 γ= γ= s, 1 γ= γ= η, 0 γ= γ= Our next step towrds the ojetive o this setion is to omplete mximl priority run r o the utomton or Q, y ssoitin to ny node u on D t, prtition o Pos t (u) y two susets, respetively denoted s L r u nd L r u:ir(u) is (s, 1) or (, 1) then the set L r u will ontin ll the positions t the node u tht nswer Q on the tree equivlent ˆt o t. The rules or omputin these sets will e iven presently. Two oservtions re essentil in uildin these rules properly, nd optimlly: (i) The set o positions t ny node u, on the iven trd t, n e omputed symolilly nd dynmilly, under ny top-down trversl o D t ; suies to tth distint position symols X, X, to the vrious rs on D t ;ix is suh symol tthed to n r on D t oin rom non-terminl A o the rmmr L t tonon-terminlb o L t,thenx is ment to stnd or the set o inteers {j 1,,j m }, ivin the positions where B ppers on the rhs o the unique A-prodution o L t. Thus, or ny node u on t, ny o its positions is symolilly represented y word over the position symols. (ii) The si query onsidered Q n e the outer query in non si imrited query Q 0. Here, the prtition o Pos t (u) sy s L u L u tht results rom the inner query Q immeditely elow Q in Q 0, should e tken into ount. For tht purpose, note tht t the end o the run r or the inner query Q, every node u o D t ets re-leled s l r (u), this ltter ein either n (s, ), or n (η, ),. Setion 4.2; the si outer query Q is then o the orm //*[A::s] (. Setion 6). Aountin or the prtition L u L u o Pos t (u) risin rom the inner run r, is then done s ollows: l r (u) is(η, ): ssoite to u one llel position-set pir η, Pos t (u) ; l r (u)is(s, ): ssoite to u two llel position-set pirs: s, L u, η, L u. (Note: suh vision does not mount to unoldin the trd into its treeequivlent; indeed, the numer trnsitions onsider etween ny two nodes o D t, or the utomton o the outer query, is t most 4.) The rules or omputin the position sets L r u nd L r u,tnyivennodeu on t, under top-down trversl o t y run r o the utomton or the urrent query, re then ormulted s ollows, where w is ny prent node o u on t, α is word over the position symols stndin or position o w on t, X is the position symol on the r rom w to u on D t ; ll the position sets re seen here s unry predites: L r usul,oret w (α) L r w (α) restore L r w(α) usul,restore L r w (α) oret L r u (α.x) L r u (α.x) L r u(α.x) L r u (α.x) 21
Automata for Analyzing and Querying Compressed Documents Barbara FILA, LIFO, Orl eans (Fr.) Siva ANANTHARAMAN, LIFO, Orl eans (Fr.) Rapport No
Automt for Anlyzing nd Querying Compressed Documents Brr FILA, LIFO, Orléns (Fr.) Siv ANANTHARAMAN, LIFO, Orléns (Fr.) Rpport N o 2006-03 Automt for Anlyzing nd Querying Compressed Documents Brr Fil, Siv
More informationThe University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 2 MODULE, SPRING SEMESTER MACHINES AND THEIR LANGUAGES ANSWERS
The University of ottinghm SCHOOL OF COMPUTR SCIC A LVL 2 MODUL, SPRIG SMSTR 2015 2016 MACHIS AD THIR LAGUAGS ASWRS Time llowed TWO hours Cndidtes my omplete the front over of their nswer ook nd sign their
More informationTechnische Universität München Winter term 2009/10 I7 Prof. J. Esparza / J. Křetínský / M. Luttenberger 11. Februar Solution
Tehnishe Universität Münhen Winter term 29/ I7 Prof. J. Esprz / J. Křetínský / M. Luttenerger. Ferur 2 Solution Automt nd Forml Lnguges Homework 2 Due 5..29. Exerise 2. Let A e the following finite utomton:
More informationMAT 403 NOTES 4. f + f =
MAT 403 NOTES 4 1. Fundmentl Theorem o Clulus We will proo more generl version o the FTC thn the textook. But just like the textook, we strt with the ollowing proposition. Let R[, ] e the set o Riemnn
More informationCS311 Computational Structures Regular Languages and Regular Grammars. Lecture 6
CS311 Computtionl Strutures Regulr Lnguges nd Regulr Grmmrs Leture 6 1 Wht we know so fr: RLs re losed under produt, union nd * Every RL n e written s RE, nd every RE represents RL Every RL n e reognized
More informationCS 573 Automata Theory and Formal Languages
Non-determinism Automt Theory nd Forml Lnguges Professor Leslie Lnder Leture # 3 Septemer 6, 2 To hieve our gol, we need the onept of Non-deterministi Finite Automton with -moves (NFA) An NFA is tuple
More informationNON-DETERMINISTIC FSA
Tw o types of non-determinism: NON-DETERMINISTIC FS () Multiple strt-sttes; strt-sttes S Q. The lnguge L(M) ={x:x tkes M from some strt-stte to some finl-stte nd ll of x is proessed}. The string x = is
More informationNondeterministic Automata vs Deterministic Automata
Nondeterministi Automt vs Deterministi Automt We lerned tht NFA is onvenient model for showing the reltionships mong regulr grmmrs, FA, nd regulr expressions, nd designing them. However, we know tht n
More informationNondeterministic Finite Automata
Nondeterministi Finite utomt The Power of Guessing Tuesdy, Otoer 4, 2 Reding: Sipser.2 (first prt); Stoughton 3.3 3.5 S235 Lnguges nd utomt eprtment of omputer Siene Wellesley ollege Finite utomton (F)
More informationA Lower Bound for the Length of a Partial Transversal in a Latin Square, Revised Version
A Lower Bound for the Length of Prtil Trnsversl in Ltin Squre, Revised Version Pooy Htmi nd Peter W. Shor Deprtment of Mthemtil Sienes, Shrif University of Tehnology, P.O.Bo 11365-9415, Tehrn, Irn Deprtment
More informationDiscrete Structures Lecture 11
Introdution Good morning. In this setion we study funtions. A funtion is mpping from one set to nother set or, perhps, from one set to itself. We study the properties of funtions. A mpping my not e funtion.
More informationSystem Validation (IN4387) November 2, 2012, 14:00-17:00
System Vlidtion (IN4387) Novemer 2, 2012, 14:00-17:00 Importnt Notes. The exmintion omprises 5 question in 4 pges. Give omplete explntion nd do not onfine yourself to giving the finl nswer. Good luk! Exerise
More informationApril 8, 2017 Math 9. Geometry. Solving vector problems. Problem. Prove that if vectors and satisfy, then.
pril 8, 2017 Mth 9 Geometry Solving vetor prolems Prolem Prove tht if vetors nd stisfy, then Solution 1 onsider the vetor ddition prllelogrm shown in the Figure Sine its digonls hve equl length,, the prllelogrm
More informationChapter 3. Vector Spaces. 3.1 Images and Image Arithmetic
Chpter 3 Vetor Spes In Chpter 2, we sw tht the set of imges possessed numer of onvenient properties. It turns out tht ny set tht possesses similr onvenient properties n e nlyzed in similr wy. In liner
More informationFinite State Automata and Determinisation
Finite Stte Automt nd Deterministion Tim Dworn Jnury, 2016 Lnguges fs nf re df Deterministion 2 Outline 1 Lnguges 2 Finite Stte Automt (fs) 3 Non-deterministi Finite Stte Automt (nf) 4 Regulr Expressions
More informationAlgebra in a Category
Algebr in Ctegory Dniel Muret Otober 5, 2006 In the topos Sets we build lgebri strutures out o sets nd opertions (morphisms between sets) where the opertions re required to stisy vrious xioms. One we hve
More informationAlgorithms & Data Structures Homework 8 HS 18 Exercise Class (Room & TA): Submitted by: Peer Feedback by: Points:
Eidgenössishe Tehnishe Hohshule Zürih Eole polytehnique fédérle de Zurih Politenio federle di Zurigo Federl Institute of Tehnology t Zurih Deprtement of Computer Siene. Novemer 0 Mrkus Püshel, Dvid Steurer
More information= state, a = reading and q j
4 Finite Automt CHAPTER 2 Finite Automt (FA) (i) Derterministi Finite Automt (DFA) A DFA, M Q, q,, F, Where, Q = set of sttes (finite) q Q = the strt/initil stte = input lphet (finite) (use only those
More informationBisimulation, Games & Hennessy Milner logic
Bisimultion, Gmes & Hennessy Milner logi Leture 1 of Modelli Mtemtii dei Proessi Conorrenti Pweł Soboiński Univeristy of Southmpton, UK Bisimultion, Gmes & Hennessy Milner logi p.1/32 Clssil lnguge theory
More informationProject 6: Minigoals Towards Simplifying and Rewriting Expressions
MAT 51 Wldis Projet 6: Minigols Towrds Simplifying nd Rewriting Expressions The distriutive property nd like terms You hve proly lerned in previous lsses out dding like terms ut one prolem with the wy
More informationCoalgebra, Lecture 15: Equations for Deterministic Automata
Colger, Lecture 15: Equtions for Deterministic Automt Julin Slmnc (nd Jurrin Rot) Decemer 19, 2016 In this lecture, we will study the concept of equtions for deterministic utomt. The notes re self contined
More information6.1 Definition of the Riemann Integral
6 The Riemnn Integrl 6. Deinition o the Riemnn Integrl Deinition 6.. Given n intervl [, b] with < b, prtition P o [, b] is inite set o points {x, x,..., x n } [, b], lled grid points, suh tht x =, x n
More informationLinear choosability of graphs
Liner hoosility of grphs Louis Esperet, Mikel Montssier, André Rspud To ite this version: Louis Esperet, Mikel Montssier, André Rspud. Liner hoosility of grphs. Stefn Felsner. 2005 Europen Conferene on
More informationGeneralization of 2-Corner Frequency Source Models Used in SMSIM
Generliztion o 2-Corner Frequeny Soure Models Used in SMSIM Dvid M. Boore 26 Mrh 213, orreted Figure 1 nd 2 legends on 5 April 213, dditionl smll orretions on 29 My 213 Mny o the soure spetr models ville
More informationMatrices SCHOOL OF ENGINEERING & BUILT ENVIRONMENT. Mathematics (c) 1. Definition of a Matrix
tries Definition of tri mtri is regulr rry of numers enlosed inside rkets SCHOOL OF ENGINEERING & UIL ENVIRONEN Emple he following re ll mtries: ), ) 9, themtis ), d) tries Definition of tri Size of tri
More informationA Rewrite Approach for Pattern Containment
A Rewrite Approh or Pttern Continment Brr Kory rr.kory@univ-orlens.r LIFO - Université Orléns, Frne Astrt. In this pper we introue n pproh tht llows to hnle the ontinment prolem or the rgment XP(/,//,[
More information1 PYTHAGORAS THEOREM 1. Given a right angled triangle, the square of the hypotenuse is equal to the sum of the squares of the other two sides.
1 PYTHAGORAS THEOREM 1 1 Pythgors Theorem In this setion we will present geometri proof of the fmous theorem of Pythgors. Given right ngled tringle, the squre of the hypotenuse is equl to the sum of the
More informationPetri Nets. Rebecca Albrecht. Seminar: Automata Theory Chair of Software Engeneering
Petri Nets Ree Alreht Seminr: Automt Theory Chir of Softwre Engeneering Overview 1. Motivtion: Why not just using finite utomt for everything? Wht re Petri Nets nd when do we use them? 2. Introdution:
More information#A42 INTEGERS 11 (2011) ON THE CONDITIONED BINOMIAL COEFFICIENTS
#A42 INTEGERS 11 (2011 ON THE CONDITIONED BINOMIAL COEFFICIENTS Liqun To Shool of Mthemtil Sienes, Luoyng Norml University, Luoyng, Chin lqto@lynuedun Reeived: 12/24/10, Revised: 5/11/11, Aepted: 5/16/11,
More informationDiscrete Structures, Test 2 Monday, March 28, 2016 SOLUTIONS, VERSION α
Disrete Strutures, Test 2 Mondy, Mrh 28, 2016 SOLUTIONS, VERSION α α 1. (18 pts) Short nswer. Put your nswer in the ox. No prtil redit. () Consider the reltion R on {,,, d with mtrix digrph of R.. Drw
More informationHybrid Systems Modeling, Analysis and Control
Hyrid Systems Modeling, Anlysis nd Control Rdu Grosu Vienn University of Tehnology Leture 5 Finite Automt s Liner Systems Oservility, Rehility nd More Miniml DFA re Not Miniml NFA (Arnold, Diky nd Nivt
More informationRegular languages refresher
Regulr lnguges refresher 1 Regulr lnguges refresher Forml lnguges Alphet = finite set of letters Word = sequene of letter Lnguge = set of words Regulr lnguges defined equivlently y Regulr expressions Finite-stte
More information2.4 Theoretical Foundations
2 Progrmming Lnguge Syntx 2.4 Theoretil Fountions As note in the min text, snners n prsers re se on the finite utomt n pushown utomt tht form the ottom two levels of the Chomsky lnguge hierrhy. At eh level
More informationLecture 11 Binary Decision Diagrams (BDDs)
C 474A/57A Computer-Aie Logi Design Leture Binry Deision Digrms (BDDs) C 474/575 Susn Lyseky o 3 Boolen Logi untions Representtions untion n e represente in ierent wys ruth tle, eqution, K-mp, iruit, et
More informationComputational Biology Lecture 18: Genome rearrangements, finding maximal matches Saad Mneimneh
Computtionl Biology Leture 8: Genome rerrngements, finding miml mthes Sd Mneimneh We hve seen how to rerrnge genome to otin nother one sed on reversls nd the knowledge of the preserved loks or genes. Now
More informationThe Word Problem in Quandles
The Word Prolem in Qundles Benjmin Fish Advisor: Ren Levitt April 5, 2013 1 1 Introdution A word over n lger A is finite sequene of elements of A, prentheses, nd opertions of A defined reursively: Given
More informationChapter 4 State-Space Planning
Leture slides for Automted Plnning: Theory nd Prtie Chpter 4 Stte-Spe Plnning Dn S. Nu CMSC 722, AI Plnning University of Mrylnd, Spring 2008 1 Motivtion Nerly ll plnning proedures re serh proedures Different
More informationIntroduction to Olympiad Inequalities
Introdution to Olympid Inequlities Edutionl Studies Progrm HSSP Msshusetts Institute of Tehnology Snj Simonovikj Spring 207 Contents Wrm up nd Am-Gm inequlity 2. Elementry inequlities......................
More informationCompression of Palindromes and Regularity.
Compression of Plinromes n Regulrity. Kyoko Shikishim-Tsuji Center for Lierl Arts Eution n Reserh Tenri University 1 Introution In [1], property of likstrem t t view of tse is isusse n it is shown tht
More informationDescriptional Complexity of Non-Unary Self-Verifying Symmetric Difference Automata
Desriptionl Complexity of Non-Unry Self-Verifying Symmetri Differene Automt Lurette Mris 1,2 nd Lynette vn Zijl 1 1 Deprtment of Computer Siene, Stellenosh University, South Afri 2 Merk Institute, CSIR,
More information1 Nondeterministic Finite Automata
1 Nondeterministic Finite Automt Suppose in life, whenever you hd choice, you could try oth possiilities nd live your life. At the end, you would go ck nd choose the one tht worked out the est. Then you
More informationAbstraction of Nondeterministic Automata Rong Su
Astrtion of Nondeterministi Automt Rong Su My 6, 2010 TU/e Mehnil Engineering, Systems Engineering Group 1 Outline Motivtion Automton Astrtion Relevnt Properties Conlusions My 6, 2010 TU/e Mehnil Engineering,
More informationCompiler Design. Spring Lexical Analysis. Sample Exercises and Solutions. Prof. Pedro C. Diniz
University of Southern Cliforni Computer Siene Deprtment Compiler Design Spring 7 Lexil Anlysis Smple Exerises nd Solutions Prof. Pedro C. Diniz USC / Informtion Sienes Institute 47 Admirlty Wy, Suite
More informationLESSON 11: TRIANGLE FORMULAE
. THE SEMIPERIMETER OF TRINGLE LESSON : TRINGLE FORMULE In wht follows, will hve sides, nd, nd these will e opposite ngles, nd respetively. y the tringle inequlity, nd..() So ll of, & re positive rel numers.
More informationFoundations of Computer Science Comp109
Reding Foundtions o Computer Siene Comp09 University o Liverpool Boris Konev konev@liverpool..uk http://www.s.liv..uk/~konev/comp09 Prt. Funtion Comp09 Foundtions o Computer Siene Disrete Mthemtis nd Its
More informationA CLASS OF GENERAL SUPERTREE METHODS FOR NESTED TAXA
A CLASS OF GENERAL SUPERTREE METHODS FOR NESTED TAXA PHILIP DANIEL AND CHARLES SEMPLE Astrt. Amlgmting smller evolutionry trees into single prent tree is n importnt tsk in evolutionry iology. Trditionlly,
More informationSolutions for HW9. Bipartite: put the red vertices in V 1 and the black in V 2. Not bipartite!
Solutions for HW9 Exerise 28. () Drw C 6, W 6 K 6, n K 5,3. C 6 : W 6 : K 6 : K 5,3 : () Whih of the following re iprtite? Justify your nswer. Biprtite: put the re verties in V 1 n the lk in V 2. Biprtite:
More informationGlobal alignment. Genome Rearrangements Finding preserved genes. Lecture 18
Computt onl Biology Leture 18 Genome Rerrngements Finding preserved genes We hve seen before how to rerrnge genome to obtin nother one bsed on: Reversls Knowledge of preserved bloks (or genes) Now we re
More informationArrow s Impossibility Theorem
Rep Voting Prdoxes Properties Arrow s Theorem Arrow s Impossiility Theorem Leture 12 Arrow s Impossiility Theorem Leture 12, Slide 1 Rep Voting Prdoxes Properties Arrow s Theorem Leture Overview 1 Rep
More informationLecture 08: Feb. 08, 2019
4CS4-6:Theory of Computtion(Closure on Reg. Lngs., regex to NDFA, DFA to regex) Prof. K.R. Chowdhry Lecture 08: Fe. 08, 2019 : Professor of CS Disclimer: These notes hve not een sujected to the usul scrutiny
More informationCIT 596 Theory of Computation 1. Graphs and Digraphs
CIT 596 Theory of Computtion 1 A grph G = (V (G), E(G)) onsists of two finite sets: V (G), the vertex set of the grph, often enote y just V, whih is nonempty set of elements lle verties, n E(G), the ege
More information6.5 Improper integrals
Eerpt from "Clulus" 3 AoPS In. www.rtofprolemsolving.om 6.5. IMPROPER INTEGRALS 6.5 Improper integrls As we ve seen, we use the definite integrl R f to ompute the re of the region under the grph of y =
More informationLIP. Laboratoire de l Informatique du Parallélisme. Ecole Normale Supérieure de Lyon
LIP Lortoire de l Informtique du Prllélisme Eole Normle Supérieure de Lyon Institut IMAG Unité de reherhe ssoiée u CNRS n 1398 One-wy Cellulr Automt on Cyley Grphs Zsuzsnn Rok Mrs 1993 Reserh Report N
More informationLecture 6: Coding theory
Leture 6: Coing theory Biology 429 Crl Bergstrom Ferury 4, 2008 Soures: This leture loosely follows Cover n Thoms Chpter 5 n Yeung Chpter 3. As usul, some of the text n equtions re tken iretly from those
More informationArrow s Impossibility Theorem
Rep Fun Gme Properties Arrow s Theorem Arrow s Impossiility Theorem Leture 12 Arrow s Impossiility Theorem Leture 12, Slide 1 Rep Fun Gme Properties Arrow s Theorem Leture Overview 1 Rep 2 Fun Gme 3 Properties
More informationLecture Notes No. 10
2.6 System Identifition, Estimtion, nd Lerning Leture otes o. Mrh 3, 26 6 Model Struture of Liner ime Invrint Systems 6. Model Struture In representing dynmil system, the first step is to find n pproprite
More informationCS 491G Combinatorial Optimization Lecture Notes
CS 491G Comintoril Optimiztion Leture Notes Dvi Owen July 30, August 1 1 Mthings Figure 1: two possile mthings in simple grph. Definition 1 Given grph G = V, E, mthing is olletion of eges M suh tht e i,
More informationFigure 1. The left-handed and right-handed trefoils
The Knot Group A knot is n emedding of the irle into R 3 (or S 3 ), k : S 1 R 3. We shll ssume our knots re tme, mening the emedding n e extended to solid torus, K : S 1 D 2 R 3. The imge is lled tuulr
More informationConvert the NFA into DFA
Convert the NF into F For ech NF we cn find F ccepting the sme lnguge. The numer of sttes of the F could e exponentil in the numer of sttes of the NF, ut in prctice this worst cse occurs rrely. lgorithm:
More informationBehavior Composition in the Presence of Failure
Behvior Composition in the Presene of Filure Sestin Srdin RMIT University, Melourne, Austrli Fio Ptrizi & Giuseppe De Giomo Spienz Univ. Rom, Itly KR 08, Sept. 2008, Sydney Austrli Introdution There re
More informationTransition systems (motivation)
Trnsition systems (motivtion) Course Modelling of Conurrent Systems ( Modellierung neenläufiger Systeme ) Winter Semester 2009/0 University of Duisurg-Essen Brr König Tehing ssistnt: Christoph Blume In
More informationMA10207B: ANALYSIS SECOND SEMESTER OUTLINE NOTES
MA10207B: ANALYSIS SECOND SEMESTER OUTLINE NOTES CHARLIE COLLIER UNIVERSITY OF BATH These notes hve been typeset by Chrlie Collier nd re bsed on the leture notes by Adrin Hill nd Thoms Cottrell. These
More information5. Every rational number have either terminating or repeating (recurring) decimal representation.
CHAPTER NUMBER SYSTEMS Points to Rememer :. Numer used for ounting,,,,... re known s Nturl numers.. All nturl numers together with zero i.e. 0,,,,,... re known s whole numers.. All nturl numers, zero nd
More informationActivities. 4.1 Pythagoras' Theorem 4.2 Spirals 4.3 Clinometers 4.4 Radar 4.5 Posting Parcels 4.6 Interlocking Pipes 4.7 Sine Rule Notes and Solutions
MEP: Demonstrtion Projet UNIT 4: Trigonometry UNIT 4 Trigonometry tivities tivities 4. Pythgors' Theorem 4.2 Spirls 4.3 linometers 4.4 Rdr 4.5 Posting Prels 4.6 Interloking Pipes 4.7 Sine Rule Notes nd
More informationDesigning finite automata II
Designing finite utomt II Prolem: Design DFA A such tht L(A) consists of ll strings of nd which re of length 3n, for n = 0, 1, 2, (1) Determine wht to rememer out the input string Assign stte to ech of
More informationTHE PYTHAGOREAN THEOREM
THE PYTHAGOREAN THEOREM The Pythgoren Theorem is one of the most well-known nd widely used theorems in mthemtis. We will first look t n informl investigtion of the Pythgoren Theorem, nd then pply this
More informationAUTOMATA AND LANGUAGES. Definition 1.5: Finite Automaton
25. Finite Automt AUTOMATA AND LANGUAGES A system of computtion tht only hs finite numer of possile sttes cn e modeled using finite utomton A finite utomton is often illustrted s stte digrm d d d. d q
More informations the set of onsequenes. Skeptil onsequenes re more roust in the sense tht they hold in ll possile relities desried y defult theory. All its desirle p
Skeptil Rtionl Extensions Artur Mikitiuk nd Miros lw Truszzynski University of Kentuky, Deprtment of Computer Siene, Lexington, KY 40506{0046, frtur mirekg@s.engr.uky.edu Astrt. In this pper we propose
More informationCounting Paths Between Vertices. Isomorphism of Graphs. Isomorphism of Graphs. Isomorphism of Graphs. Isomorphism of Graphs. Isomorphism of Graphs
Isomorphism of Grphs Definition The simple grphs G 1 = (V 1, E 1 ) n G = (V, E ) re isomorphi if there is ijetion (n oneto-one n onto funtion) f from V 1 to V with the property tht n re jent in G 1 if
More informationwhere the box contains a finite number of gates from the given collection. Examples of gates that are commonly used are the following: a b
CS 294-2 9/11/04 Quntum Ciruit Model, Solovy-Kitev Theorem, BQP Fll 2004 Leture 4 1 Quntum Ciruit Model 1.1 Clssil Ciruits - Universl Gte Sets A lssil iruit implements multi-output oolen funtion f : {0,1}
More informationChapter Five: Nondeterministic Finite Automata. Formal Language, chapter 5, slide 1
Chpter Five: Nondeterministic Finite Automt Forml Lnguge, chpter 5, slide 1 1 A DFA hs exctly one trnsition from every stte on every symol in the lphet. By relxing this requirement we get relted ut more
More informationCS241 Week 6 Tutorial Solutions
241 Week 6 Tutoril olutions Lnguges: nning & ontext-free Grmmrs Winter 2018 1 nning Exerises 1. 0x0x0xd HEXINT 0x0 I x0xd 2. 0xend--- HEXINT 0xe I nd ER -- MINU - 3. 1234-120x INT 1234 INT -120 I x 4.
More informationDecentralized Diagnosis for Nonfailures of Discrete Event Systems Using Inference-Based Ambiguity Management
IEEE TRANSACTIONS ON SYSTEMS, MAN, AND CYBERNETICS PART A: SYSTEMS AND HUMANS, VOL. XX, NO. X, XXX 2009 1 Deentrlized Dignosis or Nonilures o Disrete Event Systems Using Inerene-Bsed Amiguity Mngement
More information1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.
York University CSE 2 Unit 3. DFA Clsses Converting etween DFA, NFA, Regulr Expressions, nd Extended Regulr Expressions Instructor: Jeff Edmonds Don t chet y looking t these nswers premturely.. For ech
More informationMinimal DFA. minimal DFA for L starting from any other
Miniml DFA Among the mny DFAs ccepting the sme regulr lnguge L, there is exctly one (up to renming of sttes) which hs the smllest possile numer of sttes. Moreover, it is possile to otin tht miniml DFA
More informationCS 275 Automata and Formal Language Theory
CS 275 utomt nd Forml Lnguge Theory Course Notes Prt II: The Recognition Prolem (II) Chpter II.5.: Properties of Context Free Grmmrs (14) nton Setzer (Bsed on ook drft y J. V. Tucker nd K. Stephenson)
More informationAP Calculus BC Chapter 8: Integration Techniques, L Hopital s Rule and Improper Integrals
AP Clulus BC Chpter 8: Integrtion Tehniques, L Hopitl s Rule nd Improper Integrls 8. Bsi Integrtion Rules In this setion we will review vrious integrtion strtegies. Strtegies: I. Seprte the integrnd into
More informationExercise sheet 6: Solutions
Eerise sheet 6: Solutions Cvet emptor: These re merel etended hints, rther thn omplete solutions. 1. If grph G hs hromti numer k > 1, prove tht its verte set n e prtitioned into two nonempt sets V 1 nd
More informationCo-ordinated s-convex Function in the First Sense with Some Hadamard-Type Inequalities
Int. J. Contemp. Mth. Sienes, Vol. 3, 008, no. 3, 557-567 Co-ordinted s-convex Funtion in the First Sense with Some Hdmrd-Type Inequlities Mohmmd Alomri nd Mslin Drus Shool o Mthemtil Sienes Fulty o Siene
More informationCMPSCI 250: Introduction to Computation. Lecture #31: What DFA s Can and Can t Do David Mix Barrington 9 April 2014
CMPSCI 250: Introduction to Computtion Lecture #31: Wht DFA s Cn nd Cn t Do Dvid Mix Brrington 9 April 2014 Wht DFA s Cn nd Cn t Do Deterministic Finite Automt Forml Definition of DFA s Exmples of DFA
More informationActive Diagnosis. Serge Haddad. Vecos 16. October the 6th 2016
Ative Dignosis Serge Hddd LSV, ENS Chn & CNRS & Inri, Frne Veos 16 Otoer the 6th 2016 joint work with Nthlie Bertrnd 2, Eri Fre 2, Sten Hr 1,2, Loï Hélouët 2, Trek Melliti 1, Sten Shwoon 1 (1) FSTTCS 2013
More informationFormal Languages and Automata
Moile Computing nd Softwre Engineering p. 1/5 Forml Lnguges nd Automt Chpter 2 Finite Automt Chun-Ming Liu cmliu@csie.ntut.edu.tw Deprtment of Computer Science nd Informtion Engineering Ntionl Tipei University
More informationLecture 09: Myhill-Nerode Theorem
CS 373: Theory of Computtion Mdhusudn Prthsrthy Lecture 09: Myhill-Nerode Theorem 16 Ferury 2010 In this lecture, we will see tht every lnguge hs unique miniml DFA We will see this fct from two perspectives
More informationnd edges. Eh edge hs either one endpoint: end(e) = fxg in whih se e is termed loop t vertex x, or two endpoints: end(e) = fx; yg in whih se e is terme
Theory of Regions Eri Bdouel nd Philippe Drondeu Iris, Cmpus de Beulieu, F-35042 Rennes Cedex, Frne E-mil : feri.bdouel,philippe.drondeug@iris.fr Astrt. The synthesis prolem for nets onsists in deiding
More informationCompression vs Queryability - A Case Study
Compression vs Queryility - A Cse Stuy Siv Annthrmn To ite this version: Siv Annthrmn. Compression vs Queryility - A Cse Stuy. Dgstuhl Seminr 08621, Jun 2008, Dgstuhl, Germny. http://rops.gstuhl.e/opus/volltexte/2008/1676,
More informationCh. 2.3 Counting Sample Points. Cardinality of a Set
Ch..3 Counting Smple Points CH 8 Crdinlity of Set Let S e set. If there re extly n distint elements in S, where n is nonnegtive integer, we sy S is finite set nd n is the rdinlity of S. The rdinlity of
More informationBoolean Algebra cont. The digital abstraction
Boolen Alger ont The igitl strtion Theorem: Asorption Lw For every pir o elements B. + =. ( + ) = Proo: () Ientity Distriutivity Commuttivity Theorem: For ny B + = Ientity () ulity. Theorem: Assoitive
More informationFast index for approximate string matching
Fst index for pproximte string mthing Dekel Tsur Astrt We present n index tht stores text of length n suh tht given pttern of length m, ll the sustrings of the text tht re within Hmming distne (or edit
More informationILLUSTRATING THE EXTENSION OF A SPECIAL PROPERTY OF CUBIC POLYNOMIALS TO NTH DEGREE POLYNOMIALS
ILLUSTRATING THE EXTENSION OF A SPECIAL PROPERTY OF CUBIC POLYNOMIALS TO NTH DEGREE POLYNOMIALS Dvid Miller West Virgini University P.O. BOX 6310 30 Armstrong Hll Morgntown, WV 6506 millerd@mth.wvu.edu
More informationChapter 2 Finite Automata
Chpter 2 Finite Automt 28 2.1 Introduction Finite utomt: first model of the notion of effective procedure. (They lso hve mny other pplictions). The concept of finite utomton cn e derived y exmining wht
More informationA Study on the Properties of Rational Triangles
Interntionl Journl of Mthemtis Reserh. ISSN 0976-5840 Volume 6, Numer (04), pp. 8-9 Interntionl Reserh Pulition House http://www.irphouse.om Study on the Properties of Rtionl Tringles M. Q. lm, M.R. Hssn
More informationOn Implicative and Strong Implicative Filters of Lattice Wajsberg Algebras
Glol Journl of Mthemtil Sienes: Theory nd Prtil. ISSN 974-32 Volume 9, Numer 3 (27), pp. 387-397 Interntionl Reserh Pulition House http://www.irphouse.om On Implitive nd Strong Implitive Filters of Lttie
More informationINTEGRATION. 1 Integrals of Complex Valued functions of a REAL variable
INTEGRATION NOTE: These notes re supposed to supplement Chpter 4 of the online textbook. 1 Integrls of Complex Vlued funtions of REAL vrible If I is n intervl in R (for exmple I = [, b] or I = (, b)) nd
More informationPrefix-Free Regular-Expression Matching
Prefix-Free Regulr-Expression Mthing Yo-Su Hn, Yjun Wng nd Derik Wood Deprtment of Computer Siene HKUST Prefix-Free Regulr-Expression Mthing p.1/15 Pttern Mthing Given pttern P nd text T, find ll sustrings
More informationQualitative analysis of complex modularized fault trees using binary decision diagrams
Louhorouh University Institutionl Repository Qulittive nlysis o omplex modulrized ult trees usin inry deision dirms This item ws sumitted to Louhorouh University's Institutionl Repository y the/n uthor.
More informationPre-Lie algebras, rooted trees and related algebraic structures
Pre-Lie lgers, rooted trees nd relted lgeri strutures Mrh 23, 2004 Definition 1 A pre-lie lger is vetor spe W with mp : W W W suh tht (x y) z x (y z) = (x z) y x (z y). (1) Exmple 2 All ssoitive lgers
More informationI1 = I2 I1 = I2 + I3 I1 + I2 = I3 + I4 I 3
2 The Prllel Circuit Electric Circuits: Figure 2- elow show ttery nd multiple resistors rrnged in prllel. Ech resistor receives portion of the current from the ttery sed on its resistnce. The split is
More informationCS 2204 DIGITAL LOGIC & STATE MACHINE DESIGN SPRING 2014
S 224 DIGITAL LOGI & STATE MAHINE DESIGN SPRING 214 DUE : Mrh 27, 214 HOMEWORK III READ : Relte portions of hpters VII n VIII ASSIGNMENT : There re three questions. Solve ll homework n exm prolems s shown
More informationLearning Partially Observable Markov Models from First Passage Times
Lerning Prtilly Oservle Mrkov s from First Pssge s Jérôme Cllut nd Pierre Dupont Europen Conferene on Mhine Lerning (ECML) 8 Septemer 7 Outline. FPT in models nd sequenes. Prtilly Oservle Mrkov s (POMMs).
More informationTOPIC: LINEAR ALGEBRA MATRICES
Interntionl Blurete LECTUE NOTES for FUTHE MATHEMATICS Dr TOPIC: LINEA ALGEBA MATICES. DEFINITION OF A MATIX MATIX OPEATIONS.. THE DETEMINANT deta THE INVESE A -... SYSTEMS OF LINEA EQUATIONS. 8. THE AUGMENTED
More information