Containment of Nested XML Queries

Size: px
Start display at page:

Download "Containment of Nested XML Queries"

Transcription

1 Cotimet of Nested XML Queries Xi Dog Alo Y. Hlevy Igor Ttriov Deprtmet of Computer Sciece & Egieerig Uiversity of Wshigto Settle, WA Abstrct We cosider the problem of query cotimet for XML queries with estig. Give two queries, Q d Q, Q is sid to be cotied i Q if Q produces subset of the swers of Q for y dtbse istce. Query cotimet is importt for query optimiztio, verifictio of itegrity costrits, iformtio itegrtio d verifictio of kowledge bses. Query cotimet hs bee studied i the reltiol cotext d for XPth queries, but ot for XML queries with estig. We begi by cosiderig cojuctive XML queries (c-xqueries), d show tht cotimet is i PTIME if we restrict the fout (umber of siblig sub-blocks) to be 1. We show tht for rbitrry fout, cotimet is conp-hrd lredy for queries with estig depth 2, eve if the query does ot iclude vribles i the retur cluses. We the show tht for queries with fixed estig depth, cotimet is conp-complete. We cosider severl extesios to c-xqueries, icludig queries with uio, egtio d queries where the XPth expressios my iclude descedt edges (besides wildcrds d brchig). I ech of these cses we show tht eve with fout 1, query cotimet is conp-complete, d query cotimet for queries with fixed estig depth is still conp-complete. Filly, we show tht for queries with equlities o tg vribles, cotimet is NP-complete for queries with fout 1 d Π p 2-complete for queries with rbitrry fout but fixed estig depth; for queries with rithmetic comprisos o tg vribles, cotimet is Π p 2-complete for both cses. 1 Itroductio We cosider the problem of determiig query cotimet for XML queries with estig. Query cotimet is the most fudmetl reltioship betwee pir of queries. I the cotext of reltiol dtbses, where swers re sets of tuples, we sy tht query Q is cotied i the query Q if, for y give dtbse istce, the swer of Q is subset of the swer of Q. I the cotext of XML queries with estig (or more geerlly, queries over complex objects), where swers re trees, we require the swer of Q be embedded i the swer of Q. Query cotimet is importt i severl dt mgemet tsks. Origilly, query cotimet ws studied for optimiztio of reltiol queries [10, 33]. emovig redudt prts of query reduces the umber of jois performed by the query processor. Determiig tht miimized query is equivlet to the origil oe requires cotimet test. Lter, query cotimet ws used i swerig queries usig views [21], mitece of itegrity costrits [19, 15], kowledge-bse verifictio [26] d dt itegrtio [35, 9, 17]. I fct, i severl recet dt itegrtio products [14, 1], which offer XQuery iterfce to multitude of dt sources, there ws eed for certi kids of semtic cchig of swers which, i tur, requires lgorithms for query cotimet of XML Queries with estig. Our prticulr iterest i this problem rises from query processig i Peer Dt Mgemet Systems (PDMS) [22, 20, 32, 24, 4]. A PDMS offers decetrlized rchitecture for shrig dt mog peers, removig the eed for medited schem required i dt itegrtio systems. Semtic reltioships betwee peers re described loclly by mppigs betwee pirs (or smll sets) of peers. These semtic mppigs eble reformultig query o peer to queries o its eighbors. Give query t peer, 1

