Complexity 11-1 Complexity Andrei Bulatov Space Complexity.

Slides:



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

Complexity Classes: P and NP
Lecture 24 MAS 714 Hartmut Klauck
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.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
1 Space Complexity. 2 Def: 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)
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen.
Complexity 7-1 Complexity Andrei Bulatov Complexity of Problems.
Complexity 25-1 Complexity Andrei Bulatov #P-Completeness.
Computability and Complexity 5-1 Classifying Problems Computability and Complexity Andrei Bulatov.
Complexity 12-1 Complexity Andrei Bulatov Non-Deterministic Space.
Complexity 15-1 Complexity Andrei Bulatov Hierarchy Theorem.
Computability and Complexity 22-1 Computability and Complexity Andrei Bulatov Hierarchy Theorem.
Complexity 26-1 Complexity Andrei Bulatov Interactive Proofs.
Complexity 13-1 Complexity Andrei Bulatov Hierarchy Theorem.
Computability and Complexity 14-1 Computability and Complexity Andrei Bulatov Cook’s Theorem.
Computability and Complexity 13-1 Computability and Complexity Andrei Bulatov The Class NP.
1 Introduction to Computability Theory Lecture12: Decidable Languages Prof. Amos Israeli.
Prof. Busch - LSU1 Decidable Languages. Prof. Busch - LSU2 Recall that: A language is Turing-Acceptable if there is a Turing machine that accepts Also.
Computability and Complexity 19-1 Computability and Complexity Andrei Bulatov Non-Deterministic Space.
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.
Fall 2004COMP 3351 Recursively Enumerable and Recursive Languages.
Complexity 5-1 Complexity Andrei Bulatov Complexity of Problems.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY Read sections 7.1 – 7.3 of the book for next time.
Recursively Enumerable and Recursive Languages
1 Uncountable Sets continued Theorem: Let be an infinite countable set. The powerset of is uncountable.
Computability and Complexity 20-1 Computability and Complexity Andrei Bulatov Class NL.
Fall 2005Costas Busch - RPI1 Recursively Enumerable and Recursive Languages.
Chapter 11: Limitations of Algorithmic Power
Computability and Complexity 10-1 Computability and Complexity Andrei Bulatov Gödel’s Incompleteness Theorem.
1 Introduction to Computability Theory Lecture11: The Halting Problem Prof. Amos Israeli.
1 Reducibility. 2 Problem is reduced to problem If we can solve problem then we can solve problem.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
PSPACE-Completeness Section 8.3 Giorgi Japaridze Theory of Computability.
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.
DECIDABILITY OF PRESBURGER ARITHMETIC USING FINITE AUTOMATA Presented by : Shubha Jain Reference : Paper by Alexandre Boudet and Hubert Comon.
The Complexity of Optimization Problems. Summary -Complexity of algorithms and problems -Complexity classes: P and NP -Reducibility -Karp reducibility.
Computational Complexity Theory Lecture 2: Reductions, NP-completeness, Cook-Levin theorem Indian Institute of Science.
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 15-1 Mälardalen University 2012.
Week 10Complexity of Algorithms1 Hard Computational Problems Some computational problems are hard Despite a numerous attempts we do not know any efficient.
Complexity 25-1 Complexity Andrei Bulatov Counting Problems.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
A Problem That Is Complete for PSPACE (Polynomial Space) BY TEJA SUDHA GARIGANTI.
1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)
NP-completeness Class of hard problems. Jaruloj ChongstitvatanaNP-complete Problems2 Outline  Introduction  Problems and Languages Turing machines and.
Chapter 11 Introduction to Computational Complexity Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1.
COMPLEXITY. Satisfiability(SAT) problem Conjunctive normal form(CNF): Let S be a Boolean expression in CNF. That is, S is the product(and) of several.
Recursively Enumerable and Recursive Languages
Fall 2013 CMU CS Computational Complexity Lecture 2 Diagonalization, 9/12/2013.
Complexity 24-1 Complexity Andrei Bulatov Interactive Proofs.
Overview of the theory of computation Episode 3 0 Turing machines The traditional concepts of computability, decidability and recursive enumerability.
NP-complete Languages
CSCI 2670 Introduction to Theory of Computing December 2, 2004.
CSCI 2670 Introduction to Theory of Computing December 7, 2005.
Theory of Computational Complexity Yuji Ishikawa Avis lab. M1.
1 Recursively Enumerable and Recursive Languages.
Complexity 27-1 Complexity Andrei Bulatov Interactive Proofs (continued)
Recursively Enumerable and Recursive Languages
Computability and Complexity
Busch Complexity Lectures: Reductions
HIERARCHY THEOREMS Hu Rui Prof. Takahashi laboratory
Chapter 9 TURING MACHINES.
Complexity 6-1 The Class P Complexity Andrei Bulatov.
Computational Complexity
Decidable Languages Costas Busch - LSU.
Theory of Computability
Formal Languages, Automata and Models of Computation
LECTURE 2-9 PSPACE-Complete
Intro to Theory of Computation
Presentation transcript:

Complexity 11-1 Complexity Andrei Bulatov Space Complexity

Complexity 11-2 Measuring Space So far we have defined complexity measures based on the time used by the algorithm Now we shall do a similar analysis based on the space used In the Turing Machine model of computation this is easy to measure — just count the number of tape cells read during the computation Definition 1 The space complexity of a Turing Machine T is the function such that is the number of distinct tape cells visited during the computation T(x) Definition 1 The space complexity of a Turing Machine T is the function such that is the number of distinct tape cells visited during the computation T(x) (Note that if T(x) does not halt, then is undefined.)

