Complexity of Data Tree Patterns over XML Documents

Similar documents
Complexity of Data Tree Patterns over XML Documents

Noncrossing Trees and Noncrossing Graphs

R&D Investment and Technology Adoption

Safe Separation Distance Calculation Model with Changing Area of Fuel Packages in Large Space

ECE Introduction to Comm/SP, Fall 2011 Homework #5 Due: 11/04/11

This document contains voter and poll worker educational material for overvotes and double-votes.

Algorithms for Ship Movement Prediction for Location Data Compression

The Solution to the Bühlmann - Straub Model in the case of a Homogeneous Credibility Estimators

Depth-first search and strong connectivity in Coq

ABriefIntroductiontotheBasicsof Game Theory

arxiv:cs/ v1 [cs.ds] 8 Dec 1998

Multi-Robot Flooding Algorithm for the Exploration of Unknown Indoor Environments

Red-Black Trees Goodrich, Tamassia Red-Black Trees 1

Multi-Robot Forest Coverage

Design Engineering Challenge: The Big Dig Contest Platter Strategies: Ball Liberation

10 Torque. Lab. What You Need To Know: Physics 211 Lab

Contents TRIGONOMETRIC METHODS PROBABILITY DISTRIBUTIONS

Rearranging trees for robust consensus

tr0 TREES Hanan Samet

Chapter 5. Triangles and Vectors

Interior Rule of the Quebec Open 2017

Efficient Algorithms for finding a Trunk on a Tree Network and its Applications

CORESTA RECOMMENDED METHOD N 68

Multiple Vehicle Driving Control for Traffic Flow Efficiency

tr0 TREES Hanan Samet

Listening & Speaking. Grade 1. Supports. instructi GRADE. Develops oral and receptive language. 15- to 20-minute daily activities

Cheat-Proof Playout for Centralized and Distributed Online Games

PARK HILL HIGH SCHOOL TURF FIELD IMPROVEMENTS

A Force Platform Free Gait Analysis

EC-FRM: An Erasure Coding Framework to Speed up Reads for Erasure Coded Cloud Storage Systems

OPTIMAL SCHEDULING MODELS FOR FERRY COMPANIES UNDER ALLIANCES

2014 Victorian Shooting Championship

Announcements. CS 188: Artificial Intelligence Spring Today. P4: Ghostbusters. Exact Inference in DBNs. Dynamic Bayes Nets (DBNs)

2014 WHEAT PROTEIN RESPONSE TO NITROGEN

The Properties of. Model Rocket Body Tube Transitions

Morrison Drive tel. Ottawa, ON, Canada K2H 8S fax. com

Chp. 3_4 Trigonometry.notebook. October 01, Warm Up. Pythagorean Triples. Verifying a Pythagorean Triple... Pythagorean Theorem

The Discussion of this exercise covers the following points: The open-loop Ziegler-Nichols method. The open-loop Ziegler-Nichols method

Bradshaw Rd. Sunrise Blvd MATHER AIRPORT. Florin Rd. Excelsior Rd. Grant Line Rd. Elk Grove-Florin Rd. Bradshaw Rd. SHELDON Dillard Rd WILTON

Trends in Cycling, Walking & Injury Rates in New Zealand

PRESSURE LOSSES DUE TO THE LEAKAGE IN THE AIR DUCTS - A SAFETY PROBLEM FOR TUNNEL USERS?

Experiment #10 Bio-Physics Pre-lab Questions

Fundamental Algorithms for System Modeling, Analysis, and Optimization

Range Extension Control System for Electric Vehicles Based on Front and Rear Driving Force Distribution Considering Load Transfer

INVESTIGATION 2. What s the Angle?

CS3350B Computer Architecture. Lecture 6.2: Instructional Level Parallelism: Hazards and Resolutions

CS 188: Artificial Intelligence Spring Announcements

Tree. Tree. Siblings Grand Parent Grand Child H I J I J K. Tree Definitions

Chapter 4 Group of Volunteers

Incorporating Location, Routing and Inventory Decisions in Dual Sales Channel - A Hybrid Genetic Approach

British Prime Minister Benjamin Disraeli once remarked that

Lesson 33: Horizontal & Vertical Circular Problems

Working Paper: Reversal Patterns

TABLE OF CONTENTS. Overview Introduction... 2 List of Illustrations... 2

Lesson 12.1 Right Triangle Trigonometry

Session 6. Global Imbalances. Growth. Macroeconomics in the Global Economy. Saving and Investment: The World Economy

A CONCEPTUAL WHEELED ROBOT FOR IN-PIPE INSPECTION Ioan Doroftei, Mihaita Horodinca, Emmanuel Mignon

An integrated supply chain design model with random disruptions consideration

POSSIBLE AND REAL POWERFLOWS IN CONNECTED DIFFERENTIAL GEAR DRIVES WITH η 0 <i pq <1/η 0 INNER RATIO

An Auction Based Mechanism for On-Demand Transport Services

Why? DF = 1_ EF = _ AC

Lecture Topics. Overview ECE 486/586. Computer Architecture. Lecture # 9. Processor Organization. Basic Processor Hardware Pipelining

Bypass Compensator Cartridge, Size 16

The Study About Stopping Distance of Vehicles

Experiment #10 Bio-Physics Pre-lab Comments, Thoughts and Suggestions

Wind and extremely long bridges a challenge for computer aided design

In any right-angle triangle the side opposite to the right angle is called the Label the Hypotenuse in each diagram above.

MODELLING THE INTERACTION EFFECTS OF THE HIGH-SPEED TRAIN TRACK BRIDGE SYSTEM USING ADINA

Bicycle wheel and swivel chair

Faster Nearest Neighbors: Voronoi Diagrams and k-d Trees

Cluster trees and message propagation

A Machine Vision based Gestural Interface for People with Upper Extremity Physical Impairments

Matlab Simulink Implementation of Switched Reluctance Motor with Direct Torque Control Technique

UNIVERSITÀ DEGLI STUDI DI PADOVA. Dipartimento di Scienze Economiche Marco Fanno

17.3 Find Unknown Side Lengths

A Step, Stride and Heading Determination for the Pedestrian Navigation System

A Deceleration Control Method of Automobile for Collision Avoidance based on Driver's Perceptual Risk

Data Sheet. Linear bearings

Numerical study of super-critical carbon dioxide flow in steppedstaggered

Example. The information set is represented by the dashed line.

Asteroid body-fixed hovering using nonideal solar sails

Experimental and Numerical Studies on Fire Whirls

Data Compression. Reduce the size of data. Reduces time to retrieve and transmit data. Compression ratio = original data size/compressed data size

Rotor Design and Analysis of Stall-regulated Horizontal Axis Wind Turbine

EcoMobility World Festival 2013 Suwon: an analysis of changes in citizens awareness and satisfaction

Cyclostrophic Balance in Surface Gravity Waves: Essay on Coriolis Effects

EMBASSY SWIMMING POOL & FITNESS SUITE Fitness Programme June - September 2017

Motivation. Prize-Collecting Steiner Tree Problem (PCSTP) Kosten und Profite. Das Fraktionale Prize-Collecting Steiner Tree Problem auf Baumgraphen

SHRiMP: Accurate Mapping of Short Color-space Reads