2 the query processor pplies reformultio itertively to explore ll possible semtic pths i the PDMS, util it reches every relevt peer. I recet experimets o the Pizz PDMS, we hve show tht detectig redudt reformultio gols reduces reformultio times by order of mgitude. Detectig this redudcy cot be bsed o XPth cotimet loe, but requires query cotimet lgorithm for XML queries with estig. Query cotimet hs bee studied i depth for the reltiol model, begiig with cojuctive queries [10, 2], the cyclic queries [37], queries with uio [33], egtio [27], rithmetic comprisos [25, 36, 27, 38, 19], recursive queries [34, 11] d queries over bgs [12, 23]. Query cotimet for XML fces two chlleges: the use of XPth expressios to specify ptters o the iput dt, d the estig structure of the resultig tree. Severl recet works cosidered query cotimet for XPth i isoltio. I [30] it is show tht for simple frgmet of XPth tht cotis descedt xis(//), wildcrds(*), d qulifiers (or brchig, deoted [...]), but without either tg vribles or disjuctios, query cotimet is conp-complete. If we drop y oe of the costructs *, //, d [...] i the bove cse, query cotimet is i PTIME [3, 31]. I [13] the uthors studied XPth cotimet uder limited use of tg vribles d equlity testig, d showed the problem is Π p 2-complete i geerl d NP-complete if o disjuctio or wildcrds re llowed. Filly, [16] showed tht cotimet of queries with regulr pth expressios o geerl cyclic grphs is PSPACE-hrd. Cotimet for queries returig ested structures hs oly bee cosidered for the geerl cse of queries over complex objects [28]. However, tht pper oly presets ecessry coditio for cotimet, wheres our results offer ecessry d sufficiet coditio. Furthermore, our lysis exploits the specil structure of XML istces to obti more refied set of complexity results. I prticulr, we show how the complexity depeds o the estig depth d fout i the queries. We begi by cosiderig frgmet of XML queries, clled cojuctive XML Queries (c-xqueries), which covers my queries used i prctice. We show tht query cotimet for this frgmet is i PTIME if we restrict the fout (umber of siblig sub-blocks) i the query to be 1. However, if we llow rbitrry fout, the query cotimet is conp-hrd eve for queries with estig depth 2 d eve if the query does ot iclude vribles i the retur cluses. Sice XPth expressios i c-xqueries c be modeled s cyclic cojuctive queries, d cotimet of uested cyclic queries is i PTIME, our result isoltes the exct effect of estig o the complexity of query cotimet. Next, we show tht query cotimet for c-xqueries with rbitrry fout but fixed estig depth is conp-complete. Our techique is bsed o cosiderig fiite umber of coicl dtbses ( techique lso used i [25, 16]). Here, the pproprite set of coicl dtbses is obtied by ispectig set of coicl swers to the query, ech represetig possible structure for the swer tree. We obti our results by first cosiderig queries tht do ot iclude tg vribles (cc-xqueries), d the exted the techique of query simultio [28] to obti results for c-xqueries. We ote tht without restrictig the estig depth of the query, the umber of coicl dtbses tht eed to be ispected c be superexpoetil (eve for cc-xqueries), d the exct complexity for this cse remis ope. Filly, we cosider severl extesios of c-xqueries, icludig queries with uio, egtio, d queries where the XPth expressios my iclude descedt edges (besides wildcrds d brchig). I ech of these cses we show tht eve with fout 1, query cotimet is conp-complete, d tht query cotimet for queries with fixed estig depth is still conp-complete. We lso cosider ested queries with equlity predictes o tg vribles, d show tht cotimet is NP-complete for queries with fout 1 d Π p 2-complete for queries with rbitrry fout but fixed estig depth. Filly, we show tht for queries with rithmetic comprisos o tg vribles, cotimet is Π p 2-complete both for queries with fout 1 d for queries with rbitrry fout but fixed estig depth. This pper is orgized s follows. Sectio 2 formlly defies the problem. Sectio 3 cosiders cc- XQueries, d Sectio 4 exteds the results to c-xqueries. Sectio 5 describes our results for extesios of c-xqueries, d Sectio 6 cocludes. 2

3 D: 2 Prelimiries <project> <title>pizz</title> <member>alice</member> </project> <project> <title>tukwil</title> <member>bob</member> </project> project title member title project member Pizz Alice Tukwil Bob Figure 1: A XML istce d correspodig tree. We begi by defiig XML istces d the differet query lguge frgmets we cosider. We the defie cotimet o istces d o queries. 2.1 XML Objects d Istces A XML object is defied recursively s biry record: ech record cotis tg d cotets. A tg is tomic vlue d cotets re set of XML objects. Formlly, the defiitio is the followig: Defiitio 2.1 (XML Object d Istce). A XML object is biry record [t, {e 1,..., e }], where t is tomic tg vlue from tg costt domi T, d e 1,..., e re XML objects. Its bstrct sytx is give by e ::= [T, {ɛ e 1, e 2,..., e }]. A XML istce is XML object with distiguished root tg. ppers owhere else i the istce. I our discussio we model XML istce s uordered edge-lbeled tree. Nodes i the tree represet XML objects, d hve idetifiers from domi N, which is disjoit from the domi of tg costts, T. Edges betwee odes represet estig reltioships, d the lbels o the edges (tke from T ) represet tgs. The idetifier of the root is. Note tht i the tree represettio, lbels o edges ledig to lef odes correspod to text vlues i the XML documet, while lbels o edges ledig to iterl odes correspod to XML elemet tgs. I our ottio, tg vrible c be boud to either kid of lbel i the tree represettio. Exmple 2.2: Figure 1 shows XML istce d its correspodig tree. It lists the projects i dtbse reserch group d members i ech project. 2.2 Cojuctive XML Queries We ow defie frgmet of XML queries, clled cojuctive XML queries (c-xqueries). Sytx: A c-xquery represets FO-WHEE-ETUN query i XQuery with the followig restrictios. First, the retured vribles c be boud to oly tg mes or text vlues (i.e. cot be boud to XML elemets). Secod, XPth expressios i c-xquery coti oly child xis (/), wildcrds (*) d brchig ([...]). Note tht the descedt xis (//) is ot llowed, or is egtio, uio, comprisos except of the form vrible=costt (either i XPth expressios or i WHEE-cluse coditios). We cosider ech of these extesios of c-xquery i Sectio 5. For lysis purposes, we ofte describe c-xqueries with sytx which is remiiscet of cojuctive queries. The c-xquery i Figure 2() is show below i our sytx. Q: group project X { projtitle X title W 3

4 Q: FO $x IN /project ETUN <group>{ FO $w IN $x/title ETUN <projtitle>$w/text()</projtitle> FO $y IN $x/member ETUN <me>$y/text()</me> }</group> () projtitle S group (b) me Figure 2: A exmple c-xquery: () query Q; (b) the hed tree of Q. T } {S W SV } me X member Y {T Y TZ } A c-xquery cosists of ested query blocks. A query block ˆq returs either costt i T or tg vrible (show o the left-hd side of the ). We use lowercse letters for tg costts d cpitl letters for tg vribles. I the bove query Q, the top-level query block returs tg costt group, while the lef query blocks retur the tg vribles S d T. I our sytx, pth expressios d predictes i the FO d WHEE cluses re trslted ito sets of cojucts i the pproprite query blocks. Ech cojuct reltes two ode vribles with either tg costt or tg vrible. We use itlic cpitl letters for ode vribles, d ssume the domi of ode vribles d tg vribles re disjoit. Note tht wildcrds (*) c be represeted by tg vribles. A ode vrible tht ppers i ˆq but ot i ˆq s cestor query blocks is clled fresh ode vrible of ˆq. I the bove exmple, the pth expressio /project i the top-level query block is trslted ito the cojuct project X, while the pth expressio $y/text() is trslted ito the cojuct Y TZ. The fresh ode vribles i the lst lef block re Y d Z. A query block my hve set of sub-blocks. The fout of ˆq is the umber of sub-blocks it hs. A query with o sub-blocks hs estig depth of 1. The estig depth of ˆq is 1 plus the mximl estig depth of its sub-blocks. The estig depth of the query is the depth of its outer-most block. I the bove query Q, the outer-most query block hs fout 2 d estig depth 3. The swer to the outer-most block of the c-xquery is the swer to the query (we usully omit the root, which lwys hs the reserved tg ). We lso idetify the hed tree of the query, which is creted by removig ll the cojucts from the query (i.e. the hed tree shows us the shpe of the swers.) Note tht hed tree is lso XML istce if we pply substitutio to the vribles i the hed tree. The hed tree of the exmple query Q is show i Figure 2(b). To esure tht c-xqueries do ot llow disjuctio, we require tht siblig blocks lwys retur distict tg costts. Cosequetly, block c retur tg vrible oly whe it hs o sibligs. For our lysis i Sectio 3 we defie smller frgmet of c-xqueries, clled costt cojuctive XML queries (cc-xqueries). A cc-xquery is c-xquery tht does ot coti tg vribles (i.e. tg vribles re ot llowed o the left-hd side of the, or s the middle compoets of cojucts.) Semtics: The semtics of c-xquery is extesio of the semtics of u-ested cojuctive query. Specificlly, ech ode i the swer is geerted by query block with the sme depth s. Note tht sice c-xquery does ot llow disjuctio, ech ode hs uique geertor. We geerte retur tg of query block for every possible vrible substitutio tht stisfies the cojucts of the block. Whe there is t lest oe stisfyig substitutio, we evlute the block s sub-blocks. Note tht vrible substitutio of sub-block is extesio of the substitutio tht stisfies its pret block. Filly, i this pper we cosider set semtics for queries: t y level of the swer tree, there exists t most oe copy of ideticl siblig sub-trees. A c-xquery c be evluted o iput XML istce i polyomil time of dt size, d expoetil time of query size. Let D be the size of the iput istce, Q be the size of the query. Ech query block is cyclic query; evlutig it o the iput dt tkes O( Q D ) time [37]. Let d be the depth of Q, d 4

5 g g g g g b b b b b Figure 3: Three XML istces tht coti ech other pirwise but re ot equivlet. be the mximum umber of fresh vribles i query block of Q. I the worst cse, there c be O( D ) umber of embeddigs for query block; query block with depth d c be evluted for up to O( D d ) times. This gives the upper boud of c-xquery evlutio s O( Q D Q ). 2.3 Cotimet d Equivlece A XML object is specil cse of complex object, where ech record is biry. Hece, we follow the defiitio of cotimet give i [28]. Defiitio 2.3 (XML Object Cotimet). Let e = [t, {e 1,..., e }] d e = [t, {e 1,..., e }] be two XML objects. e is cotied i e, deoted s e e, if t = t d i. i.e i e i. This otio of cotimet hs lso bee used previously for Verso reltios [5], prtil iformtio [8], d or-sets [29]. It is prticulr cse of the lower (Hore) powerdomi orderig [18], d it coicides with the simultio reltio betwee complex objects represeted s grphs [6, 7]. It is lso the smllest order reltio for XML istces which is reflexive (i.e. e e), is cogruece (i.e. e 1 e 1 e e implies [t, {e 1,..., e }] [t, {e 1,..., e }], {e 1 } {e 1}, d e 1 e 2 e 1 e 2), d stisfies the empty set e. The cotimet of two XML istces c be justified by tree homomorphism (ot ecessrily ijective). Followig [30], we defie embeddig from tree t 1 to t 2 s ode mppig, which is root preservig, respects ode reltioships d edge lbels. It is trivil to verify tht two XML istces e d e stisfy e e, if d oly if e s correspodig tree c be embedded i e s correspodig tree. XML istce cotimet is reflexive d trsitive, but ot tisymmetric: e e d e e do ot imply e = e. As exmple, cosider the three XML istces i Figure 3. They coti ech other pirwise, but re ot equivlet. I the developmet of our lgorithms we will use the otio of miiml XML object, defied s follows. Defiitio 2.4 (Miiml XML Object). Let e be XML object. e is sid to be miiml if there is o XML object [t, {e 1,..., e }] ested i e, where there exist i, j [1, ], i j, d e i e j. Propositio 2.5. Cotimet o miiml XML objects is prtil order. Proof: As for geerl XML objects, cotimet o miiml XML objects is reflexive d trsitive. Below we prove it is lso ti-symmetric; i.e., give two miiml XML objects, D d D, D = D if d oly if D D d D D. Assume to the cotrry, D D. D D d D D imply the existece of tree embeddig from D to D, deoted s e 1, d tree embeddig from D to D, deoted s e 2. Becuse D D, there must exist ode which is ot mpped to itself through e 1 d e 2. Suppose 1 of D is such pir, d ll its prets re mpped to themselves through e 1 d e 2. Suppose e 1 mps 1 to 2, but e 2 mps 2 to other ode 1 1. Accordig to the ssumptio, 2 s pret is mpped to 1 s pret, so 1 must be oe of 1 s siblig ode. Accordigly, the subtree rooted t 1 is embedded i the subtree rooted t 2 d trsitively embedded i the subtree rooted t 1. Therefore, D is ot miiml, which cotrdicts our ssumptio. Ituitively, XML object tht is ot miiml cotis redudt iformtio. We c miimize it by removig redudcy. We defie weker equivlece reltioship betwee XML objects by comprig their miimized forms. As stted by Propositio 2.9 this ottio of equivlece grees with bi-directiol XML object cotimet. Defiitio 2.6 (Miimized Form of XML object). Let e be XML object d e be miiml XML object. e is clled miimized form of e, if e e d e e. 5

6 Propositio 2.7. Every XML object hs oe d oly oe miimized form. Proof: We first show the existece by miimizig D to miiml XML object. We process D bottom-up. For ech two siblig subtrees T d T i D, where T T, we remove T from D. The process hlts whe it reches the root. It s esy to verify tht the result, D, is miiml XML object. Next, we show the uiqueess. Assume to the cotrry, D c be miimized ito two differet miiml XML objects D 1 d D 2. D 1 D d D D 2 imply D 1 D 2 ; similrly D 2 D 1. Bsed o Propositio 2.5, D 1 = D 2, which cotrdicts our ssumptio. Defiitio 2.8 (XML Object Wek Equivlece). Let e d e be two XML objects. e is wek equivlet to e, deoted s e. = e, if the miimized form of e is equivlet to the miimized form of e. Propositio 2.9. Let e d e be two XML istces. e. = e, iff e e d e e. Proof: Let M be the miimized form of D, d M be the miimized form of D. if: D D implies M D D M, so M M. Similrly, D D implies M M. Becuse M d M re miiml, from bove M = M. So D. = D. oly if D. = D implies M = M. D M = M D, so D D ; similrly, D D. Bsed o the defiitio of XML object cotimet d wek equivlece, we defie cotimet d wek equivlece of c-xqueries s follows. Defiitio 2.10 (c-xquery Cotimet). Let Q d Q be two c-xqueries. Q is cotied i Q, deoted s Q Q, if for every iput XML istce D, Q(D) Q (D). Propositio Let Q d Q be two c-xqueries. Q. = Q iff Q Q d Q Q. 3 Cotimet of cc-xqueries We begi by cosiderig query cotimet for cc-xqueries. A cc-xquery does ot coti tg vribles, thus c be viewed s geerliztio of boole cojuctive query (i.e, cojuctive query with empty hed), except tht they c retur oe of severl tree structures, rther th oly true or flse. Although cc-xqueries re rrely useful i prctice, we study them for two resos. First, they lredy show some of the importt lower bouds o query cotimet, d secod, they help us obti isights o the umber of coicl swers we eed to cosider, which lter crry over to c-xqueries. Ituitively, give pir of queries Q d Q, we cot check tht for every possible XML iput D, Q(D) Q (D). Hece, our gol is to fid fiite set of represettive iputs, clled coicl dtbses, which hve the property tht Q Q if d oly if Q(DB) Q (DB) for every coicl dtbse DB. Our pproch is bsed o cosiderig the differet coicl swers tht c be geerted for Q, d cretig coicl dtbse for ech coicl swer. Iitilly, oe could cojecture tht it suffices to cosider ll the swers correspodig to subtrees of the hed tree of Q tht coti the root. However, the followig exmple refutes this cojecture. Furthermore, it shows tht the result i [28] offers oly ecessry coditio for query cotimet, but ot sufficiet oe. Exmple 3.1: Cosider the two cc-xqueries, Q d Q, i Figure 4() (d i our sytx below). Q: g px { px, XmY { Y Z b Y bw }} Q : g px { XmY { Y Z b Y bw }} The query Q checks whether Alice d Bob re i the reserch group, d groups them together regrdless of their projects. The query Q lso checks whether Alice d Bob re i the reserch group, but i cotrst, groups them ccordig to whether or ot they re workig o the sme project. Figure 4(b) shows the results of Q d Q o the XML istce D of Exmple 2.2. Q(D) Q (D), d thus Q Q. I cotrst, cotimet does hold for coicl dtbses geerted for ll subtrees of the hed tree. 6

7 Q: FO $x IN /project ETUN <group>{ FO $y IN /project/member ETUN <me>{ WHEE $y=``alice`` ETUN <Alice/> WHEE $Y=``Bob`` ETUN <Bob/> </me> </group> Q`: FO $x IN /project ETUN <group>{ FO $y IN $x/member ETUN <me>{ WHEE $y=``alice`` ETUN <Alice/> WHEE $Y=``Bob`` ETUN <Bob/> </me> </group> () me Alice group me Alice (b) group me Bob group me Bob Figure 4: Exmple 3.1: () Q d Q ; (b) the swers to Q d Q. g g g g g g p p p p p p p p p p p p m m m m m m b b b b b b () Figure 5: Exmple 3.1: () Q s coicl swers; (b) Q s coicl dtbses. (b) 3.1 Coicl Aswers d Dtbses The observtio ledig to our first result is tht it suffices to cosider coicl swers tht re miiml XML istces d re cotied i the hed tree (which is differet from beig subtrees of the hed tree). Defiitio 3.2 (Coicl Aswer of cc-xquery). Let Q be cc-xquery d H be its hed tree. A coicl swer of Q is miiml XML istce CA, such tht CA H. For ech coicl swer we defie coicl dtbse s follows. Defiitio 3.3 (Coicl Dtbse of cc-xquery). Let Q be cc-xquery, d CA be coicl swer of Q. Q s coicl dtbse for CA, deoted s DB CA, is XML istce, s.t. for ech ode N of CA where N s geertor query block is ˆq, the followig holds: Let X be fresh ode vrible i ˆq. There is distict ode i DB CA for X, deoted s N X. Let XlY be cojuct i ˆq. There is edge lbeled l from N X to N Y. The umber of coicl dtbses for cc-xquery is the sme s the umber of coicl swers. The size of coicl dtbse is polyomil i the size of its correspodig coicl swer. For exmple, Figure 5() shows six coicl swers for Q i Exmple 3.1. Figure 5(b) shows the correspodig coicl dtbses. 7

8 3.2 Query Cotimet Algorithm Our first result shows tht to test query cotimet, it suffices to cosider oly coicl dtbses costructed from the coicl swers. I the followig theorem, DB CA (DB CA ) refers to the coicl dtbse of Q(Q ) correspodig to the coicl swer CA. Theorem 3.4 (Cotimet of cc-xqueries). Let Q d Q be two cc-xqueries. The followig three coditios re equivlet: 1. Q Q ; 2. for every coicl dtbse DB of Q, Q(DB) Q (DB); 3. for every coicl swer CA of Q, () CA is coicl swer of Q ; d (b) DB CA DB CA. The proof of the bove theorem is bsed o two importt properties of coicl swers d coicl dtbses. Lemm 3.5. Let Q be cc-xquery d D be XML istce. There exists uique coicl swer CA of Q, such tht Q(D) CA d CA Q(D). Proof: Ech Q(D) hs uique miimized form, deoted s A. Let H be the hed tree of Q. Q(D) H d A Q(D) imply tht A H. So A is coicl swer of Q. Lemm 3.6. Let Q be cc-xquery, CA be coicl swer of Q, DB CA be the coicl dtbse for CA of Q, d D be XML istce. CA Q(D) if d oly if DB CA D. Proof: if: DB CA D implies tht there exists tree homomorphism σ : DB CA D. Let be ode i CA geerted by query block qˆ i Q, d N be the odes i DB CA ssocited with d s cestors. There exists substitutio ϕ DB : qˆ N. Composig it with σ, results i substitutio ϕ = ϕ DB σ : qˆ σ N. The result ode obtied from the substitutio is the ode to which mps. This proves CA Q(D). oly if: CA Q(D) implies tht there exists tree homomorphism σ : DB CA D. Let be ode i CA. σ() is s correspodig ode i Q(D). The defiitio of cc XQuery gurtees tht d σ() re geerted by the sme query block, deoted s htq. The defiitio of coicl dtbse DB idictes oe-to-oe correspodece betwee the odes ssocited with d the ode vribles i qˆ, deoted s φ : DB CA qˆ. Besides, there exists substitutio ϕ : qˆ D. Compose φ with ϕ results i the tree homomorphism from DB CA to D. Thus, DB CA D. Proof for Theorem 3.4: (1) (2): Follows from the defiitio. (2) (3): Cosider coicl swer CA d its coicl dtbse, DB CA. Accordig to Lemm 3.6, CA Q(DB CA ). Sice coditio (2) holds, Q(DB CA ) Q (DB CA ). Puttig the bove two cotimets together, we hve CA Q (DB CA ). This implies tht () holds. Applyig Lemm 3.6 gi gives DB CA DB CA. Hece, (b) holds. (3) (1): To show Q Q, we eed to show for every XML istce D, Q(D) Q (D). Accordig to Lemm 3.5, there exists uique coicl swer CA of Q, such tht Q(D) CA d CA Q(D). Accordig to Lemm 3.6, DB CA D. Sice coditios () d (b) hold, DB CA DB CA. So DB CA D. Applyig Lemm 3.6 gi gives CA Q (D). Bsed o cotimet trsitivity, Q(D) Q (D). The third coditio of Theorem 3.4 will become useful i the complexity lysis. The coditio sttes tht we do ot ctully hve to evlute the two queries o ech of the coicl dtbses. Isted, it suffices to check tree embeddig (which is sufficiet d ecessry coditio for cotimet) o ech pir of coicl dtbses, which c be doe i polyomil time i the size of the coicl dtbses. However, s the followig lysis shows, the umber d sizes of coicl dtbses, determied by the umber d sizes of coicl swers, re quite lrge. 8

9 Let m be the lrgest f-out of query block i Q, d let d be the estig depth of Q. We ext show ) 2 m (2m ) tht the mximl size of Q s coicl swers is Θ(m 2 m ) (which is tower of expoets with d 1 levels). Becuse the tg of ode s icomig edge hs m optios, the umber of coicl swers is similr to the bove complexity, but with d expoets. We obti this by cosiderig the upper d lower bouds of the mximl size of coicl swers. Cosider query block ˆq with depth d 1 i Q, d its pret query block ˆp. The query block ˆq hs o more th m childre query blocks, ech of which is lef block. Thus, the subtrees rooted t the odes geerted by ˆq hve o more th 2 m differet shpes; d the ode geerted by ˆp hs o more th 2 m childre tht re geerted by ˆq. Sice ˆp hs up to m childre query blocks, it c hve up to m 2 m childre subtrees. For similr reso, there re o more th 2 (m 2m) differet shpes for subtrees rooted t the odes geerted by ˆp; thus, ˆp s pret c hve up to m 2 (m 2m) childre. Itertively, the top-level query ( ) 2 m (2m ) block c hve o more th m 2 m childre, where the umber of the expoets is d 1. This is the upper boud of the mximl size of coicl swers. The rel size of coicl swers is fr less th the upper boud becuse of the cocer for siblig tree cotimet; however, the mximl size hs lower bouded i the sme clss s the upper boud. Agi, ( we lyze bottom-up. Cosider ode geerted by ˆq. Amog the trees rooted by the ode, m m/2 ) 2 m/2 hve exctly m/2 lef odes. These subtrees do ot coti ech other pirwise. A ode geerted by ˆp c hve y of them s subtrees. The query block ˆp hs up to m childre query blocks, so mog the subtrees rooted t ode geerted by ˆp, t lest 2 (m ( m/2 )) m 2 (m (2 m/2 )) do ot coti ech other. Itertively, mog the subtrees rooted t ode geerted by query with depth i, there re t lest t i = 2 (m ( t i+1 t i+1 /2 )) 2 (m (2 t i+1 /2 )) shpes. Whe the depth is 2, t 2 is i clss O(2 m ( ( 2 m (2(m/2) ) ) ), which ) 2 m (2(m/2) ) is tower of powers with height d 1. This implies tht the lower boud is O(m 2 m ). As specil cse, whe m = 1, the mximum size of coicl swer equls the depth of the query. This grees with the discussio i the ext sectio. 3.3 Effect of the Fout I this sectio, we show tht fout hs sigifict impct o the complexity of query cotimet. A cc-xquery is sid to be lier if the fout of ech query block is t most 1. We show the followig: Theorem 3.7 (PTIME). Let Q d Q be cc-xqueries. If either of them is lier, testig Q Q is i PTIME. Proof: The proof of Theorem 3.7 is bsed o the followig observtios. First, to check tht Q Q, where Q is lier cc-xquery, the umber of coicl swers we eed to cosider is equl to the estig depth of Q, deoted s d, d the sizes of coicl swers re bouded by d. Cosequetly, the size of coicl dtbse for Q is bouded by Q, d tht for Q is bouded by Q. Secod, s etiled by the third prt of Theorem 3.4, for ech such coicl swer we eed to perform embeddig test o the correspodig coicl dtbses, which c be doe i polyomil time i the sizes of the coicl dtbses. Specificlly, the time complexity for oe coicl dtbse embeddig checkig is O( Q Q ), d tht for cotimet checkig is O(d Q Q ). We ote tht this is the oly cse i which estig does ot dd to the complexity of cotimet i compriso to similr queries without estig. As we will soo see, the restrictio o the fout is crucil for obtiig polyomil-time complexity. The followig theorem shows tht the restrictio o the fout is criticl. Theorem 3.8 (conp-hrdess). Testig cotimet of cc-xqueries with estig depth 2 d rbitrry fout is conp-hrd. Proof: We reduce the 3CNF problem to query cotimet of cc-xqueries with depth 2. ( 9

10 Let ψ be 3-CNF formul with vribles x 1,..., x d cluses c 1,..., c m. We costruct two cc-xqueries, Q d Q, s.t. ψ is stisfible iff Q Q. We show tht ψ is stisfied by ssigmet ν, iff we c costruct coicl swer CA of Q from ν, which is lso coicl swer of Q, but violtes DB CA DB CA. Hece, the proof follows from the third coditio of Theorem 3.4. Both Q d Q hve two levels: top-level query block, d 2 childre blocks. I ech query, the top level block returs the tg u; for ech vrible x i, i [1, ], there re two childre query blocks o the secod level, returig v i d w i respectively. Hece, Q d Q hve exctly the sme coicl swers. I query Q, there re two groups of cojucts. Group A cotis m 2 cojucts i the top level query block. For ech cluse c i, i [1, m], there re m cojucts: C i, d C i d j for ech j [1, m], j i. ( idictes ode vrible) I group B, there re cojucts i the top level query block. For ech vrible x i, i [1, ], there is cojuct X i. O the secod level, for ech vrible x i, there is cojuct X i d 1 i the query block returig v i, d m 1 cojucts X i d j, j [2, m], i the query block returig w i. I query Q, the top-level query block hs the cojuct X. O the secod level, if x i occurs i cluse c j, there is cojuct Xd j i the query block tht returs v i ; if x i occurs i cluse c j, there is cojuct Xd j i the query block tht returs w i. As exmple, cosider the formul ψ = (x 1 x 2 x 4 ) ( x 1 x 2 x 3 ) (x 1 x 2 x 3 ). We build the followig two queries: Q: for C 1, C 1 d 2, C 1 d 3, C 2, C 2 d 1, C 2 d 3, C 3, C 3 d 1, C 3 d 2, X 1, X 2, X 3, X 4 retur [u, { for X 1 d 1 retur [v 1,{}] for X 1 d 2, X 1 d 3 retur [w 1,{}] for X 2 d 1 retur [v 2,{}] for X 2 d 2, X 2 d 3 retur [w 2,{}] for X 3 d 1 retur [v 3,{}] for X 3 d 2, X 3 d 3 retur [w 3,{}] for X 4 d 4 retur [v 4,{}] for X 4 d 2, X 4 d 3 retur [w 4,{}] }] Q : for X retur [u, { for Xd 1, Xd 3 retur [v 1,{}] for Xd 2 retur [w 1,{}] for Xd 1, Xd 2, Xd 3 retur [v 2,{}] for true retur [w 2,{}] for Xd 2, Xd 3 retur [v 3,{}] for true retur [w 3,{}] for true retur [v 4,{}] for Xd 1 retur 10

11 CA: u DB: DB? X v 1 w 2 v 3 w 4 C 1 C 2 C 3 X 1 X 2 X 3 d 2 d 3 d 1 d 3 d 1 d 2 d 1 d 2 d 3 d 1 X 4 d 2 d 3 d 1 d 2 d 3 () Figure 6: () A exmple coicl swer CA of Q tht correspods to ssigmet ν, i which x 1 = true, x 2 = flse, x 3 = true, x 4 = flse; (b) Q d Q s coicl dtbses for CA. (b) }] [w 4,{}] We costruct CA from ν, s follows. Cosider two-level coicl swer, which hs sigle ode with icomig edge lbeled u o the first level. There is ode with icomig edge lbeled v i, iff ν(x i ) = true; there is ode with icomig edge lbeled w i, iff ν(x i ) = flse. (Note tht if for give i [1, ], either v i or w i occurs i CA, the i the correspodig ssigmet, x i c be ssiged either true or flse.) Bsed o this, we prtitio these coicl swers ito three clsses. If both v i d w i occur i CA, we sy the coicl swer correspods to ivlid ssigmet. Otherwise, the coicl swer must correspod to vlid ssigmet. If the ssigmet does ot stisfy ψ, we sy the coicl swer correspods to bd ssigmet. If the ssigmet stisfies ψ, we sy the coicl swer correspods to good ssigmet. I our exmple, coicl swer tht correspods to the ssigmet x 1 = true, x 2 = flse, x 3 = true, x 4 = flse is show i Figure 8(). Costructig Q d Q tkes polyomil time. Now we show tht Q Q iff ψ is stisfible. if Assume ν is ssigmet tht stisfies ψ. Cosider the coicl swer correspodig to ν, which is good ssigmet. The coicl swer i Figure 8() correspods to good ssigmet for the give exmple. The two coicl dtbses, DB CA d DB CA, re show i Figure 8(b). Sice ν stisfies ψ, ech cluse c j = true, j [1, m]. So t lest oe of its three literls is stisfied by ν. Accordigly, the edge correspodig to the literl occurs i CA, d i tur d j must occur i DB CA. Thus, i DB CA there exists full-width ode X with depth 1, which hs icomig edge lbeled, d outgoig edges lbeled d 1,..., d m respectively. O the other hd, DB CA does ot coti y full-width odes. Thus, DB CA DB CA, d so Q Q. oly if Assume ψ is ot stisfible. The two-level coicl swer CA of Q must either correspod to ivlid ssigmet or correspod to bd ssigmet. If CA correspods to ivlid ssigmet, the there exists i [1, ], where both v i d w i occur i CA. The Group-B cojucts of Q gurtee tht there will be full-width ode i DB CA. Thus DB CA must be cotied i DB CA. If CA correspods to bd ssigmet, the i DB CA there do ot exist full-width odes. O the other hd, the Group A cojucts of Q esures DB CA DB CA s fr s DB CA does ot coti full-width odes. So gi, DB CA DB CA. Filly, it s esy to verify tht for the empty coicl swer CA 0 d the oe-level coicl swer CA 1 of Q, we hve DB CA 0 DB CA0, DB CA 1 DB CA1. This proves Q Q. 3.4 cc-xqueries with Fixed Nestig Depth I this sectio we show tht for y fixed estig depth, query cotimet for cc-xqueries is i conp. Hece, we obti the followig result: Theorem 3.9 (conp-completeess). Let Q d Q be cc-xqueries. If either of them hs fixed estig depth, testig Q Q is conp-complete. The key observtio behid Theorem 3.9 is to further reduce the umber of coicl swers (d 11

12 hece of coicl dtbses) we eed to cosider. As we show below, it suffices to cosider kerel coicl swers. Defiitio 3.10 (Kerel Coicl Aswer). Let Q be cc-xquery. Let d be the estig depth of Q d c be the mximum umber of cojucts i query block of Q. A coicl swer CA of Q is clled kerel coicl swer if the followig hold: (1) The root ode hs sigle child, d (2) Suppose N is ode i CA d p is pth from N to lef. The p ppers i t most cd 1 sibligs of N. I the followig lemm, DB KCA (DB KCA ) refers to the coicl dtbse of Q(Q ) correspodig to the coicl swer KCA. Lemm Let Q d Q be two cc-xqueries. The cotimet Q Q holds if d oly if for ech kerel coicl swer KCA of Q, (1) KCA is coicl swer of Q ; d (2) DB KCA DB KCA. Proof: I the proof, we cll coicl swer CA violtor if it violtes the coditio DB CA DB CA. We cll violtor CA miimum violtor, if CA does ot hve y proper subtree CA, which lso violtes DB CA. We prove the theorem by showig tht o-kerel coicl swer cot be miimum DB CA violtor. By iductio, if CA is o-kerel coicl swer tht violtes DB CA DB CA, there must exist kerel coicl swer KCA, which is proper subtree of CA, d violtes DB KCA DB KCA. So eve without checkig cotimet o CA, we c still get the right coclusio tht Q Q. Assume to the cotrry, there exists o-kerel coicl swer CA, which is miimum violtor for Q d Q. Let N be the ode i CA with l > cd childre, C 1,..., C l. We deote the subtrees rooted t C 1,..., C l s T 1,..., T l. Ech of them cotis commo pth ptter p. Cosider the odes i DB CA tht correspod to N or N s cestors, i.e. correspod to the ode vribles i the query block of Q tht geerte N or N s cestors. Accordig to the structure of CA, i DB CA there must be odes tht hve o less th l childre, where ech subtree T i, i [1, l], geertes t lest oe of the childre together with the subtree rooted t tht child. We cll those odes l-childre odes. Below we discuss l-childre odes, their cestors, their descedts, d the rest odes i DB CA seprtely, showig tht odes i ech ctegory c be mpped to some odes i DB CA. This implies DB CA DB CA. We first cosider l-childre ode i DB CA. If we remove subtree T i, i [1, l] from CA, d ccordigly Y s descedts i DB CA correspodig to T i, the result subtree rooted t Y must be embedded i subtree i DB CA, becuse CA is miiml violtor. We deote the root of the subtree i DB CA s Y i. If there exist Y i, Y j, i j tht re the sme ode, Y c be mpped to it. Below we show tht those Y i s, i [1, l], c ot be ll differet; otherwise, the umber of odes i DB CA exceeds the mximum umber of odes i Q s coicl dtbse for CA. Suppose there re k leves i CA. Ech lef correspods to t lest oe descedt ode of Y ; otherwise, removig tht lef will ot ffect the subtree rooted t Y, d Y still cot be mpped to y ode i DB CA, which implies CA is ot miiml violtor. As result, Y hs t lest k descedt odes. Ech descedt ode tht correspods to ode i T i, c be mpped to descedt of Y j, j [1, l], j i. If Y 1,..., Y l re differet, their descedts re disjoit. So ech descedt ode hs l 1 couterprts i DB CA. Plus Y 1,..., Y l, we hve t lest l + k(l 1) odes i DB CA. O the other hd, there re t most kd odes i CA. Ech ode hs geertor query block; ech query block cotis o more th c cojucts; d ech cojuct itroduces o more th oe ew ode vrible, d i tur o more th oe ode to the coicl dtbse. So there c be o more th kdc k(l 1) < l + k(l 1) odes i DB CA, which leds to cotrdictio. I the sme fshio we prove cestor of l-childre ode must be ble to mp to ode i DB CA. We deote the cestor s X d its l-childre child s Y. Similrly, sice CA is miiml violtor, fter removig T i, i [1, l], d ccordigly Y s descedts correspodig to T i, X must be ble to mp to ode i DB CA, deoted s X i. There must exist two X i, X j, i j tht re the sme ode; otherwise, for the sme reso s discussed for l-childre odes, there re t lest l + k(l 1) odes i DB CA ; but o more th kdc < l + k(l 1) of them c correspod to odes i CA, which leds to cotrdictio. Therefore, X c be mpped to tht X i. 12

13 If ode, deoted s X, is descedt of l-childre ode, it correspods to ode i oe T i, i [1, l]. emovig other T i s from CA does ot ffect the subtree rooted t X i DB CA. Give CA is miiml violtor, X must be ble to mp to ode i DB CA. Filly, cosider the rest of the odes, deoted s X. I the subtree rooted t X, y ode cot correspod to the ode t the very ed of the pth ptter p i CA. Otherwise, X must be l- childre ode, or cestor, or descedt of l-childre ode. Thus, removig the odes t the very ed of the pth ptter p i CA does ot ffect the subtree i DB CA rooted t X. Give CA is miiml violtor, X must be ble to mp to ode i DB CA. From the bove lysis, ll odes i DB CA c be mpped to some ode i DB CA. This cotrdicts with the ssumptio tht DB CA DB CA. Now we exmie the time complexity of the lgorithm derived from Theorem 3.4(3), by lyzig the umber d sizes of kerel coicl swers. Let m be the mximum fout, d b be the umber of query blocks i Q. I kerel coicl swer, the fout of ech ode is o more th bcd, sice there re o more th cd outgoig edges cotiig commo pth ptter, d there re t most b differet pth ptters i the query. Hece the size of the coicl swer is i O((bcd) d ). Cosider specific ode N i the coicl swer. There re o more th m cdidte lbels for the edge ledig to N. So the umber of kerel coicl swers is i O(m (bcd)d ). Hece, the time complexity of the lgorithm is i O(m (bcd)d ). Corollry Testig cotimet for cc-xqueries with fixed estig depth is i conp. Testig cotimet for cc-xqueries with rbitrry estig depth is i conexptime. Proof: Give two cc-xqueries Q d Q, to check Q Q, we eed to guess kerel coicl swer of Q, deoted s KCA; costruct Q d Q s coicl dtbses for KCA, deoted s DB d DB; d check whether DB DB. Whe the estig depth is fixed, the size of kerel coicl swer is polyomil i the size of Q. Thus, costructig coicl dtbses d checkig cotimet both tke polyomil time. Hece, query cotimet is i conp. Whe the estig depth is rbitrry, the size of kerel coicl swer is expoetil i the estig depth, thus query cotimet is i conexptime. From Corollry 3.12 d Theorem 3.8 we obti Theorem 3.9. Filly, we ote tht the complexity of query cotimet for cc-xqueries with rbitrry estig depth remis ope problem. 4 Cotimet of c-xqueries We ow cosider geerl c-xqueries, which my retur tg vribles. A tg vrible c be set to y vlue i T, d therefore the umber of cdidte swers to give query is ifiite. Cosequetly, the lgorithms for cc-xqueries do ot pply directly. There re two key poits uderlyig our lgorithm for checkig cotimet of c-xqueries. First, we cosider coicl swers tht my coti vribles. As we will see, the umber of such coicl swers is the sme s we hd i Sectio 3. Secod, we check query cotimet by pplyig more elborte procedure for ech coicl swer. Specificlly, we pply coditio clled query simultio [28] to pir of idexed cojuctive queries tht we crete for ech coicl swer. Sice query simultio, lbeit more elborte, is lso i PTIME, we re ble to show tht the complexity results for c-xqueries re, for the most prt, the sme s for cc-xqueries. 4.1 Simultio of Idexed Queries We begi by expliig idexed cojuctive queries d the coditio of query simultio, both from [28]. We represet idexed cojuctive queries usig dtlog-like ottio, s follows. Q(Ī1;... ; Īm; V ) : X 1 1 Y 1,..., X Y 13

14 The body of the idexed cojuctive query is similr to tht of ordiry cojuctive query (except tht we write XY isted of (X, Y )), but the hed hs set of tuples of idex vribles, Ī1,..., Īm, i dditio to the hed vribles V. A idexed cojuctive query produces ested structure: the tuples V of the swer re grouped first by the idex vribles Ī1, the by Ī2, etc., d filly by Īm. Formlly, simultio is defied s follows. Defiitio 4.1 (Query Simultio). Let Q d Q be two idexed cojuctive queries, ech with m sets of idex vribles. We sy tht Q simultes Q to depth m, deoted by Q m Q, if for y dtbse: Ī1. Ī 1... Īm. Ī m.[ V. (Q(Ī1;... ; Īm; V ) Q (Ī 1;... ; Ī m; V ))] I [28] it is show tht query simultio c be checked by estblishig simultio mppig from Q to Q, defied s follows. We deote with I j the set of idex vribles i Īj, j [1, m], with I the set of ll idex vribles, with V the set of o-idex vribles (hed d o-hed) of Q, d with C the set of costts. For ech j = 1,..., m, the witess vribles t level j re fresh copy of I j+1 I m V, deoted W j ; i prticulr, W m is fresh copy of V. We deote Q w j copy of Q i which the vribles i I j+1 I m V hve bee replced with those i W j, d let Q w = Q w 1 Qw m. The simultio mppig from Q to Q of depth m is mppig ϕ : I V I W 1 W m V C such tht (1) ϕ(body(q )) Body(Q) Body(Q W ), (2) ϕ( V ) = V, d (3) ϕ(i j ) (I j+1 I m W j+1 W m V) =, j [1, m]. I our cotext, where the body of the cojuctive query is cyclic, fidig simultio mppig c be trslted ito tree embeddig problem, where the sizes of trees re polyomil i the sizes of the queries. Thus, checkig simultio for the idexed cojuctive queries we will crete is i PTIME. Compre simultio mppig to clssicl cotimet query mppig τ, where ech vrible i Q c be mpped to y vrible i Q, s.t. (1) τ(body(q )) Body(Q), (2) τ( V ) = V. As show i the followig prepositios, query simultio is geerliztio of query cotimet for idexed cojuctive queries. Simultio reduces to query cotimet whe there re o idex vribles. Propositio 4.2. Let Q d Q be two fltteed queries. If there is simultio mppig from Q to Q, there is query mppig from Q to Q. Proof: Give simultio mppig ϕ from Q to Q, we costruct clssicl cotimet mppig τ. Costruct mppig ψ : I W 1 W m V C I V C, sedig ech witess vrible to its origil vrible i the idex, ech witess cojuct i Q w to its origil cojuct i the body of Q, d other vribles d cojucts to themselves. Compose ϕ with ψ results i τ = ϕ ψ : I V I V C. It s esy to verify τ is mppig from Q to Q. Propositio 4.3. Let Q d Q be two fltteed queries where V =. There is simultio mppig from Q to Q, iff V =, d there exists query mppig from Q to Q. Proof: The oly if directio holds ccordig to Propositio 4.2. We prove the if directio. Give clssicl query mppig τ from Q to Q, we costruct simultio mppig ϕ. Let ψ : I I 1 W 1 be mppig where ech idex vrible i I 1 is mpped to itself, d other idex vribles re mpped to their witesses i W 1. Compose τ with ψ results i ϕ = τ ψ : I V I W 1 V C. It s esy to verify ϕ is simultio mppig from Q to Q. 4.2 Query Cotimet Algorithm I geerl, c-xquery my hve ifiite umber of cdidte swers, give ll the possible substitutios to the tg vribles. ecll tht hed tree of c-xquery my coti tg vribles. Whe cretig coicl swers, we tret the vribles s costts. Hece, we c still represet ll cdidte swers with fiite umber of coicl swers. Give coicl swer CA, we crete idexed cojuctive query, which is geerliztio of the coicl dtbse, s defied below. 14

15 Defiitio 4.4 (Idexed Cojuctive Query for Coicl Aswer). Let Q be c-xquery d CA be coicl swer with depth d. Q s idexed cojuctive query for CA, deoted s IQ CA, hs the form IQ CA (Ī1;... ; Īd 1; V ) : X 1 1 Y 1,..., X Y, d is costructed i two steps. Let N be ode of CA o level k, k [1, d], d let ˆq be N s geertor query block i Q. First, if there exists y ode M, which my be N s cestor, descedt, or N itself, where the icomig edge of M is lbeled by tg costt c from T, the geertor query block of M returs tg vrible T, d T lso occurs i ˆq, we substitute T with c i ˆq. Secod, we compose IQ CA s follows: If k < d, the Īk icludes every fresh ode vrible d tg vrible of ˆq. V icludes the retured tg vrible i ˆq, if y. The body icludes every cojuct i ˆq. We c ow show how to test query cotimet for c-xqueries. The followig theorem shows tht it suffices to check query simultio o pirs of idexed cojuctive queries geerted from the coicl swers. I the theorem, IQ CA (IQ CA ) refers to Q s (Q s) idexed cojuctive query for CA. Theorem 4.5. Let Q d Q be two c-xqueries. The cotimet Q Q holds iff for every coicl swer CA of Q, (1) CA is coicl swer of Q (modulo vrible isomorphism); d (2) IQ CA IQ CA. Proof: From the defiitio of query simultio, it is esy to verify tht coditios (1)(2) hold, iff for every coicl swer CA d its coicl dtbse DB CA, we hve Q(DB CA ) Q (DB CA ). Composig this with Theorem 3.4 gives tht coditios (1)(2) hold iff Q Q. Exmple 4.6: Cosider query Q i the exmple of sectio 2. Give the hed tree, show i Figure 2(b), s the coicl swer CA, the idexed cojuctive query for CA is the followig (ote tht tg mes re bbrevited): IQ CA (X; W, Y ; S, T ) : px, XtW, W SV, XmY, Y T Z Note tht the lst XML istce show i Figure 5(), deoted s CA, is lso coicl swer of Q by pplyig vrible isomorphism. The idexed cojuctive query for CA is the followig: IQ CA (X; Y 1, Y 2 ; ) : px, XmY 1, XmY 2, Y 1 Z 1, Y 2 bz 2 By pplyig Theorem 4.5, we c justify tht the query Q i Exmple 3.1 is cotied i the bove query Q, but ot the other wy roud. Together with the isights ito kerel coicl swers from Sectio 3, we obti the followig complexity results, which show tht the itroductio of output tg vribles does ot mke the cotimet problem hrder. (Note tht the first bullet is slightly weker th Theorem 3.7. We require tht Q hs fout 1, rther th this holdig for either Q or Q.) Theorem 4.7. Let Q d Q be c-xqueries. If Q hs mximl fout of 1, the query cotimet is i PTIME. For rbitrry fout, if either Q or Q hs fixed estig depth, the cotimet is conp-complete. Otherwise, cotimet is i conexptime. 5 Extesios to c-xquery The previous sectio estblished the bsic complexity results o query cotimet for cojuctive XML queries with estig. This sectio discusses severl extesios of c-xqueries tht occur frequetly i pplictios. 15

16 5.1 Uio d Disjuctio Uio c be itroduced ito XML queries whe two siblig query blocks retur XML objects with the sme tg. This hppes whe either two siblig query blocks retur the sme tg costt, or whe t lest oe of the sibligs returs tg vrible, which my be isttited to the sme vlue retured by the other siblig. We cll such queries u-xqueries. We strt with costt queries, which my coti uios oly i the first form. Ech of such queries, Q, c be rewritte s uio of cc-xqueries s follows: 1. Suppose Q cotis subquery i the shpe of Q ::= for B retur [T, {Q 1, Q 2,..., Q }], where there exist i, j, i, j [1, ], i j, s.t. Q i d Q j retur the sme tg costt. The the uio of cc-xqueries for Q is the uio of ll cc-xqueries for Q where Q does ot coti Q i, d ll cc-xqueries for Q where Q does ot coti Q j. 2. If Q is cc-xquery, the the uio of Q is Q itself. Similr to Theorem 3.4, we prove the followig theory. Theorem 5.1. Let Q = i=1 CQ i d Q = m XQueries. The followig three coditios re equivlet: j=1 CQ j be two u-xqueries composed of uios of cc- 1. Q Q ; 2. for every i [1, ] d every coicl dtbse DB of CQ i, Q(DB) Q (DB); 3. for every i [1, ] d every coicl swer CA of CQ i, there exists j [1, m], s.t. (1) CA is coicl swer of CQ j ; d (2) DB j,ca DB i,ca. I similr fshio, we cosider the secod form of uio. To simplify, we first ssume i the query there is o uio i the first form. We rewrite ech query, Q, s uio of c-xqueries s follows: 1. Suppose Q is query i the shpe of Q ::= for B retur [T, {Q 1, Q 2,..., Q }], where there exists i, i [1, ], s.t. Q i returs tg vrible. The the uio of cc-xqueries for Q is the uio of ll c-xqueries for Q where Q oly cotis Q i, d ll c-xqueries for Q where Q does ot coti Q i. 2. If Q is cc-xquery, the the uio of Q is Q itself. For geerl u-xquery, we combie the bove to rewrite it s uio of c-xqueries. Note tht the umber of the c-xqueries is lier i terms of the size of the u-xquery. Similrly, we hve the followig theorem. Theorem 5.2. Let Q = i=1 CQ i d Q = m j=1 CQ j be two u-xqueries composed of uios of c- XQueries. Cotimet Q Q holds iff for every i [1, ], d every coicl swer CA of CQ i, there exists j [1, m], s.t. (1) CA is lso coicl swer of CQ j, d (2) IQ i,ca IQ j,ca. Next, we show tht ddig uios to c-xqueries does ot icrese the complexity of the cotimet problem. The key igrediet is to show tht checkig simultio o existece qutifier of Theorem 5.1 c still be doe i polyomil time i the size of the coicl dtbse. Theorem 5.3. Let Q d Q be u-xqueries. Query cotimet is i PTIME whe Q hs estig depth of 1, or Q hs mximl fout of 1; query cotimet is conp-complete if Q hs fixed estig depth. 16

17 Proof: The lower bouds re o less th tht of the query cotimet problem for c-xqueries. Now we prove the upper boud. I cse (1) d (2), the umber d size of coicl dtbses re bouded by the size of Q d Q. Give CA, coicl swer of Q, we costruct the idexed queries for CA, deoted s IQ CA d IQ CA, i the sme wy s stted i Defiitio 4.4, except tht whe costructig IQ CA, (1) for ech ode of CA, we repet the process for every cdidte geertor query block; (2) let ˆq 1 d ˆq 2 be two disjuctive query blocks; we mrk vribles for ˆq 1 s bck-up of vribles for ˆq 2. Now we fid the simultio from IQ CA to IQ CA. This c be reduced to tree embeddig problem, where the embeddig coditio is looseed so tht ode P c be mpped to ode Q s fr s P s childre or the respective bck-up childre c be mpped to childre of Q. Estblishig such embeddig is i polyomil time of the size of the coicl dtbse, thus i polyomil time of the query size. I cse (3), let Q = i=1 CQ i d Q = m j=1 CQ j be two u-xqueries. We describe o-determiistic polyomil lgorithm, tht checks whether there exists i [1, ] d coicl swer of CQ i, oe of j [1, m] stisfies both coditios (1)(2) i Theorem 5.1. We guess i [1, ] d coicl swer CA. Similr to the cses of (1) d (2), it tkes polyomil time to decide whether oe of j [1, m] stisfies both coditios (1)(2). So the problem is i co-np. Disjuctios i the query s XPth expressio or WHEE-cluse is other wy of expressig certi types of uios. This cse c be trslted ito the bove cses, but with expoetil blowup i the size of the resultig queries. We refer to queries with disjuctios s d-xqueries. We hve the followig result. Theorem 5.4. Let Q d Q be d-xqueries. Query cotimet is conp-complete i ech of the followig cses: Q hs estig depth of 1, Q hs mximl fout of 1, d Q hs fixed estig depth. If Q is c-xquery, the the complexity results of Theorem 4.7 still pply. The differece betwee Theorem 5.3 d Theorem 5.4 is tht the lower boud of cse (1) d (2) rises to co-np hrd. This result is logous to the reltiol cse, where cotimet for cojuctive queries d cotimet for queries with uios re both NP-complete, while cotimet for disjuctive queries (whe uio c occur ywhere i the query) is Π p 2 complete. The complexity of the first two cses lso icreses whe we cosider egtio d descedt edges. 5.2 Negtio We cosider XQueries where predictes i XPth expressios c coti the ot opertor (e.g. perso[ot pper]). This type of egtio is similr i spirit to NOT EXISTS i SQL. We refer to such queries s c-xqueries. Followig the spirit of cotimet checkig for reltiol queries[27], every coicl swer of c- XQueries my correspod to severl idexed queries, d we eed to check cotimet o ech of them. We costruct the idexed queries for coicl swer CA of Q s follows: (1) Costruct model idexed query s i Defiitio 4.4, igorig the egted cojucts. (2) Cosider ll possible prtitios of ode vribles i the model idexed query. For ech oe, we merge ll odes i the sme group ito sigle ode (without destroyig the tree structure), resultig i idexed query. For query cotimet Q Q to hold, it must be the cse tht every idexed cojuctive query IQ CA of Q either violtes the egtio predictes i Q, or stisfies IQ CA IQ CA. Exmple 5.5: Cosider the followig c-xqueries Q with egtio Y bw. Q : for px retur [g, { for px, XmY retur [, { 17

Review of the Riemann Integral

Review of the Riemann Integral Chpter 1 Review of the Riem Itegrl This chpter provides quick review of the bsic properties of the Riem itegrl. 1.0 Itegrls d Riem Sums Defiitio 1.0.1. Let [, b] be fiite, closed itervl. A prtitio P of

More information

Numbers (Part I) -- Solutions

Numbers (Part I) -- Solutions Ley College -- For AMATYC SML Mth Competitio Cochig Sessios v.., [/7/00] sme s /6/009 versio, with presettio improvemets Numbers Prt I) -- Solutios. The equtio b c 008 hs solutio i which, b, c re distict

More information

Section 6.3: Geometric Sequences

Section 6.3: Geometric Sequences 40 Chpter 6 Sectio 6.: Geometric Sequeces My jobs offer ul cost-of-livig icrese to keep slries cosistet with ifltio. Suppose, for exmple, recet college grdute fids positio s sles mger erig ul slry of $6,000.

More information

1.3 Continuous Functions and Riemann Sums

1.3 Continuous Functions and Riemann Sums mth riem sums, prt 0 Cotiuous Fuctios d Riem Sums I Exmple we sw tht lim Lower() = lim Upper() for the fuctio!! f (x) = + x o [0, ] This is o ccidet It is exmple of the followig theorem THEOREM Let f be

More information

lecture 16: Introduction to Least Squares Approximation

lecture 16: Introduction to Least Squares Approximation 97 lecture 16: Itroductio to Lest Squres Approximtio.4 Lest squres pproximtio The miimx criterio is ituitive objective for pproximtig fuctio. However, i my cses it is more ppelig (for both computtio d

More information

Introduction to Computational Molecular Biology. Suffix Trees

Introduction to Computational Molecular Biology. Suffix Trees 18.417 Itroductio to Computtiol Moleculr Biology Lecture 11: October 14, 004 Scribe: Athich Muthitchroe Lecturer: Ross Lippert Editor: Toy Scelfo Suffix Trees This is oe of the most complicted dt structures

More information

( a n ) converges or diverges.

( a n ) converges or diverges. Chpter Ifiite Series Pge of Sectio E Rtio Test Chpter : Ifiite Series By the ed of this sectio you will be ble to uderstd the proof of the rtio test test series for covergece by pplyig the rtio test pprecite

More information

Chapter 5. The Riemann Integral. 5.1 The Riemann integral Partitions and lower and upper integrals. Note: 1.5 lectures

Chapter 5. The Riemann Integral. 5.1 The Riemann integral Partitions and lower and upper integrals. Note: 1.5 lectures Chpter 5 The Riem Itegrl 5.1 The Riem itegrl Note: 1.5 lectures We ow get to the fudmetl cocept of itegrtio. There is ofte cofusio mog studets of clculus betwee itegrl d tiderivtive. The itegrl is (iformlly)

More information

Infinite Series Sequences: terms nth term Listing Terms of a Sequence 2 n recursively defined n+1 Pattern Recognition for Sequences Ex:

Infinite Series Sequences: terms nth term Listing Terms of a Sequence 2 n recursively defined n+1 Pattern Recognition for Sequences Ex: Ifiite Series Sequeces: A sequece i defied s fuctio whose domi is the set of positive itegers. Usully it s esier to deote sequece i subscript form rther th fuctio ottio.,, 3, re the terms of the sequece

More information

Section IV.6: The Master Method and Applications

Section IV.6: The Master Method and Applications Sectio IV.6: The Mster Method d Applictios Defiitio IV.6.1: A fuctio f is symptoticlly positive if d oly if there exists rel umer such tht f(x) > for ll x >. A cosequece of this defiitio is tht fuctio

More information

We will begin by supplying the proof to (a).

We will begin by supplying the proof to (a). (The solutios of problem re mostly from Jeffrey Mudrock s HWs) Problem 1. There re three sttemet from Exmple 5.4 i the textbook for which we will supply proofs. The sttemets re the followig: () The spce

More information

INFINITE SERIES. ,... having infinite number of terms is called infinite sequence and its indicated sum, i.e., a 1

INFINITE SERIES. ,... having infinite number of terms is called infinite sequence and its indicated sum, i.e., a 1 Appedix A.. Itroductio As discussed i the Chpter 9 o Sequeces d Series, sequece,,...,,... hvig ifiite umber of terms is clled ifiite sequece d its idicted sum, i.e., + + +... + +... is clled ifite series

More information

Taylor Polynomials. The Tangent Line. (a, f (a)) and has the same slope as the curve y = f (x) at that point. It is the best

Taylor Polynomials. The Tangent Line. (a, f (a)) and has the same slope as the curve y = f (x) at that point. It is the best Tylor Polyomils Let f () = e d let p() = 1 + + 1 + 1 6 3 Without usig clcultor, evlute f (1) d p(1) Ok, I m still witig With little effort it is possible to evlute p(1) = 1 + 1 + 1 (144) + 6 1 (178) =

More information

0 otherwise. sin( nx)sin( kx) 0 otherwise. cos( nx) sin( kx) dx 0 for all integers n, k.

0 otherwise. sin( nx)sin( kx) 0 otherwise. cos( nx) sin( kx) dx 0 for all integers n, k. . Computtio of Fourier Series I this sectio, we compute the Fourier coefficiets, f ( x) cos( x) b si( x) d b, i the Fourier series To do this, we eed the followig result o the orthogolity of the trigoometric

More information

Similar idea to multiplication in N, C. Divide and conquer approach provides unexpected improvements. Naïve matrix multiplication

Similar idea to multiplication in N, C. Divide and conquer approach provides unexpected improvements. Naïve matrix multiplication Next. Covered bsics of simple desig techique (Divided-coquer) Ch. of the text.. Next, Strsse s lgorithm. Lter: more desig d coquer lgorithms: MergeSort. Solvig recurreces d the Mster Theorem. Similr ide

More information

Chapter 7 Infinite Series

Chapter 7 Infinite Series MA Ifiite Series Asst.Prof.Dr.Supree Liswdi Chpter 7 Ifiite Series Sectio 7. Sequece A sequece c be thought of s list of umbers writte i defiite order:,,...,,... 2 The umber is clled the first term, 2

More information

is infinite. The converse is proved similarly, and the last statement of the theorem is clear too.

is infinite. The converse is proved similarly, and the last statement of the theorem is clear too. 12. No-stdrd lysis October 2, 2011 I this sectio we give brief itroductio to o-stdrd lysis. This is firly well-developed field of mthemtics bsed o model theory. It dels ot just with the rels, fuctios o

More information

Convergence rates of approximate sums of Riemann integrals

Convergence rates of approximate sums of Riemann integrals Jourl of Approximtio Theory 6 (9 477 49 www.elsevier.com/locte/jt Covergece rtes of pproximte sums of Riem itegrls Hiroyuki Tski Grdute School of Pure d Applied Sciece, Uiversity of Tsukub, Tsukub Ibrki

More information

INTEGRATION TECHNIQUES (TRIG, LOG, EXP FUNCTIONS)

INTEGRATION TECHNIQUES (TRIG, LOG, EXP FUNCTIONS) Mthemtics Revisio Guides Itegrtig Trig, Log d Ep Fuctios Pge of MK HOME TUITION Mthemtics Revisio Guides Level: AS / A Level AQA : C Edecel: C OCR: C OCR MEI: C INTEGRATION TECHNIQUES (TRIG, LOG, EXP FUNCTIONS)

More information

PROGRESSIONS AND SERIES

PROGRESSIONS AND SERIES PROGRESSIONS AND SERIES A sequece is lso clled progressio. We ow study three importt types of sequeces: () The Arithmetic Progressio, () The Geometric Progressio, () The Hrmoic Progressio. Arithmetic Progressio.

More information

Review of Sections

Review of Sections Review of Sectios.-.6 Mrch 24, 204 Abstrct This is the set of otes tht reviews the mi ides from Chpter coverig sequeces d series. The specific sectios tht we covered re s follows:.: Sequces..2: Series,

More information

is an ordered list of numbers. Each number in a sequence is a term of a sequence. n-1 term

is an ordered list of numbers. Each number in a sequence is a term of a sequence. n-1 term Mthemticl Ptters. Arithmetic Sequeces. Arithmetic Series. To idetify mthemticl ptters foud sequece. To use formul to fid the th term of sequece. To defie, idetify, d pply rithmetic sequeces. To defie rithmetic

More information

FOURIER SERIES PART I: DEFINITIONS AND EXAMPLES. To a 2π-periodic function f(x) we will associate a trigonometric series. a n cos(nx) + b n sin(nx),

FOURIER SERIES PART I: DEFINITIONS AND EXAMPLES. To a 2π-periodic function f(x) we will associate a trigonometric series. a n cos(nx) + b n sin(nx), FOURIER SERIES PART I: DEFINITIONS AND EXAMPLES To -periodic fuctio f() we will ssocite trigoometric series + cos() + b si(), or i terms of the epoetil e i, series of the form c e i. Z For most of the

More information

1. (25 points) Use the limit definition of the definite integral and the sum formulas to compute. [1 x + x2

1. (25 points) Use the limit definition of the definite integral and the sum formulas to compute. [1 x + x2 Mth 3, Clculus II Fil Exm Solutios. (5 poits) Use the limit defiitio of the defiite itegrl d the sum formuls to compute 3 x + x. Check your swer by usig the Fudmetl Theorem of Clculus. Solutio: The limit

More information

A GENERAL METHOD FOR SOLVING ORDINARY DIFFERENTIAL EQUATIONS: THE FROBENIUS (OR SERIES) METHOD

A GENERAL METHOD FOR SOLVING ORDINARY DIFFERENTIAL EQUATIONS: THE FROBENIUS (OR SERIES) METHOD Diol Bgoo () A GENERAL METHOD FOR SOLVING ORDINARY DIFFERENTIAL EQUATIONS: THE FROBENIUS (OR SERIES) METHOD I. Itroductio The first seprtio of vribles (see pplictios to Newto s equtios) is ver useful method

More information

Riemann Integration. Chapter 1

Riemann Integration. Chapter 1 Mesure, Itegrtio & Rel Alysis. Prelimiry editio. 8 July 2018. 2018 Sheldo Axler 1 Chpter 1 Riem Itegrtio This chpter reviews Riem itegrtio. Riem itegrtio uses rectgles to pproximte res uder grphs. This

More information

POWER SERIES R. E. SHOWALTER

POWER SERIES R. E. SHOWALTER POWER SERIES R. E. SHOWALTER. sequeces We deote by lim = tht the limit of the sequece { } is the umber. By this we me tht for y ε > 0 there is iteger N such tht < ε for ll itegers N. This mkes precise

More information

Definite Integral. The Left and Right Sums

Definite Integral. The Left and Right Sums Clculus Li Vs Defiite Itegrl. The Left d Right Sums The defiite itegrl rises from the questio of fidig the re betwee give curve d x-xis o itervl. The re uder curve c be esily clculted if the curve is give

More information

Approximations of Definite Integrals

Approximations of Definite Integrals Approximtios of Defiite Itegrls So fr we hve relied o tiderivtives to evlute res uder curves, work doe by vrible force, volumes of revolutio, etc. More precisely, wheever we hve hd to evlute defiite itegrl

More information

MA123, Chapter 9: Computing some integrals (pp )

MA123, Chapter 9: Computing some integrals (pp ) MA13, Chpter 9: Computig some itegrls (pp. 189-05) Dte: Chpter Gols: Uderstd how to use bsic summtio formuls to evlute more complex sums. Uderstd how to compute its of rtiol fuctios t ifiity. Uderstd how

More information

Sequence and Series of Functions

Sequence and Series of Functions 6 Sequece d Series of Fuctios 6. Sequece of Fuctios 6.. Poitwise Covergece d Uiform Covergece Let J be itervl i R. Defiitio 6. For ech N, suppose fuctio f : J R is give. The we sy tht sequece (f ) of fuctios

More information

DEPARTMENT OF ELECTRICAL &ELECTRONICS ENGINEERING SIGNALS AND SYSTEMS. Assoc. Prof. Dr. Burak Kelleci. Spring 2018

DEPARTMENT OF ELECTRICAL &ELECTRONICS ENGINEERING SIGNALS AND SYSTEMS. Assoc. Prof. Dr. Burak Kelleci. Spring 2018 DEPARTMENT OF ELECTRICAL &ELECTRONICS ENGINEERING SIGNALS AND SYSTEMS Assoc. Prof. Dr. Bur Kelleci Sprig 8 OUTLINE The Z-Trsform The Regio of covergece for the Z-trsform The Iverse Z-Trsform Geometric

More information

Unit 1. Extending the Number System. 2 Jordan School District

Unit 1. Extending the Number System. 2 Jordan School District Uit Etedig the Number System Jord School District Uit Cluster (N.RN. & N.RN.): Etedig Properties of Epoets Cluster : Etedig properties of epoets.. Defie rtiol epoets d eted the properties of iteger epoets

More information

A general theory of minimal increments for Hirsch-type indices and applications to the mathematical characterization of Kosmulski-indices

A general theory of minimal increments for Hirsch-type indices and applications to the mathematical characterization of Kosmulski-indices Mlysi Jourl of Librry & Iformtio Sciece, Vol. 9, o. 3, 04: 4-49 A geerl theory of miiml icremets for Hirsch-type idices d pplictios to the mthemticl chrcteriztio of Kosmulski-idices L. Egghe Uiversiteit

More information

=> PARALLEL INTERCONNECTION. Basic Properties LTI Systems. The Commutative Property. Convolution. The Commutative Property. The Distributive Property

=> PARALLEL INTERCONNECTION. Basic Properties LTI Systems. The Commutative Property. Convolution. The Commutative Property. The Distributive Property Lier Time-Ivrit Bsic Properties LTI The Commuttive Property The Distributive Property The Associtive Property Ti -6.4 / Chpter Covolutio y ] x ] ] x ]* ] x ] ] y] y ( t ) + x( τ ) h( t τ ) dτ x( t) * h(

More information

Recurrece reltio & Recursio 9 Chpter 3 Recurrece reltio & Recursio Recurrece reltio : A recurrece is equtio or iequlity tht describes fuctio i term of itself with its smller iputs. T T The problem of size

More information

lecture 24: Gaussian quadrature rules: fundamentals

lecture 24: Gaussian quadrature rules: fundamentals 133 lecture 24: Gussi qudrture rules: fudmetls 3.4 Gussi qudrture It is cler tht the trpezoid rule, b 2 f ()+ f (b), exctly itegrtes lier polyomils, but ot ll qudrtics. I fct, oe c show tht o qudrture

More information

EVALUATING DEFINITE INTEGRALS

EVALUATING DEFINITE INTEGRALS Chpter 4 EVALUATING DEFINITE INTEGRALS If the defiite itegrl represets re betwee curve d the x-xis, d if you c fid the re by recogizig the shpe of the regio, the you c evlute the defiite itegrl. Those

More information

Reversing the Arithmetic mean Geometric mean inequality

Reversing the Arithmetic mean Geometric mean inequality Reversig the Arithmetic me Geometric me iequlity Tie Lm Nguye Abstrct I this pper we discuss some iequlities which re obtied by ddig o-egtive expressio to oe of the sides of the AM-GM iequlity I this wy

More information

8.3 Sequences & Series: Convergence & Divergence

8.3 Sequences & Series: Convergence & Divergence 8.3 Sequeces & Series: Covergece & Divergece A sequece is simply list of thigs geerted by rule More formlly, sequece is fuctio whose domi is the set of positive itegers, or turl umbers,,,3,. The rge of

More information

Stalnaker s Argument

Stalnaker s Argument Stlker s Argumet (This is supplemet to Coutble Additiviy, Dutch Books d the Sleepig Beuty roblem ) Stlker (008) suggests rgumet tht c be stted thus: Let t be the time t which Beuty wkes o Mody morig. Upo

More information

MATH 104 FINAL SOLUTIONS. 1. (2 points each) Mark each of the following as True or False. No justification is required. y n = x 1 + x x n n

MATH 104 FINAL SOLUTIONS. 1. (2 points each) Mark each of the following as True or False. No justification is required. y n = x 1 + x x n n MATH 04 FINAL SOLUTIONS. ( poits ech) Mrk ech of the followig s True or Flse. No justifictio is required. ) A ubouded sequece c hve o Cuchy subsequece. Flse b) A ifiite uio of Dedekid cuts is Dedekid cut.

More information

MTH 146 Class 16 Notes

MTH 146 Class 16 Notes MTH 46 Clss 6 Notes 0.4- Cotiued Motivtio: We ow cosider the rc legth of polr curve. Suppose we wish to fid the legth of polr curve curve i terms of prmetric equtios s: r f where b. We c view the cos si

More information

f(bx) dx = f dx = dx l dx f(0) log b x a + l log b a 2ɛ log b a.

f(bx) dx = f dx = dx l dx f(0) log b x a + l log b a 2ɛ log b a. Eercise 5 For y < A < B, we hve B A f fb B d = = A B A f d f d For y ɛ >, there re N > δ >, such tht d The for y < A < δ d B > N, we hve ba f d f A bb f d l By ba A A B A bb ba fb d f d = ba < m{, b}δ

More information

A GENERALIZATION OF GAUSS THEOREM ON QUADRATIC FORMS

A GENERALIZATION OF GAUSS THEOREM ON QUADRATIC FORMS A GENERALIZATION OF GAU THEOREM ON QUADRATIC FORM Nicole I Brtu d Adi N Cret Deprtmet of Mth - Criov Uiversity, Romi ABTRACT A origil result cocerig the extesio of Guss s theorem from the theory of biry

More information

18.01 Calculus Jason Starr Fall 2005

18.01 Calculus Jason Starr Fall 2005 18.01 Clculus Jso Strr Lecture 14. October 14, 005 Homework. Problem Set 4 Prt II: Problem. Prctice Problems. Course Reder: 3B 1, 3B 3, 3B 4, 3B 5. 1. The problem of res. The ciet Greeks computed the res

More information

(II.G) PRIME POWER MODULI AND POWER RESIDUES

(II.G) PRIME POWER MODULI AND POWER RESIDUES II.G PRIME POWER MODULI AND POWER RESIDUES I II.C, we used the Chiese Remider Theorem to reduce cogrueces modulo m r i i to cogrueces modulo r i i. For exmles d roblems, we stuck with r i 1 becuse we hd

More information

SM2H. Unit 2 Polynomials, Exponents, Radicals & Complex Numbers Notes. 3.1 Number Theory

SM2H. Unit 2 Polynomials, Exponents, Radicals & Complex Numbers Notes. 3.1 Number Theory SMH Uit Polyomils, Epoets, Rdicls & Comple Numbers Notes.1 Number Theory .1 Addig, Subtrctig, d Multiplyig Polyomils Notes Moomil: A epressio tht is umber, vrible, or umbers d vribles multiplied together.

More information

Canonical Form and Separability of PPT States on Multiple Quantum Spaces

Canonical Form and Separability of PPT States on Multiple Quantum Spaces Coicl Form d Seprbility of PPT Sttes o Multiple Qutum Spces Xio-Hog Wg d Sho-Mig Fei, 2 rxiv:qut-ph/050445v 20 Apr 2005 Deprtmet of Mthemtics, Cpitl Norml Uiversity, Beijig, Chi 2 Istitute of Applied Mthemtics,

More information

Error-free compression

Error-free compression Error-free compressio Useful i pplictio where o loss of iformtio is tolerble. This mybe due to ccurcy requiremets, legl requiremets, or less th perfect qulity of origil imge. Compressio c be chieved by

More information

Merge Sort. Outline and Reading. Divide-and-Conquer. Divide-and-conquer paradigm ( 4.1.1) Merge-sort ( 4.1.1)

Merge Sort. Outline and Reading. Divide-and-Conquer. Divide-and-conquer paradigm ( 4.1.1) Merge-sort ( 4.1.1) Merge Sort 7 2 9 4 2 4 7 9 7 2 2 7 9 4 4 9 7 7 2 2 9 9 4 4 Merge Sort versio 1.3 1 Outlie d Redig Divide-d-coquer prdigm ( 4.1.1 Merge-sort ( 4.1.1 Algorithm Mergig two sorted sequeces Merge-sort tree

More information

General properties of definite integrals

General properties of definite integrals Roerto s Notes o Itegrl Clculus Chpter 4: Defiite itegrls d the FTC Sectio Geerl properties of defiite itegrls Wht you eed to kow lredy: Wht defiite Riem itegrl is. Wht you c ler here: Some key properties

More information

MAS221 Analysis, Semester 2 Exercises

MAS221 Analysis, Semester 2 Exercises MAS22 Alysis, Semester 2 Exercises Srh Whitehouse (Exercises lbelled * my be more demdig.) Chpter Problems: Revisio Questio () Stte the defiitio of covergece of sequece of rel umbers, ( ), to limit. (b)

More information

, we would have a series, designated as + j 1

, we would have a series, designated as + j 1 Clculus sectio 9. Ifiite Series otes by Ti Pilchowski A sequece { } cosists of ordered set of ubers. If we were to begi ddig the ubers of sequece together s we would hve series desigted s. Ech iteredite

More information

Convergence rates of approximate sums of Riemann integrals

Convergence rates of approximate sums of Riemann integrals Covergece rtes of pproximte sums of Riem itegrls Hiroyuki Tski Grdute School of Pure d Applied Sciece, Uiversity of Tsuku Tsuku Irki 5-857 Jp tski@mth.tsuku.c.jp Keywords : covergece rte; Riem sum; Riem

More information

Chapter 2 Infinite Series Page 1 of 9

Chapter 2 Infinite Series Page 1 of 9 Chpter Ifiite eries Pge of 9 Chpter : Ifiite eries ectio A Itroductio to Ifiite eries By the ed of this sectio you will be ble to uderstd wht is met by covergece d divergece of ifiite series recogise geometric

More information

Linear Programming. Preliminaries

Linear Programming. Preliminaries Lier Progrmmig Prelimiries Optimiztio ethods: 3L Objectives To itroduce lier progrmmig problems (LPP To discuss the stdrd d coicl form of LPP To discuss elemetry opertio for lier set of equtios Optimiztio

More information

The Weierstrass Approximation Theorem

The Weierstrass Approximation Theorem The Weierstrss Approximtio Theorem Jmes K. Peterso Deprtmet of Biologicl Scieces d Deprtmet of Mthemticl Scieces Clemso Uiversity Februry 26, 2018 Outlie The Wierstrss Approximtio Theorem MtLb Implemettio

More information

THE NATIONAL UNIVERSITY OF IRELAND, CORK COLÁISTE NA hollscoile, CORCAIGH UNIVERSITY COLLEGE, CORK SUMMER EXAMINATION 2005 FIRST ENGINEERING

THE NATIONAL UNIVERSITY OF IRELAND, CORK COLÁISTE NA hollscoile, CORCAIGH UNIVERSITY COLLEGE, CORK SUMMER EXAMINATION 2005 FIRST ENGINEERING OLLSCOIL NA héireann, CORCAIGH THE NATIONAL UNIVERSITY OF IRELAND, CORK COLÁISTE NA hollscoile, CORCAIGH UNIVERSITY COLLEGE, CORK SUMMER EXAMINATION 2005 FIRST ENGINEERING MATHEMATICS MA008 Clculus d Lier

More information

9.1 Sequences & Series: Convergence & Divergence

9.1 Sequences & Series: Convergence & Divergence Notes 9.: Cov & Div of Seq & Ser 9. Sequeces & Series: Covergece & Divergece A sequece is simply list of thigs geerted by rule More formlly, sequece is fuctio whose domi is the set of positive itegers,

More information

Schrödinger Equation Via Laplace-Beltrami Operator

Schrödinger Equation Via Laplace-Beltrami Operator IOSR Jourl of Mthemtics (IOSR-JM) e-issn: 78-578, p-issn: 39-765X. Volume 3, Issue 6 Ver. III (Nov. - Dec. 7), PP 9-95 www.iosrjourls.org Schrödiger Equtio Vi Lplce-Beltrmi Opertor Esi İ Eskitşçioğlu,

More information

Approximate Integration

Approximate Integration Study Sheet (7.7) Approimte Itegrtio I this sectio, we will ler: How to fid pproimte vlues of defiite itegrls. There re two situtios i which it is impossile to fid the ect vlue of defiite itegrl. Situtio:

More information

Math 2414 Activity 17 (Due with Final Exam) Determine convergence or divergence of the following alternating series: a 3 5 2n 1 2n 1

Math 2414 Activity 17 (Due with Final Exam) Determine convergence or divergence of the following alternating series: a 3 5 2n 1 2n 1 Mth 44 Activity 7 (Due with Fil Exm) Determie covergece or divergece of the followig ltertig series: l 4 5 6 4 7 8 4 {Hit: Loo t 4 } {Hit: } 5 {Hit: AST or just chec out the prtil sums} {Hit: AST or just

More information

10.5 Power Series. In this section, we are going to start talking about power series. A power series is a series of the form

10.5 Power Series. In this section, we are going to start talking about power series. A power series is a series of the form 0.5 Power Series I the lst three sectios, we ve spet most of tht time tlkig bout how to determie if series is coverget or ot. Now it is time to strt lookig t some specific kids of series d we will evetully

More information

Math 104: Final exam solutions

Math 104: Final exam solutions Mth 14: Fil exm solutios 1. Suppose tht (s ) is icresig sequece with coverget subsequece. Prove tht (s ) is coverget sequece. Aswer: Let the coverget subsequece be (s k ) tht coverges to limit s. The there

More information

Prior distributions. July 29, 2002

Prior distributions. July 29, 2002 Prior distributios Aledre Tchourbov PKI 357, UNOmh, South 67th St. Omh, NE 688-694, USA Phoe: 4554-64 E-mil: tchourb@cse.ul.edu July 9, Abstrct This documet itroduces prior distributios for the purposes

More information

Compact Representation of Ambiguities. Generating Sentences by Grammar Specialization. Compact Representation of Ambiguities

Compact Representation of Ambiguities. Generating Sentences by Grammar Specialization. Compact Representation of Ambiguities Compct Represettio of Ambiguities Geertig Seteces by Grmmr Speciliztio Jürge Wedekid Prsig Chrt: represets ltertive sytctic lyses pcked f-structures (cotexted costrit stisfctio, Mxwell & Kpl 91) Geertio

More information

LEVEL I. ,... if it is known that a 1

LEVEL I. ,... if it is known that a 1 LEVEL I Fid the sum of first terms of the AP, if it is kow tht + 5 + 0 + 5 + 0 + = 5 The iterior gles of polygo re i rithmetic progressio The smllest gle is 0 d the commo differece is 5 Fid the umber of

More information

B. Examples 1. Finite Sums finite sums are an example of Riemann Sums in which each subinterval has the same length and the same x i

B. Examples 1. Finite Sums finite sums are an example of Riemann Sums in which each subinterval has the same length and the same x i Mth 06 Clculus Sec. 5.: The Defiite Itegrl I. Riem Sums A. Def : Give y=f(x):. Let f e defied o closed itervl[,].. Prtitio [,] ito suitervls[x (i-),x i ] of legth Δx i = x i -x (i-). Let P deote the prtitio

More information

The total number of permutations of S is n!. We denote the set of all permutations of S by

The total number of permutations of S is n!. We denote the set of all permutations of S by DETERMINNTS. DEFINITIONS Def: Let S {,,, } e the set of itegers from to, rrged i scedig order. rerrgemet jjj j of the elemets of S is clled permuttio of S. S. The totl umer of permuttios of S is!. We deote

More information

9.5. Alternating series. Absolute convergence and conditional convergence

9.5. Alternating series. Absolute convergence and conditional convergence Chpter 9: Ifiite Series I this Chpter we will be studyig ifiite series, which is just other me for ifiite sums. You hve studied some of these i the pst whe you looked t ifiite geometric sums of the form:

More information

SUTCLIFFE S NOTES: CALCULUS 2 SWOKOWSKI S CHAPTER 11

SUTCLIFFE S NOTES: CALCULUS 2 SWOKOWSKI S CHAPTER 11 UTCLIFFE NOTE: CALCULU WOKOWKI CHAPTER Ifiite eries Coverget or Diverget eries Cosider the sequece If we form the ifiite sum 0, 00, 000, 0 00 000, we hve wht is clled ifiite series We wt to fid the sum

More information

M3P14 EXAMPLE SHEET 1 SOLUTIONS

M3P14 EXAMPLE SHEET 1 SOLUTIONS M3P14 EXAMPLE SHEET 1 SOLUTIONS 1. Show tht for, b, d itegers, we hve (d, db) = d(, b). Sice (, b) divides both d b, d(, b) divides both d d db, d hece divides (d, db). O the other hd, there exist m d

More information

5. Solving recurrences

5. Solving recurrences 5. Solvig recurreces Time Complexity Alysis of Merge Sort T( ) 0 if 1 2T ( / 2) otherwise sortig oth hlves mergig Q. How to prove tht the ru-time of merge sort is O( )? A. 2 Time Complexity Alysis of Merge

More information

Petar Maymounkov 6.854J Advanced Algorithms, Problem Set 2 With: Benjamin Rossman, Oren Weimann, and Pouya Kheradpour

Petar Maymounkov 6.854J Advanced Algorithms, Problem Set 2 With: Benjamin Rossman, Oren Weimann, and Pouya Kheradpour Petr Mymoukov 6.854J Advced Algorithms, Problem Set 2 With: Bejmi Rossm, Ore Weim, d Pouy Kherdpour Problem 1. vribles: Use regulr sply tree where ech ode keeps three extr 1. left-cout: The umber of descedts

More information

: : 8.2. Test About a Population Mean. STT 351 Hypotheses Testing Case I: A Normal Population with Known. - null hypothesis states 0

: : 8.2. Test About a Population Mean. STT 351 Hypotheses Testing Case I: A Normal Population with Known. - null hypothesis states 0 8.2. Test About Popultio Me. Cse I: A Norml Popultio with Kow. H - ull hypothesis sttes. X1, X 2,..., X - rdom smple of size from the orml popultio. The the smple me X N, / X X Whe H is true. X 8.2.1.

More information

DETERMINANT. = 0. The expression a 1. is called a determinant of the second order, and is denoted by : y + c 1

DETERMINANT. = 0. The expression a 1. is called a determinant of the second order, and is denoted by : y + c 1 NOD6 (\Dt\04\Kot\J-Advced\SMP\Mths\Uit#0\NG\Prt-\0.Determits\0.Theory.p65. INTRODUCTION : If the equtios x + b 0, x + b 0 re stisfied by the sme vlue of x, the b b 0. The expressio b b is clled determit

More information

Chapter Real Numbers

Chapter Real Numbers Chpter. - Rel Numbers Itegers: coutig umbers, zero, d the egtive of the coutig umbers. ex: {,-3, -, -,,,, 3, } Rtiol Numbers: quotiets of two itegers with ozero deomitor; termitig or repetig decimls. ex:

More information

Math 140B - Notes. Neil Donaldson. September 2, 2009

Math 140B - Notes. Neil Donaldson. September 2, 2009 Mth 40B - Notes Neil Doldso September 2, 2009 Itroductio This clss cotiues from 40A. The mi purpose of the clss is to mke bsic clculus rigorous.. Nottio We will observe the followig ottio throughout this

More information

Week 13 Notes: 1) Riemann Sum. Aim: Compute Area Under a Graph. Suppose we want to find out the area of a graph, like the one on the right:

Week 13 Notes: 1) Riemann Sum. Aim: Compute Area Under a Graph. Suppose we want to find out the area of a graph, like the one on the right: Week 1 Notes: 1) Riem Sum Aim: Compute Are Uder Grph Suppose we wt to fid out the re of grph, like the oe o the right: We wt to kow the re of the red re. Here re some wys to pproximte the re: We cut the

More information

,... are the terms of the sequence. If the domain consists of the first n positive integers only, the sequence is a finite sequence.

,... are the terms of the sequence. If the domain consists of the first n positive integers only, the sequence is a finite sequence. Chpter 9 & 0 FITZGERALD MAT 50/5 SECTION 9. Sequece Defiitio A ifiite sequece is fuctio whose domi is the set of positive itegers. The fuctio vlues,,, 4,...,,... re the terms of the sequece. If the domi

More information

Probability and Stochastic Processes: A Friendly Introduction for Electrical and Computer Engineers Roy D. Yates and David J.

Probability and Stochastic Processes: A Friendly Introduction for Electrical and Computer Engineers Roy D. Yates and David J. Probbility d Stochstic Processes: A Friedly Itroductio for Electricl d Computer Egieers Roy D. Ytes d Dvid J. Goodm Problem Solutios : Ytes d Goodm,4..4 4..4 4..7 4.4. 4.4. 4..6 4.6.8 4.6.9 4.7.4 4.7.

More information

Discrete Mathematics and Probability Theory Spring 2016 Rao and Walrand Lecture 17

Discrete Mathematics and Probability Theory Spring 2016 Rao and Walrand Lecture 17 CS 70 Discrete Mthemtics d Proility Theory Sprig 206 Ro d Wlrd Lecture 7 Vrice We hve see i the previous ote tht if we toss coi times with is p, the the expected umer of heds is p. Wht this mes is tht

More information

UNIVERSITY OF BRISTOL. Examination for the Degrees of B.Sc. and M.Sci. (Level C/4) ANALYSIS 1B, SOLUTIONS MATH (Paper Code MATH-10006)

UNIVERSITY OF BRISTOL. Examination for the Degrees of B.Sc. and M.Sci. (Level C/4) ANALYSIS 1B, SOLUTIONS MATH (Paper Code MATH-10006) UNIVERSITY OF BRISTOL Exmitio for the Degrees of B.Sc. d M.Sci. (Level C/4) ANALYSIS B, SOLUTIONS MATH 6 (Pper Code MATH-6) My/Jue 25, hours 3 miutes This pper cotis two sectios, A d B. Plese use seprte

More information

Mathacle. PSet Stats, Concepts In Statistics Level Number Name: Date:

Mathacle. PSet Stats, Concepts In Statistics Level Number Name: Date: APPENDEX I. THE RAW ALGEBRA IN STATISTICS A I-1. THE INEQUALITY Exmple A I-1.1. Solve ech iequlity. Write the solutio i the itervl ottio..) 2 p - 6 p -8.) 2x- 3 < 5 Solutio:.). - 4 p -8 p³ 2 or pî[2, +

More information

Statistics for Financial Engineering Session 1: Linear Algebra Review March 18 th, 2006

Statistics for Financial Engineering Session 1: Linear Algebra Review March 18 th, 2006 Sttistics for Ficil Egieerig Sessio : Lier Algebr Review rch 8 th, 6 Topics Itroductio to trices trix opertios Determits d Crmer s rule Eigevlues d Eigevectors Quiz The cotet of Sessio my be fmilir to

More information

Discrete Mathematics I Tutorial 12

Discrete Mathematics I Tutorial 12 Discrete Mthemtics I Tutoril Refer to Chpter 4., 4., 4.4. For ech of these sequeces fid recurrece reltio stisfied by this sequece. (The swers re ot uique becuse there re ifiitely my differet recurrece

More information

Fig. 1. I a. V ag I c. I n. V cg. Z n Z Y. I b. V bg

Fig. 1. I a. V ag I c. I n. V cg. Z n Z Y. I b. V bg ymmetricl Compoets equece impedces Although the followig focuses o lods, the results pply eqully well to lies, or lies d lods. Red these otes together with sectios.6 d.9 of text. Cosider the -coected lced

More information

Chapter System of Equations

Chapter System of Equations hpter 4.5 System of Equtios After redig th chpter, you should be ble to:. setup simulteous lier equtios i mtrix form d vice-vers,. uderstd the cocept of the iverse of mtrix, 3. kow the differece betwee

More information

INTEGRATION IN THEORY

INTEGRATION IN THEORY CHATER 5 INTEGRATION IN THEORY 5.1 AREA AROXIMATION 5.1.1 SUMMATION NOTATION Fibocci Sequece First, exmple of fmous sequece of umbers. This is commoly ttributed to the mthemtici Fibocci of is, lthough

More information

( ) dx ; f ( x ) is height and Δx is

( ) dx ; f ( x ) is height and Δx is Mth : 6.3 Defiite Itegrls from Riem Sums We just sw tht the exct re ouded y cotiuous fuctio f d the x xis o the itervl x, ws give s A = lim A exct RAM, where is the umer of rectgles i the Rectgulr Approximtio

More information

2.1.1 Definition The Z-transform of a sequence x [n] is simply defined as (2.1) X re x k re x k r

2.1.1 Definition The Z-transform of a sequence x [n] is simply defined as (2.1) X re x k re x k r Z-Trsforms. INTRODUCTION TO Z-TRANSFORM The Z-trsform is coveiet d vluble tool for represetig, lyig d desigig discrete-time sigls d systems. It plys similr role i discrete-time systems to tht which Lplce

More information

FACULTY OF MATHEMATICAL STUDIES MATHEMATICS FOR PART I ENGINEERING. Lectures

FACULTY OF MATHEMATICAL STUDIES MATHEMATICS FOR PART I ENGINEERING. Lectures FACULTY OF MATHEMATICAL STUDIES MATHEMATICS FOR PART I ENGINEERING Lectures MODULE 0 FURTHER CALCULUS II. Sequeces d series. Rolle s theorem d me vlue theorems 3. Tlor s d Mcluri s theorems 4. L Hopitl

More information

Lesson-2 PROGRESSIONS AND SERIES

Lesson-2 PROGRESSIONS AND SERIES Lesso- PROGRESSIONS AND SERIES Arithmetic Progressio: A sequece of terms is sid to be i rithmetic progressio (A.P) whe the differece betwee y term d its preceedig term is fixed costt. This costt is clled

More information

b a 2 ((g(x))2 (f(x)) 2 dx

b a 2 ((g(x))2 (f(x)) 2 dx Clc II Fll 005 MATH Nme: T3 Istructios: Write swers to problems o seprte pper. You my NOT use clcultors or y electroic devices or otes of y kid. Ech st rred problem is extr credit d ech is worth 5 poits.

More information

Linford 1. Kyle Linford. Math 211. Honors Project. Theorems to Analyze: Theorem 2.4 The Limit of a Function Involving a Radical (A4)

Linford 1. Kyle Linford. Math 211. Honors Project. Theorems to Analyze: Theorem 2.4 The Limit of a Function Involving a Radical (A4) Liford 1 Kyle Liford Mth 211 Hoors Project Theorems to Alyze: Theorem 2.4 The Limit of Fuctio Ivolvig Rdicl (A4) Theorem 2.8 The Squeeze Theorem (A5) Theorem 2.9 The Limit of Si(x)/x = 1 (p. 85) Theorem

More information

Numerical Methods (CENG 2002) CHAPTER -III LINEAR ALGEBRAIC EQUATIONS. In this chapter, we will deal with the case of determining the values of x 1

Numerical Methods (CENG 2002) CHAPTER -III LINEAR ALGEBRAIC EQUATIONS. In this chapter, we will deal with the case of determining the values of x 1 Numericl Methods (CENG 00) CHAPTER -III LINEAR ALGEBRAIC EQUATIONS. Itroductio I this chpter, we will del with the cse of determiig the vlues of,,..., tht simulteously stisfy the set of equtios: f f...

More information

 n. A Very Interesting Example + + = d. + x3. + 5x4. math 131 power series, part ii 7. One of the first power series we examined was. 2!

 n. A Very Interesting Example + + = d. + x3. + 5x4. math 131 power series, part ii 7. One of the first power series we examined was. 2! mth power series, prt ii 7 A Very Iterestig Emple Oe of the first power series we emied ws! + +! + + +!! + I Emple 58 we used the rtio test to show tht the itervl of covergece ws (, ) Sice the series coverges

More information

Certain sufficient conditions on N, p n, q n k summability of orthogonal series

Certain sufficient conditions on N, p n, q n k summability of orthogonal series Avilble olie t www.tjs.com J. Nolier Sci. Appl. 7 014, 7 77 Reserch Article Certi sufficiet coditios o N, p, k summbility of orthogol series Xhevt Z. Krsiqi Deprtmet of Mthemtics d Iformtics, Fculty of

More information

MATRIX ALGEBRA, Systems Linear Equations

MATRIX ALGEBRA, Systems Linear Equations MATRIX ALGEBRA, Systes Lier Equtios Now we chge to the LINEAR ALGEBRA perspective o vectors d trices to reforulte systes of lier equtios. If you fid the discussio i ters of geerl d gets lost i geerlity,

More information