Time and space classes

Similar documents
6.840 Language Membership

6.045 Final Exam Solutions

SOLUTION: SOLUTION: SOLUTION:

6.045: Automata, Computability, and Complexity (GITCS) Class 17 Nancy Lynch

Lecture 23: More PSPACE-Complete, Randomized Complexity

CSE200: Computability and complexity Space Complexity

Chapter 7: Time Complexity

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

CS151 Complexity Theory. Lecture 13 May 15, 2017

CSE 555 HW 5 SAMPLE SOLUTION. Question 1.

6.045J/18.400J: Automata, Computability and Complexity Final Exam. There are two sheets of scratch paper at the end of this exam.

Computability Theory

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

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

P and NP. Or, how to make $1,000,000.

Time Complexity (1) CSCI Spring Original Slides were written by Dr. Frederick W Maier. CSCI 2670 Time Complexity (1)

Lecture 24: Randomized Complexity, Course Summary

Lecture 19: Interactive Proofs and the PCP Theorem

Lecture 12: Interactive Proofs

BBM402-Lecture 11: The Class NP

1 PSPACE-Completeness

The Class NP. NP is the problems that can be solved in polynomial time by a nondeterministic machine.

Space Complexity. Huan Long. Shanghai Jiao Tong University

Computability and Complexity CISC462, Fall 2018, Space complexity 1

Introduction to Computational Complexity

Notes on Complexity Theory Last updated: October, Lecture 6

CSCI 1590 Intro to Computational Complexity

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

Lecture 22: PSPACE

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

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

-bit integers are all in ThC. Th The following problems are complete for PSPACE NPSPACE ATIME QSAT, GEOGRAPHY, SUCCINCT REACH.

Theory of Computation Time Complexity

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

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

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

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

6.045: Automata, Computability, and Complexity (GITCS) Class 15 Nancy Lynch

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

Lecture 19: Finish NP-Completeness, conp and Friends

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

CISC 4090 Theory of Computation

Automata Theory. Lecture on Discussion Course of CS120. Runzhe SJTU ACM CLASS

Computability and Complexity

Notes on Complexity Theory Last updated: November, Lecture 10

Third Year Computer Science and Engineering, 6 th Semester

Computer Sciences Department

CS 301. Lecture 18 Decidable languages. Stephen Checkoway. April 2, 2018

Computational Models Lecture 11, Spring 2009

x 2 +2 x 2 x 3 2x 2 +2x +1 (mod 5).

Umans Complexity Theory Lectures

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

Space and Nondeterminism

Lecture 11: Proofs, Games, and Alternation

Advanced topic: Space complexity

Chapter 2 : Time complexity

Essential facts about NP-completeness:

CS151 Complexity Theory. Lecture 14 May 17, 2017

CSE 135: Introduction to Theory of Computation NP-completeness

Chapter 5 : Randomized computation

Computational Complexity Theory

PSPACE COMPLETENESS TBQF. THURSDAY April 17

CSE 105 THEORY OF COMPUTATION

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

1 More finite deterministic automata

2 Evidence that Graph Isomorphism is not NP-complete

CS151 Complexity Theory. Lecture 4 April 12, 2017

Umans Complexity Theory Lectures

Ma/CS 117c Handout # 5 P vs. NP

CS5371 Theory of Computation. Lecture 19: Complexity IV (More on NP, NP-Complete)

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

Computational Complexity IV: PSPACE

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

Lecture 26: Arthur-Merlin Games

Independent Study Complexity Theory

Computability and Complexity Theory: An Introduction

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

Lecture 20: conp and Friends, Oracles in Complexity Theory

Great Theoretical Ideas in Computer Science

CS5371 Theory of Computation. Lecture 18: Complexity III (Two Classes: P and NP)

POLYNOMIAL SPACE QSAT. Games. Polynomial space cont d

Logarithmic space. Evgenij Thorstensen V18. Evgenij Thorstensen Logarithmic space V18 1 / 18

Beyond NP [HMU06,Chp.11a] Tautology Problem NP-Hardness and co-np Historical Comments Optimization Problems More Complexity Classes

Complexity Theory 112. Space Complexity

Lecture 16: Time Complexity and P vs NP

CS154, Lecture 13: P vs NP

CSE 105 THEORY OF COMPUTATION

INAPPROX APPROX PTAS. FPTAS Knapsack P

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

Lecture 13, Fall 04/05

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

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

NP Complete Problems. COMP 215 Lecture 20

Answers to the CSCE 551 Final Exam, April 30, 2008

1 Non-deterministic Turing Machine

TIME COMPLEXITY AND POLYNOMIAL TIME; NON DETERMINISTIC TURING MACHINES AND NP. THURSDAY Mar 20

Finish K-Complexity, Start Time Complexity

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

Transcription:

