Space Complexity. Master Informatique. Université Paris 5 René Descartes. Master Info. Complexity Space 1/26

Similar documents
Space is a computation resource. Unlike time it can be reused. Computational Complexity, by Fu Yuxi Space Complexity 1 / 44

Complexity Theory. Knowledge Representation and Reasoning. November 2, 2005

Non-Deterministic Time

Computational Complexity IV: PSPACE

Computability and Complexity CISC462, Fall 2018, Space complexity 1

Complexity Theory 112. Space Complexity

Principles of Knowledge Representation and Reasoning

Lecture 22: PSPACE

Theory of Computation. Ch.8 Space Complexity. wherein all branches of its computation halt on all

Introduction to Advanced Results

Lecture 20: PSPACE. November 15, 2016 CS 1010 Theory of Computation

CSCI 1590 Intro to Computational Complexity

Polynomial Time Computation. Topics in Logic and Complexity Handout 2. Nondeterministic Polynomial Time. Succinct Certificates.

P vs. NP Classes. Prof. (Dr.) K.R. Chowdhary.

COMPLEXITY THEORY. PSPACE = SPACE(n k ) k N. NPSPACE = NSPACE(n k ) 10/30/2012. Space Complexity: Savitch's Theorem and PSPACE- Completeness

Introduction to Complexity Classes. Marcin Sydow

The space complexity of a standard Turing machine. The space complexity of a nondeterministic Turing machine

1 PSPACE-Completeness

CSCI 1590 Intro to Computational Complexity

SOLUTION: SOLUTION: SOLUTION:

P = k T IME(n k ) Now, do all decidable languages belong to P? Let s consider a couple of languages:

Space and Nondeterminism

Review of Basic Computational Complexity

CS5371 Theory of Computation. Lecture 23: Complexity VIII (Space Complexity)

Chapter 1 - Time and Space Complexity. deterministic and non-deterministic Turing machine time and space complexity classes P, NP, PSPACE, NPSPACE

CSE200: Computability and complexity Space Complexity

De Morgan s a Laws. De Morgan s laws say that. (φ 1 φ 2 ) = φ 1 φ 2, (φ 1 φ 2 ) = φ 1 φ 2.

Theory of Computation Space Complexity. (NTU EE) Space Complexity Fall / 1

U.C. Berkeley CS278: Computational Complexity Professor Luca Trevisan 9/6/2004. Notes for Lecture 3

CS Lecture 29 P, NP, and NP-Completeness. k ) for all k. Fall The class P. The class NP

POLYNOMIAL SPACE QSAT. Games. Polynomial space cont d

Notes on Space-Bounded Complexity

Mm7 Intro to distributed computing (jmp) Mm8 Backtracking, 2-player games, genetic algorithms (hps) Mm9 Complex Problems in Network Planning (JMP)

satisfiability (sat) Satisfiability unsatisfiability (unsat or sat complement) and validity Any Expression φ Can Be Converted into CNFs and DNFs

Complexity Theory. Jörg Kreiker. Summer term Chair for Theoretical Computer Science Prof. Esparza TU München

NP-Completeness. f(n) \ n n sec sec sec. n sec 24.3 sec 5.2 mins. 2 n sec 17.9 mins 35.

Undirected ST-Connectivity in Log-Space. Omer Reingold. Presented by: Thang N. Dinh CISE, University of Florida, Fall, 2010

Advanced Topics in Theoretical Computer Science

P, NP, and Beyond. Hengfeng Wei. May 01 May 04, Hengfeng Wei P, NP, and Beyond May 01 May 04, / 29

Space Complexity. Huan Long. Shanghai Jiao Tong University

Notes on Space-Bounded Complexity

Could we potentially place A in a smaller complexity class if we consider other computational models?

MTAT Complexity Theory October 20th-21st, Lecture 7

Time Complexity. Definition. Let t : n n be a function. NTIME(t(n)) = {L L is a language decidable by a O(t(n)) deterministic TM}

Introduction to Computational Complexity

Theory of Computation CS3102 Spring 2015 A tale of computers, math, problem solving, life, love and tragic death

Introduction to Complexity Theory. Bernhard Häupler. May 2, 2006

Notes on Complexity Theory Last updated: October, Lecture 6

Resource-Bounded Computation

The Polynomial Hierarchy

CS151 Complexity Theory. Lecture 4 April 12, 2017

