1 Polynomial Space The classes PS and NPS Relationship to Other Classes Equivalence PS = NPS A PS-Complete Problem.

Slides:



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

INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
Complexity Classes: P and NP
Variants of Turing machines
1 Savitch and Immerman- Szelepcsènyi Theorems. 2 Space Compression  For every k-tape S(n) space bounded offline (with a separate read-only input tape)
1 Nondeterministic Space is Closed Under Complement Presented by Jing Zhang and Yingbo Wang Theory of Computation II Professor: Geoffrey Smith.
Cook’s Theorem The Foundation of NP-Completeness.
1 More NP-Complete Problems NP-Hard Problems Tautology Problem Node Cover Knapsack.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen.
1 More Undecidable Problems Rice’s Theorem Post’s Correspondence Problem Some Real Problems.
Complexity 25-1 Complexity Andrei Bulatov #P-Completeness.
Complexity 12-1 Complexity Andrei Bulatov Non-Deterministic Space.
Complexity 11-1 Complexity Andrei Bulatov Space Complexity.
1 L is in NP means: There is a language L’ in P and a polynomial p so that L 1 · L 2 means: For some polynomial time computable map r : 8 x: x 2 L 1 iff.
Computability and Complexity 14-1 Computability and Complexity Andrei Bulatov Cook’s Theorem.
1 Introduction to Computability Theory Lecture11: Variants of Turing Machines Prof. Amos Israeli.
Introduction to Computability Theory
P, NP, PS, and NPS By Muhannad Harrim. Class P P is the complexity class containing decision problems which can be solved by a Deterministic Turing machine.
1 The Satisfiability Problem Cook’s Theorem: An NP-Complete Problem Restricted SAT: CSAT, 3SAT.
1 Intractable Problems Time-Bounded Turing Machines Classes P and NP Polynomial-Time Reductions.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY Read sections 7.1 – 7.3 of the book for next time.
Normal Forms for CFG’s Eliminating Useless Variables Removing Epsilon
Submitted by : Estrella Eisenberg Yair Kaufman Ohad Lipsky Riva Gonen Shalom.
1 Pushdown Automata Definition Moves of the PDA Languages of the PDA Deterministic PDA’s.
1 Decidability Turing Machines Coded as Binary Strings Diagonalizing over Turing Machines Problems as Languages Undecidable Problems.
Normal forms for Context-Free Grammars
CS5371 Theory of Computation Lecture 8: Automata Theory VI (PDA, PDA = CFG)
February 20, 2015CS21 Lecture 191 CS21 Decidability and Tractability Lecture 19 February 20, 2015.
Restricted Satisfiability (SAT) Problem
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.
Properties of Context-Free Languages
Lecture 18 Various TMs. Allow the head not move Theorem. If the head is allowed to stay at the cell in each move, then every function computed by the.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
CS 461 – Nov. 21 Sections 7.1 – 7.2 Measuring complexity Dividing decidable languages into complexity classes. Algorithm complexity depends on what kind.
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.
Undecidability Everything is an Integer Countable and Uncountable Sets
1 Data-Flow Analysis Proving Little Theorems Data-Flow Equations Major Examples.
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.
1 Pushdown Automata Definition: relation to  -NFA Moves of the PDA Languages of the PDA Deterministic PDA’s Quiz Wednesday on CFGs lecture #3.
1 More About Turing Machines “Programming Tricks” Restrictions Extensions Closure Properties.
1 P P := the class of decision problems (languages) decided by a Turing machine so that for some polynomial p and all x, the machine terminates after at.
A Problem That Is Complete for PSPACE (Polynomial Space) BY TEJA SUDHA GARIGANTI.
1 Undecidability Everything is an Integer Countable and Uncountable Sets Turing Machines Recursive and Recursively Enumerable Languages.
Strings Basic data type in computational biology A string is an ordered succession of characters or symbols from a finite set called an alphabet Sequence.
Chapter 11 Introduction to Computational Complexity Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1.
1 Pushdown Automata Definition Moves of the PDA Languages of the PDA Deterministic PDA’s.
1 Section 13.1 Turing Machines A Turing machine (TM) is a simple computer that has an infinite amount of storage in the form of cells on an infinite tape.
1 Turing Machines and Equivalent Models Section 13.1 Turing Machines.
Overview of the theory of computation Episode 3 0 Turing machines The traditional concepts of computability, decidability and recursive enumerability.
CSCI 2670 Introduction to Theory of Computing December 2, 2004.
CSCI 2670 Introduction to Theory of Computing December 7, 2005.
Given this 3-SAT problem: (x1 or x2 or x3) AND (¬x1 or ¬x2 or ¬x2) AND (¬x3 or ¬x1 or x2) 1. Draw the graph that you would use if you want to solve this.
Theory of Computational Complexity Yuji Ishikawa Avis lab. M1.
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.
1 8.4 Extensions to the Basic TM Extended TM’s to be studied: Multitape Turing machine Nondeterministic Turing machine The above extensions make no increase.
1 SAT SAT: Given a Boolean function in CNF representation, is there a way to assign truth values to the variables so that the function evaluates to true?
Intractable Problems Time-Bounded Turing Machines Classes P and NP
Part VI NP-Hardness.
Relationship to Other Classes
Turing Machines Acceptors; Enumerators
Summary.
Intractable Problems Time-Bounded Turing Machines Classes P and NP
Intractable Problems Time-Bounded Turing Machines Classes P and NP
Intractable Problems Time-Bounded Turing Machines Classes P and NP
The Satisfiability Problem
CS21 Decidability and Tractability
The Satisfiability Problem
Intro to Theory of Computation
Presentation transcript:

1 Polynomial Space The classes PS and NPS Relationship to Other Classes Equivalence PS = NPS A PS-Complete Problem

2 Polynomial-Space-Bounded TM’s uA TM M is said to be polyspace- bounded if there is a polynomial p(n) such that, given input of length n, M never uses more than p(n) cells of its tape. uL(M) is in the class polynomial space, or PS.

3 Nondeterministic Polyspace uIf we allow a TM M to be nondeterministic but to use only p(n) tape cells in any sequence of ID’s when given input of length n, we say M is a nondeterministic polyspace-bounded TM. uAnd L(M) is in the class nondeterministic polyspace, or NPS.

4 Relationship to Other Classes uObviously, P  PS and NP  NPS. wIf you use polynomial time, you cannot reach more than a polynomial number of tape cells. uAlas, it is not even known whether P = PS or NP = PS. uOn the other hand, we shall show PS = NPS.

5 Exponential Polytime Classes uA DTM M runs in exponential polytime if it makes at most c p(n) steps on input of length n, for some constant c and polynomial p. uSay L(M) is in the class EP. uIf M is an NTM instead, say L(M) is in the class NEP (nondeterministic exponential polytime ).

6 More Class Relationships uP  NP  PS  EP, and at least one of these is proper. wA diagonalization proof shows that P  EP. uPS  EP requires proof. uKey Point: A polyspace-bounded TM has only c p(n) different ID’s. wWe can count to c p(n) in polyspace and stop it after it surely repeated an ID.

7 Proof PS  EP uLet M be a p(n)-space bounded DTM with s states and t tape symbols. uAssume M has only one semi-infinite tape. uThe number of possible ID’s of M is sp(n)t p(n). States Positions of tape head Tape contents

8 Proof PS  EP – (2) uNote that (t+1) p(n)+1 > p(n)t p(n). wUse binomial expansion (t+1) p(n)+1 = t p(n)+1 + (p(n)+1)t p(n) + … uAlso, s = (t+1) c, where c = log t+1 s. uThus, sp(n)t p(n) < (t+1) p(n)+1+c. uWe can count to the maximum number of ID’s on a separate tape using base t+1 and p(n)+1+c cells – a polynomial.

9 Proof PS  EP – (2) uRedesign M to have a second tape and to count on that tape to sp(n)t p(n). uThe new TM M’ is polyspace bounded. uM’ halts if its counter exceeds sp(n)t p(n). wIf M accepts, it does so without repeating an ID. uThus, M’ is exponential-polytime bounded, proving L(M) is in EP.

10 Savitch’s Theorem: PS = NPS uKey Idea: a polyspace NTM has “only” c p(n) different ID’s it can enter.  Implement a deterministic, recursive function that decides, about the NTM, whether I ⊦ *J in at most m moves. uAssume m < c p(n), since if the NTM accepts, it does so without repeating an ID.

11 Savitch’s Theorem – (2)  Recursive doubling trick: to tell if I ⊦ *J in < m moves, search for an ID K such that I ⊦ *K and K ⊦ *J, both in < m/2 moves.  Complete algorithm: ask if I 0 ⊦ *J in at most c p(n) moves, where I 0 is the initial ID with given input w of length n, and J is any of the ID’s with an accepting state and length < p(n).

12 Recursive Doubling boolean function f(I, J, m) { for (all ID’s K using p(n) tape) if (f(I, K, m/2) && f(K, J, m/2)) return true; return false; }

13 Stack Implementation of f I, J, m O(p(n)) space I, K, m/2 O(p(n)) space L, K, m/4 O(p(n)) space M, N, 1 O(p(n)) space... O(p 2 (n)) space

