Database design and implementation CMPSCI 645. Lectures 11-12: Database Theory
|
|
- Hugh Small
- 5 years ago
- Views:
Transcription
1 Database design and implementation CMPSCI 645 Lectures 11-12: Database Theory 1
2 Theory problems in databases } Expressiveness of languages } Any query in L1 can be expressed in L2 } Complexity of languages } Bounds on resources required to evaluate any query in language L } Sta?c analysis of queries (for op?miza?on) } Given q in L: is it minimal? } Given q1 and q2 in L: are they equivalent? } Views 2
3 Crash review of complexity classes } AC 0 } Circuits of O(1) depth and polynomial size } L (LOGSPACE) } Solvable in logarithmic (small) space } NL (NLOGSPACE) } "YES" answers checkable in logarithmic space } NC } Solvable efficiently (in polylogarithmic?me) on parallel computers } P (PTIME) } Solvable in polynomial?me } NP } "YES" answers checkable in polynomial?me } PSPACE } Solvable with polynomial memory 3
4 Rules of thumb } Step 1: check if you can solve the problem in that class } Step 2: if not, check if your problem looks like (is reducible from) the complete problem from the next class. } Of interest: PTIME-complete are not efficiently parallelizable. 4
5 Query complexity Given a query Q and a database D, what is the complexity of compu?ng Q(D)? } The answer depends on the query language } Rela?onal algebra, calculus, datalog } Design tradeoff: } High complexity à rich queries } Low complexity à implemented efficiently 5
6 Complexity of query languages Query Q, database D } Data complexity } Fix Q, complexity f(d) } Query complexity } Fix D, complexity f(q) } Combined complexity } Complexity f(d,q) Moshe Vardi 6
7 Conventions } Complexity is usually defined for a decision problem } We study the complexity of Boolean queries } Complexity usually assumes some encoding of the input } We encode instances using binary representa?on 7
8 Boolean queries Defini&on: A Boolean query is a query that returns either true or false. Non-Boolean SELECT DISTINCT R.x, S.y FROM R, S WHERE R.z = S.z Q(x,y) :- R(x,z), S(z,y) T(x,y) :- R(x,y) T(x,y) :- T(x,z), R(z,y) Boolean SELECT DISTINCT yes FROM R, S WHERE R.x = a and R.z = S.z and S.y = b Q :- R(x,z), S(z,y) T(x,y) :- R(x,y) T(x,y) :- T(x,z), R(z,y) Answer() :- T( a, b ) 8
9 Database encoding } Encode D = (D, R 1D,, R kd ) as follows: } Let n = ADom(D) } If R i has arity k, encode it as a string of n k bits: 2 } 0 means element (a 1, a k ) R i D } 1 means element (a 1, a k ) 2 R D i a a b b c b c b c a
10 Data complexity } Fix a Boolean query Q in the query language. Determine the complexity of the following problem: } Given an input database instance D = (D, R 1D,, R kd ) check if Q(D) = true } This is also known as model checking problem: check if D is a model for Q. 10
11 What is the complexity of relational queries? AC 0 L NL NC PTIME PSPACE all computable 11
12 Example Q = 9z. R( a,z) S(z, b ) Prove that Q is in AC 0 R: a b c a b c S: a b c a b c
13 Example Q = 9z. R( a,z) S(z, b ) Prove that Q is in AC 0 Circuit of depth 2 OR has n inputs Each AND has 2 inputs R: a b c a b c S: a b c a b c
14 What is the complexity of relational queries? All rela?onal queries (expressible in RC) are in AC 0 AC 0 L NL NC PTIME PSPACE all computable 14
15 What is the complexity of datalog queries? AC 0 L NL NC PTIME T(x,y) :- R(x,y) T(x,y) :- T(x,z), R(z,y) Answer() :- T( a, b ) PSPACE all computable 15
16 Datalog is not in AC 0 } Parity is not in AC 0 } We will reduce parity to the reachability problem } Given input (x 1, x 2, x 3, x 4, x 5 ) = (0,1,1,0,1) construct the graph: a 1 a 2 a 3 a 4 a 5 a 6 T(x,y) :- R(x,y) T(x,y) :- T(x,z), R(z,y) Answer() :- T( a 1, b 6 ) b 1 b 2 b 3 b 4 b 5 b 6 The # of 1s is odd iff Answer is true 16
17 Datalog is in PTIME } Fix any Boolean datalog program P. } Given D, check if P(D) = true is in PTIME } Proof argument: } If an IDB has arity k, then it will reach its fixpoint in at most n k itera?ons. 17
18 Conjunctive Queries (CQ) } A subset of FO (first order) } Less expressive } Many queries in prac?ce are conjunc?ve } Some op?mizers only handle CQs } Break larger queries into many CQs } CQs have beler theore?cal proper?es than arbitrary queries 18
19 Conjunctive Queries if variables subgoals P(x,z) :- R(x,y) & R(y,z) head body implicit 9 conjunc?on } R: Extensional database (EDB) stored } P: Inten?onal database (IDB) computed 19
20 Conjunctive Queries if variables subgoals P(x,z) :- R(x,y) & R(y,z) head body implicit 9 conjunc?on } When facts in the body are true, we infer the head } Consider all possible assignments of variables in the body 20
21 Conjunctive queries } A single datalog rule } Equivalent to SELECT-DISTINCT-FROM-WHERE } Select/project/join in RA } Existen?al/conjunc?ve frac?on of RC Strictly speaking, we are not allowed to have non-equality selec?on predicates 21
22 Example } Find all employees having the same manager as Smith A(x) :- ManagedBy( Smith,y) & ManagedBy(x,y) SELECT DISTINCT m2.name FROM ManagedBy m1, ManagedBy m2 WHERE m1.name = Smith AND m1.manager = m2.manager 22
23 Properties of CQ } Sa?sfiability } A query is sa?sfiable if there exists some input rela?on R such that q(r) is non-empty } Every CQ is sa?sfiable } Monotonicity } A query is monotonic if for each instance I, J over the schema, I J implies q(i) q(j) } Every CQ is monotonic 23
24 Satisfiability We can always generate sa?sfying EDB rela?ons from the body of the rule S(x,y,z) :- P(x,w) & R(w,y,v) & P(v,z) a b b c d d e S a c e P a b R b c d d e 24
25 Monotonicity ans(u):- R 1 (u 1 ) & & R n (u n ) } Consider 2 databases I, J, s.t. I J } Let t q(i) 2 } For some subs?tu?on v: } v(u i ) 2 I(R i ) for each i. } t = v(u) } Since I J, v(u i ) 2J(R i ) for each i. } So t q(j) 2 25
26 Consequence of monotonicity Product (pname, price, cid) Company (cid, cname, city) Q: Find all companies that make only products with price < 100! SELECT!DISTINCT C.cname! FROM!Company C! WHERE!100 > ALL!(SELECT price!!! FROM Product P!!! WHERE P.cid = C.cid)! } This query is not monotone } Therefore, not CQ } It cannot be expressed as a simple SFW query 26
27 Equivalence and containment } Needed for a variety of sta?c analysis tasks } Query op?miza?on } Query rewri?ng using views } Tes?ng for semijoin reduc?ons 27
28 Query equivalence Defini&on: Queries q1 and q2 are equivalent if for every database D, q1(d) = q2(d) Nota?on: q1 q2 28
29 Query containment Defini&on: Query q1 is contained in q2 if for every database D, q1(d) q2(d) Nota?on: q1 q2 Fact: q1 q2 and q2 q1 iff q1 q2 For the case of Boolean queries, containment is logical implica?on 29
30 Examples Is q1 q2? Yes q1(x) :- R(x,u), R(u, Smith ) q2(x) :- R(x,u), R(u,v) 30
31 Examples Is q1 q2? Yes q1(x) :- R(x,u), R(u,v), R(v,w) q2(x) :- R(x,u), R(u,v) x u v w x u v 31
32 Examples Is q1 q2? No q1(x) :- R(x,u), R(u,v), R(v,x) q2(x) :- R(x,u), R(u,x) x u v x u 32
33 Examples Is q1 q2? Yes q1(x) :- R(x,u), R(u,y) q2(x) :- R(x,u), R(v,u), R(u,y) x u y x u v y 33
34 Examples Is q1 q2? Yes q1(x) :- R(x,u), R(u,v) q2(x) :- R(x,u), R(x,y), R(u,v), R(u,w) x u v x u v y w 34
35 Examples Is q1 q2? Yes q1(x) :- R(x,u), R(u,u) q2(x) :- R(x,u), R(u,v), R(v,w) x x u v w u 35
36 Query containment Theorem: The query containment and query equivalence problems for CQ are NP-complete. Theorem: The query containment and query equivalence problems for Rela?onal Calculus are undecidable. 36
37 Query containment for CQ } Two ways to test } Check if q2 holds on the canonical database of q1 } Check if there exists a homomorphism q2 à q1 37
38 Canonical database } Canonical database for q1 is D = (D, R 1D,, R kd ) } D: all variables and constants in q1 } R 1D,, R kd : the body of q1 } Canonical tuple t q1 is the head of q1 38
39 Example } Canonical database D = (D, R D ) } D = {x,y,u,v} } R D = x v v q1(x,y) :- R(x,u), R(v,u), R(v,y) u u y } Canonical tuple t q1 = (x,y) 39
40 Example } Canonical database D = (D, R) } D = {x,u, Smith, Fred } } R= q1(x) :- R(x,u), R(u, Smith ), R(u, Fred ), R(u,u) x u u u } Canonical tuple t q1 = (x) u Smith Fred u 40
41 Checking containment using the canonical database } D={x,y,u,v} } R = x q1(x,y) :- R(x,u), R(v,u), R(v,y) q2(x,y) :- R(x,u), R(v,u), R(v,w), R(t,w), R(t,y) v v u u y q1 is contained in q2 41
42 Query homomorphisms } A homomorphism f: q2 à q1 is a func?on f:var(q2) à var(q1) U const(q1), such that: } f(body(q2)) body(q1) } f(t q1 ) = t q2 42
43 Example var(q1) = {x,u,v,y} var(q2) = {x,u,v,w,t,y} q1(x,y) :- R(x,u), R(v,u), R(v,y) q2(x,y) :- R(x,u), R(v,u), R(v,w), R(t,w), R(t,y) q1 is contained in q2 43
44 Example var(q1) U const(q1) = {x,u, Smith } var(q2) = {x,u,v,w} q1(x) :- R(x,u), R(u, Smith ), R(u, Fred ), R(u,u) q2(x) :- R(x,u), R(u,v), R(u, Smith ), R(w,u) q1 is contained in q2 44
45 Complexity Theorem: Checking containment of two CQs is NP-complete. =( X 3 _ X 1 _ X 4 ) ^ (X 1 _ X 2 _ X 3 ) ^ ( X 2 _ X 3 _ X 1 ) Proof: Reduc?on from 3-SAT Given a 3CNF Φ Step 1: construct q1 independently of Φ Step 2: construct q2 from Φ Prove: there exists a homomorphism q2àq1 iff Φ is sa?sfiable 45
46 Proof: Step 1 Construc?ng q1 There are 4 types of clauses in every 3SAT: Type 1: X _ Y _ Z Type 2: X _ Y _ Z Type 3: X _ Y _ Z Type 4: X _ Y _ Z For each type, q1 contains one rela?on with all 7 sa?sfying assignments, where u=0, v=1 R1 (misses v,v,v) R2 (misses v,v,u) R3 (misses v,u,u) R4 (misses u,u,u) u u u u u u u u u u u v u u v u u v u u v u v u u v u u v u u v u u v v u v v u v v u v v v u u v u u v u u v u v v u v v u v v u v v v u v v u v v u v v v v v v v v v 46
47 Proof: Step 2 Construc?ng q2 q2 has one atom for each clause is Φ: Rela?on name is R1, or R2, or R3, or R4 The variables are the same as those in the clause Example: =( X 3 _ X 1 _ X 4 ) ^ (X 1 _ X 2 _ X 3 ) ^ ( X 2 _ X 3 _ X 1 ) q2 = R2(x 3,x 1,x 4 ), R4(x 1,x 2,x 3 ), R2(x 2,x 3,x 1 ) 47
48 Proof } Suppose there is a sa?sfying assignment for Φ: it maps each X i to either 0 or 1 } Define func?on f: Vars(q2)àVars(q1): } If X i = 0 then f(x i ) = u } If X i = 1 then f(x i ) = v } Then f is a homomorphism f: q2àq1 } Suppose there exists a homomorphism f: q2àq1 } Define the assignment: } If f(x i ) = u then X i = 0 } If f(xi) = v then X i = 1 } This is a sa?sfying assignment for Φ 48
49 Beyond CQ } Containment for arbitrary rela?onal queries is undecidable } Any sta?c analysis on rela?onal queries is undecidable } All these results follow from Trakhtenbrot s theorem 49
50 Trakhtenbrot s theorem Defini&on: A sentence φ is called finitely sa?sfiable if there exists a finite database instance D s.t. D = φ Theorem: The following problem is undecidable: Given FO sentence φ, check if φ is finitely sa?sfiable. 50
51 Query containment for UCQ q 1 [ q 2 [ q 3... q 0 1 [ q 0 2 [ q Note: q 1 [ q 2 [ q 3... q q 1 q q 2 q iff and and Theorem: q q1 0 [ q2 0 [ q that q qk 0 iff there exists some k such 51
52 Query minimization Defini&on: A conjunc?ve query q is minimal, if for every other query q such that q q, q has at least as many predicates (subgoals) as q Are these queries minimal? q(x) :- R(x,y), R(y,z), R(x,x) q(x) :- R(x,y), R(y,z), R(x, Alice ) 52
53 Query minimization } Algorithm: } Choose a subgoal g of q } Remove g: let q be the new query } q q Why? } If q q, then permanently remove g } The order in which we inspect subgoals doesn t maler 53
54 In practice } No database system performs minimiza?on } It s hard } Users usually write minimal queries } Non-minimal queries arise when using views intensely 54
55 Remember Semijoins? R S = Π A1,,An (R S) R S = (R S) S Prove that the following two datalog queries are equivalent: q1(x,y,z) :- R(x,y), S(x,z) R1(x,y) :- R(x,y), S(x,z) q2(x,y,z) :- R1(x,y), S(x,z) q1(x,y,z) :- R(x,y), S(x,z) q1(x,y,z) :- R(x,y), S(x,z) q2(x,y,z) :- R(x,y), S(x,u), S(x,z) q2(x,y,z) :- R(x,y), S(x,u), S(x,z) 55
56 Semijoins } Important in distributed databases } Owen combined with Bloom filters } See in the textbook 56
57 Semijoin Reducer } Given a query: Q = R1 R2 Rn } A semijoin reducer for q is: } R i1 = R i1 R j1 } R i2 = R i2 R j2 } } R ip = R ip R jp } Such that the query is equivalent to } Q = R k1 R k2 R kn } In a full reducer, no dangling tuples remain 57
58 Example } Q = R(A,B) S(B,C) } Semijoin reducer: R1(A,B) = R(A,B) S(B,C) } Re-wrilen query: Q = R1(A,B) S(B,C) Are there any dangling tuples? 58
59 Example } Q = R(A,B) S(B,C) } Full semijoin reducer: R1(A,B) = R(A,B) S(B,C) S1(B,C) = S(B,C) R1(A,B) } Re-wrilen query: Q = R1(A,B) S1(B,C) No more dangling tuples 59
60 Example } More complex: Q = R(A,B) S(B,C) T(C,D,E) } Full reducer: S (B,C) = S(B,C) R(A,B) T (C,D,E) = T(C,D,E) S (B,C) S (B,C) = S (B,C) T (C,D,E) R (A,B) = R(A,B) S (B,C) } Q = R (A,B) S (B,C) T (C,D,E) 60
61 Semijoin Reducer } Example: Q = R(A,B) S(B,C) T(C,A) } No full reducer Theorem: A query has a full reducer iff it is acyclic. 61
62 Expressive power of FO } Let R(x,y) represent a graph } Query path(x,y) = } All x,y such that there is a path from x to y } Theorem: path(x,y) cannot be expressed in FO 62
63 Non-recursive rules } Graph R(x,y) P(x,y) :- R(x,u), R(u,v), R(v,y) A(x,y) :- P(x,u), P(u,y) } Can unfold into: A(x,y) :- R(x,u), R(u,v), R(v,w), R(w,m), R(m,n), R(n,y) 63
64 Non-recursive datalog with negation } Expresses FO queries } Negated subgoals } Implicit union } Can evaluate in an order such that all body predicates have been evaluated. 64
65 Recursion Two forms of transi?ve closure Path(x,y) :- R(x,y) Path(x,y) :- Path(x,u), R(u,y) Path(x,y) :- R(x,y) Path(x,y) :- Path(x,u), Path(u,y) 65
66 Recursion example } EDB Par(c,p) = p is parent of c } Generalized cousins: people with common ancestors one or more genera?ons back Sib(x,y) :- Par(x,p), Par(y,p), x y Cousin(x,y) :- Sib(x,y) Cousin(x,y) :- Par(x,xp), Par(y,yp), Cousin(xp,yp) 66
67 Definition of recursion } Form a dependency graph whose nodes are IDB predicates } Connect XàY iff there is a rule with X in the head and Y in the body } Cycle = recursion; no cycle = no recursion 67
68 Meaning of datalog rules } Model-theore?c } Rules define a set of sa?sfying rela?ons } Whenever body is true, head is true } Proof-theore?c } Set of facts derivable from EDB rela?ons by applying the rules. 68
69 Evaluating recursive rules } This works if there is no nega?on } Start with all IDB rela?ons empty } Repeatedly evaluate the rules using the EDB and the previous IDB to get the new IDB } End when there is no change in the IDB rela?ons 69
70 Naïve evaluation algorithm Start: IDB = ; Apply rules to IDB, EDB yes Change to IDB? no done 70
71 Semi-naïve evaluation } Since the EDB never changes, on each round we only get new IDB tuples if we use at least one IDB tuple obtained in the previous round } Saves work; lets us avoid re-discovering most known facts } Though a fact can s?ll be derived in more than one way 71
72 Par data: parent above child Round 1 a d Round 2 b c e Round 3 f g h j k i 72
73 Recursion + negation } Naïve evalua?on doesn t work when there are negated subgoals } Nega?on wrapped in recursion makes no sense in general } Even when they are separate, we can have ambiguity about the correct IDB rela?ons 73
74 Stratified negation } Stra?fica?on is a constraint usually placed on datalog with recursion and nega?on } It rules out nega?on wrapped inside recursion 74
75 Example P(x) :- R(x) & Q(x) :- R(x) & Q(x) P(x) } Suppose R = {(1)} } Two models sa?sfy the rules: } P = { }, Q={1} } P={1}, Q={ } 75
76 Stratum } Intui?vely, the stratum of an IDB predicate P is the maximum number of nega?ons that can be applied to an IDB predicate used in evalua?ng P } Stra?fied nega?on = finite strata 76
77 Stratum graph } Nodes = IDB predicates } Connect Aà B if predicate A depends on B } Label the edge - if the B subgoal is negated } The stratum is the maximum number of - edges on a path leading from that node } A datalog program is stra?fied if all its IDB predicates have finite strata 77
78 Example P(x) :- R(x) & Q(x) :- R(x) & Q(x) P(x) } Not stra?fied P - - Q 78
79 The stratified model } When a datalog program is stra?fied, we can evaluate IDB predicates lowest-stratum-first } Once evaluated, treat it as EDB for higher strata 79
80 Summary } Query complexity } Conjunc?ve queries } Containment, equivalence, minimality } Semijoin reduc?ons } Recursive datalog 80
CSE 544: Principles of Database Systems
CSE 544: Principles of Database Systems Conjunctive Queries (and beyond) CSE544 - Spring, 2013 1 Outline Conjunctive queries Query containment and equivalence Query minimization Undecidability for relational
More informationCS 161: Design and Analysis of Algorithms
CS 161: Design and Analysis of Algorithms NP- Complete I P, NP Polynomial >me reduc>ons NP- Hard, NP- Complete Sat/ 3- Sat Decision Problem Suppose there is a func>on A that outputs True or False A decision
More informationGAV-sound with conjunctive queries
GAV-sound with conjunctive queries Source and global schema as before: source R 1 (A, B),R 2 (B,C) Global schema: T 1 (A, C), T 2 (B,C) GAV mappings become sound: T 1 {x, y, z R 1 (x,y) R 2 (y,z)} T 2
More informationQuery answering using views
Query answering using views General setting: database relations R 1,...,R n. Several views V 1,...,V k are defined as results of queries over the R i s. We have a query Q over R 1,...,R n. Question: Can
More informationDatabase Theory VU , SS Complexity of Query Evaluation. Reinhard Pichler
Database Theory Database Theory VU 181.140, SS 2018 5. Complexity of Query Evaluation Reinhard Pichler Institut für Informationssysteme Arbeitsbereich DBAI Technische Universität Wien 17 April, 2018 Pichler
More information1 First-order logic. 1 Syntax of first-order logic. 2 Semantics of first-order logic. 3 First-order logic queries. 2 First-order query evaluation
Knowledge Bases and Databases Part 1: First-Order Queries Diego Calvanese Faculty of Computer Science Master of Science in Computer Science A.Y. 2007/2008 Overview of Part 1: First-order queries 1 First-order
More informationCSCI 1010 Models of Computa3on. Lecture 02 Func3ons and Circuits
CSCI 1010 Models of Computa3on Lecture 02 Func3ons and Circuits Overview Func3ons and languages Designing circuits from func3ons Minterms and the DNF Maxterms and CNF Circuit complexity Algebra of Boolean
More informationUndecidable Problems. Z. Sawa (TU Ostrava) Introd. to Theoretical Computer Science May 12, / 65
Undecidable Problems Z. Sawa (TU Ostrava) Introd. to Theoretical Computer Science May 12, 2018 1/ 65 Algorithmically Solvable Problems Let us assume we have a problem P. If there is an algorithm solving
More informationDefinition: Alternating time and space Game Semantics: State of machine determines who
CMPSCI 601: Recall From Last Time Lecture 3 Definition: Alternating time and space Game Semantics: State of machine determines who controls, White wants it to accept, Black wants it to reject. White wins
More informationLogic and Databases. Phokion G. Kolaitis. UC Santa Cruz & IBM Research Almaden. Lecture 4 Part 1
Logic and Databases Phokion G. Kolaitis UC Santa Cruz & IBM Research Almaden Lecture 4 Part 1 1 Thematic Roadmap Logic and Database Query Languages Relational Algebra and Relational Calculus Conjunctive
More informationFundamentos lógicos de bases de datos (Logical foundations of databases)
20/7/2015 ECI 2015 Buenos Aires Fundamentos lógicos de bases de datos (Logical foundations of databases) Diego Figueira Gabriele Puppis CNRS LaBRI About the speakers Gabriele Puppis PhD from Udine (Italy)
More informationn CS 160 or CS122 n Sets and Functions n Propositions and Predicates n Inference Rules n Proof Techniques n Program Verification n CS 161
Discrete Math at CSU (Rosen book) Sets and Functions (Rosen, Sections 2.1,2.2, 2.3) TOPICS Discrete math Set Definition Set Operations Tuples 1 n CS 160 or CS122 n Sets and Functions n Propositions and
More informationCMPS 277 Principles of Database Systems. Lecture #9
CMPS 277 Principles of Database Systems http://www.soe.classes.edu/cmps277/winter10 Lecture #9 1 Summary The Query Evaluation Problem for Relational Calculus is PSPACEcomplete. The Query Equivalence Problem
More informationProvenance Semirings. Todd Green Grigoris Karvounarakis Val Tannen. presented by Clemens Ley
Provenance Semirings Todd Green Grigoris Karvounarakis Val Tannen presented by Clemens Ley place of origin Provenance Semirings Todd Green Grigoris Karvounarakis Val Tannen presented by Clemens Ley place
More informationPredicate Calculus. Formal Methods in Verification of Computer Systems Jeremy Johnson
Predicate Calculus Formal Methods in Verification of Computer Systems Jeremy Johnson Outline 1. Motivation 1. Variables, quantifiers and predicates 2. Syntax 1. Terms and formulas 2. Quantifiers, scope
More informationQuery Languages for Data Exchange: Beyond Unions of Conjunctive Queries
DOI 10.1007/s00224-010-9259-6 Query Languages for Data Exchange: Beyond Unions of Conjunctive Queries Marcelo Arenas Pablo Barceló Juan Reutter Springer Science+Business Media, LLC 2010 Abstract The class
More informationBounded Query Rewriting Using Views
Bounded Query Rewriting Using Views Yang Cao 1,3 Wenfei Fan 1,3 Floris Geerts 2 Ping Lu 3 1 University of Edinburgh 2 University of Antwerp 3 Beihang University {wenfei@inf, Y.Cao-17@sms}.ed.ac.uk, floris.geerts@uantwerpen.be,
More informationOutline. Logic. Knowledge bases. Wumpus world characteriza/on. Wumpus World PEAS descrip/on. A simple knowledge- based agent
Outline Logic Dr. Melanie Mar/n CS 4480 October 8, 2012 Based on slides from hap://aima.eecs.berkeley.edu/2nd- ed/slides- ppt/ Knowledge- based agents Wumpus world Logic in general - models and entailment
More informationParallel-Correctness and Transferability for Conjunctive Queries
Parallel-Correctness and Transferability for Conjunctive Queries Tom J. Ameloot1 Gaetano Geck2 Bas Ketsman1 Frank Neven1 Thomas Schwentick2 1 Hasselt University 2 Dortmund University Big Data Too large
More informationThe Query Containment Problem: Set Semantics vs. Bag Semantics. Phokion G. Kolaitis University of California Santa Cruz & IBM Research - Almaden
The Query Containment Problem: Set Semantics vs. Bag Semantics Phokion G. Kolaitis University of California Santa Cruz & IBM Research - Almaden PROBLEMS Problems worthy of attack prove their worth by hitting
More informationCircuits. Lecture 11 Uniform Circuit Complexity
Circuits Lecture 11 Uniform Circuit Complexity 1 Recall 2 Recall Non-uniform complexity 2 Recall Non-uniform complexity P/1 Decidable 2 Recall Non-uniform complexity P/1 Decidable NP P/log NP = P 2 Recall
More informationFoundations of Query Languages
Foundations of Query Languages SS 2011 2. 2. Foundations of Query Languages Dr. Fang Wei Lehrstuhl für Datenbanken und Informationssysteme Universität Freiburg SS 2011 Dr. Fang Wei 30. Mai 2011 Seite 1
More informationPredicate Calculus. CS 270 Math Foundations of Computer Science Jeremy Johnson
Predicate Calculus CS 270 Math Foundations of Computer Science Jeremy Johnson Presentation uses material from Huth and Ryan, Logic in Computer Science: Modelling and Reasoning about Systems, 2nd Edition
More informationW3203 Discrete Mathema1cs. Logic and Proofs. Spring 2015 Instructor: Ilia Vovsha. hcp://www.cs.columbia.edu/~vovsha/w3203
W3203 Discrete Mathema1cs Logic and Proofs Spring 2015 Instructor: Ilia Vovsha hcp://www.cs.columbia.edu/~vovsha/w3203 1 Outline Proposi1onal Logic Operators Truth Tables Logical Equivalences Laws of Logic
More informationComputability and Complexity Theory: An Introduction
Computability and Complexity Theory: An Introduction meena@imsc.res.in http://www.imsc.res.in/ meena IMI-IISc, 20 July 2006 p. 1 Understanding Computation Kinds of questions we seek answers to: Is a given
More informationEssential facts about NP-completeness:
CMPSCI611: NP Completeness Lecture 17 Essential facts about NP-completeness: Any NP-complete problem can be solved by a simple, but exponentially slow algorithm. We don t have polynomial-time solutions
More informationOn the Succinctness of Query Rewriting for Datalog
On the Succinctness of Query Rewriting for Datalog Shqiponja Ahmetaj 1 Andreas Pieris 2 1 Institute of Logic and Computation, TU Wien, Austria 2 School of Informatics, University of Edinburgh, UK Foundational
More informationComplete problems for classes in PH, The Polynomial-Time Hierarchy (PH) oracle is like a subroutine, or function in
Oracle Turing Machines Nondeterministic OTM defined in the same way (transition relation, rather than function) oracle is like a subroutine, or function in your favorite PL but each call counts as single
More informationPushing Extrema Aggregates to Optimize Logic Queries. Sergio Greco
Pushing Extrema Aggregates to Optimize Logic Queries Sergio Greco DEIS - Università della Calabria ISI-CNR 87030 Rende, Italy greco@deis.unical.it Abstract In this paper, we explore the possibility of
More informationLogarithmic space. Evgenij Thorstensen V18. Evgenij Thorstensen Logarithmic space V18 1 / 18
Logarithmic space Evgenij Thorstensen V18 Evgenij Thorstensen Logarithmic space V18 1 / 18 Journey below Unlike for time, it makes sense to talk about sublinear space. This models computations on input
More informationAlgorithmic Model Theory SS 2016
Algorithmic Model Theory SS 2016 Prof. Dr. Erich Grädel and Dr. Wied Pakusa Mathematische Grundlagen der Informatik RWTH Aachen cbnd This work is licensed under: http://creativecommons.org/licenses/by-nc-nd/3.0/de/
More informationLecture 21: Algebraic Computation Models
princeton university cos 522: computational complexity Lecture 21: Algebraic Computation Models Lecturer: Sanjeev Arora Scribe:Loukas Georgiadis We think of numerical algorithms root-finding, gaussian
More informationINAPPROX APPROX PTAS. FPTAS Knapsack P
CMPSCI 61: Recall From Last Time Lecture 22 Clique TSP INAPPROX exists P approx alg for no ε < 1 VertexCover MAX SAT APPROX TSP some but not all ε< 1 PTAS all ε < 1 ETSP FPTAS Knapsack P poly in n, 1/ε
More informationSome algorithmic improvements for the containment problem of conjunctive queries with negation
Some algorithmic improvements for the containment problem of conjunctive queries with negation Michel Leclère and Marie-Laure Mugnier LIRMM, Université de Montpellier, 6, rue Ada, F-3439 Montpellier cedex
More informationDatalog and Constraint Satisfaction with Infinite Templates
Datalog and Constraint Satisfaction with Infinite Templates Manuel Bodirsky 1 and Víctor Dalmau 2 1 CNRS/LIX, École Polytechnique, bodirsky@lix.polytechnique.fr 2 Universitat Pompeu Fabra, victor.dalmau@upf.edu
More informationDRAFT. Algebraic computation models. Chapter 14
Chapter 14 Algebraic computation models Somewhat rough We think of numerical algorithms root-finding, gaussian elimination etc. as operating over R or C, even though the underlying representation of the
More informationConstraint satisfaction problems and dualities
Andrei Krokhin - CSPs and dualities 1 Constraint satisfaction problems and dualities Andrei Krokhin University of Durham Andrei Krokhin - CSPs and dualities 2 The CSP The Constraint Satisfaction (or Homomorphism)
More informationRela%ons and Their Proper%es. Slides by A. Bloomfield
Rela%ons and Their Proper%es Slides by A. Bloomfield What is a rela%on Let A and B be sets. A binary rela%on R is a subset of A B Example Let A be the students in a the CS major A = {Alice, Bob, Claire,
More informationIntelligent Agents. Formal Characteristics of Planning. Ute Schmid. Cognitive Systems, Applied Computer Science, Bamberg University
Intelligent Agents Formal Characteristics of Planning Ute Schmid Cognitive Systems, Applied Computer Science, Bamberg University Extensions to the slides for chapter 3 of Dana Nau with contributions by
More informationComplexity Theory VU , SS The Polynomial Hierarchy. Reinhard Pichler
Complexity Theory Complexity Theory VU 181.142, SS 2018 6. The Polynomial Hierarchy Reinhard Pichler Institut für Informationssysteme Arbeitsbereich DBAI Technische Universität Wien 15 May, 2018 Reinhard
More informationOutline. Complexity Theory EXACT TSP. The Class DP. Definition. Problem EXACT TSP. Complexity of EXACT TSP. Proposition VU 181.
Complexity Theory Complexity Theory Outline Complexity Theory VU 181.142, SS 2018 6. The Polynomial Hierarchy Reinhard Pichler Institut für Informationssysteme Arbeitsbereich DBAI Technische Universität
More informationFinite Model Theory: First-Order Logic on the Class of Finite Models
1 Finite Model Theory: First-Order Logic on the Class of Finite Models Anuj Dawar University of Cambridge Modnet Tutorial, La Roche, 21 April 2008 2 Finite Model Theory In the 1980s, the term finite model
More informationLimits to Approximability: When Algorithms Won't Help You. Note: Contents of today s lecture won t be on the exam
Limits to Approximability: When Algorithms Won't Help You Note: Contents of today s lecture won t be on the exam Outline Limits to Approximability: basic results Detour: Provers, verifiers, and NP Graph
More informationDefinition: Alternating time and space Game Semantics: State of machine determines who
CMPSCI 601: Recall From Last Time Lecture Definition: Alternating time and space Game Semantics: State of machine determines who controls, White wants it to accept, Black wants it to reject. White wins
More informationSums of Products. Pasi Rastas November 15, 2005
Sums of Products Pasi Rastas November 15, 2005 1 Introduction This presentation is mainly based on 1. Bacchus, Dalmao and Pitassi : Algorithms and Complexity results for #SAT and Bayesian inference 2.
More informationCS 320, Fall Dr. Geri Georg, Instructor 320 NP 1
NP CS 320, Fall 2017 Dr. Geri Georg, Instructor georg@colostate.edu 320 NP 1 NP Complete A class of problems where: No polynomial time algorithm has been discovered No proof that one doesn t exist 320
More informationOverview of Topics. Finite Model Theory. Finite Model Theory. Connections to Database Theory. Qing Wang
Overview of Topics Finite Model Theory Part 1: Introduction 1 What is finite model theory? 2 Connections to some areas in CS Qing Wang qing.wang@anu.edu.au Database theory Complexity theory 3 Basic definitions
More informationNotes on Satisfiability-Based Problem Solving. First Order Logic. David Mitchell October 23, 2013
Notes on Satisfiability-Based Problem Solving First Order Logic David Mitchell mitchell@cs.sfu.ca October 23, 2013 Preliminary draft. Please do not distribute. Corrections and suggestions welcome. In this
More informationBrief Tutorial on Probabilistic Databases
Brief Tutorial on Probabilistic Databases Dan Suciu University of Washington Simons 206 About This Talk Probabilistic databases Tuple-independent Query evaluation Statistical relational models Representation,
More informationTractable Lineages on Treelike Instances: Limits and Extensions
Tractable Lineages on Treelike Instances: Limits and Extensions Antoine Amarilli 1, Pierre Bourhis 2, Pierre enellart 1,3 June 29th, 2016 1 Télécom ParisTech 2 CNR CRItAL 3 National University of ingapore
More informationDualities for Constraint Satisfaction Problems
Dualities for Constraint Satisfaction Problems Andrei Bulatov 1, Andrei Krokhin 2, and Benoit Larose 3 1 School of Computing Science Simon Fraser University Burnaby, BC, Canada, V5A 1S6 abulatov@cs.sfu.ca
More informationLecture #14: NP-Completeness (Chapter 34 Old Edition Chapter 36) Discussion here is from the old edition.
Lecture #14: 0.0.1 NP-Completeness (Chapter 34 Old Edition Chapter 36) Discussion here is from the old edition. 0.0.2 Preliminaries: Definition 1 n abstract problem Q is a binary relations on a set I of
More informationLocally Consistent Transformations and Query Answering in Data Exchange
Locally Consistent Transformations and Query Answering in Data Exchange Marcelo Arenas University of Toronto marenas@cs.toronto.edu Pablo Barceló University of Toronto pablo@cs.toronto.edu Ronald Fagin
More informationNotes for Lecture 2. Statement of the PCP Theorem and Constraint Satisfaction
U.C. Berkeley Handout N2 CS294: PCP and Hardness of Approximation January 23, 2006 Professor Luca Trevisan Scribe: Luca Trevisan Notes for Lecture 2 These notes are based on my survey paper [5]. L.T. Statement
More information1 PSPACE-Completeness
CS 6743 Lecture 14 1 Fall 2007 1 PSPACE-Completeness Recall the NP-complete problem SAT: Is a given Boolean formula φ(x 1,..., x n ) satisfiable? The same question can be stated equivalently as: Is the
More informationFirst&Order&Logics& Logics&and&Databases&
First&Order&Logics& Logics&and&Databases& G. Falquet Technologies du Web Sémantique UNIG&6&G.&Falquet& First&Order&Logic&and&Databases& 1& First&order&logic& Language vocabulary constant symbols variable
More informationDefinite Logic Programs
Chapter 2 Definite Logic Programs 2.1 Definite Clauses The idea of logic programming is to use a computer for drawing conclusions from declarative descriptions. Such descriptions called logic programs
More informationQuerying Big Data by Accessing Small Data
Querying Big Data by Accessing Small Data Wenfei Fan 1,3 Floris Geerts 2 Yang Cao 1,3 Ting Deng 3 Ping Lu 3 1 University of Edinburgh 2 University of Antwerp 3 Beihang University {wenfei@inf, yang.cao@}.ed.ac.uk,
More informationA Novel Stable Model Computation Approach for General Dedcutive Databases
Georgia State University ScholarWorks @ Georgia State University Computer Science Theses Department of Computer Science 7-15-2010 A Novel Stable Model Computation Approach for General Dedcutive Databases
More informationα-acyclic Joins Jef Wijsen May 4, 2017
α-acyclic Joins Jef Wijsen May 4, 2017 1 Motivation Joins in a Distributed Environment Assume the following relations. 1 M[NN, Field of Study, Year] stores data about students of UMONS. For example, (19950423158,
More informationPROPOSITIONAL LOGIC. VL Logik: WS 2018/19
PROPOSITIONAL LOGIC VL Logik: WS 2018/19 (Version 2018.2) Martina Seidl (martina.seidl@jku.at), Armin Biere (biere@jku.at) Institut für Formale Modelle und Verifikation BOX Game: Rules 1. The game board
More information9. PSPACE 9. PSPACE. PSPACE complexity class quantified satisfiability planning problem PSPACE-complete
Geography game Geography. Alice names capital city c of country she is in. Bob names a capital city c' that starts with the letter on which c ends. Alice and Bob repeat this game until one player is unable
More informationCSCI 1010 Models of Computa3on. Lecture 11 Proving Languages NP-Complete
CSCI 1010 Models of Computa3on Lecture 11 Proving Languages NP-Complete Overview P-3me reduc3ons Composi3on of P-3me reduc3ons Reduc3on from CIRCUIT SAT to SAT SAT is NP-complete. 3-SAT is NP-complete.
More information9. PSPACE. PSPACE complexity class quantified satisfiability planning problem PSPACE-complete
9. PSPACE PSPACE complexity class quantified satisfiability planning problem PSPACE-complete Lecture slides by Kevin Wayne Copyright 2005 Pearson-Addison Wesley Copyright 2013 Kevin Wayne http://www.cs.princeton.edu/~wayne/kleinberg-tardos
More informationLecture 8: Complete Problems for Other Complexity Classes
IAS/PCMI Summer Session 2000 Clay Mathematics Undergraduate Program Basic Course on Computational Complexity Lecture 8: Complete Problems for Other Complexity Classes David Mix Barrington and Alexis Maciel
More informationCourse information. Winter ATFD
Course information More information next week This is a challenging course that will put you at the forefront of current data management research Lots of work done by you: extra reading: at least 4 research
More informationDe Morgan s a Laws. De Morgan s laws say that. (φ 1 φ 2 ) = φ 1 φ 2, (φ 1 φ 2 ) = φ 1 φ 2.
De Morgan s a Laws De Morgan s laws say that (φ 1 φ 2 ) = φ 1 φ 2, (φ 1 φ 2 ) = φ 1 φ 2. Here is a proof for the first law: φ 1 φ 2 (φ 1 φ 2 ) φ 1 φ 2 0 0 1 1 0 1 1 1 1 0 1 1 1 1 0 0 a Augustus DeMorgan
More informationCS6840: Advanced Complexity Theory Mar 29, Lecturer: Jayalal Sarma M.N. Scribe: Dinesh K.
CS684: Advanced Complexity Theory Mar 29, 22 Lecture 46 : Size lower bounds for AC circuits computing Parity Lecturer: Jayalal Sarma M.N. Scribe: Dinesh K. Theme: Circuit Complexity Lecture Plan: Proof
More information1 Circuit Complexity. CS 6743 Lecture 15 1 Fall Definitions
CS 6743 Lecture 15 1 Fall 2007 1 Circuit Complexity 1.1 Definitions A Boolean circuit C on n inputs x 1,..., x n is a directed acyclic graph (DAG) with n nodes of in-degree 0 (the inputs x 1,..., x n ),
More informationKnowledge Base Exchange: The Case of OWL 2 QL
Knowledge Base Exchange: The Case of OWL 2 QL Marcelo Arenas Pontificia Universidad Católica de Chile, Chile Elena Botoeva, Diego Calvanese, Vladislav Ryzhikov Free University of Bozen-Bolzano, Italy Abstract
More informationAutomata Theory CS Complexity Theory I: Polynomial Time
Automata Theory CS411-2015-17 Complexity Theory I: Polynomial Time David Galles Department of Computer Science University of San Francisco 17-0: Tractable vs. Intractable If a problem is recursive, then
More informationif t 1,...,t k Terms and P k is a k-ary predicate, then P k (t 1,...,t k ) Formulas (atomic formulas)
FOL Query Evaluation Giuseppe De Giacomo Università di Roma La Sapienza Corso di Seminari di Ingegneria del Software: Data and Service Integration Laurea Specialistica in Ingegneria Informatica Università
More informationProperties of Relational Logic
Computational Logic Lecture 8 Properties of Relational Logic Michael Genesereth Autumn 2011 Programme Expressiveness What we can say in First-Order Logic And what we cannot Semidecidability and Decidability
More informationNotes for Lecture 3... x 4
Stanford University CS254: Computational Complexity Notes 3 Luca Trevisan January 14, 2014 Notes for Lecture 3 In this lecture we introduce the computational model of boolean circuits and prove that polynomial
More informationAdvanced DB CHAPTER 5 DATALOG
Advanced DB CHAPTER 5 DATALOG Datalog Basic Structure Syntax of Datalog Rules Semantics of Nonrecursive Datalog Safety Relational Operations in Datalog Recursion in Datalog The Power of Recursion A More
More informationThe DL-Lite Family of Languages A FO Perspective
The DL-Lite Family of Languages A FO Perspective Alessandro Artale KRDB Research Centre Free University of Bozen-Bolzano Joint work with D. Calvanese, R. Kontchakov, M. Zakharyaschev TU Dresden. December
More informationChapter 9. PSPACE: A Class of Problems Beyond NP. Slides by Kevin Wayne Pearson-Addison Wesley. All rights reserved.
Chapter 9 PSPACE: A Class of Problems Beyond NP Slides by Kevin Wayne. Copyright @ 2005 Pearson-Addison Wesley. All rights reserved. 1 Geography Game Geography. Alice names capital city c of country she
More informationChapter 2. Reductions and NP. 2.1 Reductions Continued The Satisfiability Problem (SAT) SAT 3SAT. CS 573: Algorithms, Fall 2013 August 29, 2013
Chapter 2 Reductions and NP CS 573: Algorithms, Fall 2013 August 29, 2013 2.1 Reductions Continued 2.1.1 The Satisfiability Problem SAT 2.1.1.1 Propositional Formulas Definition 2.1.1. Consider a set of
More informationan efficient procedure for the decision problem. We illustrate this phenomenon for the Satisfiability problem.
1 More on NP In this set of lecture notes, we examine the class NP in more detail. We give a characterization of NP which justifies the guess and verify paradigm, and study the complexity of solving search
More informationTransitive Closure and Recursive Datalog Implemented on Clusters
Transitive Closure and Recursive Datalog Implemented on Clusters Foto N. Afrati, and Jeffrey D. Ullman June 17, 2011 Abstract Implementing recursive algorithms on computing clusters presents a number of
More informationOn Datalog vs. LFP. Anuj Dawar and Stephan Kreutzer
On Datalog vs. LFP Anuj Dawar and Stephan Kreutzer 1 University of Cambridge Computer Lab, anuj.dawar@cl.cam.ac.uk 2 Oxford University Computing Laboratory, kreutzer@comlab.ox.ac.uk Abstract. We show that
More informationOn the Relationship between Consistent Query Answering and Constraint Satisfaction Problems
On the Relationship between Consistent Query Answering and Constraint Satisfaction Problems Carsten Lutz 1 and Frank Wolter 2 1 Fachbereich Informatik, Universität Bremen, Germany clu@uni-bremen.de 2 Department
More information1.1 P, NP, and NP-complete
CSC5160: Combinatorial Optimization and Approximation Algorithms Topic: Introduction to NP-complete Problems Date: 11/01/2008 Lecturer: Lap Chi Lau Scribe: Jerry Jilin Le This lecture gives a general introduction
More informationMonadic Predicate Logic is Decidable. Boolos et al, Computability and Logic (textbook, 4 th Ed.)
Monadic Predicate Logic is Decidable Boolos et al, Computability and Logic (textbook, 4 th Ed.) These slides use A instead of E instead of & instead of - instead of Nota>on Equality statements are atomic
More informationAbout the relationship between formal logic and complexity classes
About the relationship between formal logic and complexity classes Working paper Comments welcome; my email: armandobcm@yahoo.com Armando B. Matos October 20, 2013 1 Introduction We analyze a particular
More informationData Exchange with Arithmetic Comparisons
Data Exchange with Arithmetic Comparisons Foto Afrati 1 Chen Li 2 Vassia Pavlaki 1 1 National Technical University of Athens (NTUA), Greece {afrati,vpavlaki}@softlab.ntua.gr 2 University of California,
More informationHalting and Equivalence of Program Schemes in Models of Arbitrary Theories
Halting and Equivalence of Program Schemes in Models of Arbitrary Theories Dexter Kozen Cornell University, Ithaca, New York 14853-7501, USA, kozen@cs.cornell.edu, http://www.cs.cornell.edu/~kozen In Honor
More informationNP and Computational Intractability
NP and Computational Intractability 1 Polynomial-Time Reduction Desiderata'. Suppose we could solve X in polynomial-time. What else could we solve in polynomial time? don't confuse with reduces from Reduction.
More informationAbstract model theory for extensions of modal logic
Abstract model theory for extensions of modal logic Balder ten Cate Stanford, May 13, 2008 Largely based on joint work with Johan van Benthem and Jouko Väänänen Balder ten Cate Abstract model theory for
More informationLogical reasoning - Can we formalise our thought processes?
Logical reasoning - Can we formalise our thought processes? Why study (mathematical) logic? Logic: the science or method of reasoning Logical: able to reason correctly Human reasoning poorly understood,
More informationNP-Complete problems
NP-Complete problems NP-complete problems (NPC): A subset of NP. If any NP-complete problem can be solved in polynomial time, then every problem in NP has a polynomial time solution. NP-complete languages
More informationIntroduction. Foundations of Computing Science. Pallab Dasgupta Professor, Dept. of Computer Sc & Engg INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR
1 Introduction Foundations of Computing Science Pallab Dasgupta Professor, Dept. of Computer Sc & Engg 2 Comments on Alan Turing s Paper "On Computable Numbers, with an Application to the Entscheidungs
More informationJASS 06 Report Summary. Circuit Complexity. Konstantin S. Ushakov. May 14, 2006
JASS 06 Report Summary Circuit Complexity Konstantin S. Ushakov May 14, 2006 Abstract Computer science deals with many computational models. In real life we have normal computers that are constructed using,
More informationCS2742 midterm test 2 study sheet. Boolean circuits: Predicate logic:
x NOT ~x x y AND x /\ y x y OR x \/ y Figure 1: Types of gates in a digital circuit. CS2742 midterm test 2 study sheet Boolean circuits: Boolean circuits is a generalization of Boolean formulas in which
More informationIntroduction to Complexity Theory. Bernhard Häupler. May 2, 2006
Introduction to Complexity Theory Bernhard Häupler May 2, 2006 Abstract This paper is a short repetition of the basic topics in complexity theory. It is not intended to be a complete step by step introduction
More informationLecture Notes Each circuit agrees with M on inputs of length equal to its index, i.e. n, x {0, 1} n, C n (x) = M(x).
CS 221: Computational Complexity Prof. Salil Vadhan Lecture Notes 4 February 3, 2010 Scribe: Jonathan Pines 1 Agenda P-/NP- Completeness NP-intermediate problems NP vs. co-np L, NL 2 Recap Last time, we
More informationNon-Approximability Results (2 nd part) 1/19
Non-Approximability Results (2 nd part) 1/19 Summary - The PCP theorem - Application: Non-approximability of MAXIMUM 3-SAT 2/19 Non deterministic TM - A TM where it is possible to associate more than one
More informationUmans Complexity Theory Lectures
Umans Complexity Theory Lectures Lecture 12: The Polynomial-Time Hierarchy Oracle Turing Machines Oracle Turing Machine (OTM): Deterministic multitape TM M with special query tape special states q?, q
More information-bit integers are all in ThC. Th The following problems are complete for PSPACE NPSPACE ATIME QSAT, GEOGRAPHY, SUCCINCT REACH.
CMPSCI 601: Recall From Last Time Lecture 26 Theorem: All CFL s are in sac. Facts: ITADD, MULT, ITMULT and DIVISION on -bit integers are all in ThC. Th The following problems are complete for PSPACE NPSPACE
More information