The Complexity of Translation Membership for Macro Tree Transducers

Slides:



Advertisements
Similar presentations
Comparative Succinctness of KR Formalisms Paolo Liberatore.
Advertisements

Lecture 24 MAS 714 Hartmut Klauck
The Theory of NP-Completeness
1 NP-Complete Problems. 2 We discuss some hard problems:  how hard? (computational complexity)  what makes them hard?  any solutions? Definitions 
Complexity 12-1 Complexity Andrei Bulatov Non-Deterministic Space.
Complexity 15-1 Complexity Andrei Bulatov Hierarchy Theorem.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY Read sections 7.1 – 7.3 of the book for next time.
1 Polynomial Time Reductions Polynomial Computable function : For any computes in polynomial time.
Exact Learning of Boolean Functions with Queries Lisa Hellerstein Polytechnic University Brooklyn, NY AMS Short Course on Statistical Learning Theory,
Containment and Equivalence for an XPath Fragment By Gerom e Mikla Dan Suciu Presented By Roy Ionas.
Analysis of Algorithms CS 477/677
CS Master – Introduction to the Theory of Computation Jan Maluszynski - HT Lecture NP-Completeness Jan Maluszynski, IDA, 2007
February 20, 2015CS21 Lecture 191 CS21 Decidability and Tractability Lecture 19 February 20, 2015.
Streaming Tree Transducers Loris D'Antoni University of Pennsylvania Joint work with Rajeev Alur 1.
Streaming Tree Transducers Loris D'Antoni University of Pennsylvania Joint work with Rajeev Alur 1.
1 The Theory of NP-Completeness 2012/11/6 P: the class of problems which can be solved by a deterministic polynomial algorithm. NP : the class of decision.
THE COMPLEXITY OF TRANSLATION MEMBERSHIP FOR MACRO TREE TRANSDUCERS Kazuhiro Inaba (The University of Tokyo) Sebastian Maneth (NICTA & University of New.
February 18, 2015CS21 Lecture 181 CS21 Decidability and Tractability Lecture 18 February 18, 2015.
The Complexity of Optimization Problems. Summary -Complexity of algorithms and problems -Complexity classes: P and NP -Reducibility -Karp reducibility.
Computational Complexity Theory Lecture 2: Reductions, NP-completeness, Cook-Levin theorem Indian Institute of Science.
Theory of Computing Lecture 17 MAS 714 Hartmut Klauck.
NP Complexity By Mussie Araya. What is NP Complexity? Formal Definition: NP is the set of decision problems solvable in polynomial time by a non- deterministic.
Week 10Complexity of Algorithms1 Hard Computational Problems Some computational problems are hard Despite a numerous attempts we do not know any efficient.
CSCI 3160 Design and Analysis of Algorithms Tutorial 10 Chengyu Lin.
1 The Theory of NP-Completeness 2 Cook ’ s Theorem (1971) Prof. Cook Toronto U. Receiving Turing Award (1982) Discussing difficult problems: worst case.
Multi-Return Macro Tree Transducers The Univ. of Tokyo Kazuhiro Inaba The Univ. of Tokyo Haruo Hosoya NICTA, and UNSW Sebastian Maneth CIAA 2008, San Francisco.
Umans Complexity Theory Lectures Lecture 1a: Problems and Languages.
NP-Complete Problems. Running Time v.s. Input Size Concern with problems whose complexity may be described by exponential functions. Tractable problems.
Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity.
The Complexity of Tree Transducer Output Languages FSTTCS 2008, Bengaluru The Univ. of Tokyo Kazuhiro Inaba NICTA, and UNSW Sebastian Maneth.
Lecture 25 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity.
Chapter 11 Introduction to Computational Complexity Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1.
Fall 2013 CMU CS Computational Complexity Lecture 2 Diagonalization, 9/12/2013.
Complexity 24-1 Complexity Andrei Bulatov Interactive Proofs.
NP-complete Languages
Multi-Return Macro Tree Transducers Kazuhiro Inaba Haruo Hosoya University of Tokyo PLAN-X 2008, San Francisco.
Computability Examples. Reducibility. NP completeness. Homework: Find other examples of NP complete problems.
The NP class. NP-completeness Lecture2. The NP-class The NP class is a class that contains all the problems that can be decided by a Non-Deterministic.
NP-Completeness A problem is NP-complete if: It is in NP
The NP class. NP-completeness
NP-Completeness (2) NP-Completeness Graphs 4/13/2018 5:22 AM x x x x x
Chapter 10 NP-Complete Problems.
Computational Complexity Theory
L is in NP means: There is a language L’ in P and a polynomial p so that L1 ≤ L2 means: For some polynomial time computable map r :  x: x  L1 iff.
Advanced Algorithms Analysis and Design
Lecture 2-2 NP Class.
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
NP-Completeness (2) NP-Completeness Graphs 7/23/ :02 PM x x x x
NP-Completeness (2) NP-Completeness Graphs 7/23/ :02 PM x x x x
NP-Completeness Proofs
Approximate Inference
NP-Completeness Yin Tat Lee
Intro to Theory of Computation
Jaya Krishna, M.Tech, Assistant Professor
NP-Completeness (2) NP-Completeness Graphs 11/23/2018 2:12 PM x x x x
How Hard Can It Be?.
Computability & Complexity I
Chapter 11 Limitations of Algorithm Power
NP-Complete Problems.
Lecture 10: Query Complexity
CS154, Lecture 13: P vs NP.
NP-Completeness Yin Tat Lee
Umans Complexity Theory Lectures
NP-Completeness Reference: Computers and Intractability: A Guide to the Theory of NP-Completeness by Garey and Johnson, W.H. Freeman and Company, 1979.
CSE 589 Applied Algorithms Spring 1999
Instructor: Aaron Roth
Instructor: Aaron Roth
Instructor: Aaron Roth
RAIK 283 Data Structures & Algorithms
NP-Completeness (2) NP-Completeness Graphs 7/9/2019 6:12 AM x x x x x
Presentation transcript:

The Complexity of Translation Membership for Macro Tree Transducers Kazuhiro Inaba (The University of Tokyo) Sebastian Maneth (NICTA & University of New South Wales) PLAN-X 2009, Savannah

Translation Membership? “Translation Membership Problem” for a tree-to-tree translation τ: We are especially interested in nondeterministic translations where τ(s) is a set of trees (i.e., the translation membership problem asks “t ∈τ(s) ?”) Input: Two trees s and t Output: “YES” if τ translates s to t (“NO” otherwise) ? s t τ

Applications Dynamic assertion testing / Unit testing How can we check the assertion efficiently? How can we check it when the translation depends on external effects (randomness, global options, or data form external DB…)?  “Is there a configuration realizes the input/output pair?” Sub-problem of larger decision problems Membership test for the domain of the translation [Inaba&Maneth 2008] assert( run_my_xslt( load_xml(“test-in.xml”) ) == load_xml(“test-out.xml”) );

Known Results on Complexities of Translation Membership If τ is a Turing Machine … Undecidable If τ is a finite composition of top-down/bottom-up tree transducers … Linear space [Baker 1978]  Cubic Time [This Work] If τ is a finite composition of deterministic macro tree transducers … Linear time (Easy consequence of [Maneth 2002])

Outline Macro Tree Transducers (MTTs) IO and OI -- Two Evaluation Strategies MTTOI Translation Membership is NP-complete … also for finite compositions of MTTIO/MTTOI’s MTTIO Translation Membership is in PTIME!! … also for several extensions of MTTIO!! Conclusion and Open Problems

Macro Tree Transducer (MTT) start( A(x1) ) → double( x1, double(x1, E) ) double( A(x1), y1) → double( x1, double(x1, y1) ) double( B, y1 ) → F( y1, y1 ) double( B, y1 ) → G( y1, y1 ) An MTT M = (Q, q0, Σ, Δ, R) is a set of first-order functions of type Tree(Σ) * Tree(Δ)k  Tree(Δ) Each function is inductively defined on the 1st parameter Dispatch based on the label of the current node Functions are applied only to the direct children of the current node Not allowed to inspect other parameter trees

(M)TT in the XML World Simulation of XSLT, XML-QL [Milo&Suciu&Vianu 2000] Expressive fragment of XSLT and XML-QL can be represented as a composition of pebble tree transducers (which is a model quite related to macro tree transducers) TL – XML Translation Language [MBPS 2005] A translation language equipping Monadic Second Order Logic as its query sub-language, representable by 3 compositions of MTTs. Exact Type Checking [MSV00, Tozawa 2001, Maneth&Perst&Seidl 2007, Frisch&Hosoya 2007, …] Streaming [Nakano&Mu 2006] Equality Test [Maneth&Seidl 2007] …

IO and OI double( A(x1), y1) → double( x1, double(x2, y1) ) double( B, y1 ) → F( y1, y1 ) double( B, y1 ) → G( y1, y1 ) IO (inside-out / call-by-value): evaluate the arguments first and then call the function start(A(B))  double( B, double(B, E) )  double( B, F(E, E) )  F( F(E,E), F(E,E) ) or  G( F(E,E), F(E,E) ) or  double( B, G(E, E) )  F( G(E, E), G(E, E) ) or  G( G(E, E), G(E, E) )

IO and OI double( A(x1), y1) → double( x1, double(x2, y1) ) double( B, y1 ) → F( y1, y1 ) double( B, y1 ) → G( y1, y1 ) OI (outside-in / call-by-name): call the function first and evaluate each argument when it is used start(A(B))  double( B, double(B, E) )  F( double(B, E), double(B, E) )  F( F(E,E), double(B, E) )  F( F(E,E), F(E,E) )  F( F(E,E), G(E,E) )  F( G(E,E), double(B, E) )  F( G(E,E), F(E,E) )  F( G(E,E), G(E,E) )  G( double(B, E), double(B, E) )  G( F(E,E), double(B, E) )  G( F(E,E), F(E,E) )  G( F(E,E), G(E,E) )  G( G(E,E), double(B, E) )  G( G(E,E), F(E,E) )  G( G(E,E), G(E,E) )

IO or OI? Why we consider two strategies? IO is usually a more precise approximation of originally deterministic programs: OI has better closure properties and a normal form: For a composition sequence of OI MTTs, there exists a certain normal form with a good property, while not in IO. (explained later) // f(A(x))  if ≪complex_choice≫ then e1 else e2 f(A(x))  e1 f(A(x))  e2 g(A(x))  h(x, f(x)) h(A(x), y)  B(y, y)

Results

Translation Membership for MTTOI But, not x1 ∧ ¬ ∨ MTTOI Translation Membership is NP-hard Proof is by reduction from the 3-SAT problem There is an MTTOI translation that takes an input encoding two natural numbers (c and v), and generates all (and only) satisfiable 3-CNF boolean formulas with c clauses and v variables. x1 ∧ x2 ∨ x3 A e.g., 2 clauses A τ B ¬ ∧ x2 ∨ x1 x3 or 3 variables B B Z

Translation Membership for MTTOI ‘Path-linear’ MTTOI Translation Membership is in NP [Inaba&Maneth 2008] Path-linear ⇔ No nested state calls to the same child node Proof is by the “compressed representation” The set τ(s) can be represented as a single “sharing graph” (generalization of a DAG) of size O(|s|) [Maneth&Bussato 2004] Navigation (up/1st child/next sibling) on the representation can be done in P only if the MTT τ is a path-linear. Corollary: MTTOI Translation Membership is in NP Proof is by the ‘Garbage-Free’ form in the next page… f( A(x1, x2) )  g(x1, g(x2, B)) // ok f( A(x1, x2) )  g(x1, g(x1, B)) // bad f( A(x1, x2) )  h(x1, g(x2, B) , g(x2, C)) // ok

k-Compositions of MTTs: Translation Membership for MTTOIk and MTTIOk MTTOIk (k≧1) Translation Membership is NP-complete Proof is by the Garbage-Free Form [Inaba&Maneth 2008]  by NP-oracle we can guess all si’s MTTIOk (k≧2) Translation Membership is NP-complete Proof is by Simulation between IO and OI [Engelfriet&Vogler 1985] MTTOI ⊆ MTTIO ; MTTIO and MTTIO ⊆ MTTOI ; MTTOI Any composition sequence of MTTOI’s τ = τ1 ; τ2 ; … ; τk can be transformed to a “Garbage-Free” sequence of path-linear MTTOI’s τ = ρ1 ; ρ2 ; … ; ρ2k where for any (s,t) with t∈τ(s), there exists intermediate trees s1∈ρ1 (s), s2∈ρ2 (s1), …, t∈ρ2k (s2k-1) such that |si|≦ c |t|

Main Result: Translation Membership for MTTIO MTTIO Translation Membership is in PTIME (for an mtt with k parameters, O(nk+2)) Proof is based on the Inverse Type Inference [Engelfriet&Vogler 1985, Milo&Suciu&Vianu 2000] Instead of “t ∈ τ(s)”, check “s ∈ τ-1(t)” First, construct the bottom-up tree automaton recognizing τ-1(t) Then, run the automaton on s. For an MTT τ and a tree t, the inverse image τ-1 (t) is a regular tree language PITFALL The automaton may have 2|t| states in the worst case. PTIME SOLUTION Do not fully instantiate the automaton. Run it while constructing it on-the-fly.

Example (1) A B τ = s = A(B), t = F(G(E,E), G(E,E)) st( A(x1) ) → db( x1, db(x2, E) ) db( A(x1), y1) → db( x1, db(x2, y1) ) db( B, y1 ) → F( y1, y1 ) db( B, y1 ) → G( y1, y1 ) τ = s = A(B), t = F(G(E,E), G(E,E)) State of the inverse-type automaton :: {st} ∪ ({db}×V(t))  2V(t) where V(t) is the set of all subtrees of t We assign the state qA such that: qA (st) = qB (db, qB(db,E)) = qB (db, {G(E,E)}) = {F(G(E,E), G(E,E))} qA (db, E) = qB (db, qB(db,E)) = {F(G(E,E), G(E,E))} qA (db, G(E,E)) = qB (db, qB(db,G(E,E))) = {} qA (db, F(G(E,E), G(E,E))) = … = {} A We assign the state qB such that: qB (st) = {} qB (db, E) = { G(E,E) } // F(E,E) ∉ V(t) qB (db, G(E,E)) = { F(G(E,E), G(E,E)) } // G(G,G) ∉ V(t) qB (db, F(G(E,E), G(E,E))) = {} B

Example (2) A B τ = s = A(B), t = F(G(E,E), F(E,E)) st( A(x1) ) → db( x1, db(x1, E) ) db( A(x1), y1) → db( x1, db(x1, y1) ) db( B, y1 ) → F( y1, y1 ) db( B, y1 ) → G( y1, y1 ) τ = s = A(B), t = F(G(E,E), F(E,E)) State of the inverse-type automaton :: {st} ∪ ({db}×V(t))  2V(t) where V(t) is the set of all subtrees of t qA (st) = qB (db, qB(db,E)) = qB (db, {G(E,E),F(E,E)}) = {} qA (db, E) = qB (db, qB(db,E)) = {} qA (db, G(E,E)) = qB (db, qB(db,G(E,E))) = {} qA (db, F(E,E)) = qB (db, qB(db,F(E,E))) = {} qA (db, F(G(E,E), G(E,E))) = … = {} A qB (st) = {} qB (db, E) = { G(E,E), F(E,E) } qB (db, G(E,E)) = {} // F(G,G) and G(G,G) ∉ V(t) qB (db, F(E,E)) = {} // F(F,F) and G(F,F) ∉ V(t) qB (db, F(G(E,E), F(E,E))) = {} // … B

Note Complexity: At each node of s, one function of type {st}∪({db}×V(t))  2V(t) is computed {st}∪({db}×V(t))  2V(t) ≡ 2V(t)×({st}∪({db}×V(t))) Each function is of size O( |V(t)|2 ), which is computed per each node (O(|s|) times) (and, computation of each entry of the function requires O(|t|2) time)  O( |s| |t|4 ) time MTTOI also has regular inverse image, but the inverse- type automaton may have 2^2^|t| many states in the worst case  Computing even a single state requires EXPTIME

Several Extensions Variants of MTTs with PTIME Translation Membership As long as the inverse type is sufficiently small, we can apply the same technique. Variants of MTTs with PTIME Translation Membership MTTIO with TAC-look-ahead Rules are chosen not only by the label of the current node, but by a regular look-ahead and (dis)equality-check on child subtrees Multi-Return MTTIO Each function can return multiple tree fragments (tuples of trees) Finite-copying MTTOI OI, but each parameter is copied not so many times. f( A(x1,x2) ) s.t. x1≡x2 → C( f(x1) ) f( A(x1,x2) ) s.t. x1 has even number of nodes → D( f(x1), f(x2) ) f( A(x1,x2) ) otherwise → E( f(x1), f(x2) ) f( A(x1,x2) )  let (z1,z2) = g(x1) in D( z1, C(z2) ) g( A(x1,x2) )  ( f(x1), f(x2) )

Conclusion and Open Problems Complexity of Translation Membership is NP-complete for MTTOIk (k ≧ 1), MTTIOk (k ≧ 2) Higher-Order MTT, Macro Forest TT, … PTIME for MTTIO (+ look-ahead and multi-return) Open Problems MTTOI with at most one accumulating parameter Our encoding of SAT used 3 parameters, which actually can be done with 2. How about 1? MTTIO with holes [Maneth&Nakano PLAN-X08] It is an extension of IO MTTs, but has more complex inverse-type.

Thank You!