I. FORMULATION. Here, p i is the pressure in the bubble, assumed spatially uniform,

SIGHT DISTANCE AT INTERSECTIONS 546 1

Color Encodings: srgb and Beyond

MODEL 1000S DIGITAL TANK GAUGE

Design and Calibration of Submerged Open Channel Flow Measurement Structures: Part 3 - Cutthroat Flumes

Performance Characteristics of Parabolic Trough Solar Collector System for Hot Water Generation

Alternate stable states in coupled fishery-aquaculture systems. Melissa Orobko

ERRATA for Guide for the Development of Bicycle Facilities, 4th Edition (GBF-4)

Assessment of Head and Neck Injury Potential During Aircraft Longitudinal Impacts

bark bark bat bat Multiple Meaning Words: Kindergarten to Grade 2 More Teaching Tools at harsh sound made by a dog

Torque. Physics 2. Prepared by Vince Zaccone For Campus Learning Assistance Services at UCSB

Transcription:

Complexity of Dt Tee Pttens ove XML Documents Clie Dvid LIAFA, Univesity Pis 7 nd CNRS, Fnce cdvid@lifjussieuf Abstct We conside Boolen combintions of dt tee pttens s specifiction nd quey lnguge fo XML documents Dt tee pttens e tee pttens plus vible (in)equlities which expess joins between ttibute vlues Dt tee pttens e simple nd ntul fomlism fo expessing popeties of XML documents We conside fist the model checking poblem (quey evlution), we show tht it is DP-complete in genel nd ledy NP-complete when we conside single ptten We then conside the stisfibility poblem in the pesence of DTD We show tht it is in genel undecidble nd we identify sevel decidble fgments Intoduction The eltionl model nd its popul quey lnguge SQL e widely used in dtbse systems Howeve, it does not fit well in the eve chnging Intenet envionment, since its stuctue is fixed by n initilly specified schem which is difficult to modify When exchnging nd mnipulting lge mounts of dt fom diffeent souces, less stuctued nd moe flexible dt model is pefeble This ws the initil motivtion fo the Extensible Mkup Lnguge (XML) model which is now the stndd fo dt exchnge An XML document is stuctued s n unnked, lbelled tee The min diffeence with the eltionl model is tht in XML, dt is lso extcted becuse of its position in the tee nd not only becuse of its vlue Consequently, ll the tools mnipulting XML dt, like XML quey lnguges nd XML schem, combine nvigtionl fetues with clssicl dt extction ones XPth 2 is typicl exmple It hs nvigtionl coe, known s Coe-XPth nd studied in [6], which is essentilly modl lnguge tht wlks ound in the tee XPth lso llows esticted tests on dt ttibutes It is the building block of most XML quey lnguges (XQuey, XSLT) Similly, in ode to specify integity constints in XML Schem, XML lnguges hve nvigtionl fetues fo desciption of wlks in the tee nd selection of nodes The nodes e fo instnce chosen ccoding to key o foeign key [5] A poblem DP is the intesection of NP poblem nd co-np poblem 2 In ll the ppe, XPth efes to XPth

In this ppe, we study n ltentive fomlism s building block fo queying nd specifying XML dt It is bsed on Boolen combintions of dt tee pttens A dt tee ptten is essentilly tee with child o descendnt edges, lbelled nodes nd (in)equlity constints on dt vlues Intuitively, document stisfies dt tee ptten if thee exists n injective mpping fom the tee ptten into the tee tht espects edges, node lbels nd dt vlue constints Using pttens, one cn expess popeties on tees in ntul, visul nd intuitive wy These popeties cn expess queies, s well s some integity constints At fist glnce, the injectivity equiement does not seem impotnt; howeve, it hs some consequences in tems of expessive powe As we do not conside hoizontl ode between siblings, without injectivity dt tee pttens e invint by bisimultion Dt tee pttens with injective semntics e stictly moe expessive thn with non-injective semntics Fo exmple, it is not possible to expess desible popeties such s node hs two -lbelled childen without injectivity Anothe consequence of injectivity ppes when consideing conjunctions of dt tee pttens With non-injective semntics, the conjunction of two pttens would be equivlent to new ptten obtined by meging the two pttens t the oot With injectivity this no longe woks nd we hve to conside conjunctions of tee pttens This diffeence ppes when we study the complexity of the stisfibility poblem: fo one ptten the poblem is PTime while it is untctble fo conjunction of pttens XPth nd dt tee pttens e incompble in tems of expessiveness Without dt vlue, XPth queies e closed unde bisimultion while dt tee pttens e not On the othe hnd, XPth llows negtion of subfomuls while we only llow negtion of full dt tee ptten Fo exmple XPth cn check whethe node hs -lbelled childen but no b-lbelled child This is not possible with Boolen combintions of tee ptten In tems of dt compison, Xpth llows vey limited joins becuse XPth queies cnnot compe moe thn two elements t time, while single ptten cn compe simultneously n bity numbe of elements In this ppe, to continue this compison, we study the complexity of two questions elted to dt tee pttens: the model checking poblem (quey evlution) nd the stisfibility poblem in the pesence of schem The evlution of XPth queies hs been extensively studied (see [6] fo detiled suvey) The evlution poblem is PTime fo genel XPth queies In ou cse, this poblem is moe difficult: the combined complexity of the model checking poblem fo Boolen combintions of dt tee pttens is untctble We pove tht it is DP-complete in genel nd ledy NP-complete when consideing only one tee ptten The stisfibility poblem fo XPth is undecidble in genel [5] Howeve fo mny fgments the poblem is decidble with complexity nging fom NP to NExpTime Similly, fo Boolen combintions of dt tee pttens the stisfibility poblem is undecidble in genel We identify sevel decidble fgments by estining the expessivity of tee pttens o by bounding 2

the depth of the documents The coesponding complexities nge fom NP to 2ExpTime Relted Wok: Tee pttens hve ledy been investigted in dtbse context, often without dt vlues [22, 3, 2] The focus is usully optimistion techniques fo efficient nvigtion [, 2, 7] In this wok, we focus on the difficulty ised by dt vlues nd we e not inteested in optimistion but in the wost cse complexity fo the model checking nd stisfibility poblems Sevel ppes consideed the non injective semntics of tee ptten with dt constints Fist, [9] consideed the stisfibility poblem fo one positive ptten while we conside Boolen combintions of tee ptten Then, the uthos of [2] conside the type checking poblem which is moe poweful tht unstisfibility but incompble to the stisfibility poblem Dt tee pttens e used in [4] to specify dt exchnge settings They study two poblems: the fist one is consistency of dt exchnge settings, the second one is quey nsweing unde dt exchnge settings Given conjunction of dt tee pttens nd DTD, we cn constuct dt exchnge setting such tht the consistency of this setting is equivlent to the stisfibility of the conjunction of pttens in the pesence of the DTD Howeve the dt tee pttens they conside e less expessive thn ous, in tht they cn not expess inequlity constints on dt vlues no Boolen combintions of dt tee pttens The othe poblem consideed in this ppe is quey nsweing This poblem seems elted to ou model checking poblem Howeve it does not seem possible to use thei esult o thei poof techniques Fgment of XPth: In [4], the uthos conside n XPth fgment (simple XPth) llowing only veticl nvigtion but ugmented with dt compisons Negtion is disllowed, both in the nvigtion pt nd in the compison pt A simple XPth expession cn be viewed s ptten with non-injective semntics nd only dt equlity They study the inclusion poblem of such expessions wt specil schemes (SXIC) contining integity constints like inclusion dependency We cnnot simulte inclusion dependency even with Boolen combintions of dt tee pttens Hence, thei fmewok is incompble to ous Conjunctive queies on tees: Conjunctive queies on tees cn be expessed by tee pttens They wee consideed in [7, 8] without dt vlues Vey ecently [9], n extension by schem constints is poposed nd in vey few cses they llow dt compison Notice tht, without sibling pedicte, those conjunctive queies e stictly less expessive thn ou fmewok becuse they do not llow negtion nd do not hve n injective semntic It is shown tht the quey stisfibility poblem is NP-complete, whees the quey vlidity poblem is 2ExpTime-complete Moeove, the vlidity of disjunction of conjunctive queies is shown to be undecidble This lst esult coesponds to ou undecidbility esult but the poof is diffeent Logics ove infinite lphbets: Anothe elted ppoch is to conside logic fo tees ove n infinite lphbet In [,], the uthos study n extension of Fist Ode Logic with two vibles In [3, 8], the focus is on tempol logic nd µ-clculus These woks e vey elegnt, but the coesponding complexities 3