Time and space classes Little Oh (o, <) and Big Oh (O, ) Quick description: f(x) O(g(x)) f(x) cg(x), for some c and for all big enough x f(x) f(x) o(g(x)) lim x g(x) = 0 Also equivalent to saying that for all c > 0, there exist big enough x such that f(n) < cg(n) What we know Theorem P NP conp A P, A NP A NP NP-complete NP-hard By definition of NP-hard, every NP-complete problem is also NP-hard. NL P NL PSPACE Space hierarchy theorem. EXPSPACE P EXPTIME Time hierarchy theorem. UNIQUE-SAT P SAT If we can find an x i, i n such that φ i (x 1 = a, x 2 = b,, x i, x i+1,, x n ) is satisfiable for x i = 0 and x i = 1 then we reject. Otherwise, we recurse on the x i assignment that made φ satisfiable. IP = PSPACE NP IP Prover sends certificate, verifier runs the verification algorithm. BPP IP Prover does nothing, verifier runs the BPP algorithm for the problem in poly-time. Or because BPP PSPACE since we can simulate all possible coin flips in NPSPACE and thus simulate a prob. poly time TM. weak-ip = BPP Because, just like with IP, we can solve any BPP problem in weak-ip by just having the verifier run the BPP algorithm. Thus, BPP weak-ip. Also, any problem in weak-ip can be solved in BPP since both the prover and verifier are polynomial, which means their interaction will be polynomial, and can be simulated in BPP. Complexity classes - RED means the problem is known to be complete for its class - PURPLE means the problem is not known to be complete for its class (but could be, open for proving) - BLACK means I have not investigated Problems Reasons or explanation in P PATH Run a BFS/DFS on the graph. RELPRIME Run the Euclidean algorithm: Until y = 0, x x mod y, exchange x and y. Output x. PRIMES Use the recently discovered AKS algorithm. A CFG Convert grammar to CNF. Use dynamic programming O(n 4 ) algo. to build n n table for acceptance. A DFA Simulate the DFA and see if w is accepted. 1

E DFA Run a BFS/DFS on the DFA s graph to see if there is a path from start to accept state. E NFA Similar to E DFA. ALL DFA Build the complement of the DFA, by flipping accept into non-accept states and vice-versa. EQ DFA Take the symmetric difference, get an NFA, and use E NFA P on it. Remember: A is NP-complete and A p A NP conp NP Reasons or explanation HAMPATH The certificate c is the Hamiltonian path. We can check it against the graph G. LPATH Reduction from HAMPATH. COMPOSITES c is the two numbers a, b such that n = ab. CLIQUE c is the k-clique itself. We can check it against the graph G. SUBSET-SUM { S, t S = {x 1,, x k }, and for some {y 1,, y k } S, we have y i = t}, c = {y 1,, y k }. SAT, 3SAT c is the truth value assignments of the variables such that φ = true VERTEX-COVER Every edge in G needs to touch the nodes in the VC. c is the set of nodes of size k in the VC. ISO Graph isomorphism G 1, G 2, because c = permutation of nodes FACTORING In NP conp. Not known to be NP-complete. If proven to be (surprisingly) then NP = conp. EQ BP Non-deterministically try all assignments, accept if the two BPs disagree on one. conpcomplete. EQ ROBP Not known to be conp-complete, but can be solved using reduction to EQ. BP PSPACE TQBF Basically an instance of SAT, with exists ( ) quantifiers. To solve it in PSPACE, we have to take care of for all ( ) quantifiers by trying all truth values for such variables and making sure they all satisfy the expression. We can do this recursively, peeling off each quantifier and filling in truth values in the expression, until we can evaluate it (O(n + log n) space). PSPACE-completeness proof is similar to Savitch s theorem proof, but we rely on the quantifiers to assert the existence of an intermediary configuration of the PSPACE machine we are trying to simulate. A LBA We can solve TQBF using an LBA and a recursive algorithm, filling in the values for each variable. (see HW6 for TQBF p A LBA ) FORMULA- GAME x 1, x 2, x 3 [(x 1 x 2 ) (x 2 x 3 ) (x 2 x 3)], each player takes turns picking a value for the variables. Can the first player win? Prove it s PSPACE-complete using reduction from TQBF (insert dummy variables with appropriate quantifiers to convert any QBF to a formula game). GG Given a directed graph G and a start node s, players take turns picking the next node of a simple path (respecting graph transitions, no node repeats). The goal of player A is to get player B stuck in a node, such that he has no more edges to pick for his next path (all used up, or none outgoing). Prove it s PSPACE-complete using reduction from TQBF or FORMULA-GAME. EQ NFA We can try all strings of size 2 max{ Q 1, Q 2 } (non-deterministically by picking next symbol and next transitions in NFAs to simulate) and see if the two NFAs disagree on any string. If they do, then they re not equal. EQ REX Convert to NFAs and run EQ NFA. ALL NFA ALL NFA NPSPACE because we can non-deterministically try all strings of length 2 Q and see if the NFA rejects. From Savitch ALL NFA PSPACE and, since PSPACE = copspace ALL NFA PSPACE. 2