Algorithms & Complexity II Avarikioti Zeta

INAPPROX APPROX PTAS. FPTAS Knapsack P

Space Complexity. The space complexity of a program is how much memory it uses.

Lecture 8. MINDNF = {(φ, k) φ is a CNF expression and DNF expression ψ s.t. ψ k and ψ is equivalent to φ}

6.045 Final Exam Solutions

NP Complete Problems. COMP 215 Lecture 20

About the relationship between formal logic and complexity classes

Hierarchy theorems. Evgenij Thorstensen V18. Evgenij Thorstensen Hierarchy theorems V18 1 / 18

Lecture 8: Complete Problems for Other Complexity Classes

Ταουσάκος Θανάσης Αλγόριθμοι και Πολυπλοκότητα II 7 Φεβρουαρίου 2013

Lecture 21: Space Complexity (The Final Exam Frontier?)

Complexity: Some examples

CS5371 Theory of Computation. Lecture 23: Complexity VIII (Space Complexity)

Lecture 3: Reductions and Completeness

PSPACE COMPLETENESS TBQF. THURSDAY April 17

an efficient procedure for the decision problem. We illustrate this phenomenon for the Satisfiability problem.

DRAFT. Diagonalization. Chapter 4

Deterministic Time and Space Complexity Measures

MTAT Complexity Theory October 13th-14th, Lecture 6

Technische Universität München Summer term 2010 Theoretische Informatik August 2, 2010 Dr. J. Kreiker / Dr. M. Luttenberger, J. Kretinsky SOLUTION

Lecture 6: Oracle TMs, Diagonalization Limits, Space Complexity

CS154, Lecture 17: conp, Oracles again, Space Complexity

Time and space classes

CSE 555 HW 5 SAMPLE SOLUTION. Question 1.

Lecture 7: Polynomial time hierarchy

Lecture 5: The Landscape of Complexity Classes

Theory of Computation Chapter 1: Introduction

Bounded rationality of restricted Turing machines

Outline. Complexity Theory. Example. Sketch of a log-space TM for palindromes. Log-space computations. Example VU , SS 2018

CS5371 Theory of Computation. Lecture 24: Complexity IX (PSPACE-complete, L, NL, NL-complete)

Lecture 3. 1 Terminology. 2 Non-Deterministic Space Complexity. Notes on Complexity Theory: Fall 2005 Last updated: September, 2005.

Computability and Complexity Theory

Notes for Lecture 3... x 4

Complete problems for classes in PH, The Polynomial-Time Hierarchy (PH) oracle is like a subroutine, or function in

Lecture Notes Each circuit agrees with M on inputs of length equal to its index, i.e. n, x {0, 1} n, C n (x) = M(x).

Week 2: Defining Computation

NP-completeness was introduced by Stephen Cook in 1971 in a foundational paper.

On Straight Forward Approaches to P vs NP

NP-Completeness. NP-Completeness 1

LTCC Course: Graph Theory 2017/18 3: Complexity and Algorithms

Lecture 23: More PSPACE-Complete, Randomized Complexity

6-1 Computational Complexity

Computational complexity theory

CS 6505, Complexity and Algorithms Week 7: NP Completeness

NP-Completeness. Sections 28.5, 28.6

More Complexity. Klaus Sutner Carnegie Mellon University. Fall 2017

Quantified Boolean Formulas Part 1

Complexity Theory Final Exam

Transcription:

Space Complexity Master Informatique Université Paris 5 René Descartes 2016 Master Info. Complexity Space 1/26

Outline Basics on Space Complexity Main Space Complexity Classes Deterministic and Non-Deterministic Space Space-Time Relations Determining Space Complexity Hardness and Completeness Well-Known Problems Master Info. Complexity Space 2/26

Space Used by a Turing Machine If M is a Turing Machine and x an input word, the space used by M on x is the number of different squares visited by M during the computation. For f : N N, we say that a Turing Machine M works with space O(f(n)) if M stops for every input x on every input x, M uses on x a space s(n) with s(n) O(f(n)) Master Info. Complexity Space 3/26

Space Complexity Classes For f : N N, DSPACE(f(n)) is the set of languages which are decided by a deterministic Turing Machine M working with space O(f(n)). For f : N N, NSPACE(f(n)) is the set of languages which are decided by a non-deterministic Turing Machine M working with space O(f(n)). Master Info. Complexity Space 4/26