e non pimitive ecusive Ou wok cn be seen s continution of this wok iming fo lowe complexities Stuctue: Section 2 contins the necessy definitions In Section 3, we conside the model-checking poblem In Section 4, we conside the stisfibility poblem in genel nd the esticted cses Section 5 contins summy of ou esults nd discussion Omitted poofs cn be found in the ppendix vilble t http://wwwlifjussieuf/~cdvid/publi/mfcs8pdf 2 Peliminy In this ppe, we conside XML documents tht e modeled s unodeed, unnked dt tees, s consideed eg in [] Definition A dt tee ove finite lphbet Σ is n unnked, unodeed, lbelled tee with dt vlues Evey node v hs lbel vl Σ nd dt vlue vd D, whee D is n infinite domin We only conside equlity tests between dt vlues The dt pt of tee cn thus be seen s n equivlence eltion on its nodes In the following, we wite u v fo two nodes u, v, if ud = vd nd we use the tem clss without moe pecision to denote n equivlence clss fo the eltion The dt esue of dt tee t ove Σ is the tee obtined fom t by ignoing the dt vlue vd of ech node v of t ` ` ` ` b ` b & ` ` ` ` ` b & ` b b oot b b () dt tee (b) dt esue (c) ptten Fig Exmples Dt tee pttens e ntul wy to expess popeties of dt tees, o to quey such tees They descibe set of nodes though thei eltive positions in the tee, nd (in)equlities between thei dt vlues Definition 2 A dt tee ptten P = (p, C, C ) consists of: n unodeed, unnked tee p, with nodes lbelled eithe by Σ o by the wildcd symbol, nd edges lbelled eithe by (child edges) o by (descendnt edge), nd two biny eltions C nd C on the set of nodes of p 4

A dt tee t stisfies ptten P = (p, C, C ), nd we wite t = P, if thee exists n injective mpping f fom the nodes of p to the nodes of t tht is consistent with the lbelling, the eltive positions of nodes, the bnching stuctue nd the dt constints Fomlly, we equie the following: fo evey node v fom p with vl Σ, we hve vl = f(v)l, fo evey pi of nodes (u,v) fom p, if (u, v) C (esp (u, v) C ) then f(u) f(v) (esp f(u) f(v)), fo evey pi of nodes (u,v) fom p, if (u, v) is n edge of p lbelled by (esp by ), then f(v) is child (esp descendnt) of f(u), fo ny nodes u,v,z fom p, if (u, v) nd (u, z) e both edges of p lbelled by, then f(v) nd f(z) e not elted by the descendnt eltion in t A mpping f s bove is clled witness of the ptten P in the dt tee t Notice tht the semntic does not peseve the lest common ncesto nd sks fo n injective mpping between the nodes of ptten nd those of the tee This enbles pttens to expess integity constints We will discuss the impct of those choices in Section 5 Dt tee pttens cn descibe popeties tht XPth cnnot, see eg the ptten in Fig (XPth cnnot tlk simultneously bout the two -nodes nd the two b-nodes) We denote by Ptn(,, ) the set of dt tee pttens nd by BC(,, ) the set of Boolen combintions of dt tee pttens We will lso conside esticted pttens, tht do not use child eltions o do not use descendnt eltions (denoted espectively by P tn(, ), P tn(, )) Fom these, we deive the coesponding clsses of Boolen combintions Finlly, BC + (esp BC ) denotes conjunctions of pttens (esp negtions of pttens) In poofs, we conside the pse tee of Boolen fomul ϕ ove pttens, denoted by T (ϕ) The leves of this tee e lbelled by (possibly negtion of) pttens nd inne nodes e lbelled by conjunctions o disjunctions Such tees e of line size in the size of the fomul nd cn be computed in PTime Given ptten fomul fom BC(,, ), the min poblems we e inteested in e the model-checking on dt tee (evlution), the stisfibility poblem, in the genel cse s well s fo inteesting fgments Becuse the genel stuctue of XML documents is usully constined, we my conside DTDs s dditionl inputs DTDs e essentilly egul constints on the finite stuctue of the tee Since we wok on unodeed, unnked tees, we use s DTDs n unodeed vesion of hedge utomt A DTD is bottom-up utomton A whee the tnsition to stte q with lbel is given by Boolen combintion of cluses of the fom #q k whee q is stte nd k constnt (uny encoded) A cluse #q k is stisfied if thee e t most k childen in stte q Adding DTD constint does not chnge the complexity esults fo the model-checking, since checking whethe the dt esue of tee stisfies DTD is PTime Theefoe, we do not mention DTDs in the model-checking pt We conside the following poblems: Poblem Given dt tee t nd ptten fomul ϕ, the model-checking poblem sks whethe t stisfies ϕ 5