MIN- We don t care about time, so we can generate all small formulas (a lot of them), one at a time, and FORMULA check if the two formulas are equivalent (exponential time). Not known to be in conp. Reasons or explanation EXPSPACE EQ REX Regular expressions with exponentiation. Reduction from M, w is R 1 = Δ, Δ = Q Γ {#} and R 2 = all strings over Δ that are not rejecting computation histories of M on w. R 1 R 2 iff. M accepts w. Problems in L A DFA Simulate DFA by keeping track of current node in DFA, a number from 1 to n, representable on log n bits. UPATH Complicated proof in a paper quoted in the textbook. Problems Reasons or explanation in (co)nl PATH In NL, because we can non-deterministically pick the next node and guess the path (repeat n times). It s complete because we can reduce any NL problem to PATH in log-space by creating a graph of all the configurations with transitions between possible adjacent configurations. Note that a configuration for an NL machine is log-sized, so our log-space transducer can work. PATH Fairly non-obvious algorithm in NL. See resources online and in textbook. NL = conl. E DFA Show E DFA is conl-complete using reduction from PATH. This will imply it s also NL-complete. E NFA Also by reduction from PATH. A NFA We can non-deterministically simulate the NFA up to w Q transitions to see if it accepts w. We can reduce from PATH, by creating an NFA just like the original graph but with just ε transitions and q 0 = s, q acc = t. We can check if the NFA accepts the empty string. BOTH NFA { M 1, M 2 NFAs where L(M 1 ) L(M 2 ) } is in NL because you can try all strings of size k 1 k 2 (# of states in the NFAs) and see if they agree on any. It s complete because we can reduce E DFA to it by using M 2 as the NFA for Σ. EQ DFA Because we can decide EQ DFA if we try all strings of length max{k 1, k 2 } (number of states) and see if they disagree on anything. CYCLE Can solve with PATH from s to s. Can reduce from PATH by unwinding the graph: 1) v V, add v k V k, 2) a b E, add k, a k 1 b k in G, 3) add t V s 1 in G. ODDCYCLE We can non-deterministically select a start vertex, an odd length l V and then keep guessing nondeterministically for the next node. If there is an odd cycle, we will guess it. BIPARTITE Can use the ODDCYCLE algorithm to make sure there are no odd cycles in the graph. Remember: For NL/coNL, when proving something is in NL you can either: - Prove it s in conl, and NL = conl - Logspace-reduce it to another problem in NL/coNL, like DISJOINT REX l DISJOINT NFA NL 3

Unknown Reasons or explanation problems HAMPATH We cannot come up with a certificate to prove it s in NP. EQ NFA Not known to be in P, according to prob. 7.11 in 3 rd ed. Probabilistic complexity classes A probabilistic time TM M decides language A with error probability ε if for all w, we have: - w A Pr[M accepts w] 1 ε - w A Pr[M accepts w] ε A prob. time TM is an NTM where each non-deterministic step is called a coin-flip step and has two legal moves. The probability of a branch b is 2 k, where k is the # of coin flips that occurred on that branch. BPP = {A prob. time TM that decides A with error probability 1/3} Amplification lemma: Says that A probabilistic poly-time TM with error probability ε < 1 has another equivalent 2 probabilistic poly time TM with error ε as small as you want. BPP PRIMES and COMPOSITES Use Fermat s little theorem: p is prime and a < p a, a p 1 1 (mod p). If we can find an a such that the prime test is failed, then p is not prime. The good news is that most a will fail the test! BPP algorithm just picks two such a s and accepts its input as composite if both a s fail the test. Pr[COMPOSITES accepts prime w] = 0 and. Pr[COMPOSITES accepts composite w] = 3 4 (see Carmichael numbers) EQ ROBP It s easy to build two ROBPs that agree on all but one or two inputs, so we have to use the arithmetization trick to turn two ROBPs that disagree rarely, into two ROBPs that disagree very often, while still keeping them equal if they were equal. Definition: RP: always reject w when w A - w A Pr[M accepts w] 1 2 - w A Pr[M accepts w] = 0 Pr[M rejects w] = 1 Definition: corp: always accept w when w A - w A Pr[M accepts w] = 1 Pr[M rejects w] = 0 - w A Pr[M accepts w] 1 2 RP COMPOSITES Pr[COMPOSITES accepts prime w] = 0 and Pr[COMPOSITES accepts composite w] 3 4 corp PRIMES Pr[PRIMES accepts prime w] = 1 and Pr[PRIMES accepts composite w] 1 4 EQ ROBP 4

Open problems - GREEN means the statement is believed to be true, like P NP is believed to be true. - BLACK means I have not investigated Open problems Reason, implications P NP If P = NP, that would imply NP = conp, because P = cop and cop = conp. P PSPACE NP conp TQBF NP It would imply NP = PSPACE. L NL Savitch s theorem does not help here because f(n) = log n and the square of log n is not log n. L P NP PSPACE NP BPP 5