1 Finite Model Theory Lecture 9 Logics and Complexity Classes (cont’d)

Slides:



Advertisements
Similar presentations
1 Datalog: Logic Instead of Algebra. 2 Datalog: Logic instead of Algebra Each relational-algebra operator can be mimicked by one or several Database Logic.
Advertisements

Completeness and Expressiveness
Lecture 16 Deterministic Turing Machine (DTM) Finite Control tape head.
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.
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 3 School of Innovation, Design and Engineering Mälardalen University 2012.
Complexity 12-1 Complexity Andrei Bulatov Non-Deterministic Space.
1 Introduction to Computability Theory Lecture12: Decidable Languages Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY Read sections 7.1 – 7.3 of the book for next time.
1 Finite Model Theory Lecture 13 FO k, L k 1, ,L  1, , and Pebble Games.
CSE 636 Data Integration Datalog Rules / Programs / Negation Slides by Jeffrey D. Ullman.
Computability and Complexity 20-1 Computability and Complexity Andrei Bulatov Class NL.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
Non-Deterministic Space is Closed Under Complementation Neil Immerman Richard Szelepcsenyi Presented By: Subhajit Dasgupta.
1 The Cook-Levin Theorem Zeph Grunschlag. 2 Announcements Last HW due Thursday Please give feedback about course at oracle.seas.columbia.edu/wces oracle.seas.columbia.edu/wces.
CSE 544 Theory of Query Languages Tuesday, February 22 nd, 2011 Dan Suciu , Winter
Definition: Let M be a deterministic Turing Machine that halts on all inputs. Space Complexity of M is the function f:N  N, where f(n) is the maximum.
February 18, 2015CS21 Lecture 181 CS21 Decidability and Tractability Lecture 18 February 18, 2015.
Computational Complexity Theory Lecture 2: Reductions, NP-completeness, Cook-Levin theorem Indian Institute of Science.
Theory of Computing Lecture 17 MAS 714 Hartmut Klauck.
Datalog Inspired by the impedance mismatch in relational databases. Main expressive advantage: recursive queries. More convenient for analysis: papers.
1 Finite Model Theory Lecture 3 Ehrenfeucht-Fraisse Games.
NP-completeness Section 7.4 Giorgi Japaridze Theory of Computability.
Lecture 7: Foundations of Query Languages Tuesday, January 23, 2001.
1 Finite Model Theory Lecture 14 Proof of the Pebble Games Theorem.
1 Finite Model Theory Lecture 16 L  1  Summary and 0/1 Laws.
Fall 2013 CMU CS Computational Complexity Lecture 2 Diagonalization, 9/12/2013.
NP-complete Languages
CSCI 2670 Introduction to Theory of Computing December 2, 2004.
CSCI 2670 Introduction to Theory of Computing December 7, 2005.
1 Finite Model Theory Lecture 5 Turing Machines and Finite Models.
Theory of Computational Complexity Yuji Ishikawa Avis lab. M1.
Extensions of Datalog Wednesday, February 13, 2001.
Lecture 9: Query Complexity Tuesday, January 30, 2001.
Lecture # 16. Applications of Incrementing and Complementing machines 1’s complementing and incrementing machines which are basically Mealy machines are.
Finite Model Theory Lecture 8
Busch Complexity Lectures: Reductions
Semantics of Datalog With Negation
Hierarchy of languages
ICS 353: Design and Analysis of Algorithms
Steven Lindell Scott Weinstein
Alternating tree Automata and Parity games
Non-Deterministic Finite Automata
Non Deterministic Automata
Introduction to Finite Automata
Finite Automata Reading: Chapter 2.
Finite Model Theory Lecture 15
Finite Model Theory Lecture 11
FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY
Finite Model Theory Lecture 2
Finite Model Theory Lecture 6
Lecture 10: Query Complexity
CS21 Decidability and Tractability
Proposed in Turing’s 1936 paper
CS21 Decidability and Tractability
CS21 Decidability and Tractability
Logic Based Query Languages
Time Complexity Classes
Umans Complexity Theory Lectures
CSE 544: Lecture 8 Theory.
Finite Model Theory Lecture 4
Datalog Inspired by the impedance mismatch in relational databases.
Conjunctive Queries, Views, Datalog Monday, 4/29/2002
Finite Model Theory Lecture 7
CSE 544: Lecture 11 Theory Monday, May 3, 2004.
Variants of Turing machines
CS6382 Theory of Computation
Instructor: Aaron Roth
Theory of Computation Lecture 23: Turing Machines III
Presentation transcript:

1 Finite Model Theory Lecture 9 Logics and Complexity Classes (cont’d)

2 Outline Proof of Immerman and Vardi’s theorems Normal form for lfp Datalog Other logics capturing complexity classes

3 Proof: LFP = PTIME LFP + < µ PTIME [why ?] To show PTIME µ LFP + < Let M = (Q, , , , q 0, Q a, Q r ) be a PTIME Turing machine Input: Enc( A ) = 01 n Enc(R 1 A )…Enc(R m A ) Output: accept or reject Need: formula  s.t. A ²  iff T accepts A

4 Proof: LFP = PTIME Time t and space p vary from 0 to n k -1 –Represent them as k-tuples Can define t < t’ [ how ? ] Can define succ(t, t’) [ how ?] Goal: express the following: T 0 (p, t) = true iff tape has 0 on p at time t T 1 (p, t) = true iff tape has 1 on p at time t H q (p, t) = true iff head is on p at time t, state q All these can be expressed by simultaneous fixpoint [ how ? ]

5 Proof: PFP = PSPACE PFP + < µ PSPACE [ why ? ] To show PSPACE µ PFP + < proceed as before, but can’t define T 0 (p, t) because we can’t express t Instead define T 0 (p), T 1 (p), H q (p) using a PFP Each new step recomputes these tables Make sure to define T 0 (p+1) = T 0 (p) etc whenever reaching an accepting state

6 Remark Somewhere in the proof we need to use + and £, defined in terms of < Where ?

7 Simultaneous Fixpoints U 1, U 2, …, U k = finite sets Definition Let F : P(U 1 ) £ … £ P(U k ) ! P(U 1 ) £ … £ P(U k ). A fixpoint for F is X = (X 1, …, X k ), X 1 µ U 1, …, X k µ U k s.t. F(X) = X lfp(F), ifp(F), pfp(F) defined as before

8 Simultaneous Fixpoints Given  = (  1 (R 1, …, R k, x 1 ), …,  k (R 1, …, R k, x k )) lfp R i simult [  ](t), ifp R i simult [  ](t), pfp R i simult [  ](t) Mean the following: compute the lfp/ifp/pfp extract the i’th component (since index is R i )

9 Simultaneous Fixpoints LFP simult = LFP IFP simult = IFP PFP simult = PFP

10 Normal Form Every IFP or LFP formula is equivalent to one formula “with only one LFP, at the top”: 9 x 1 … 9 x k. lfp R [  ](x) where  is in FO (i.e. without fixpoints) Proof: in the book (not hard), but better see next

11 Datalog Recall: a conjunctive query has the form: q(x) = 9 y 1 … 9 y k.  (x, y) where  is a conjunction of positive atomic formulas Example: stands for 9 u. 9 v.(R(x,u) Æ R(u,v) Æ R(v,y)) q(x,y) :- R(x,u), R(u,v), R(v,y)

12 Datalog Definition. EDB Extensional relations = are those in  Definition. IDB Intensional relations = m new relation names R 1, …, R m Definition. A datalog rule is: where R =intensional  = conjunctive query R(x) :- 

13 Datalog Definition. A datalog program is a set of rules: R i 1 :-  1 R i 2 :-  R i m :-  m