14 Space for Recursive Doubling uf(I, J, m) requires space O(p(n)) to store I, J, m, and the current K. wm need not be more than c p(n), so it can be stored in O(p(n)) space. uHow many calls to f can be active at once? uLargest m is c p(n).

15 Space for Recursive Doubling – (2) uEach call with third argument m results in only one call with argument m/2 at any one time. uThus, at most log 2 c p(n) = O(p(n)) calls can be active at any one time. uTotal space needed by the DTM is therefore O(p 2 (n)) – a polynomial.

16 PS-Complete Problems uA problem P in PS is said to be PS- complete if there is a polytime reduction from every problem in PS to P. wNote: it has to be polytime, not polyspace, because: 1.Polyspace can exponentiate the output size. 2.Without polytime, we could not deal with the question P = PS?

17 What PS-Completeness Buys uIf some PS-complete problem is: 1.In P, then P = PS. 2.In NP, then NP = PS.

18 Quantified Boolean Formulas uWe shall meet a PS-complete problem, called QBF : is a given quantified boolean formula true? uBut first we meet the QBF’s themselves. uWe shall give a recursive (inductive) definition of QBF’s along with the definition of free/bound variable occurrences.

19 QBF’s – (2) uFirst-order predicate logic, with variables restricted to true/false. uBasis: 1.Constants 0 (false) and 1 (true) are QBF’s. 2.A variable is a QBF, and that variable occurrence is free in this QBF.

20 QBF’s – (3) uInduction: If E and F are QBF’s, so are: 1.E AND F, E OR F, and NOT F. uVariables are bound or free as in E or F. 2.(  x)E and (  x)E for any variable x. uAll free occurrences x are bound to this quantifier, and other occurrences of variables are free/bound as in E. uUse parentheses to group as needed. uPrecedence: quantifiers, NOT, AND, OR.

21 Example: QBF (  x)(  y) ( ( (  x)(x OR y) ) AND NOT (x AND y) ) bound

22 Evaluating QBF’s uIn general, a QBF is a function from truth assignments for its free variables to {0, 1} (false/true). uImportant special case: no free variables; a QBF is either true or false. uWe shall give the evaluation only for these formulas.

23 Evaluating QBF’s – (2) uInduction on the number of operators, including quantifiers. uStage 1: eliminate quantifiers. uStage 2: evaluate variable-free formulas. uBasis: 0 operators. wExpression can only be 0 or 1, because there are no free variables. wTruth value is 0 or 1, respectively.

24 Induction 1.Expression is NOT E, E OR F, or E AND F. wEvaluate E and F; apply boolean operator to the results. 2.Expression is (  x)E. wConstruct E 0 = E with each x bound to this quantifier replaced by 0, and analogously E 1. wE is true iff both E 0 and E 1 are true. 3.Expression is (  x)E. wSame, but E is true iff either E 0 or E 1 is true.

25 Example: Evaluation (  x)(  y) ( ( (  x)(x OR y) ) AND NOT (x AND y) ) uSubstitute x = 0 for outer quantifier: (  y) ( ( (  x)(x OR y) ) AND NOT (0 AND y) ) uSubstitute x = 1 for outer quantifier: (  y) ( ( (  x)(x OR y) ) AND NOT (1 AND y) )

26 Example: Evaluation – (2) uLet’s follow the x = 0 subproblem: (  y) ( ( (  x)(x OR y) ) AND NOT (0 AND y) ) uTwo cases: y = 0 and y = 1. ( (  x)(x OR 0) ) AND NOT (0 AND 0) ( (  x)(x OR 1) ) AND NOT (0 AND 1)

27 Example: Evaluation – (3) uLet’s follow the y = 0 subproblem: ( (  x)(x OR 0) ) AND NOT (0 AND 0) uNeed to evaluate (  x)(x OR 0). wx = 0: 0 OR 0 = 0. wx = 1: 1 OR 0 = 1. wHence, value is 1. uAnswer is 1 AND NOT (0 AND 0) = 1.

28 Example: Evaluation – (4) uLet’s follow the y = 1 subproblem: ( (  x)(x OR 1) ) AND NOT (0 AND 1) uNeed to evaluate (  x)(x OR 1). wx = 0: 0 OR 1 = 1. wx = 1: 1 OR 1 = 1. uHence, value is 1. uAnswer is 1 AND NOT (0 AND 1) = 1.

29 Example: Evaluation – (5) uNow we can resolve the (outermost) x = 0 subproblem: (  y) ( ( (  x)(x OR y) ) AND NOT (0 AND y) ) uWe found both of its subproblems are true. uWe only needed one, since the outer quantifier is  y. uHence, 1.

