Computational complexity Plan Complexity of a computation. Complexity classes DTIME(T (n)). Relations between complexity classes. Complete problems. Domino problems. NP-completeness. Complete problems for other classes Alternating machines. – p.1/17 Complexity of a computation A machine M is T (n) time bounded if for every n and word w of size n, every computation of M has length at most T (n). A machine M is S(n) space bounded if for every n and word w of size n, every computation of M uses at most S(n) cells of the working tape. Fact: If M is time or space bounded then L(M) is recursive. If L is recursive then there is a time and space bounded machine recognizing L. DTIME(T (n)) = fL(M) : M is det. and T (n) time boundedg NTIME(T (n)) = fL(M) : M is T (n) time boundedg DSPACE(S(n)) = fL(M) : M is det. and S(n) space boundedg NSPACE(S(n)) = fL(M) : M is S(n) space boundedg . – p.2/17 Hierarchy theorems A function S(n) is space constructible iff there is S(n)-bounded machine that given w writes aS(jwj) on the tape and stops. A function T (n) is time constructible iff there is a machine that on a word of size n makes exactly T (n) steps. Thm: Let S2(n) be a space-constructible function and let S1(n) ≥ log(n). If S1(n) lim infn!1 = 0 S2(n) then DSPACE(S2(n)) − DSPACE(S1(n)) is nonempty. Thm: Let T2(n) be a time-constructible function and let T1(n) log(T1(n)) lim infn!1 = 0 T2(n) then DTIME(T2(n)) − DTIME(T1(n)) is nonempty. – p.3/17 Relations between complexity classes Thm: 1. DTIME(T (n)) ⊆ NTIME(T (n)) 2. NTIME(T (n)) ⊆ DSPACE(T (n)) 3. DSPACE(S(n)) ⊆ NSPACE(S(n)) cS(n) 4. DSPACE(S(n)) ⊆ Sc>0 DTIME(2 ), for S(n) ≥ log(n). cS(n) 5. NSPACE(S(n)) ⊆ Sc>0 DTIME(2 ), for S(n) ≥ log(n) which is space constructible. Thm[Sawitch]: If S(n) ≥ log(n) is space constructible then 2 NSPACE(S(n)) ⊆ DSPACE(S(n) ). Thm[Immerman, Szelepcsenyi]: If S(n) ≥ log(n) is space constructible then NSPACE(S(n)) is closed under complementation. – p.4/17 Some standard complexity classes LOGSPACE = DSPACE(log(n)) NLOGSPACE = NSPACE(log(n)) c P = PTIME = Sc2 DTIME(n ) c NP = Sc2 NTIME(n ) c c PSPACE = Sc2 DSPACE(n ) = Sc2 NSPACE(n ) nc EXPTIME = Sc2 DTIME(2 ) nc NEXPTIME = Sc2 NTIME(2 ) nc nc EXPSPACE = Sc2 DSPACE(2 ) = Sc2 NSPACE(2 ) LOGSPACE ⊆ NLOGSPACE ⊆ P ⊆ NP ⊆ PSPACE ⊆ ⊆ EXPTIME ⊆ NEXPTIME ⊆ EXPSPACE NLOGSPACE =6 PSPACE =6 EXPSPACE P =6 EXPTIME NP =6 NEXPTIME . – p.5/17 Reductions, complete problems ∗ ∗ We say that L1 ⊆ Σ1 is poly-time reducible to L2 ⊆ Σ2 ∗ ∗ (L1 ≤P L2) if there is a function f : Σ1 ! Σ2 computable in PTIME such that w 2 L1 iff '(w) 2 L2 Similarly for log-space reducible. Language L hard for a class K if for every L0 2 K there is poly-time reducible to L. Language L is complete for a class K if L 2 K and L is hard for K. Fact: 0 0 If L ≤P L and L 2 P then L 2 P. If there exists NP-complete language L such that L 2 P then P = NP. 0 0 If L is NP-complete and L ≤p L then L is NP-hard. – p.6/17 Domino problems Let C ba a countable set of colours. A domino type is a quadruple d = (l; r; u; d) of colours. D1: Given a finite set T of domino types, number n (in unary) and two domino types dl, du, decide if a grid n × n can be tiled with dominoes of types from T so that the bottom leftmost tile is of type dl and top leftmost tile is of type du. D2: The same but now we need to find m such that there is a tiling of n × m. D3: The same but now we need to find both m and n. D4: Given d and T is there a tiling of a quarter of the plane N × N with leftmost bottom tile of type d. – p.7/17 Domino problems cont. D1: Given a finite set T of domino types, number n (in unary) and two domino types dl, du, decide if a grid n × n can be tiled with dominoes of types from T so that the bottom leftmost tile is of type dl and top leftmost tile is of type du. D2: The same but now we need to find m such that there is a tiling of n × m. D3: The same but now we need to find both m and n. D4: Given d and T is there a tiling of a quarter of the plane N × N with leftmost bottom tile of type d. Thm: Problem D1 is NP-complete. Problem D2 is PSPACE-complete. Problem D3 is r.e. but not recursive. Problem 0 D4 is Π1 in the arithmetic hierarchy. – p.8/17 Problem D1 Take M = hQ; Σ; Γ; q0; B; δ; A; Ri. Let p(n) be the polynomial time bound for M. For every word w 2 Σ∗ we construct a set of tile types T (w) of size jT (w)j = O(p(jwj), and two types dl and dr so that w 2 L(M) iff problem D1 has a solution for (T (w); dl; dr; p(jwj)). – p.9/17 Tiles jL qw0 w1 wn 0 0 1 1 2 n n + 1 Initial tiles: jL ? ? . ? . B B jR n + 1 n + 2 p(n) − 1 p(n) p(n) ¡ ? . ? jR a jL jR ¡ B B B B a Copy tiles: for a 2 Σ jL jR b q0c B q0R q0R B qa c Transition tiles: if (q; a; q0; b; +1) 2 δ q0c b B q0L q0L B c qa if (q; a; q0; b; −1) 2 δ . – p.10/17 SAT problem is NP complete Reduction of D1 to SAT. Let n, T = fd1; : : : ; dkg and dl; du be given. Consider the formulas: n n k Vi=1 Vj=1(Wm=1 LRUDi;j = dm) n n Vi=1 Vj=1(RIGHTi;j = LEFTi+1;j ^ UPi;j = DOWNi;j+1) LRUD1;1 = dl, LRUD1;n = du The conjunction of these formulas is satisfiable iff (T; dl; dr; n) has a solution. – p.11/17 Other NP-complete problems 3-SAT is NP-complete: (α11 _ α12 _ α13) ^ · · · ^ (αn1 _ αn2 _ αn3). Graph coloring is NP-complete: (G; k). Clique problem is NP-complete: (G; k). Hamilton cycle problem is NP complete: G. Knapsack problem is NP complete: i1; : : : ; ik; min; max 2 N, check existence of A ⊆ f1; : : : ; kg such that min ≤ Pj2A ij ≤ max. – p.12/17 Class CONP ∗ L 2 CONP iff Σ − L 2 NP. Fact: If L is NP-complete and L 2 CONP then NP = CONP. Fact: fα : α is a true propositional formulag is CONP complete. ∗ PRIMES = fw 2 f0; 1g : w is a binary repr. of a prime numberg PRIMES 2 CONP PRIMES 2 NP. Thm[Agrawal, Kayal, Saxena, 2002]: PRIMES 2 P. Parity game: a finite game with a Mostowski winning condition and fixed initial vertex. PG = fG : player 0 has a winning strategy in the parity game Gg PG 2 NP \ CONP Open: Is PG 2 P? . – p.13/17 PSPACE Quantified Boolean Formulas (QBF): 9x1:8x2: : : : :9xn.α where x1; : : : ; xn are propositional variables and α a propositional formula. Thm: The set fβ : β is a true QBF formulag is PSPACE-complete. – p.14/17 Alternating Turing Machines M = hQ9; Q8; Σ; Γ; q0; B; δ; A; Ri Such a machine accepts iff player 9 has a winning strategy in the associated game. We can define ATIME(T (n)) and ASPACE(S(n)) as a maximal time and space used in any possible computation. P Σi = fL(M) : M is a ATIME(p(n)) machine with (i − 1) alternations and starting in 9 state} P Πi = fL(M) : M is a ATIME(p(n)) machine with (i − 1) alternations and starting in 8 state} P P Σ1 = NP, Π1 = CONP. – p.15/17 ATIME and ASPACE Thm: If S(n) ≥ log(n) then 2 2 NSPACE(S(n)) ⊆ ATIME(S(n) ) ⊆ DSPACE(S(n) ). cS(n) Thm: If S(n) ≥ log(n) then ASPACE(S(n)) = Sc2 DTIME(2 ). – p.16/17 Exercises 2 What is the relation between classes DSPACE(n ) and 3 DSPACE(S(n)) where S(n) = n for n even and S(n) = n for n odd. n n What is the relation between NSPACE(2 ) and DSPACE(5 ). Show that if there is a PSPACE-hard language L such that L 2 P then PSPACE = P. L 2 NP iff there is a polynomial p(n) and a language R 2 P such that L = fx : 9y: jyj = p(jxj) and (x; y) 2 Rg. Show that if there is a NP-complete language over singleton alphabet then P = NP. – p.17/17.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages17 Page
-
File Size-