polynomial space
play

Polynomial Space [HMU06,Chp.11b] The classes PS and NPS - PowerPoint PPT Presentation

Polynomial Space [HMU06,Chp.11b] The classes PS and NPS Relationship to Other Classes Equivalence PS = NPS Quantified Boolean Formulas A PS-Complete Problem 1 Polynomial Space Machines & Classes 2


  1. Polynomial Space [HMU06,Chp.11b] • The classes PS and NPS • Relationship to Other Classes • Equivalence PS = NPS • Quantified Boolean Formulas • A PS-Complete Problem 1

  2. Polynomial Space Machines & Classes 2

  3. Polynomial-Space-Bounded TM’s  A 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.  L(M) is in the class polynomial space , or PS , also called PSPACE. 3

  4. NonDeterministic Polyspace  If 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.  And L(M) is in the class nondeterministic polyspace , or NPS . 4

  5. Relationship to Other Classes  Obviously, P ⊆ PS and NP ⊆ NPS .  If you use polynomial time, you cannot reach more than a polynomial number of tape cells.  Alas, it is not even known whether P = PS or NP = PS .  On the other hand, we shall show PS = NPS . [cf. believed P≠NP] 5

  6. Exponential Polytime Classes  A 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 some polynomial p.  Say L(M) is in the class EXP .  If M is an NTM instead, say L(M) is in the class NEXP ( nondeterministic exponential polytime ). 6

  7. More Class Relationships  P ⊆ NP ⊆ PS ⊆ EXP  at least one of these is proper.  a diagonalization proof shows that P ≠ EXP .  PS ⊆ EXP requires proof.  Key Point: A polyspace-bounded TM has only c p(n) different ID’s.  We can count to c p(n) in polyspace and stop it after it surely repeated an ID. 7

  8. Proof PS ⊆ EXP  Let M be a p(n)-space bounded DTM with s states and t tape symbols.  Assume M has only one semi-infinite tape.  The number of possible ID’s of M is s ⨯ p(n) ⨯ t p(n) . Tape Positions of contents States tape head 8

  9. Proof PS ⊆ EXP – (2)  Note that (t+ 1) p(n)+ 1 > p(n)t p(n) .  Use binomial expansion (t+ 1) p(n)+ 1 = t p(n)+ 1 + (p(n)+ 1)t p(n) + …  Also, s = (t+ 1) c , where c = log t+ 1 s.  Thus, s ⨯ p(n) ⨯ t p(n) < (t+ 1) p(n)+ 1+ c .  We 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

  10. Proof PS ⊆ EXP – (3)  Redesign M to have a second tape and to count on that tape to s ⨯ p(n) ⨯ t p(n) .  The new TM M’ is polyspace bounded.  M’ halts if its counter exceeds s ⨯ p(n) ⨯ t p(n) .  If M accepts, it does so without repeating an ID.  Thus, M’ is exponential-polytime bounded, proving L(M) is in EXP . 10

  11. Equivalence PS = NPS 11

  12. Savitch’s Theorem: PS = NPS  Key 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.  Assume m < c p(n) , since if the NTM accepts, it does so without repeating an ID. 12

  13. 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). 13

  14. 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; } 14

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

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

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

  18. PS-Complete Problems  A problem P in PS is said to be PS- complete if there is a polytime reduction from every problem in PS to P.  Note: 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 ? 18

  19. What PS-Completeness Buys  If some PS-complete problem is: 1. In P , then P = PS . 2. In NP , then NP = PS . 19

  20. Quantified Boolean Formulas 20

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

  22. QBF’s – (2)  First-order predicate logic, with variables restricted to true/false.  Basis: 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. 22

  23. QBF’s – (3)  Induction: If E and F are QBF’s, so are: 1. E ∧ F, E ∨ F, and ¬ F.  Variables are bound or free as in E or F. 2. ( ∀ x)E and ( ∃ x)E for any variable x.  All free occurrences x are bound to this quantifier , and other occurrences of variables are free/bound as in E.  Use parentheses to group as needed.  Precedence: quantifiers, ¬ , ∧ , ∨ . 23

  24. Example: QBF bound ( ∀ x)( ∃ y) ( ( ( ∃ x)(x ∨ y) ) ∧ ¬ (x ∧ y) ) bound bound 24

  25. Evaluating QBF’s  In general, a QBF is a function from truth assignments for its free variables to { 0, 1} (False/True).  Important special case: no free variables; a QBF is either true or false.  We shall give the evaluation only for these formulas. 25

  26. Evaluating QBF’s – (2)  Induction on the number of operators, including quantifiers.  Stage 1: eliminate quantifiers.  Stage 2: evaluate variable-free formulas.  Basis: 0 operators.  Expression can only be 0 or 1, because there are no free variables.  Truth value is 0 or 1, respectively. 26

  27. Induction 1. Expression is ¬ E, E ∨ F, or E ∧ F.  Evaluate E and F; apply boolean operator to the results. 2. Expression is ( ∀ x)E.  Construct E 0 = E with each x bound to this quantifier replaced by 0, and analogously E 1 .  E is true iff both E 0 and E 1 are true. 3. Expression is ( ∃ x)E.  Same, but E is true iff E 0 or E 1 is true. 27

  28. Example: Evaluation ( ∀ x)( ∃ y) ( ( ( ∃ x)(x ∨ y) ) ∧ ¬ (x ∧ y) )  Substitute x = 0 for outer quantifier: ( ∃ y) ( ( ( ∃ x)(x ∨ y) ) ∧ ¬ (0 ∧ y) )  Substitute x = 1 for outer quantifier: ( ∃ y) ( ( ( ∃ x)(x ∨ y) ) ∧ ¬ (1 ∧ y) ) 28

  29. Example: Evaluation – (2)  Let’s follow the x = 0 subproblem: ( ∃ y) ( ( ( ∃ x)(x ∨ y) ) ∧ ¬ (0 ∧ y) )  Two cases: y = 0 and y = 1. ( ( ∃ x)(x ∨ 0) ) ∧ ¬ (0 ∧ 0) ( ( ∃ x)(x ∨ 1) ) ∧ ¬ (0 ∧ 1) 29

  30. Example: Evaluation – (3)  Let’s follow the y = 0 subproblem: ( ( ∃ x)(x ∨ 0) ) ∧ ¬ (0 ∧ 0)  Need to evaluate ( ∃ x)(x ∨ 0).  x = 0: 0 ∨ 0 = 0.  x = 1: 1 ∨ 0 = 1.  Hence, value is 1.  Answer is 1 ∧ ¬ (0 ∧ 0) = 1. 30

  31. Example: Evaluation – (4)  Let’s follow the y = 1 subproblem: ( ( ∃ x)(x ∨ 1) ) ∧ ¬ (0 ∧ 1)  Need to evaluate ( ∃ x)(x ∨ 1).  x = 0: 0 ∨ 1 = 1.  x = 1: 1 ∨ 1 = 1.  Hence, value is 1.  Answer is 1 ∧ ¬ (0 ∧ 1) = 1. 31

  32. Example: Evaluation – (5)  Now we can resolve the (outermost) x = 0 subproblem: ( ∃ y) ( ( ( ∃ x)(x ∨ y) ) ∧ ¬ (0 ∧ y) )  We found both of its subproblems are true.  We only needed one, since the outer quantifier is ∃ y.  Hence, 1. 32

  33. Example: Evaluation – (6)  Next, we must deal with the x = 1 case: ( ∃ y) ( ( ( ∃ x)(x ∨ y) ) ∧ ¬ (1 ∧ y) )  It also has the value 1, because the subproblem y = 0 evaluates to 1.  Hence, the entire QBF has value 1. 33

  34. A PS-Complete Problem: QBF 34

  35. The QBF Problem  The problem QBF is:  Given a QBF with no free variables, is its value 1 (true)?  Theorem: QBF is PS-complete.  Comment: What makes QBF extra hard? Alternation of quantifiers.  Example: if only ∃ used, then the problem is really SAT. 35

  36. Part I: QBF is in PS  Suppose we are given QBF F of length n.  F has at most n operators.  We can evaluate F using a stack of subexpressions that never has more than n subexpressions, each of length < n.  Thus, space used is O(n 2 ). 36

  37. QBF is in PS – (2)  Suppose we have subexpression E on top of the stack, and E = G ∨ 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. 37

Recommend


More recommend