Hierarchy Theorems Definition A mapping f : N N is space-constructible if α a constant and M a Turing Machine s.t. M(n) computes f(n) using a space less than α f(n) Master Info. Complexity Space 5/26

Hierarchy Theorems Definition A mapping f : N N is space-constructible if α a constant and M a Turing Machine s.t. M(n) computes f(n) using a space less than α f(n) Deterministic Space Hierarchy Theorem Let f : N N and g : N N be two mappings such that n N, f(x) 0, g is space-constructible and f o(g). Then DSPACE(f(n)) DSPACE(g(n)) Master Info. Complexity Space 5/26

Hierarchy Theorems Definition A mapping f : N N is space-constructible if α a constant and M a Turing Machine s.t. M(n) computes f(n) using a space less than α f(n) Deterministic Space Hierarchy Theorem Let f : N N and g : N N be two mappings such that n N, f(x) 0, g is space-constructible and f o(g). Then DSPACE(f(n)) DSPACE(g(n)) Non-Deterministic Space Hierarchy Theorem Let f : N N and g : N N be two mappings such that n N, f(x) 0, g is space-constructible and f o(g). Then NSPACE(f(n)) NSPACE(g(n)) Master Info. Complexity Space 5/26

Deterministic vs Non-Deterministic Space Intuition: Non-determinism is not so important for space complexity... Theorem [Savitch 1970] For all function s space-constructible, DSPACE(f(n)) NSPACE(f(n)) DSPACE(f(n) 2 ) Master Info. Complexity Space 6/26

Complement Classes Proposition For all function f(n) space-constructible, DSPACE(f(n)) = codspace(f(n)) Theorem [Immerman 1988, Szelepcsényi 1988] For all function f(n) log(n) space-constructible, NSPACE(f(n)) = conspace(f(n)) Master Info. Complexity Space 7/26

Outline Basics on Space Complexity Main Space Complexity Classes Deterministic and Non-Deterministic Space Space-Time Relations Determining Space Complexity Hardness and Completeness Well-Known Problems Master Info. Complexity Space 8/26

Deterministic Space Complexity L = DSPACE(log(n)) is the class of decision problems that can be solved by a DTM using logarithmic space PSPACE = k>0 DSPACE(nk ) is the class of decision problems that can be solved by a DTM using polynomial space Master Info. Complexity Space 9/26

Deterministic Space Complexity L = DSPACE(log(n)) is the class of decision problems that can be solved by a DTM using logarithmic space PSPACE = k>0 DSPACE(nk ) is the class of decision problems that can be solved by a DTM using polynomial space L PSPACE Master Info. Complexity Space 9/26

Non-Deterministic Space Complexity NL = NSPACE(log(n)) is the class of decision problems that can be solved by a NDTM using logarithmic space NPSPACE = k>0 NSPACE(nk ) is the class of decision problems that can be solved by a NDTM using polynomial space Master Info. Complexity Space 10/26

Non-Deterministic Space Complexity NL = NSPACE(log(n)) is the class of decision problems that can be solved by a NDTM using logarithmic space NPSPACE = k>0 NSPACE(nk ) is the class of decision problems that can be solved by a NDTM using polynomial space NL NPSPACE Master Info. Complexity Space 10/26

PSPACE vs NPSPACE Proposition PSPACE = NPSPACE Master Info. Complexity Space 11/26