30 Example: Evaluation – (6) uNext, we must deal with the x = 1 case: (  y) ( ( (  x)(x OR y) ) AND NOT (1 AND y) ) uIt also has the value 1, because the subproblem y = 0 evaluates to 1. uHence, the entire QBF has value 1.

31 The QBF Problem uThe problem QBF is: wGiven a QBF with no free variables, is its value 1 (true)? uTheorem: QBF is PS-complete. uComment: What makes QBF extra hard? Alternation of quantifiers. wExample: if only  used, then the problem is really SAT.

32 Part I: QBF is in PS uSuppose we are given QBF F of length n. uF has at most n operators. uWe can evaluate F using a stack of subexpressions that never has more than n subexpressions, each of length < n. uThus, space used is O(n 2 ).

33 QBF is in PS – (2) uSuppose we have subexpression E on top of the stack, and E = G OR H. 1.Push G onto the stack. 2.Evaluate it recursively. 3.If true, return true. 4.If false, replace G by H, and return what H returns.

34 QBF is in PS – (3) uCases E = G AND H and E = NOT G are handled similarly. uIf E = (  x)G, then treat E as if it were E = E 0 OR E 1. wObserve: difference between  and OR is succinctness; you don’t write both E 0 and E 1. But E 0 and E 1 must be almost the same. uIf E = (  x)G, then treat E as if it were E = E 0 AND E 1.

35 Part II: All of PS Polytime Reduces to QBF uRecall that if a polyspace-bounded TM M accepts its input w of length n, then it does so in c p(n) moves, where c is a constant and p is a polynomial. uUse recursive doubling to construct a QBF saying “there is a sequence of c p(n) moves of M leading to acceptance of w.”

36 Polytime Reduction: The Variables uWe need collections of boolean variables that together represent one ID of M. uA variable ID I is a collection of O(p(n)) variables y j,A. wTrue iff the j-th position of the ID I is A (a state or tape symbol). w0 < j < p(n)+1 = length of an ID.

37 The Variables – (2) uWe shall need O(p(n)) variable ID’s. wSo the total number of boolean variables is O(p 2 (n)). uShorthand: (  I), where I is a variable ID, is short for (  y 1 )(  y 2 )(…), where the y’s are the boolean variables belonging to I. uSimilarly (  I).

38 Structure of the QBF uThe QBF is (  I 0 )(  I f )(S AND N AND F AND U), where: 1.I 0 and I f are variable ID’s representing the start and accepting ID’s respectively. 2.U = “unique” = one symbol per position. 3.S = “starts right”: I 0 = q 0 w. 4.F = “finishes right” = I f accepts. 5.N = “moves right.”

39 Structure of U, S, and F uU is as done for Cook’s theorem. uS asserts that the first n+1 symbols of I 0 are q 0 w, and other symbols are blank. uF asserts one of the symbols of I f is a final state. uAll are easy to write in O(p(n)) time.

40 Structure of QBF N  N(I 0,I f ) needs to say that I 0 ⊦ *I f by at most c p(n) moves.  We construct subexpressions N 0, N 1, N 2,… where N i (I,J) says “I ⊦ *J by at most 2 i moves.” uN is N k, where k = log 2 c p(n) = O(p(n)). Note: differs from text, where the subscripts exponentiate.

41 Constructing the N i ’s  Basis: N 0 (I, J) says “I=J OR I ⊦ J.” uIf I represents variables y j,A and J represents variables z j,A, we say I=J by the boolean expression for y j,A = z j,A for all j and A. wRemember: a=b is (a AND b) OR (NOT a AND NOT b).  I ⊦ J uses the same idea as for SAT.

42 Induction uSuppose we have constructed N i and want to construct N i+1. uN i+1 (I, J) = “there exists K such that N i (I, K) and N i (K, J).” uWe must be careful: wWe must write O(p(n)) formulas, each in polynomial time.

43 Induction – (2) uIf each formula used two copies of the previous formula, times and sizes would exponentiate. uTrick: use  to make one copy of N i serve for two. uN i+1 (I, J) = “if (P,Q) = (I,K) or (P,Q) = (K,J), then N i (P, Q).”

44 Induction – (3) uMore formally, N i+1 (I, J) = (  K)(  P)(  Q) ( ( (P  I OR Q  K) AND (P  K OR Q  J) ) OR N i (P, Q) ) Express as boolean variables Pair (P,Q) is neither (I,K) nor (K,J) Or P ⊦ *Q in at most 2 i moves.

45 Induction – (4) uWe can thus write N i+1 in time O(p(n)) plus the time it takes to write N i. uRemember: N is N k, where k = log 2 c p(n) = O(p(n)). uThus, we can write N in time O(p 2 (n)). uFinished!! The whole QBF for w can be written in polynomial time.