Poblem 2 Given ptten fomul ϕ nd DTD L, the stisfibility poblem in the pesence of DTD sks whethe ϕ is stisfied by some dt tee whose dt esue belongs to L 3 Model Checking Pttens povide fomlism fo expessing popeties In this section, we see how efficiently we cn evlute them Ou min esult is the exct complexity of the model-checking poblem fo ptten fomuls fom BC(,, ) Theoem 3 The model-checking poblem fo BC(,, ) is DP-complete The clss of complexity DP is defined s the clss of poblems tht e the conjunction of NP poblem nd co-np poblem [2] In pticul, DP includes both NP nd co-np A typicl DP-complete poblem is SAT/UNSAT: given two popositionl fomuls ϕ, ϕ 2, it sks whethe ϕ is stisfible, nd ϕ 2 is unstisfible The key to the poof of Theoem 3 is the cse whee only one ptten is pesent This poblem is ledy NP-complete Poposition 4 The model-checking poblem fo single ptten fom P tn(,, ) is NP-complete Poof The uppe bound is obtined by n lgoithm guessing witness fo the ptten in the dt tee nd checking in PTime whethe the witness is coect The lowe bound is moe difficult It is obtined by eduction of 3SAT Given popositionl fomul ϕ in 3-CNF, we build dt tee t ϕ nd ptten P ϕ of polynomil size, such tht t ϕ P ϕ iff ϕ is stisfible Becuse we conside the model-checking poblem, the dt tee is fixed in the input Thus, it must contin ll possible vlutions of the vibles nd t lest ll possible tue vlutions of ech vible Moeove, one positive dt tee ptten should identify tue vlution of the fomul nd check its consistency Hence, it does not seem possible to use peviously published encodings of 3SAT into tees The ptten selects one vlution pe vible nd pe cluse Its stuctue ensues tht only one vlution pe vible nd pe litel is selected The constints on dt ensue the consistency of the selection The dt tee nd the tee of the ptten depend only on the numbe of vibles nd cluses of the fomul Only the constints on dt of the ptten e specific to the fomul They encode the link between vibles nd cluses Let Σ = {,, X, Y, Z, #, } be the finite lphbet Assume tht ϕ hs k vibles nd n cluses The dt tee t ϕ is composed of k copies of the tee t v nd n copies of the tee t c s depicted in Figue 2 Even if we conside unodeed tees, ech copy of t v coesponds to vible of the fomul nd ech copy of t c to cluse The tee t ϕ involves exctly thee clsses, denoted s,, Ech subtee t v, see Figue 2(b), contins the two possible vlues fo vible The left (ight) bnch of the tee epesents tue (esp flse) 6

`# t v t v t c t c ` ` ` ` ` () The dt tee t ϕ ` `X `Y `Y `Z `Z ` ` `X `Y `Z `Z (b) The subtee t v ` `X `Y `Z () (2) (3) (c) The subtee t c Fig2 The dt tee t ϕ A cluse is viewed hee s the disjunction of thee litels, sy X, Y, nd Z Ech subtee t c, see Figue 2(c), is fomed by thee subtees Ech of them epesents one of the thee disjoint possibilities fo cluse to be tue: () X is tue, o (2) X is flse nd Y is tue, o (3) X nd Y e flse nd Z is tue We now tun to the definition of the tee ptten P ϕ = (tp ϕ, C, C ), depicted in Figue 3 Similly to t ϕ, the tee tp ϕ is fomed by k copies of tp v (ech of them implicitly coesponding to vible) nd n copies of tp c (ech of them implicitly coesponding to cluse) # tp v tp v tp c tp c X Y Z () The tee tp ϕ (b) Subtees tp v nd tp c Fig3 The tee tp ϕ The fom of the dt esues of t ϕ nd tp ϕ ensues tht ny witness of P ϕ in t ϕ selects exctly one vlue pe vible nd one (stisfying) vlution fo ech cluse Note tht this is ensued by the definition of witness, since the witness mpping is injective It emins to define the dt constints C nd C in ode to guntee tht ech cluse is stisfied Assume tht the fist litel of cluse c is positive vible x (esp the negtion of x) Then we dd in C the -position (esp the -position) of the subtee tp v coesponding to the vible x togethe with the X-position of the subtee tp c coesponding to the cluse c The sme cn be 7

done with the litels Y nd Z Figue 4 gives the exmple of the ptten fo the fomul ϕ with only the cluse b c # X Y Z Fig4 Ptten fo ϕ = b c We now pove tht t ϕ P ϕ iff ϕ is stisfible Assume tht the fomul ϕ is stisfible Fom ny stisfying ssignment of ϕ we deive mpping of P ϕ into t ϕ : the subtee p v coesponding to the vible v is mpped on the left bnch of the coesponding t v if the vlue of v is tue, nd on the ight bnch othewise Since ech cluse is stisfied, one of the thee cses epesented by the subtee t c hppens, nd we cn mp the tp c coesponding to the cluse on the bnch of the coesponding t c The convese is simil In the poofs of Poposition 4 nd Theoem 3, the pttens use only the child pedicte We cn do the sme with simil pttens using only the descendnt pedicte As consequence, we hve: Theoem 5 The model-checking poblem fo both fgments BC(, ), BC(, ) is DP-complete Coolly 6 The model-checking poblem fo BC + (, ), BC + (, ) nd fo BC + (,, ) is NP-complete Similly, we cn see tht the model-checking poblem of (conjunction of) negted ptten(s) is co-np-complete Notice tht in the poof of Theoem 3, the ptten fomul of the lowe bound is conjunction of one ptten nd the negtion of one ptten Thus, the model-checking poblem is ledy DPcomplete fo conjunction of one ptten nd one negted ptten The model checking poblem fo conjunctive queies is lso exponentil (NP) in eltionl dtbses Howeve, the lgoithms wok vey well in pctice, when models o queies e simple In pticul, when the quey is cyclic, the poblem becomes polynomil The wost cses tht led to exponentil behvios do not ppe often It would be inteesting to know how the lgoithms following fom ou poofs behve on pcticl cses, nd whethe we cn find some estiction on the pttens tht would led to efficient evlution in pctice 4 Stisfibility In this section, we study the stifibility poblem in the pesence of DTDs Checking stisfibility of quey is useful fo optimiztion of quey evlution 8

o minimiztion techniques In tems of schem design, stisfibility coesponds to checking the consistency of the specifiction We show tht the stisfibility poblem is undecidble in genel Howeve the eduction needs the combintion of negtion, child nd descendnt opetions Indeed, emoving ny one of these fetues yields decidbility, nd we give the coesponding pecise complexities 4 Undecidbility Theoem 7 The stisfibility poblem fo BC(,, ) in the pesence of DTD is undecidble Poof sketch We pove the undecidbility by eduction fom the cceptnce poblem of two-counte mchines (o Minsky mchines) Ou eduction builds DTD nd ptten fomul of size polynomil in the size of the mchine whose models e exctly the encodings of the ccepting uns The encoding of un cn be split in thee pts: The genel stuctue of the tee, which depends only on the dt esue, nd is contolled by the DTD 2 The intenl consistency of configution 3 The evolution of counte vlues between two successive configutions The globl stuctue contins bnch tht is lbelled by the sequence of tnsitions Ensuing tht tee is of this shpe is done by the DTD It ecognizes the dt esue of sequences of configutions In pticul it checks tht counte is zeo when this is equied by the tnsition It lso ensues tht the sequence of tnsitions espects the mchine s ules (succession of contol sttes, initil nd finl configutions) The dt vlues llow us to contol the evolution of the countes between two consecutive configutions In ode to do so, we need to guntee cetin degee of stuctue nd continuity of the vlues though un The dt stuctue nd the evolution of countes e ensued by the ptten fomul The poof uses only conjunctions of negted pttens Thus, the stisfibility poblem is ledy undecidble fo the BC (,, ) fgment in the pesence of DTD Altentively, the DTD cn be eplced by ptten fomul To do so, we need few positive pttens to constin initil nd finl configutions in the coding Thus, the stisfibility poblem is undecidble fo BC(,, ) without DTDs It is inteesting to notice tht the stisfibility poblem of BC(,, ) is undecidble on wod models We will discuss this in Section 5 42 Decidble Restictions We cn obtin decidbility by estining eithe the expessive powe of ptten fomuls o the dt tees consideed Fo the fist pt, using only one kind of edge pedicte ( o ) leds to decidbility Fo the second pt, esticting the tees to bounded depth leds to decidbility We povide the exct complexities 9

Resticted Fgments: The poof of undecidbility uses both nd in the ptten to count unbounded vlues of the countes If we estict expessivity of pttens to use eithe o, we cn t do this nymoe nd the poblem becomes decidble The key to both lowe bounds is tht pttens cn still count up to polynomil vlue nd thus compe positions of tee of polynomil depth We use this ide to encode exponentil size configutions of Tuing mchine into the leves of polynomil depth subtees Theoem 8 The stisfibility poblem of BC(, ) in the pesence of DTD is 2ExpTime-complete Poof sketch The uppe bound is obtined by smll model popety We cn pove tht ptten fomul ϕ of BC(, ) is stisfible in the pesence of given DTD iff it hs model with numbe of clsses tht is doubly exponentil in the size of the fomul We cn ecognize the dt esue of such smll models with n utomton of size doubly exponentil in the size of the fomul Becuse emptiness of such utomt is PTime, we hve the 2ExpTime uppe bound The lowe bound is obtined by coding of ccepting uns of AExpSpce Tuing mchines We cn build DTD nd ptten fomul fom BC(, ) such tht dt tee is model on the ptten fomul nd espects the DTD iff it is the encoding of n ccepting un of the mchine Theoem 9 The stisfibility poblem of BC(, ) in the pesence of DTD is NExpTime-complete Bounded Depth estictions: In the context of XML documents, looking t the stisfibility poblem esticted to dt tees of bounded depth is cucil estiction This estiction leds to decidbility fo BC(, <, +) Poblem 3 Conside ptten fomul ϕ, n intege d nd DTD L The poblem of bounded depth stisfibility in the pesence of DTD sks whethe ϕ is stisfible by dt tee of depth smlle thn d whose dt esue belongs to L Theoem If d is fixed, the bounded depth stisfibility poblem in the pesence of DTD fo BC(,, ) is Σ 2 -complete Theoem If d is pt of the input, the bounded depth stisfibility poblem in the pesence of DTD fo BC(,, ) is NExpTime-complete Othe emks: All the lowe bound esults of this section only use conjunctions of negted pttens Thus these esults hold fo the BC fgments Poposition 2 The stisfibility poblem of single ptten is PTime Poposition 3 The stisfibility poblem fo BC + (,, ) is NP-complete in the pesence of DTD

5 Conclusion The tble below summizes ou esults bnd (esp bnd f ) St stnds fo Bounded depth Stisfibility when the bound is pt of the input (esp fixed) The gy pts of the tble gives complexity esults fo dt wods models Dt wods e the line model coesponding to dt tees This model is studied in the veifiction e [, 3] Dt pttens cn lso be consideed fo dt wods The poofs e moe complex nd will be vilble in longe vesion Fgments Model-Checking Stisfibility bnd St bnd f St BC(,, ) DP-complete Undecidble NExpTime-complete Σ 2-complete BC(, ) DP-complete 2ExpTime-complete NExpTime-complete Σ 2-complete Dt Wod PTime PSpce-complete BC(, ) DP-complete NExpTime-complete NExpTime-complete Σ 2-complete Dt Wod DP-complete Σ 2-complete BC (,, ) conp-complete Undecidble NExpTime-complete Σ 2-complete Dt Wod conp-complete undecidble BC + (,, ) NP-complete NP-complete NP-complete NP-complete Dt Wod NP-complete NP-complete Discussion: In ou fmewok we use the unodeed vesion of tees If we conside the next-sibling pedicte, the sitution is diffeent Fo the model checking poblem ll esults hold with simil poofs Howeve, the complexity of the stisfibility poblem cn incese when negtion is llowed In pticul the stisfibility poblem fo bounded depth tee becomes undecidble since we cn encode dt wods Recll tht ou ptten fomlism does not peseve the lest common ncesto All esults hold if we dd the lest common ncesto An impotnt issue of semi-stuctued dtbses is the continment poblem Given DTD nd two ptten fomuls we wnt to know whethe evey tee stisfying the DTD nd the fist fomul lso stisfies the second one When the set of fomuls we conside is closed unde negtion, we cn decide whethe fomul ϕ is moe constining thn ϕ 2 by checking the stisfibility of ϕ 2 ϕ In Boolen combintions, we hve closue unde negtion, hence the inclusion poblem educes to the stisfibility poblem Fo the positive fgment, the pecise complexity seems hde to stte nd the question is left open In tems of expessiveness, ou ptten fomlism is incompble to XPth In tems of tctbility, evlution of XPth queies is PTime whees model-checking of one dt tee ptten is ledy NP-hd A question is to find good notions of constints in ode to isolte inteesting fgments with lowe complexity Consideing the complexity of the stisfibility poblem, XPth nd ou ptten fomlism behve similly In this ppe, we only conside pttens s filtes in ode to define popeties on the dt tees Defining quey lnguge would be ntul extension of this wok To do this, some of the vibles of the pttens cn be chosen s output vibles

Refeences S Al-Khlif, H V Jgdish, J M Ptel, Y Wu, N Kouds, nd D Sivstv Stuctul Joins: A Pimitive fo Efficient XML Quey Ptten Mtching In ICDE, pges 4 53 IEEE, 22 2 N Alon, T Milo, F Neven, D Suciu, nd V Vinu XML with dt vlues: typechecking evisited J Comput Syst Sci, 66(4):688 727, 23 3 S Ame-Yhi, S Cho, L V S Lkshmnn, nd D Sivstv Minimiztion of tee ptten queies SIGMOD Rec, 3(2):497 58, 2 4 M Aens nd L Libkin XML dt exchnge: consistency nd quey nsweing In PODS, pges 3 24, 25 5 M Benedikt, W Fn, nd F Geets XPth stisfibility in the pesence of DTDs In PODS, pges 25 36, 25 6 M Benedikt nd C Koch XPth Leshed To ppe in ACM Computing Suveys 7 V Benzken, G Cstgn, nd C Michon CQL: ptten-bsed quey lnguge fo XML In BDA, pges 469 49, 24 8 H Bjöklund, W Mtens, nd T Schwentick Conjunctive Quey Continment ove Tees In DBPL, LNCS 4797, pges 66 8 Spinge, 27 9 H Bjöklund, W Mtens, nd T Schwentick Optimizing Conjunctive Queies ove Tees using Schem Infomtion To ppe in MFCS, 28 M Bojnczyk, C Dvid, A Muscholl, T Schwentick, nd L Segoufin Twovible logic on dt tees nd XML esoning In PODS, pges 9, 26 M Bojnczyk, A Muscholl, T Schwentick, L Segoufin, nd C Dvid Two- Vible Logic on Wods with Dt In LICS, pges 7 6 IEEE, 26 2 N Buno, N Kouds, nd D Sivstv Holistic twig joins: optiml XML ptten mtching In SIGMOD Confeence, pges 3 32 ACM, 22 3 S Demi nd R Lzic LTL with the Feeze Quntifie nd Registe Automt In LICS, pges 7 26 IEEE, 26 4 A Deutsch nd V Tnnen Continment nd integity constints fo xpth In KRDB, volume 45 of CEUR Wokshop Poceedings CEUR-WSog, 2 5 W Fn nd L Libkin On XML integity constints in the pesence of DTDs J ACM, 49(3):368 46, 22 6 G Gottlob, C Koch, nd R Pichle Efficient lgoithms fo pocessing XPth queies ACM Tns Dtbse Syst, 3(2):444 49, 25 7 G Gottlob, C Koch, nd K U Schulz Conjunctive queies ove tees J ACM, 53(2):238 272, 26 8 M Judzinski nd R Lzic Altention-fee modl mu-clculus fo dt tees In LICS, pges 3 4 IEEE, 27 9 L V S Lkshmnn, G Rmesh, H Wng, nd Z J Zho On Testing Stisfibility of Tee Ptten Queies In VLDB, pges 2 3, 24 2 A Neumnn nd H Seidl Locting mtches of tee pttens in foests In FSTTCS, volume 53 of LNCS, pges 34 45 Spinge, 998 2 C H Ppdimitiou nd M Ynnkkis The Complexity of Fcets (nd Some Fcets of Complexity) J Comput Syst Sci, 28(2):244 259, 984 22 Y Wu, J M Ptel, nd H V Jgdish Stuctul Join Ode Selection fo XML Quey Optimiztion In ICDE, pges 443 454 IEEE, 23 2

A Model-Checking Hee we pove Theoem 3: The model-checking poblem fo BC(,, ) is DP-complete Poof The uppe bound is obtined by stightfowd lgoithm Conside dt tee t nd ptten fomul ϕ Fom Poposition 4 model-checking dt tee ptten is in NP nd model-checking negted ptten is in co-np Thus we hve DP pocedue fo ny fomul ϕ fom BC(,, ) to fill the pse tee Ech lef lbeled by positive ptten is evluted in NP, nd ech lef lbeled by negtive ptten is evluted in co-np Checking the pse tee of the ptten fomul is PTime Fo the lowe bound, we educe SAT/UNSAT to ou poblem, using the encoding defined in the poof of Poposition 4 We use two disjoint copies of the lphbet Σ to encode the two fomuls The instnce (ϕ, ψ) of SAT/UNSAT is the dt tee t constucted by meging the oots of t ϕ nd t ψ We hve t = P ϕ P ψ iff ϕ is stisfible nd ψ is not stisfible B Stisfibility B Undecidbility Hee we show the Theoem 7: The stisfibility poblem fo BC(,, ) in pesence of DTD is undecidble Poof We pove the undecidbility by eduction fom the cceptnce poblem of two-counte mchines (o Minsky mchines) Ou eduction builds DTD nd ptten fomul such tht ny dt tee stisfying both is the coding of n ccepting un of the mchine In the following, we explin how to encode n ccepting un into dt tee nd we descibe the DTD nd the ptten fomul The encoding of un cn be split in thee pts: The genel stuctue of the tee, which depends only on the dt esue, nd is contolled by the DTD 2 The intenl consistency of configution 3 The evolution of counte vlues between two successive configutions The globl stuctue is descibed in Figue 5() A un contins bnch tht is lbeled by the sequence of tnsitions Ech tnsition bnches to subtee coesponding to the cuent configution The subtee coesponding to configution is mde of two bnches, one with only s nd one finl (the -bnch) nd the othe with only b s nd nothe finl (the b-bnch), s shown in Figue 5(b) They epesent, in uny fom, the vlues of the countes Ensuing tht tee is of this shpe is done by the DTD It ecognizes the dt esue of sequences of configutions In pticul it checks tht counte is 3

zeo when this is equied by the tnsition It lso ensues tht the sequence of tnsitions espects the mchine s ules (succession of contol sttes, initil nd finl configutions) c δ cf b b δ n cf cf n () The encoding of un (b) The encoding of configution cf i Fig5 Encoding of un The dt vlues llow us to contol the evolution of the countes between two consecutive configutions In ode to do so, we need to guntee cetin degee of stuctue nd continuity of the vlues though un We show how this cn be done fo the -bnches Simil pttens contol the behvio of the b-bnches The fist step is to ensue tht in ny configution, the dt vlues in the -bnches e ll diffeent The ptten descibed in Figue 6() coesponds to the cse whee two s in the sme configution hve the sme vlue, nd so we fobid it The second step bings in the necessy continuity: if two s e t the sme position in two successive configutions, they must she the sme dt vlue Fobidding the two pttens of Figue 6(b) ensues inductively tht divegence cnnot occu The lst step is to check tht the lengths of the bnches chnge ccoding to the cuent tnsition Two pttens, coesponding to the cses whee thee e too mny o too few pttens in the new configution, e fobidden The pecise fom of these pttens depends on whethe the counte inceses, deceses, o emins constnt Figue 6(c) descibes the ones fo tnsition tht inceses the fist counte We hve now ll the elements of the eduction We cn build DTD nd ptten fomul of size polynomil in the size of the mchine whose models e exctly the encodings of the ccepting uns B2 Descendnt Fgment Hee we show Theoem 9: 4

δ δ c c c c () Stuctue c c (b) Continuity c c (c) Incesing counte Fig 6 Fobidden pttens The stisfibility poblem of BC(, ) in the pesence of DTD is NExpTimecomplete Poof The uppe bound esult follows fom smll model popety If ptten fomul is stisfible in the pesence of given DTD, thee exists model of nk nd depth polynomil in the size of the fomul nd the DTD Theefoe the model hs size exponentil in the input Conside ptten fomul ϕ nd DTD L Conside model t of ϕ tht espects the DTD L Mk the nodes of one witness fo ech ptten of ϕ stisfied by t Ignoing dt vlues, s in clssicl egul tee lnguges, we cn pump wt the DTD, both hoizontlly nd veticlly, ny pt of the tee tht does not contin mked position This wy, we educe the nk nd depth of the tee to be polynomil into the size of L nd the pttens of the fomul ϕ The dt esue of the new tee still belongs to L The new tee contins ll the pevious witnesses Since the pttens only llow descendnt pedictes, if the oiginl tee does not contin ptten, the new tee does not eithe Thus, the new tee is still model of the fomul A stightfowd lgoithm nswes the stisfibility poblem in NExp- Time Fist guess dt tee t of exponentil size Fo ech ptten of the fomul, conside ech possible mpping of the ptten into the tee (thee e t k possible mtchings if k is the size of the ptten) nd check whethe the mtching is witness fo the ptten (PTime in the size of the tee t ) Finlly, evlute the syntctic psing tee of ϕ (PTime in the size of the fomul) The lowe bound esult is obtined by eduction fom the cceptnce of non-deteministic Tuing mchine tht uses time 2 n to ou poblem This yields NExpTime-hdness We encode un of NExpTime Tuing mchine into dt tee Then we explin how to build DTD nd ptten fomul whose models e exctly the encodings of the ccepting uns of the mchine Conside mchine M nd n input w of length n The mchine M uses time 2 n An ccepting un of the mchine M on input w is succession of t most 2 n tnsitions δ, δ, δ 2, δ 3,, δ f Moeove ech configution is of length 5

t most 2 n We encode such un with tee of the following fom given in Figue 7: # n δ δ δ i δ i+ δ f c c c i c i+ c f Fig 7 The fist subtee ooted by # is biny tee of depth n This is tee whee ech node hs exctly one child lbeled by nd the othe one lbeled by In ech lef, we plug nothe biny tee of depth n (ooted by tnsition of the mchine) such tht the lef wod coesponds to configution of the mchine (conside leves odeed by the lexicl ode on the lbel of the pth fom the oot) In the following, we denote those subtees by C-subtees All C-subtees hve the sme lbel stuctue nd dt vlues The only diffeence lies in the lbels of leves llowing to encode configutions Moeove two nodes belonging to the sme C-subtee must hve diffeent dt vlues The DTD ensues nk equl to two, the shpe of the sub-tees, the pths lbeled nd The ptten fomul ensues the dt vlue popety nd checks tnsitions between configutions Becuse coesponding positions in ll C- subtees hve the sme sequence of dt vlues long the pth fom the oot, we cn identify them in the pttens nd then compe the evolution of consecutive positions between consecutive configutions As in the poof of Theoem 7, we only fobid bd behvios We fist explin how to enfoce the dt vlue popeties descibed bove In C-subtee ech position is in diffeent clssthis is ensued by fobidding the pttens given in Figue 8: A position hs the sme dt vlue in evey C-subtee This is ensued by fobidding the pttens of Figue 9 6

() (b) Fig 8 # n () # k n k (b) # n (c) # k n k (d) Fig 9 7

Then we hve to ensue tht tnsitions e simulted coectly If we cn tlk bout thee consecutive positions of configution, it suffices to fobid bd behvios of evey such goup of consecutive positions between two consecutive configutions We cn distinguish two consecutive positions of configution If two positions nd b stisfy ptten of the following fom, b is the successo of in the configution mked by # b n k Similly, if position, b nd c stisfies ptten of the following fom, they e consecutive positions in the configution # n k b c 8

In this wy, we cn constuct pttens coesponding to bd behvios s in the exmple of Figue # k n k b c d Fig Tken togethe, we need polynomil numbe of negted pttens to ensue dt vlue popeties nd the coheence of tnsition between consecutive configutions We cn build DTD nd ptten fomul of size polynomil in the size of the mchine whose models e exctly the encodings of the ccepting uns B3 Child fgment Hee we explin the uppe bound pt of Theoem 8: Lemm The stisfibility poblem in the pesence of DTD fo BC(, ) is in 2ExpTime Poof Fist, we pove tht ptten fomul ϕ of BC(, ) is stisfible iff it is stisfible by dt tee with numbe of clsses doubly exponentil in the size of the fomul Then we show tht we cn ecognize the dt esue of such smll models with n utomton of size doubly exponentil in the size of the fomul Becuse emptiness of such utomt is PTime, we hve the 2ExpTime uppe bound 9

Conside ptten fomul ϕ nd dt tee t tht stisfies the fomul Conside tuth vlution of ϕ tht is stisfied by the dt tee t We denote by positive (esp negtive) pttens, the pttens of the fomul tht must be tue (esp flse) in the vlution Conside lso witness function ssociting nodes of the positive pttens with nodes of the tee t We cll mked the nodes of t which e ssocited with nodes of the positive ptten Fist notice tht we cn pump hoizontlly 3 into the tee t with espect to the DTD to bound the ity of the tee by, whee is polynomil in the size of the DTD nd the ptten fomul We obtin new tee t of polynomil ity By constuction, the tee espects the DTD Becuse it still contins the mked positions, it stisfies the positive pttens Becuse, pttens do not llow sibling edges, nd we hve pumped only in the width, the tee still espects the negted pttens Fom this new model t, we cn constuct model t c with the sme dt esue but numbe of clsses bounded by polynomil constnt of the fom m = p + d The numbe d is the sum of the depth of negted pttens nd p epesents the sum of the sizes of the pttens Moe pecisely, we cn enme dt vlues top-down so tht the dt eltion between ll nodes is peseved in evey subtee of depth d Becuse of positive pttens, we do not enme clsses coesponding to mked position Renming dt vlues does not chnge nything to the DTD membeship Moeove, since we do not enme the mked positions, the tee t c contins t le st witness fo ech positive ptten Finlly, s negted pttens e of depth smlle thn d, the new dt tee espects the negted pttens Thus, the tee t c is still model of the fomul This ends the fist pt of the poof We cn build finite utomton ove the lphbet Σ M tht ecognizes exctly the models of ϕ nd DTD of ity less thn nd t most m clsses lbeled with M lettes This utomton is of size double exponentil in size of ϕ nd DTD nd cn be built in time 2ExpTime Emptiness of finite tee utomton is PTime The stisfibility poblem is thus 2ExpTime Lemm 2 The stisfibility poblem in the pesence of DTD fo BC(, ) is AExpSpce-hd Poof This lowe bound esult is obtined by coding of ccepting uns of AExpSpce Tuing mchines Recll tht the complexity clsses AExpSpce nd 2ExpTime e equl We explin how to encode un of n ExpSpce Tuing mchine into dt tee Then we give the ide how to extend the model to AExpSpce Tuing mchines Conside Tuing mchine of spce 2 n nd input wod x of length n A un (see Figue below) is encoded in dt tee contining bnch lbeled 3 We cnnot pump veticlly becuse of negted pttens contining some child pedicte Thus if we pump veticlly, we cn intoduce witnesses fo negted ptten 2

by the sequence of tnsitions In ech node of this bnch, we plug subtee coesponding to the configution These configution subtees e defined s in the poof of Theoem 9 δ δ δ f end c c c f Fig We cn build DTD nd ptten fomul fom BC(, ) such tht dt tee is model on the ptten fomul nd espects the DTD iff it is the encoding of n ccepting un of the mchine The DTD constins the shpe of the tee In pticul it ensues tht the sequence of tnsitions espects the mchine s ules (succession of contol sttes, initil nd finl configutions) As in the poof of Theoem 9, we use the fct tht pttens cn compe positions of tee of polynomil depth We constuct pttens close to the one used in the poof of Theoem 9, nd ptten fomul ensuing tht the evolution of the configutions is coect Using the child pedicte it s possible to tlk bout consecutive configutions in the bnch These two constuctions cn be extended to AExpSpce Tuing mchines We encode uns by bnching the coding of ExpSpce Tuing mchine uns The encoding of the un is tee lbeled by the sequence of tnsitions nd in ech node of this bnch, we plug the C-subtees of the coesponding configution of the mchine The ptten fomul nd DTD cn be built with the sme ide B4 Bounded-depth Stisfibility In this pt, we pove Theoem nd Theoem : Fixed bounded depth (Theoem ) If d is fixed, bounded depth stisfibility in the pesence of DTD fo BC(,, ) is Σ 2 -complete Lemm 3 If d is fixed, bounded depth stisfibility in the pesence of DTD fo BC(,, ) is Σ 2 2

Poof Conside DTD L nd fomul ϕ nd tuth vlution of the fomul tht is stisfible with espect to L This vlution is stisfible by dt tee of size polynomil in the size of the fomul (exponentil in the size of bound d) Conside model of this vlution whose dt esue belongs to L Fo ech positive ptten of the vlution let mk the positions of witness Ignoing dt vlues, s in clssicl egul tee lnguges, we cn pump hoizontlly ny pt of the tee tht does not contin mked position with espect to L By pumping we educe the size of those pts to be of nk polynomil in L The depth of the tee is fixed Becuse thee e polynomil numbe of such positions, we obtin new tee of polynomil size in ϕ nd L The dt esue of the new tee is still in L, nd it still contins the witness positions Moeove, becuse the ptten do not llow hoizontl constints, if the oiginl tee does not contin ny fobidden ptten, the new tee does not eithe This new tee is still model of the fomul Lemm 4 Bounded depth stisfibility in the pesence of DTD fo BC(,, ) is Σ 2 -hd fo ny fixed bound gete thn thee Poof This lowe bound esult is obtined by eduction of QSAT2 to the stisfibility poblem of BC(, ) in the pesence of DTD QSAT2 poblem is the stisfibility poblem of quntified popositionl Boolen fomuls with quntifie depth two (ie fomul of the fom X Y ϕ whee ϕ is in 3-DNF) Conside fomul X Y ϕ whee ϕ is in 3-DNF The ide of the poof is the following Thee exists set of dt tees S nd ptten P X ϕ such tht one of the dt tees stisfies the negted ptten iff X Y ϕ is stisfible This set of dt tees S cn be descibed s the models of ptten fomul tht espect specil DTD In the following we descibe this set S, nd the fom of the ptten P X ϕ Intuitively, evey dt tee fom S coesponds to the fomul ϕ with mked vlution of X vibles The stuctue of dt tees fom S is simil to the one of the tee t ϕ descibed in the poof of Poposition 4 The lphbet is Σ = {,,,, X, Y, Z, #, } A dt tee in S contins exctly the six clsses,,2,3, nd It lso contins ll the possible vlues fo ech vible Hee we conside in disjunctive noml fom, the tee contins ll the possible vlues fo ech tiplet of litels fo cluse to be flse Additionlly, we impose tht ech dt tee contins mked vlution of X vibles The stuctue is depicted in Figue 2 22

(#, ) t x t xk t y t yl t c t ck () The fom of dt tee of S (#, ) (#, ) (, ) (, ) (, ) (, ) (, ) (, ) (, ) (, ) (b) The two possible subtees t x (, ) (, ) t X (X, ) (Y, ) (Z, ) (Z, ) t Z (c) The subtee t c with t Y coesponding to Y flse Fig2 Dt tees of S The t y subtees e identicl to t v subtees in the poof of Poposition 4 The t x subtees e vey simil The only diffeence is tht we mk one of the two vlutions Eithe the vible is tue nd is negtion is flse o it is flse nd its negtion is tue A cluse is viewed hee s the conjunction of thee litels, sy X, Y, nd Z Ech subtee t c is still fomed by thee subtees (t X, t Y nd t Z ), ech of them now epesenting one of the tee disjoint possibilities fo cluse being flse () X is flse, o (2) X is tue nd Y is flse, o (3) X nd Y e tue nd Z is flse Figue 2 shows t c with the subtee t Y coesponding to Y flse Notice tht the depth of the tee is thee The ptten P X ϕ is simil to the ptten P ϕ Thus we do not descibe if fomlly It selects vlution pe vible nd pe cluse Its stuctue mkes sue tht only one vlution pe vible nd pe litel is selected The only diffeence is tht the vlution selected fo X vibles must be the mked one The dt constints of the ptten ensue the consistency of the selection between vible pt nd cluse pt s in the poof of Poposition 4 Infomlly, the ptten descibes vlution of Y vibles such tht the fomul is flse with the mked vlution of X We hve the following popety: if dt tee of S stisfies the ptten P X ϕ, the mked vlution of X vibles is not solution fo ou instnce of 2QSAT poblem 23

It is esy to see tht we cn descibe the set S of dt tees with simple DTD tht constins the stuctue nd node lbels of tee A single ptten cn constin dt (in)equlity between ll the nodes Hence, given QSAT2 instnce X Y ϕ, we cn constuct DTD nd ptten fomul such tht the ptten fomul is stisfible with espect to the DTD iff the instnce of QSAT2 hs solution The ptten fomul is simple s it is the conjunction of ptten nd negted ptten Fixed bounded depth (Theoem ) If d is pt of the input, bounded depth stisfibility in the pesence of DTD fo BC(,, ) is NExpTime-hd Poof The poof of the lowe bound is simil to the one of Theoem 9 The uppe bound comes fom smll model popety Given model of the fomul, thee exists model of size exponentil in the size of the input Conside ptten fomul ϕ nd DTD L Conside model t of ϕ tht espect the DTD L Mk positions of one witness fo ech ptten of ϕ stisfied by t Ignoing dt vlue, s in clssicl egul tee lnguge, we cn pump hoizontlly wt the DTD ny pt of the tee tht does not contin one of the mked positions This wy, we educe the nk of the tee to be polynomil into the size of L nd pttens of the fomul ϕ The depth is bounded by definition The dt esue of the new tee still belongs to L The new tee contins ll the pevious witnesses And becuse we pttens do not llow sibling edges, if the oiginl tee does not contin ptten, the new tee does not eithe Thus, the new tee is still model of the fomul A guess nd check lgoithm gives the uppe bound Guess model, then evlute the ptten on the tee nd check the vlidity of the vlution To evlute the ptten, test ech possible witness in the tee Ech ptten hs finite numbe of nodes so thee is n exponentil numbe of possible witnesses to test The test is NP in the size of the model, which gives us the NExpTime uppe bound B5 Positive Fgment Hee we show Poposition 3: The stisfibility poblem of ptten fomul tht does not llow negtion of ptten in the pesence of DTD is in NP-complete Notice this poof is vey simil to the poof of Theoem 45 in [5] Poof The lowe bound is vey esy It cn be obtin fo exmple fom the poof of Poposition 4, with the sme eduction fom 3SAT: the esulting ptten fomul is conjunction of two pttens It is lso be obtin by using othe 3SAT s in coding [5] even without dt vlue The uppe bound poof is vey simil to the poof of Theoem 45 in [5] It is moe difficult thn the lowe bound, minly becuse even simple DTD cn foce 24

evey model to be of exponentil size Howeve, the bsence of negtive pttens llows us to concentte on the positions used s witnesses fo the pttens This llows us to guess only smll pt of model (of polynomil size) nd check tht it cn be extended to vlid tee (without constucting it) If ptten fomul fom BC + (,, ) hs model, thee is model of depth polynomil in the size of the DTD nd the fomul Indeed, consideing model with witness fo ech ptten, we cn pump veticlly with espect to the DTD in ll subtees tht do not contin ny witness position fo ptten of the fomul We obtin new model of depth polynomil in the size of the DTD nd the ptten fomul In model with polynomil depth, we now conside the miniml subtee contining one witness fo ech ptten This subtee is of polynomil size The lst emining poblem is to check whethe we cn build, fom the dt esue of this tee, tee stisfying the DTD In ode to do tht, we guess the sttes lbeling the nodes nd tnsitions of the subtee in successful un of the utomton coesponding to the DTD We only hve to check if it is possible to extend the tee into tee stisfying the DTD with the guessed tnsitions This tkes polynomil time We only hve to check fo ech node whethe the Boolen combintion fomul coesponding to tnsition cn be fulfilled by dding nodes to the tee As thee e no fobidden pttens, this pdding cnnot cuse poblems wt the ptten fomul An NP lgoithm consist of () guessing tee of polynomil size with witness positions nd tnsitions (2) checking whethe witnesses e coect nd whethe the tee cn be extended wt the DTD 25