14 Examples in Datalog Transitive closure: Same generation: T(x,y) :- R(x,y) T(x,y) :- R(x,z), T(z,y) S(x,y) :- Root(u), R(u,x), R(u,y) S(x,y) :- S(u,v), R(u,x), R(v,y)

15 Datalog Semantics Simultaneous least fixpoints: Given a program P, define the operators F P as follows: F P (R 1, …, R m ) = (  1, …,  m ) Next, take the lfp(F P )

16 Adding negation Semipositive datalog: Allow negation only on the EDBs If we allow negation on IDBs, what is the semantics ?

17 Semantics 1: Stratified Datalog Split datalog program into “strata”. Each stratum may use negation of IDBs defined by previous strata. Evaluate program in stages Example: find pairs x,y that are not connected: T(x,y) :- R(x,y) T(x,y) :- R(x,z), T(z,y) Answer(x,y) :- : T(x,y) here we have 2 strata

18 Semantics 2: Inflationary Datalog We know what this is… Find all pairs x, y that are not connected: T(x,y) :- R(x,y) T(x,y) :- R(x,z), T(z,y) oldT(x,y) :- T(x,y) oldTexceptFinalT(x,y) :- T(x,y), R(x’,z’),T(z’,y’), : T(x’,y’) Answ(x,y) :- : T(x,y), oldT(x’,y’), : oldTexceptFinalT(x’,y’)

19 Datalog : s ½ Datalog : i Every stratified datalog program can be expressed as an inflationary datalog program The “winning game” query can be expressed in inflationary datalog but not in stratified datalog [ show the query in class ] [ inexpressibility: Kolaitis’91, in Information and Control]

20 Datalog : i = LFP Theorem Datalog : i = LFP Corollary Datalog :,< i = PTIME

21 Semantics 3: Partial Fixpoint Datalog Partial fixpoint semantics Theorem Datalog : p = PFP Corollary Datalog :,< p = PSPACE

22 FO+TrCl Definition Transitive closure. Let  (x, y, z) be a formula, where |x| = |y| = k, and t 1, t 2 are tuples of length k. Then: [trcl x, y  (x, y, z)](t 1, t 2 ) is a formula with free variables z.

23 TrCl The logic FO extended with trcl is denoted TrCl Note: may combing trcl arbitrarily with Æ, Ç, :, 8, 9.

24 Examples in TrCl Is the graph connected: Is there a path from u to v where all edges are labeled with the same color: here c is a free variable in trcl Do we need free variables ? 8 u. 8 v.[trcl x,y (R(x,y))](u,v) 9 c..[trcl x,y (R(x,c,y))](u,v)

25 Homework Problem Let TrCl r denote the logic where trcl is applied to tuples x, y with |x| = |y| · r Consider structures that represent strings over, say  = {a,b}. I.e.  = {<, A, B}. E.g. abbab is represented by ({1,2,3,4,5}, <, A(1),A(4),B(2),B(3),B(5)) Prove that on strings TrCl 1  TrCl 2

26 Immerman’s Theorem Theorem TrCl + < = NLOGSPACE Corollary NLOGSPACE is closed under complementation.

27 Proof Sketch 1. TrCl \subseteq NLOGSPACE Lemma. Denote PosTrCl the language where trcl is used only in positive positions (under even number of negations). Then: PosTrCL + < = TrCl + < You proved it already in 531 ! Plus: recall how inflationary datalog expresses not TC.

28 Proof Sketch NLOGSPACE \subseteq TrCl + < Standard simulation of a Turing Machine

29 Logics and Complexity Classes DTrCl = transitive closure on deterministic graphs (i.e. where 8 x. 9 · 1 y.  (x, y)). Theorem DTrCl+< = LOGSPACE ATrCl = alternating transitive closure [ define in class ] Theorem ATrCl + < = PTIME

30 Major Open Problem What happens without < ? Open problem. Find a “logic” that captures precisely the order invariant PTIME properties Read 10.7 in the book (pp. 204)