Complexity 11-3 Palindromes Consider the following 3-tape machine deciding if an input string is a palindrome The first tape contains the input string and is never overwritten The machine works in stages. On stage i it does the following - the second tape contains the binary representation of i - the machine finds and remembers the i -th symbol of the string by (1) initializing the 3 rd string j = 1 ; (2) if j < i then increment j ; (3) if j = i then remember the current symbol by switching to correspondent state - in a similar way the machine finds the i -th symbol from the end of the string - if the symbols are unequal, halt with “no” If the i -th symbol is the blank symbol, halt with “yes”

Complexity 11-4 By Def.1, the space complexity of this machine is n However, it seems to be fair to define its space complexity as log n Another Definition Definition 2 Let T be a Turing Machine with 2 tapes such that the first tape contains the input and never overwritten. The space complexity of T is the function such that is the number of distinct cells on the second tape visited during the computation T(x) Definition 2 Let T be a Turing Machine with 2 tapes such that the first tape contains the input and never overwritten. The space complexity of T is the function such that is the number of distinct cells on the second tape visited during the computation T(x)

Complexity 11-5 Blum’s Axioms Blum proposed that any useful dynamic complexity measure should satisfy the following properties: is defined exactly when M(x) is defined The problem: for given M, x, r, does is decidable Theorem is a proper complexity measure

Complexity 11-6 Proof 1. is obvious. 2. Note that if the machine has k states and l symbols in the alphabet, then there are possible configuration involving at most r visited cells on the second tape If the same configuration occurs twice during the computation M(x), then the machine goes into an infinite loop and M(x) (as well as ) is not defined Therefore after performing steps M(x) either halts, or visits more than r cells, or goes into an infinite loop

Complexity 11-7 Definition For any function f, we say that the space complexity of a decidable language L is in O(f) if there exists a Turing Machine T which decides L, and constants and c such that for all inputs x with Definition For any function f, we say that the space complexity of a decidable language L is in O(f) if there exists a Turing Machine T which decides L, and constants and c such that for all inputs x with Space Complexity of Problems As with time complexity, we cannot define an exact space complexity for a language, but we can give an asymptotic form …

Complexity 11-8 Space Complexity Classes Now we are in a position to divide up the decidable languages into classes, according to their space complexity Definition The space complexity class SPACE[f] is defined to be the class of all languages with space complexity in O(f) Definition The space complexity class SPACE[f] is defined to be the class of all languages with space complexity in O(f) (Note, it is sometimes called DSPACE[f] — for Deterministic Space)

Complexity 11-9 Definition Polynomial Space As with time, we can obtain a robust space complexity class by considering all polynomial space complexity classes

Complexity Time vs. Space Visiting a cell takes at least one time step, so we have Theorem A more subtle analysis, based on the fact that there are only different possible configurations with f(n) non- blank tape cells, gives

Complexity Reusing Space The previous result suggests that a given amount of space is more useful than a given amount of time This is because space can be reused For example, Satisfiability can be solved in linear space, by trying each possible assignment, one at a time, reusing the same space Theorem

Complexity All Languages Decidable Languages PSPACENPP

Complexity Problems in PSPACE Instance: A quantified Boolean formula where each is a Boolean variable, is a Boolean expression involving and each is a quantifier (  or  ). Question: Is  logically valid ? Quantified Boolean Formula

Complexity Instance: A game for 2 players consisting of a directed graph G, and a start vertex s. Players take turns to move along the edges from the current vertex. A player who cannot move without returning to a vertex already visited loses Question: Is there a winning strategy for the first player? Generalized Geography

Complexity PSPACE-Completeness Definition A language L is said to be PSPACE -complete if L  PSPACE, and for any A  PSPACE, Definition A language L is said to be PSPACE -complete if L  PSPACE, and for any A  PSPACE,

Complexity Instance: A quantified Boolean formula where each is a Boolean variable, is a Boolean expression involving and each is a quantifier (  or  ). Question: Is  logically valid ? Quantified Boolean Formula PSPACE-Complete Problem Theorem QBF is PSPACE-complete Theorem QBF is PSPACE-complete

Complexity Proof First we show that QBF is in PSPACE, using the following recursive algorithm For the input Boolean sentence  If  contains no quantifiers, then it contains no variables, only constants. Evaluate this expression; accept if it is true ; otherwise reject If    X  then  is true if and only if is true. Recursively call the algorithm on and, and accept if one of them is accepted; otherwise reject If    X  then  is true if and only if is true. Recursively call the algorithm on and, and accept if both of them is accepted; otherwise reject

Complexity This algorithm is polynomial space, because on every round of recursion it needs to store only a transformed copy of the input formula the depth of recursion is the number of variables, m Therefore, it uses m  |  | space

Complexity Let A be a language in PSPACE Let T be a deterministic Turing Machine that decides A with space complexity f(n), where f is a polynomial Choose an encoding for the computation T(x) that uses k·f(|x|) symbols for each configuration Let be the initial configuration, and be the accepting configuration

Complexity When proving Cook’s theorem we managed to define a Boolean CNF formula such that is true if and only if the values of variables describe in a certain way a legal configuration of the Turing machine T Then we constructed a formula which is true if and only if and represent legal configurations, say and, and T can go from to in at most one step The length of both formulas is polynomial in the amount of tape cells involved in the computation. Denote the length of by g(|x|) We construct a formula which is true if and only if and represent legal configurations, say and, and T can go from to in at most steps Finally, T accepts x if and only if is true

Complexity The formula is built recursively Straightforward approach: It does not work because is build of formulas There are universal quantifiers to do the job! The length of this formula is