IIT Kharagpur 1 Space Complexity

IIT Kharagpur 1 Space Complexity

Computer Science & Engineering Department IIT Kharagpur Theory of Computation: CS41001 Lecture VIII Instructor: Goutam Biswas Autumn Semester 2014-2015 1 Space Complexity In this lecture we shall consider workspace-bounded computation of Turing machines. In such a Turing machine the restriction is put on the number of work-tape cells used by the machine. 1.1 PSPACE, NPSPACE, L and NL We already know that a language L ⊆ {0, 1}∗ is in DSP ACE(s(n)), if there is a function s : N0 → N0 so that there is a Turing machine M, that decides L, using at most s(n) cells of the work tape for all but finite many input x ∈ {0, 1}∗, where n = |x|. In fact a language is in DSP ACE(s(n)) even if it is in DSP ACE(cs(n)) or DSP ACE(O(s(n))), where c > 0 is a constant. NSPACE(s(n)) is defined similarly if there is a nondeterministic Turing machine that decides L (in the usual way), using at most s(n) cells of the work tape. The bound on space has nothing to do with the read-only input tape. So, it makes sense to talk about the sub-linear amount of workspace (s(n) < n). But s(n) should be greater than log n as it may be necessary to remember the position of the input symbols. We know the following relation among the time and space complexity classes. Proposition 1. For any space-constructible function s : N0 → N0, DTIME(s(n)) ⊆ DSPACE(s(n)) ⊆ NSPACE(s(n)) ⊆ DTIME(2O(s(n))). We conclude the following from the previous proposition. Proposition 2. NP ⊆ PSPACE Proof: Let L ∈ NP, so there is a polynomial time Turing machine verifier V and a polynomial p so that for every x ∈ L there is a certificate w ∈ {0, 1}p(|x|) such that V accepts <x,w >. We design a Turing machine as follows: N: input x ∈ {0, 1}∗ 1. Systematically generates string w ∈ {0, 1}p(|x|) (bounded by polynomial space) and performs the following steps. 2. Runs V on <x,w > (polynomial time, so bounded by polynomial space), 3. If V accepts, then accept, else continue. 4. If no witness found, reject. 1 QED. Consider the following language in L and NL. Example 1. We already know that a regular language is in L. As it is not necessary to use any space. Example 2. n n L1 = {0 1 : n ∈ N0}. We have a Turing machine M with read-only input tape and read-write work tape. It works as follows: M: input x 1. Scan the input to see that there is no 0 after 1. If there is, reject. 2. Count the number of 0’s as a binary numeral. 3. Decrement the counter with the number of 1’s. 4. If the count is non-zero and all 1’s are counted, or the count is zero but a few more 1’s are left, then reject, otherwise accept. The counter will take O(log n) work space, so L1 ∈ L. Similarly the context-sensitive language n n n L2 = {0 1 2 : n ∈ N} is also in L. Example 3. MULT = {< a, b, ab >: a, b ∈ N0}. The algorithm depends on the fact that the ith bit of the result depends on j=min(i,n−1) (c + ajbi−j) mod 2, j=maxX(0,i−n) where c is the carry from the previous stage. The value i = 0, · · · , 2n − 1, where both a and b are n bit numbers. The next stage carry is generated as j=min(i,n−1) ⌊(c + ajbi−j)/2⌋. j=maxX(0,i−n) The maximum size of the result to store is O(log n). So MULT ∈ L Example 4. PATH = {< G,s,d >: G is a directed graph with a path from s to d}. Let |V (G)| = n. So the nodes can be numbered with ⌈log2 n⌉ bits. If there is a path from s to t, then there is a nondeterministic choice for the next node. The workspace requirement is O(log n) - the bits of the current node and the bits (partially completed) next node obtained through non-deterministic choice. So a path can be computed in O(log n) work space by a nondeterministic Turing machine in O(log n) work space i.e. PATH ∈ NL . Note that the size of the whole path is O(n log n). We may assume tape to be “write only once” from left to right. Or at any point we can compute the jth bit of the ith node using O(log n) workspace. Whether PATH ∈ L is unknown. But we shall prove that PATH is NL complete. 2 1.2 PSPACE It is not known whether P = PSPACE. But people believe that they are not equal. If P = PSPACE, then P = NP as NP ⊆ PSPACE and P ⊆ NP. Definition 1: A language L is PSPACE-hard if for every L′ ∈ PSPACE, L′ is polynomial ′ time Karp reducible to L, L ≤P L. A language L is PSPACE-complete if it is PSPACE- hard and also belongs to PSPACE. The following language is PSPACE-complete. SP ACE − T MSAT = {< M,x, 1n >: M accepts x in space n} Any language L ∈ P SP ACE is Karp reducible to SP ACE − T MSAT . Let M be a deter- ministic Turing machine decides L in polynomial space p(n), where n is the length of the input. The reduction function maps x →< M,x, 1p(|x|) >, ∀x ∈ {0, 1}∗. Compare it with a similar r.e.-complete language L∈ = {<M,x>: Turing machine M accepts x}, and an NP-complete language T MSAT = {< M,x, 1n, 1t >: ∃w ∈ {0, 1}n such that the TM M accepts <x,w > in t steps}. For every r.e. language L accepted by a Turing machine M, L ≤m L∈. The mapping is ∀x ∈ {0, 1}∗, x →<M,x>. Similarly, for every language L in NP with a p(n) (polynomial) time bounded verifier V and a q(n) (polynomial) length witness, L ≤p T MSAT . The mapping is ∀x ∈ {0, 1}∗,x →< V,x, 1p(|x|), 1q(|x|) >. We are now going to look for a more useful language known to be PSPACE-complete. Definition 2: A quantified Boolean formula (QBF) is defined inductively as follows: 1. Boolean constants true (1) and false (0) are QBFs. 2. Any Boolean variable xi is a QBF. There are denumerable Boolean variables. 3. If f1 and f2 are Boolean formulas and xi is a Boolean variables, then (f1 ∨ f2), (f1 ∧ f2), ¬f1, ∃xif1 and ∀xif1 are QBFs. We shall use appropriate associativity and precedence conventions to avoid most of the paren- thesis. The scope of a quantifier is as usual. In general a QBF looks as follows: Q1x1 · · · Qnxnφ(x1, · · · ,xn), n ≥ 0, where Qi is either an existential (∃) or a universal (∀) quantifier. xi’s are Boolean variables that take values over { true, false}. A QBF is called closed if all variables are quantified. A closed QBF can be evaluated to true (1) or false (0). A variable is said to be free if it is not quantified. An open QBF with k free variables is a map from {0, 1}k → {0, 1}. Example 5. The closed QBF ∃x1∀x2(x1 ∨ x2) is true as x1 = 1 makes the formula always true. But the closed formula ∃x1∀x2(x1 ∧ x2) is false. The open formula ∀x2(x1 ∨ x2), where x1 is the free variable, is a map from {0, 1} → {0, 1}. The Boolean argument goes to x1, ∀x2(0 ∨ x2) → 0, ∀x2(1 ∨ x2) → 1. 3 A QBF is not restricted to prenex normal form. Quantifiers may appear within the body of the formula. But such formula can be convert to prenex normal form using the following equivalences: ∀xφ(x) ≡ ¬¬∀xφ(x) ≡ ¬∃x¬φ(x), ψ ∨∃xφ(x) ≡ ∃x(ψ ∨ φ(x)), ψ ∧∀xφ(x) ≡ ∀x(ψ ∧ φ(x)), where ψ does not have any free x. If ψ has a free variable x, then we can rename the bound variable in ∀xφ(x). Example 6. The question of satisfiability of φ(x1, · · · ,xn) is equivalent to the question of truth value of the QBF ∃x1 ···∃φ(x1, · · · ,xn). The formula φ(x1, · · · ,xn) is SAT if and only if ∃x1 ···∃φ(x1, · · · ,xn) is true. Similarly the question of validity of φ(x1, · · · ,xn) is equivalent to the truth value of ∀x1 ···∀xnφ(x1, · · · ,xn). The formula φ(x1, · · · ,xn) is a tautology (in TAUT) if and only if ∀x1 ···∀xnφ(x1, · · · ,xn) is true. The language TQBF is defined as follows: TQBF = {ψ : ψ is a closed and true QBF}. Theorem 3. The language TQBF is PSPACE-complete. Proof: First we prove that TQBF is in PSPACE. Let the size of the formula ψ be m and there are n variables. If (n = 0), the formula contains Boolean constants, and it can be evaluated in O(m) time and space. Let s(n,m) be the space required to evaluate a formula of n variables and of length m. If we initialise the first variable x1 with 0, we get a new formula ψ[x1 ← 0] of n − 1 variables. Similarly, if we initialise x1 with 1, we get another formula ψ[x1 ← 1] of n − 1 variables. So we have the following recursive procedure to evaluate the truth value of a QBF. eval(Qixi · · · Qnxnφ(v1, · · · , vi−1,xi, · · · ,xn), i) if i = n evaluate the constant Boolean expression.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    12 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us