Complexity 12-1 Complexity Andrei Bulatov Non-Deterministic Space.

Slides:



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

Complexity Classes: P and NP
Variants of Turing machines
1 Savitch and Immerman- Szelepcsènyi Theorems. 2 Space Compression  For every k-tape S(n) space bounded offline (with a separate read-only input tape)
1 Nondeterministic Space is Closed Under Complement Presented by Jing Zhang and Yingbo Wang Theory of Computation II Professor: Geoffrey Smith.
Complexity Theory Lecture 3 Lecturer: Moni Naor. Recap Last week: Non deterministic communication complexity Probabilistic communication complexity Their.
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)
NP-complete and NP-hard problems Transitivity of polynomial-time many-one reductions Concept of Completeness and hardness for a complexity class Definition.
1 NP-Complete Problems. 2 We discuss some hard problems:  how hard? (computational complexity)  what makes them hard?  any solutions? Definitions 
NL equals coNL Section 8.6 Giorgi Japaridze Theory of Computability.
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.
Complexity 15-1 Complexity Andrei Bulatov Hierarchy Theorem.
Complexity 11-1 Complexity Andrei Bulatov Space Complexity.
Computability and Complexity 22-1 Computability and Complexity Andrei Bulatov Hierarchy Theorem.
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.
Computability and Complexity 19-1 Computability and Complexity Andrei Bulatov Non-Deterministic Space.
1 Linear Bounded Automata LBAs. 2 Linear Bounded Automata are like Turing Machines with a restriction: The working space of the tape is the space of the.
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.
Complexity ©D.Moshkovits 1 Space Complexity Complexity ©D.Moshkovits 2 Motivation Complexity classes correspond to bounds on resources One such resource.
NP-Complete Problems Reading Material: Chapter 10 Sections 1, 2, 3, and 4 only.
Computability and Complexity 32-1 Computability and Complexity Andrei Bulatov Boolean Circuits.
1 Polynomial Time Reductions Polynomial Computable function : For any computes in polynomial time.
The Theory of NP-Completeness
NP-Complete Problems Problems in Computer Science are classified into
Computability and Complexity 20-1 Computability and Complexity Andrei Bulatov Class NL.
Non Deterministic Space Avi Ben Ari Lior Friedman Adapted from Dr. Eli Porat Lectures Bar-Ilan - University.
Computability and Complexity 3-1 Turing Machine Computability and Complexity Andrei Bulatov.
Chapter 11: Limitations of Algorithmic Power
Non-Deterministic Space is Closed Under Complementation Neil Immerman Richard Szelepcsenyi Presented By: Subhajit Dasgupta.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
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.
Machines with Memory Chapter 3 (Part B). Turing Machines  Introduced by Alan Turing in 1936 in his famous paper “On Computable Numbers with an Application.
Nattee Niparnan. Easy & Hard Problem What is “difficulty” of problem? Difficult for computer scientist to derive algorithm for the problem? Difficult.
February 18, 2015CS21 Lecture 181 CS21 Decidability and Tractability Lecture 18 February 18, 2015.
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.
Theory of Computing Lecture 17 MAS 714 Hartmut Klauck.
CSCI 2670 Introduction to Theory of Computing November 29, 2005.
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.
Theory of Computing Lecture 21 MAS 714 Hartmut Klauck.
NP-Complete Problems. Running Time v.s. Input Size Concern with problems whose complexity may be described by exponential functions. Tractable problems.
P Vs NP Turing Machine. Definitions - Turing Machine Turing Machine M has a tape of squares Each Square is capable of storing a symbol from set Γ (including.
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.
NPC.
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.
Complexity 24-1 Complexity Andrei Bulatov Interactive Proofs.
NP-complete Languages
CSCI 2670 Introduction to Theory of Computing December 2, 2004.
CSCI 2670 Introduction to Theory of Computing December 7, 2005.
Complexity 24-1 Complexity Andrei Bulatov Counting Problems.
Theory of Computational Complexity Yuji Ishikawa Avis lab. M1.
Computability Examples. Reducibility. NP completeness. Homework: Find other examples of NP complete problems.
The NP class. NP-completeness Lecture2. The NP-class The NP class is a class that contains all the problems that can be decided by a Non-Deterministic.
Chapter 7 Introduction to Computational Complexity.
Space Complexity Guy Feigenblat Based on lecture by Dr. Ely Porat Complexity course Computer science department, Bar-Ilan university December 2008.
The NP class. NP-completeness
Part VI NP-Hardness.
Theory of Computational Complexity
NP-Complete Problems.
CSE 589 Applied Algorithms Spring 1999
Instructor: Aaron Roth
Intro to Theory of Computation
CS151 Complexity Theory Lecture 4 April 8, 2004.
Presentation transcript:

Complexity 12-1 Complexity Andrei Bulatov Non-Deterministic Space

Complexity 12-2 Non-deterministic Machines Recall that if NT is a non-deterministic Turing Machine, then NT(x) denotes the tree of configurations which can be entered with input x, and NT accepts x if there is some accepting path in NT(x) Definition The space complexity of a non-deterministic Turing Machine NT is the function such that is the minimal number of cells visited in an accepting path of NT(x) if there is one, otherwise it is the minimal number of cells in the rejecting paths Definition The space complexity of a non-deterministic Turing Machine NT is the function such that is the minimal number of cells visited in an accepting path of NT(x) if there is one, otherwise it is the minimal number of cells in the rejecting paths (If not all paths of NT(x) halt, then is undefined)

Complexity 12-3 Nondeterministic Space Complexity Definition For any function f, we say that the nondeterministic space complexity of a decidable language L is in O(f) if there exists a nondeterministic Turing Machine NT which decides L, and constants and c such that for all inputs x with Definition For any function f, we say that the nondeterministic space complexity of a decidable language L is in O(f) if there exists a nondeterministic Turing Machine NT which decides L, and constants and c such that for all inputs x with Definition The nondeterministic space complexity class NSPACE[f] is defined to be the class of all languages with nondeterministic space complexity in O(f) Definition The nondeterministic space complexity class NSPACE[f] is defined to be the class of all languages with nondeterministic space complexity in O(f)

Complexity 12-4 Definition of NPSPACE Definition

Complexity 12-5 Savitch’s Theorem Unlike time, it can easily be shown that non-determinism does not reduce the space requirements very much: Theorem (Savitch) If s(n)  log n, then Theorem (Savitch) If s(n)  log n, then Corollary PSPACE  NPSPACE Corollary PSPACE  NPSPACE

Complexity 12-6 Proof (for s(n)  n ) Let L be a language in NSPACE[s] Let NT be a non-deterministic Turing Machine that decides L with space complexity s Choose an encoding for the computation NT(x) that uses ks(|x|) symbols for each configuration Let be the initial configuration, and be the accepting configuration Define a Boolean function reach(C,C,j) which is true if and only if configuration C can be reached from configuration C in at most steps To decide whether or not x  L we must determine whether or not is true

Complexity 12-7 We can calculate in space, using a divide-and-conquer algorithm: 1. If j=0 then if C=C', or C' can be reached from C in one step, then return true, else return false. 2. For each configuration C'', if reach(C,C'',j –1) and reach(C'',C',j –1), then return true. 3. Return false 1. If j=0 then if C=C', or C' can be reached from C in one step, then return true, else return false. 2. For each configuration C'', if reach(C,C'',j –1) and reach(C'',C',j –1), then return true. 3. Return false The depth of recursion is O(s(|x|)) and each recursive call requires O(s(|x|)) space for the parameters

Complexity 12-8 Logarithmic Space Since polynomial space is so powerful, it is natural to consider more restricted space complexity classes Even linear space is enough to solve Satisfiability Definition

Complexity 12-9 Problems in L and NL What sort of problems are in L and NL ? In logarithmic space we can store: a fixed number of counters (up to length of input) a fixed number of pointers to positions in the input string Therefore in deterministic log-space we can solve problems that require a fixed number of counters and/or pointers for solving; in non-deterministic log-space we can solve problems that require a fixed number of counters/pointers for verifying a solution

Complexity Examples (L) Palindromes : We need to keep two counters First count the number of 0 s, then count 1 s, subtracting from the previous number one by one. If the result is 0, accept; otherwise, reject. Brackets (if brackets in an expression positioned correctly): We need only a counter of brackets currently open. If this counter gets negative, reject; otherwise accept if and only if the last value of the counter is zero

Complexity Examples (NL) The first problem defined on this course was Reachability ¹ This can be solved by the following non-deterministic algorithm: Define a counter and initialize it to the number of vertices in the graph Define a pointer to hold the ``current vertex’’ and initialize it to the start vertex While the counter is non-zero - If the current vertex equals the target vertex, return yes - Non-deterministically choose a vertex which is connected to the current vertex - Update the pointer to this vertex and decrement the counter Return no ¹Also known as Path

Complexity We have seen that polynomial time reduction between problems is a very useful concept for studying relative complexity of problems. It allowed us to distinguish a class of problems, NP, which includes many important problems and is viewed as the class of hard problems We are going to do the same for space complexity classes: NL and PSPACE There is a problem: Polynomial time reduction is too powerful Reducing Problems

Complexity Log-Space Reduction A transducer is a 3-tape Turing Machine such that the first tape is an input tape, it is never overwritten the second tape is a working tape the third tape is an output tape, no instruction of the transition function uses the content of this tape The space complexity of such a machine is the number of cells on the working tape visited during a computation A function is said to be log-space computable if there is a transducer computing f in O(log n)

Complexity Definition A language A is log-space reducible to a language B, denoted, if a log-space computable function f exists such that for all Note that a function computable in log-space is computable in polynomial time, so

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

Complexity NL-Completeness of REACHABITITY Theorem Reachability is NL-complete Theorem Reachability is NL-complete Proof Idea For any non-deterministic log-space machine NT, and any input x, construct the graph NT(x). Its vertices are possible configurations of NT using at most log(|x|) cells on the working tape; its edges are possible transitions between configurations. Then NT accepts the input x if and only if the accepting configuration is reachable from the initial configuration Corollary NL  P Corollary NL  P

Complexity Proof Let A be a language in NL Let NT be a non-deterministic Turing Machine that decides A with space complexity log n Choose an encoding for the computation NT(x) that uses klog(|x|) symbols for each configuration Let be the initial configuration, and be the accepting configuration We represent NT(x) by giving first the list of vertices, and then a list of edges

Complexity Our transducer T does the following - T goes through all possible strings of length klog(|x|) and, if the string properly encodes a configuration of NT, prints it on the output tape - Then T goes through all possible pairs of strings of length klog(|x|). For each pair it checks if both strings are legal encodings of configurations of NT, and if can yield. If yes then it prints out the pair on the output tape Both operations can be done in log-space because the first step requires storing only the current string (the strings can be listed in lexicographical order). Similarly, the second step requires storing two strings, and (possibly) some counters NT accepts x if and only if there is a path in NT(x) from to

Complexity Log-Space reductions and L We take it for granted that P is closed under polynomial-time reductions We can expect that L is closed under log-space reductions, but it is much less trivial Theorem If and B  L, then A  L Theorem If and B  L, then A  L Corollary If any NL-complete language belongs to L, then L = NL Corollary If any NL-complete language belongs to L, then L = NL

Computability and Complexity Proof Let M be a Turing Machine solving B in log-space, and let T be a log-space transducer reducing A to B It is not possible to construct a log-space decider for A just combining M and T, because the output of T may require more than log-space Instead, we do the following On an input x, a decider M' for A Simulates M on f(x) Let f be the function computed by T When it needs to read the l -th symbol of f(x), M' simulates T on x, but ignores all outputs except for the l -th symbol

Complexity P-completeness Using log-space reductions we can study the finer structure of the class P Instance: A Horn CNF . Question: Is  satisfiable? Horn-SAT A clause is said to be a Horn if it contains at most one positive literal A CNF is said to be Horn if every its clause is Horn

Complexity Theorem Horn-SAT is P-complete Theorem Horn-SAT is P-complete

Complexity All Languages Decidable Languages P PSPACE Time and Space NP NP-complete P-complete NL-complete NL L