Definition: Let M be a deterministic Turing Machine that halts on all inputs. Space Complexity of M...
-
Upload
winfred-barrett -
Category
Documents
-
view
212 -
download
0
Transcript of Definition: Let M be a deterministic Turing Machine that halts on all inputs. Space Complexity of M...
![Page 1: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032802/56649dff5503460f94ae7043/html5/thumbnails/1.jpg)
*THEORY OF COMPUTATION
TOPIC:COMPLEXITY CLASSES
SPACE COMPLEXITY
SHESHAN SRIVATHSA
![Page 2: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032802/56649dff5503460f94ae7043/html5/thumbnails/2.jpg)
*INTRODUCTION
Definition:Let M be a deterministic Turing Machine that halts on all inputs.Space Complexity of M is the function f:NN, where f(n) is the maximum number of tape cells that M scans on any input of length n.
For any function f:NN, we define:
SPACE(f(n))={L | L is a language decided by an O(f(n)) space DTM}
NSPACE(f(n))={L | L is a language decided by an O(f(n)) space NTM}
![Page 3: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032802/56649dff5503460f94ae7043/html5/thumbnails/3.jpg)
*INTRODUCTION
Low Space Classes:
Definitions (logarithmic space classes):
L = SPACE(logn)NL = NSPACE(logn)
![Page 4: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032802/56649dff5503460f94ae7043/html5/thumbnails/4.jpg)
*Analyzing Space Complexity
If M is a deterministic Turing machine that halts on an inputs, then the value of
spacereq(M) is the function f(n) defined so that, for any natural number n,f(n) is
the maximum number of tape squares that M reads on any input of length n.
If M is a nondeterministic Turing machine all of whose computational paths halt on all
inputs, then the value of spacereq(M) is the function f(n) defined so that, for any natural
number n,f(n) is the maximum number of tape squares that M reads on
any path that it executes on any input of length n.
![Page 5: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032802/56649dff5503460f94ae7043/html5/thumbnails/5.jpg)
*EXAMPLE
SAT is NP-complete.
SAT can be solved in linear(O(m)) space.
M1=“On input <>, where is a Boolean formula:
1. For each truth assignment to the variables x1,…xm of .
2. Evaluate on that truth assignment.
3. If ever evaluate to 1, ACCEPT; if not, REJECT.”
0 0 0 … 0
x1 x2 x3 … xn
![Page 6: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032802/56649dff5503460f94ae7043/html5/thumbnails/6.jpg)
*Relating Time and Space Complexity
Theorem: Given a Turing machine M = (K , 2:., r, 8, s, H) and assuming that spacereq(M) ~
n, the following relationships hold between M's time and space requirements:
spacereq(M) < timereq(M) E o (cspacereq(M) )
Proof: Spacereq(M) is bounded by timereq(M) since M must use at least one time step for every
tape square it visits.
The upper bound on timereq(M) follows from the fact, since M halts, the number of steps that it
can execute is bounded by the number of distinct configurations that it can enter. That number is
given by the function MaxConfigs(M), as described above. Since MaxConjigs(M) E
O(cspacereq(M»), timereq(M) E O(cspacereq(M»).
![Page 7: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032802/56649dff5503460f94ae7043/html5/thumbnails/7.jpg)
*Savitch’s Theorem
Proof:
Suppose language A can be decided by an NTM in k f(n) space,
for some constant k.
We shall show that it can be decided by a DTM in O((f(n))2) space.
Let be an input string to N.t: integer;
c1,c2: configurations of N on .
Theorem
For any function f: NR+, where f(n)n, we have
NSPACE(f(n)) SPACE(f2(n)).
![Page 8: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032802/56649dff5503460f94ae7043/html5/thumbnails/8.jpg)
*Savitch’s Theorem
CANYIELD(c1,c2,t) accept if starting from c1 N has a branch
entering configuration c2 in t steps; o/w rejects.CANYIELD=“On input c1,c2 and t:
1. If t=1, test whether c1=c2 or c1├ c2, then accept; else reject.
2. If t>1, then for each configuration cm of N on using space f(n).
3. Run CANYIELD(c1,cm, ) 4. Run CANYIELD(cm,c2, ) 5. If 3 & 4 both accept, then accept; else reject.”
![Page 9: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032802/56649dff5503460f94ae7043/html5/thumbnails/9.jpg)
caccept: accept configuration.cstart: start configuration of N on .
Select a constant d so that N has no more than 2df(n) configurations
using f(n) tape space, n=| |.M=“On input output the result of CANYIELD(cstart, caccept, 2df(n)).”CANYIELD is a recursive procedure:•Recursive depth:log22df(n)=O(f(n))•Each recursive call of CANYIELD use O(f(n)) space.•Thus, it uses O(f2(n)) space.
![Page 10: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032802/56649dff5503460f94ae7043/html5/thumbnails/10.jpg)
*Example of Savitch’s algorithmboolean PATH(a,b,d) {
if there is an edge from a to b then
return TRUE else { if (d=1) return FALSE for every vertex v (not a,b) { if PATH(a,v, d/2) and PATH(v,b, d/2) then return TRUE } return FALSE }}
1
4
32
![Page 11: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032802/56649dff5503460f94ae7043/html5/thumbnails/11.jpg)
*PSPACE AND NSPACE
PSPACE is the class of languages (or problems) that are decidable in polynomial space on a det. TM.
Similarly we can define NPSPACE to be the class of languages that are decidable in polynomial space by a NTM.
So, what is the relationship between PSPACE and NPSPACE?
![Page 12: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032802/56649dff5503460f94ae7043/html5/thumbnails/12.jpg)
PSPACE = NPSPACE
Theorem: PSPACE = NPSPACE
Proof : If L is in PSPACE, then it must also be in NPSPACE because
the deterministic Turing machine that decides it in polynomial time is
also a nondeterministic Turing machine that decides it in polynomial
time.
It is an important corollary of Savitch's Theorem.
![Page 13: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032802/56649dff5503460f94ae7043/html5/thumbnails/13.jpg)
*PSPACE Completeness
Definition:
A language B is PSPACE-Complete if
1. BPSPACE
2. For every ASPACE, APB.
If B is just satisfies Condition 2, we say B is PSPACE-hard
![Page 14: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032802/56649dff5503460f94ae7043/html5/thumbnails/14.jpg)
*P, NP, and PSPACE
Theorem: P PSPACE⊆
Proof: If a language is decided by some DTM M
in f(n) time, M cannot see more than f(n) cells.
Thus, TIME(f(n)) ⊆ SPACE(f(n)),
So that P ⊆ PSPACE
![Page 15: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032802/56649dff5503460f94ae7043/html5/thumbnails/15.jpg)
*PSPACE and EXPTIME
Proof: If a language is decided by some DTM M in f(n)
space (where f(n) >=n), M can visit at most f(n) 2 O(f(n))
configurations (why?) Thus, M must run in f(n) 2 O(f(n))
time.
In other words, SPACE(f(n)) ⊆ TIME(2O(f(n))),
so that PSPACE ⊆ EXPTIME.
P NP P SPACE EXPTIME⊆ ⊆ ⊆
![Page 16: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032802/56649dff5503460f94ae7043/html5/thumbnails/16.jpg)
*A Hierarchy ofComplexity
![Page 17: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032802/56649dff5503460f94ae7043/html5/thumbnails/17.jpg)
*The Language QBF
Mathematical statements usually involve quantifiers: 8 (for all) and 9
(there exists)
• E.g., 8x F(x) means for every value of x, the statement F(x) is TRUE
• E.g., 9x F(x) means there exists some value of x such that F(x) is
TRUE
•Boolean formulas with quantifiers are called quantified Boolean
formulas
• E.g., 9y ( y = x+1) and 8x (9y ( y x)) are quantified Boolean
formulas
![Page 18: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032802/56649dff5503460f94ae7043/html5/thumbnails/18.jpg)
All of the following are quantified Boolean expressions.
• (P 1\ ,R)~S
• 3P «P 1\ ,R) ~ S)
• \iR (3P «P 1\ ,R) ~ S»
• \iS (\iR (3P «P 1\ ,R) ~ S»).
All quantified Boolean expressions are in prenex normal form.
![Page 19: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032802/56649dff5503460f94ae7043/html5/thumbnails/19.jpg)
*TQBF is PSPACE Complete
Theorem: TQBF is PSPACE-Complete
Proof:
(s,t,|V|) is TRUE iff there is a path from s to t.
is constructible in poly-time.
Thus, any PSPACE language is poly-time reducible to TQBF,
i.e. TQBF is PSPACE-hard.
Since TQBFPSPACE, it’s PSPACE-Complete.
![Page 20: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032802/56649dff5503460f94ae7043/html5/thumbnails/20.jpg)
*EXAMPLE(1)PSPACE-complete:The generalized version of some common games we play are PSPACE-complete:
Game of the Amazons Tic-Tac-Toe
![Page 21: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032802/56649dff5503460f94ae7043/html5/thumbnails/21.jpg)
*EXAMPLE(2)
Generalized Geography : Each city chosen must begin with the same letter that ended the previous city name.
![Page 22: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032802/56649dff5503460f94ae7043/html5/thumbnails/22.jpg)
*The Classes L and NL
L=SPACE(log n)
NL=NSPACE(log n)
E.G : PATH={<G,s,t> | G is a directed graph that has a directed path
from s to t}.
NL Completeness :
A language B is NL-Complete if1. BNL2. For every ANL, ALB.
![Page 23: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032802/56649dff5503460f94ae7043/html5/thumbnails/23.jpg)
*The Closure of Space Complexity ClassesUnder Complement
Deterministic Space-Complexity Classes are Closed Under Complement
Theorem: For every function f(n) , dspace(f( n)) = co-dspace(f(n)).
Proof: If L is a language that is decided by some deterministic Turing machine M,th en the deterministic Turing machine M' that is identical to M except that thehalting states y and n are reversed decides ~L. spacereq(M' ) = spacereq(M) .So, if L E dspace(f( n)), so is ~L.
![Page 24: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032802/56649dff5503460f94ae7043/html5/thumbnails/24.jpg)
• www.cs.tau.ac.il/~safra/Complexity/Space.ppt space complexity
• people.cs.nctu.edu.tw/~sctsai/fc/notes/SpaceComplexity.ppt
• http://homepage.cs.uri.edu/faculty/hamel/courses/2013/spring2013/csc544/lecture-notes/18-space-complexity.pdf
• 2008 Elaine A Rich, Automata, Computability And Complexity, Theory And Application (CHAPTER 29).
• http://www.cs.elte.hu/~lovasz/kurzusok/complexity.pdf.
• http://en.wikipedia.org/wiki/True_quantified_Boolean_formula
• http://www.cs.nthu.edu.tw/~wkhon/lectures/.
*REFERENCES
![Page 25: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032802/56649dff5503460f94ae7043/html5/thumbnails/25.jpg)