Abstract State Machines and Computationally Complete Query Languages Andreas Blass,U Michigan Yuri Gurevich,Microsoft Research & U Michigan Jan Van den.

Slides:



Advertisements
Similar presentations
Part VI NP-Hardness. Lecture 23 Whats NP? Hard Problems.
Advertisements

NP-Hard Nattee Niparnan.
Lecture 24 MAS 714 Hartmut Klauck
Lecture 11: Datalog Tuesday, February 6, Outline Datalog syntax Examples Semantics: –Minimal model –Least fixpoint –They are equivalent Naive evaluation.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Relational Calculus Chapter 4, Part B.
Timed Automata.
1 541: Relational Calculus. 2 Relational Calculus  Comes in two flavours: Tuple relational calculus (TRC) and Domain relational calculus (DRC).  Calculus.
1 Relational Algebra & Calculus. 2 Relational Query Languages  Query languages: Allow manipulation and retrieval of data from a database.  Relational.
1 Conditional XPath, the first order complete XPath dialect Maarten Marx Presented by: Einav Bar-Ner.
Complexity 12-1 Complexity Andrei Bulatov Non-Deterministic Space.
Weizmann Institute Deciding equality formulas by small domain instantiations O. Shtrichman The Weizmann Institute Joint work with A.Pnueli, Y.Rodeh, M.Siegel.
CMPT 354, Simon Fraser University, Fall 2008, Martin Ester 52 Database Systems I Relational Algebra.
A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines Andreas Glausch and Wolfgang Reisig 1.
CPSC 411, Fall 2008: Set 12 1 CPSC 411 Design and Analysis of Algorithms Set 12: Undecidability Prof. Jennifer Welch Fall 2008.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY Read sections 7.1 – 7.3 of the book for next time.
Firewall Policy Queries Author: Alex X. Liu, Mohamed G. Gouda Publisher: IEEE Transaction on Parallel and Distributed Systems 2009 Presenter: Chen-Yu Chang.
Query Languages Aswin Yedlapalli. XML Query data model Document is viewed as a labeled tree with nodes Successors of node may be : - an ordered sequence.
SEQUENTIAL ABSTRACT STATE MACHINES CAPTURE SEQUENTIAL ALGORITHMS.
CS Master – Introduction to the Theory of Computation Jan Maluszynski - HT Lecture NP-Completeness Jan Maluszynski, IDA, 2007
1 Relational Algebra and Calculus Yanlei Diao UMass Amherst Feb 1, 2007 Slides Courtesy of R. Ramakrishnan and J. Gehrke.
Rutgers University Relational Calculus 198:541 Rutgers University.
Theory of Computing Lecture 19 MAS 714 Hartmut Klauck.
Computability and Modeling Computation What are some really impressive things that computers can do? –Land the space shuttle (and other aircraft) from.
1 Relational Algebra and Calculus Chapter 4. 2 Relational Query Languages  Query languages: Allow manipulation and retrieval of data from a database.
The Church-Turing Thesis over Arbitrary Domains Udi Boker and Nachum Dershowitz Presenting: Yorai Geffen.
Introduction to ASMs Dumitru Roman Digital Enterprise Research Institute
Nattee Niparnan. Easy & Hard Problem What is “difficulty” of problem? Difficult for computer scientist to derive algorithm for the problem? Difficult.
Theory of Computing Lecture 15 MAS 714 Hartmut Klauck.
SAT and SMT solvers Ayrat Khalimov (based on Georg Hofferek‘s slides) AKDV 2014.
The Relational Model: Relational Calculus
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Relational Calculus Chapter 4, Section 4.3.
Theory of Computing Lecture 17 MAS 714 Hartmut Klauck.
Lecture 1 Computation and Languages CS311 Fall 2012.
Database Management Systems, R. Ramakrishnan1 Relational Calculus Chapter 4.
1 Relational Algebra. 2 Relational Query Languages v Query languages: Allow manipulation and retrieval of data from a database. v Relational model supports.
1 Querying Infinite Databases Safety of Datalog Queries over infinite Databases (Sagiv and Vardi ’90) Queries and Computation on the Web (Abiteboul and.
1 Relational Algebra & Calculus Chapter 4, Part A (Relational Algebra)
1 Relational Algebra and Calculas Chapter 4, Part A.
Relational Algebra.
GRAPHS THEROY. 2 –Graphs Graph basics and definitions Vertices/nodes, edges, adjacency, incidence Degree, in-degree, out-degree Subgraphs, unions, isomorphism.
Interactive proof systems Section 10.4 Giorgi Japaridze Theory of Computability.
Mathematical Preliminaries
THEORY OF COMPUTATION Komate AMPHAWAN 1. 2.
Verification & Validation By: Amir Masoud Gharehbaghi
Lecture 7: Foundations of Query Languages Tuesday, January 23, 2001.
1 First order theories (Chapter 1, Sections 1.4 – 1.5) From the slides for the book “Decision procedures” by D.Kroening and O.Strichman.
1 CSE544 Monday April 26, Announcements Project Milestone –Due today Next paper: On the Unusual Effectiveness of Logic in Computer Science –Need.
Chapter Relations and Their Properties
Computability NP complete problems. Space complexity. Homework: [Post proposal]. Find PSPACE- Complete problems. Work on presentations.
1 Finite Model Theory Lecture 16 L  1  Summary and 0/1 Laws.
Database Management Systems, R. Ramakrishnan1 Relational Calculus Chapter 4, Part B.
Theory of Computational Complexity TA : Junichi Teruyama Iwama lab. D3
Lecture 9: Query Complexity Tuesday, January 30, 2001.
1 Finite Model Theory Lecture 9 Logics and Complexity Classes (cont’d)
1 CMPS 277 – Principles of Database Systems Lecture #8.
Theory of Computational Complexity Probability and Computing Chapter Hikaru Inada Iwama and Ito lab M1.
Relational Calculus Chapter 4, Section 4.3.
Part VI NP-Hardness.
Relational Calculus Chapter 4, Part B
Modeling Arithmetic, Computation, and Languages
Intro to Theory of Computation
Graphs.
Steven Lindell Scott Weinstein
Alternating tree Automata and Parity games
Finite Model Theory Lecture 6
Lecture 10: Query Complexity
MA/CSSE 474 More Math Review Theory of Computation
Relational Calculus Chapter 4, Part B 7/1/2019.
CSE544 Wednesday, March 29, 2006.
Relational Calculus Chapter 4, Part B
Presentation transcript:

Abstract State Machines and Computationally Complete Query Languages Andreas Blass,U Michigan Yuri Gurevich,Microsoft Research & U Michigan Jan Van den Bussche,U Limburg

Outline Databases and queries Query languages: –while new, while new sets –ASMs Notions of polynomial time Comparisons

Database schema = Finite set  of relation names with associated arities Database B over  = Finite structure over  –Finite domain D of atomic values –For each R  , a k-ary relation R B on D Relational databases

Database schema = Finite set  of relation names with associated arities Database B over  = Finite structure over  –Finite domain D of atomic values –For each R  , a k-ary relation R B on D Relational databases arity associated to R in 

Database schema = Finite set  of relation names with associated arities Database B over  = Finite structure over  –Finite domain D of atomic values –For each R  , a k-ary relation R B on D E.g. Graph: Relational databases arity associated to R in 

Database schema = Finite set  of relation names with associated arities Database B over  = Finite structure over  –Finite domain D of atomic values –For each R  , a k-ary relation R B on D E.g. Graph: Relational databases arity associated to R in 

Database schema = Finite set  of relation names with associated arities Database B over  = Finite structure over  –Finite domain D of atomic values –For each R  , a k-ary relation R B on D E.g. Graph: Relational databases arity associated to R in  D1234D1234 E (1,2) (2,3) (2,4) (3,4)

Queries General definition of query: a (partial, computable) mapping Q –from databases –to relations (of a common arity) (over a common schema)

Queries General definition of query: a (partial, computable) mapping Q –from databases –to relations Q(B) is the answer to the query Q on database B. (of a common arity) (over a common schema)

Queries General definition of query: a (partial, computable) mapping Q –from databases –to relations Q(B) is the answer to the query Q on database B. Arity 0: {( )} or { }  Boolean query (of a common arity) (over a common schema)

Queries General definition of query: a (partial, computable) mapping Q –from databases –to relations Q(B) is the answer to the query Q on database B. Arity 0: {( )} or { }  Boolean query E.g. On a graph: –Give all pairs of nodes that are targets of a common source. (of a common arity) (over a common schema)

Queries General definition of query: a (partial, computable) mapping Q –from databases –to relations Q(B) is the answer to the query Q on database B. Arity 0: {( )} or { }  Boolean query E.g. On a graph: –Give all pairs of nodes that are targets of a common source. –Is f(m)=2000? (of a common arity) (over a common schema)

Queries General definition of query: a (partial, computable) mapping Q –from databases –to relations Q(B) is the answer to the query Q on database B. Arity 0: {( )} or { }  Boolean query E.g. On a graph: –Give all pairs of nodes that are targets of a common source. –Is f(m)=2000? (of a common arity) (over a common schema) number of edges in graph

Queries General definition of query: a (partial, computable) mapping Q –from databases –to relations Q(B) is the answer to the query Q on database B. Arity 0: {( )} or { }  Boolean query E.g. On a graph: –Give all pairs of nodes that are targets of a common source. –Is f(m)=2000? (of a common arity) (over a common schema) arbitrary computable function on N

The consistency criterion The answer of a query on a database can depend only on information that is logically contained in that database.  If h is an isomorphism B  B, then h is also an isomorphism Q(B)  Q(B).

Query languages In practice: SQL  first-order logic + counting, summation, … E.g. Give all pairs of nodes that are targets of a common source:

Query languages In practice: SQL  first-order logic + counting, summation, … E.g. Give all pairs of nodes that are targets of a common source: select E1.target, E2.target from E E1, E E2 where E1.source = E2.source

Query languages In practice: SQL  first-order logic + counting, summation, … E.g. Give all pairs of nodes that are targets of a common source: select E1.target, E2.target from E E1, E E2 where E1.source = E2.source  (x,y)  z ( E(z,x)  E(z,y) ) 

Expressiveness of first-order logic (FO) Many useful queries are expressible in FO. But many others are not: –Connectivity: Is the graph connected? –Is f(m)=2000, where if m is even if m is odd f(m) =

Expressiveness of first-order logic (FO) Many useful queries are expressible in FO. But many others are not: –Connectivity: Is the graph connected? –Is f(m)=2000, where (parity query) if m is even if m is odd f(m) =

Towards a complete language: while Make FO basis of a small programming language for working with relations: –relation variables (typed by fixed arities) –operations on relations provided by FO –assignment: X   (x 1,…,x j )  (x 1,…,x j ) 

Towards a complete language: while Make FO basis of a small programming language for working with relations: –relation variables (typed by fixed arities) –operations on relations provided by FO –assignment: X   (x 1,…,x j )  (x 1,…,x j )  relation variable of arity j

Towards a complete language: while Make FO basis of a small programming language for working with relations: –relation variables (typed by fixed arities) –operations on relations provided by FO –assignment: X   (x 1,…,x j )  (x 1,…,x j )  FO-formula over db relations and relation variables

Towards a complete language: while Make FO basis of a small programming language for working with relations: –relation variables (typed by fixed arities) –operations on relations provided by FO –assignment: X   (x 1,…,x j )  (x 1,…,x j )  –sequential composition

Towards a complete language: while Make FO basis of a small programming language for working with relations: –relation variables (typed by fixed arities) –operations on relations provided by FO –assignment: X   (x 1,…,x j )  (x 1,…,x j )  –sequential composition –while-loops: while  do … od

Towards a complete language: while Make FO basis of a small programming language for working with relations: –relation variables (typed by fixed arities) –operations on relations provided by FO –assignment: X   (x 1,…,x j )  (x 1,…,x j )  –sequential composition –while-loops: while  do … od FO-sentence

Towards a complete language: while Make FO basis of a small programming language for working with relations: –relation variables (typed by fixed arities) –operations on relations provided by FO –assignment: X   (x 1,…,x j )  (x 1,…,x j )  –sequential composition –while-loops: while  do … od Chandra & Harel [1982]

Example while-program Connectivity query: Seen (2)   ; Path (2)  E; while Path  Seen   do Seen  Path; Path  Path   (x,z)  y ( Path(x,y)  E(y,z) )  ; od.

Example while-program Connectivity query: Seen (2)   ; Path (2)  E; while Path  Seen   do Seen  Path; Path  Path   (x,z)  y ( Path(x,y)  E(y,z) )  ; od. Parity query:

Example while-program Connectivity query: Seen (2)   ; Path (2)  E; while Path  Seen   do Seen  Path; Path  Path   (x,z)  y ( Path(x,y)  E(y,z) )  ; od. Parity query: Not!

A complete language: while new S. Abiteboul & V. Vianu [1988] Allow introduction of new domain elements in the computation. New operator:

A complete language: while new S. Abiteboul & V. Vianu [1988] Allow introduction of new domain elements in the computation. New operator: new

A complete language: while new S. Abiteboul & V. Vianu [1988] Allow introduction of new domain elements in the computation. New operator: new X (3)  new R (2) abcdfgabcdfg R abcdfgabcdfg X

A complete language: while new S. Abiteboul & V. Vianu [1988] Allow introduction of new domain elements in the computation. New operator: new X (3)  new R (2) Every partial computable query can be programmed in while new. abcdfgabcdfg R abcdfgabcdfg X

Parity in while new 1Easy to check parity of a set S equipped with a successor relation: Even (0)  true; Visit (1)   first element of S  ; while Visit   do Even   Even; Visit   succ(x)  Visit(x)  od.

Parity in while new 2Make a set S of new elements, one for each edge: S 0  new E; S   3 (S 0 );

Parity in while new 3Compute a successor relation on S: Impossible!

Parity in while new 3Compute the tree T of all m! successor relations, where m = |S|: T  new   ; Seen   ; Extend   r,x  T  r   S  x  ; while Extend   do X  new Extend; T  T   3  X  ; succ  succ   1,3  X  ; Seen  Seen   n,x  n  X  n,x,n    x  x  Seen  n,x     ; Extend   n,x  n   3  X   S  x    Seen(n,x  od.

We can’t do better! while new -PSPACE: class of while new -programs running in polynomial space. Theorem: [Abiteboul–Vianu 1991] The parity query cannot be done in while new -PSPACE. Intuition: In while new you cannot make arbitrary choices (recall consistency criterion)  Instead of choosing one successor relation, we must work with them all. while new -PTIME: class of while new -PSPACE- programs running in polynomial time.

BGS Blass, Gurevich, Shelah [1996]: –How can we formalize algorithms that never have to make arbitrary choices? –What can such algorithms still do in polynomial time?  Instantiation of ASMs for expressing database queries.

BGS ASMs Universe: HF(D) –every x  D is in HF(D); –every finite set of elements of HF(D) is itself in HF(D). Infinite, but at any point only finitely many sets are “active”. Set-theoretic static functions: –  pairing –bounded set-construction forall do (parallel ASMs)

Connectivity with a BGS-ASM if Mode   then forall x  D do Frontier  x    x  enddo, Mode   endif, if Mode  then forall x  D do Reached  x  := Reached  x   Frontier  x  Frontier  x  :=  y  D  z  Frontier  x   E  z,y   y  Reached  x   Frontier  x  enddo, Halt   Frontier  x  x  D   endif.

BGS-PTIME BGS-PTIME: class of BGS-ASMs –running for at most polynomially many steps –constructing at most polynomially many sets “Choiceless polynomial time”

BGS-PTIME versus while new -PTIME? Structure I n :   n nn

BGS-PTIME versus while new -PTIME? Structure I n : There is a PTIME BGS-program that outputs:   n nn

BGS-PTIME versus while new -PTIME? Structure I n : There is a PTIME BGS-program that outputs: –trueon every I n with neven;   n nn

BGS-PTIME versus while new -PTIME? Structure I n : There is a PTIME BGS-program that outputs: –trueon every I n with neven; –falseodd.   n nn

BGS-PTIME versus while new -PTIME? Structure I n : There is a PTIME BGS-program that outputs: –trueon every I n with neven; –falseodd. (Just construct all red subsets of even size.)   n nn

BGS-PTIME versus while new -PTIME? Structure I n : There is a PTIME BGS-program that outputs: –trueon every I n with neven; –falseodd. (Just construct all red subsets of even size.) Theorem: There is no such PSPACE while new - program (let alone PTIME).   n nn

Sets versus lists BGS programs can construct sets. while new programs can only construct lists. –operator new works tuple- (  list-) based. Lists are ordered; sets can be unordered. If you want to simulate something unordered by something ordered, you have to work with all orders. –(Recall parity in while new.)  BGS-PTIME strictly encompasses while new -PTIME.

The language while new sets Theory of object-based query languages, studied late 80s – early 90s. Operator new from while new is really tuple-new.  We need also a set-new!  Language while new sets

set-new Y   set-new R  adaebebdcecfcgadaebebdcecfcg R

set-new Y   set-new R  adaebebdcecfcgadaebebdcecfcg R

set-new Y   set-new R  adaebebdcecfcgadaebebdcecfcg R

set-new Y   set-new R  adaebebdcecfcgadaebebdcecfcg R a b c a b c Y

Equivalence results while new sets and BGS can simulate each other. Simulation: –linear step overhead –polynomial space overhead  BGS-PTIME  while new sets -PTIME  while new -PTIME

Concluding remarks ASMs and query languages are quite related, and share the common concern of computation on the “logical” level. Purely mathematically, –basic parallel ASMs –while new are essentially the same thing. ASMs clearly win from query languages in flexibility, appeal to practitioners, developed philosophy, and people like Yuri and Egon. while new never “escaped” database theory! Challenge: the Web (querying XML, WWW, …)