PSPACE vs NPSPACE Proposition PSPACE = NPSPACE Proof: For any k > 0, NSPACE(n k ) DSPACE((n k ) 2 ) = DSPACE((n 2k ) PSPACE, so NPSPACE PSPACE For any k > 0, DSPACE(n k ) NSPACE(n k ) NPSPACE, so PSPACE NPSPACE Master Info. Complexity Space 11/26

Relations Between Time and Space (1/3) Proposition For any mapping f : N N, NTIME(f(n)) DSPACE(f(n)) Master Info. Complexity Space 12/26

Relations Between Time and Space (1/3) Proposition For any mapping f : N N, NTIME(f(n)) DSPACE(f(n)) Corollary NP PSPACE Master Info. Complexity Space 12/26

Relations Between Time and Space (2/3) Polynomial Hierarchy vs Polynomial Space PH PSPACE Intuition For each class of the polynomial hierharchy, there is a complete problem i QBF or i QBF. All these problems are special instances of TQBF, so they are in PSPACE. Master Info. Complexity Space 13/26

Relations Between Time and Space (3/3) L NL P NP conp P 2 ΣP 2 Π P 2 We also know that some inclusions are strict: NL PSPACE P EXP PH PSPACE EXP NEXP Master Info. Complexity Space 14/26

Outline Basics on Space Complexity Main Space Complexity Classes Deterministic and Non-Deterministic Space Space-Time Relations Determining Space Complexity Hardness and Completeness Well-Known Problems Master Info. Complexity Space 15/26

Completeness for Space Complexity Classes The notions of hardness and completeness exist for space complexity classes. For most of the complexity classes, the definition is exactly the same as hardness and completeness for time complexity Master Info. Complexity Space 16/26

Completeness for Space Complexity Classes The notions of hardness and completeness exist for space complexity classes. For most of the complexity classes, the definition is exactly the same as hardness and completeness for time complexity A problem P is C-hard if for every problem P in C, P P f P, i.e. there is a polynomial reduction from any problem in C to P Master Info. Complexity Space 16/26

Completeness for Space Complexity Classes The notions of hardness and completeness exist for space complexity classes. For most of the complexity classes, the definition is exactly the same as hardness and completeness for time complexity A problem P is C-hard if for every problem P in C, P P f P, i.e. there is a polynomial reduction from any problem in C to P A problem is C-complete if it is in C and it is C-complete Master Info. Complexity Space 16/26

Completeness for Space Complexity Classes The notions of hardness and completeness exist for space complexity classes. For most of the complexity classes, the definition is exactly the same as hardness and completeness for time complexity A problem P is C-hard if for every problem P in C, P P f P, i.e. there is a polynomial reduction from any problem in C to P A problem is C-complete if it is in C and it is C-complete This definition works for PSPACE-hardness and PSPACE-completeness Master Info. Complexity Space 16/26

Completeness for Space Complexity Classes The notions of hardness and completeness exist for space complexity classes. For most of the complexity classes, the definition is exactly the same as hardness and completeness for time complexity A problem P is C-hard if for every problem P in C, P P f P, i.e. there is a polynomial reduction from any problem in C to P A problem is C-complete if it is in C and it is C-complete This definition works for PSPACE-hardness and PSPACE-completeness It does not work for L and NL Master Info. Complexity Space 16/26

Logarithmic Space and Completeness Logarithmic-Space Functional Reduction A logarithmic-space functional reduction f is a total computable function from a problem P 1 to a problem P 2 such that, for any instance i of P 1, f(i) can be computed in logarithmic-space in the size of i i is a positive instance of P 1 iff f(i) is a positive instance of P 2 Notation: P 1 L f P 2 Master Info. Complexity Space 17/26

Logarithmic Space and Completeness Logarithmic-Space Functional Reduction A logarithmic-space functional reduction f is a total computable function from a problem P 1 to a problem P 2 such that, for any instance i of P 1, f(i) can be computed in logarithmic-space in the size of i i is a positive instance of P 1 iff f(i) is a positive instance of P 2 Notation: P 1 L f P 2 Observation: If P 1 L f P 2, then P 1 P f P 2 Master Info. Complexity Space 17/26

Logarithmic Space and Completeness Logarithmic-Space Functional Reduction A logarithmic-space functional reduction f is a total computable function from a problem P 1 to a problem P 2 such that, for any instance i of P 1, f(i) can be computed in logarithmic-space in the size of i i is a positive instance of P 1 iff f(i) is a positive instance of P 2 Notation: P 1 L f P 2 Observation: If P 1 L f P 2, then P 1 P f P 2 NL-Hardness and NL-Completeness A problem P is NL-hard iff P NL, P L f P A problem P is NL-complete iff P is NL-hard and P L Master Info. Complexity Space 17/26

What About L-Completeness? Theorem Any problem in L is L-complete with respect to L f! Master Info. Complexity Space 18/26

What About L-Completeness? Theorem Any problem in L is L-complete with respect to L f! To define a meaningful notion of L-completeness, the hardness must be defined with another kind of functional reductions More details in [Garey and Johnson 1979] Master Info. Complexity Space 18/26

Canonical PSPACE-Complete Problem Reminder: A canonical QBF is a formula Q 1 X 1, Q 2 X 2,... Q n X n, φ: Q i {, } and Q i Q i+1 X 1,... X n form a partition of the Boolean variables in φ φ is a propositional formula n QBF: is the QBF X 1, X 2,... Q n X n, φ true? n QBF: is the QBF X 1, X 2,... Q n X n, φ true? Master Info. Complexity Space 19/26

Canonical PSPACE-Complete Problem Reminder: A canonical QBF is a formula Q 1 X 1, Q 2 X 2,... Q n X n, φ: Q i {, } and Q i Q i+1 X 1,... X n form a partition of the Boolean variables in φ φ is a propositional formula n QBF: is the QBF X 1, X 2,... Q n X n, φ true? n QBF: is the QBF X 1, X 2,... Q n X n, φ true? Complexity of TQBF TQBF = n 1( n QBF n QBF) TQBF is PSPACE-complete Master Info. Complexity Space 19/26

PSPACE vs Games Tic-Tac-Toe Classical Tic-Tac-Toe: In a 3 3 grid, two players must draw some marks (X or O). The winner is the first who has placed three marks in a horizontal, vertical or diagonal row Generalized Tic-tac-toe ((m, n, k) game): In a m n grid, a player wins when he has placed k marks in a row A winning strategy at time t for a player is a sequence of moves (drawing a mark in the grid) such that the player wins. Master Info. Complexity Space 20/26

PSPACE vs Games Tic-Tac-Toe Classical Tic-Tac-Toe: In a 3 3 grid, two players must draw some marks (X or O). The winner is the first who has placed three marks in a horizontal, vertical or diagonal row Generalized Tic-tac-toe ((m, n, k) game): In a m n grid, a player wins when he has placed k marks in a row A winning strategy at time t for a player is a sequence of moves (drawing a mark in the grid) such that the player wins. Complexity of (m, n, k)-strat (m n k)-strat is the decision problem: Is there a winning strategy for player X in the (m, n, k) game? (m n k)-strat is PSPACE-complete Master Info. Complexity Space 20/26

PSPACE vs Games Tic-Tac-Toe: Intuition Determining if there is a winning strategy for player X is like asking the question: Is there a way to draw an X at step 1, such that for all possible moves of the O player at step 2, there is a way to draw an X at step 3, such that for all possible moves of the O player at step 4, there is... such that X player wins? Master Info. Complexity Space 21/26

PSPACE vs Games Tic-Tac-Toe: Intuition Determining if there is a winning strategy for player X is like asking the question: Is there a way to draw an X at step 1, such that for all possible moves of the O player at step 2, there is a way to draw an X at step 3, such that for all possible moves of the O player at step 4, there is... such that X player wins? This can be represented as a QBF formula Master Info. Complexity Space 21/26

Generalized Super Mario Bros. [Demaine et al. 2016] Figure Super Mario Bros. is PSPACE-complete Master Info. Complexity Space 22/26

NL-Complete Problem in Graphs Reach Given a directed graph G = N, E and two nodes n 1, n 2 N, is there a path from n 1 to n 2 in G? Theorem [Papadimitriou 1994] Reach is NL-complete Master Info. Complexity Space 23/26

NL-Complete Problem in Logics Reminder on 2SAT 2SAT is a special case of satisfiability problem where only CNF formulas with binary clauses are considered Theorem [Papadimitriou 1994] 2SAT is NL-complete Master Info. Complexity Space 24/26

References W. J. Savitch, Relationships between nondeterministic and deterministic tape complexities. Journal of Computer and System Sciences, 177 192, 1970. N. Immerman, Nondeterministic space is closed under complementation. SIAM Journal on Computing 17, 935 938, 1988. R. Szelepcsényi, The Method of Forced Enumeration for Nondeterministic Automata. Acta Informatica vol. 26, no 3, 279 284, 1988. Master Info. Complexity Space 25/26

References M. R. Garey and D. S. Johnson, Computers and Intractability: A Guide to the Theory of NP-Completeness. W.H. Freeman. Section 7.5: Logarithmic Space, 177 181, 1979. C.H Papadimitriou, Computational Complexity. Addison-Wesley, 1994. E.D. Demaine, G. Viglietta and A. Williams. Super Mario Bros. Is Harder/Easier than We Thought. Proceedings of the 8th International Conference on Fun with Algorithms, 2016. Master Info. Complexity Space 26/26