Precise complexity classes

Introduction to Complexity • DTIME(T(n)) = {problems that can be (part 2) solved deterministically in T(n) time} • NTIME(T(n)) = {problems that can be solved non-deterministically in T(n) time} • DSPACE(S(n)) = {problems that can be Richard Borie University of Alabama solved deterministically in S(n) space} November 18, 2005 • NSPACE(S(n)) = {problems that can be solved non-deterministically in S(n) space}

General complexity classes Formal definitions

k • P = deterministic polynomial time •P = ∪c≥0,k≥0 DTIME(cn ) k • NP = non-det. polynomial time •NP = ∪c≥0,k≥0 NTIME(cn ) k • PSPACE = det. polynomial space •PSPACE = ∪c≥0,k≥0 DSPACE(cn ) k • NPSPACE = non-det. polynomial space • NPSPACE = ∪c≥0,k≥0 NSPACE(cn ) nk • EXP = det. exponential time •EXP = ∪c≥0,k≥0 DTIME(c ) nk • NEXP = non-det. exponential time •NEXP = ∪c≥0,k≥0 NTIME(c ) nk • EXPSPACE = det. exponential space •EXPSPACE = ∪c≥0,k≥0 DSPACE(c ) nk • NEXPSPACE = non-det. exponential space • NEXPSPACE = ∪c≥0,k≥0 NSPACE(c )

Notes on time complexity Notes on

• Precise time complexity is often affected • Precise space complexity is usually by the underlying model of computation independent of the model – Checking whether or not a string is a – Thus general space complexity is too 2 palindrome takes O(n ) time on a Turing • Space complexity is sometimes defined machine but only O(n) time on a random by ignoring the space used for the input access machine and/or output, so S(n)=o(n) is possible • However, general time complexity is – Only permitted if input is only read once, usually independent of the model and/or if output is not read after it’s written 2 –Both O(n) and O(n) are polynomial time, and – Assume a one-way read-only input stream so the problem is in class P either way and/or a one-way write-only output stream

1 Time-space relationships More time-space relationships

Consider any function f(n) Consider any function f(n) ≥ lg n • DTIME(f(n)) ⊆ NTIME(f(n)) •NSPACE(f(n)) ⊆ DTIME(cf(n)) for some c –So P ⊆ NP and EXP ⊆ NEXP –So NPSPACE ⊆ EXP ⊆ 2 • NTIME(f(n)) ⊆ DSPACE(f(n)) •NSPACE(f(n)) DSPACE(f(n) ) –So NPSPACE ⊆ PSPACE and NEXPSPACE ⊆ ⊆ ⊆ –So NP PSPACE and NEXP EXPSPACE EXPSPACE •DSPACE(f(n)) ⊆ NSPACE(f(n)) • Putting it together – So PSPACE ⊆ NPSPACE and EXPSPACE ⊆ –P ⊆ NP ⊆ PSPACE = NPSPACE ⊆ EXP ⊆ NEXP NEXPSPACE ⊆ EXPSPACE = NEXPSPACE

Constructible functions Hierarchy theorems

•Function T(n) is time-constructible if •If T1(n) and T2(n) are time-constructible there exists a program P such that for functions such that limn→∞ T1(n)/T2(n) = 0, each n there exists input x of length n then there exists a language that is in such that P takes exactly T(n) time on DTIME(T2(n) lg T2(n) ) but not in input x DTIME(T1(n))

• Function S(n) is space-constructible if •If S1(n) and S2(n) are space-constructible there exists a program P such that for functions such that limn→∞ S1(n)/S2(n) = 0 each n there exists input x of length n and S2(n) ≥ lg n, then there exists a such that P takes exactly S(n) space on language that is in DSPACE(S2(n)) but not input x in DSPACE(S1(n))

Gap theorems Speed- theorems

Consider any function g(n) Consider any function g(n) [ex. g(n) = lg n] • There exists T(n) such that • There exists language such that for any DTIME(T(n)) = DTIME(g(T(n))) program P1 for L, there exists program P2 • There exists T(n) such that for L and constant n0 such that TP2(n) ≤ NTIME(T(n)) = NTIME(g(T(n))) g(TP1(n)) for all n ≥ n0 • There exists S(n) such that • There exists language L such that for any DSPACE(S(n)) = DSPACE(g(S(n))) program P1 for L, there exists program P2 • There exists S(n) such that for L and constant n such that S (n) ≤ NSPACE(S(n)) = NSPACE(g(S(n))) 0 P2 g(SP1(n)) for all n ≥ n0

2 Union theorems Interesting but useless theorem

Consider any set of functions {gk(n): k ≥ 0} • There exists a function h(n) such that such that g (n) ≥ g (n) for all k and n DTIME(h(n)) = NTIME(h(n)) = k+1 k DSPACE(h(n)) = NSPACE(h(n)). • There exists T(n) such that • Proof: For all functions f(n), ∪ DTIME(T(n)) = k≥0 DTIME(gk(n)) NSPACE(f(n)) ⊆ DTIME(cf(n)) ⊆ • There exists S(n) such that NTIME(cf(n)) ⊆ DSPACE(cf(n)) ⊆ f(n) f(n) DSPACE(S(n)) = ∪k≥0 DSPACE(gk(n))) NSPACE(c ) ⊆ NSPACE(f(n) ). Letting g(n)=nn in the gap theorem, NSPACE(f(n)) = NSPACE(f(n)f(n)) for some f(n), so let h(n) = f(n)f(n).

Defining other complexity classes Other complexity classes • Let C = any •Examples – co-C = {complements of problems in C} – co-PSPACE

– C-easy = {problems Q such that Q ≤T Q’ –EXP-easy for some Q’ ∈ C} – NEXPSPACE-hard – C-hard = {problems Q such that Q’ ≤T Q – P-complete (defined using log-space for some Q’ ∈ C-complete} reductions) – C-complete = {problems Q∈C such that for all Q’∈C, there exists Q’ ≤m Q} • Each of the above reductions can be defined as taking either polynomial-time (Q’ ≤ P Q) or logarithmic-space (Q’ ≤ log Q)

More about oracles Some observations • Can you prove each of these statements? • Let C, D = any complexity classes – If P=NP then NP=co-NP • Recall DQ = {Q’ : Q’ ≤ D Q} • Note: the converse is not necessarily true T – If P=NP then P=NP∩co-NP – Q denotes a problem solved by an oracle • Note: the converse is not necessarily true • Also recall DC = ∪ {DQ : Q∈C} – If NP=co-NP and P=NP∩co-NP then P=NP • Theorem: DQ = DC if Q is C-complete • Each of P=NP, NP=co-NP, and P=NP∩co-NP is an important unresolved question •Example: PNP = PSAT NP PSPACE QBF co-NP •Example: NP = NP P NP-complete co-NP-complete

3 Why are P=NP, NP=co-NP, and Future topics in complexity P=NP∩co-NP difficult to resolve? • All the theorems discussed today • Counting classes such as #P, ⊕P continue to hold when DTIME, NSPACE, • Randomized classes RP, ZPP, PP, BPP etc. are extended to oracle machines • Interactive and zero-knowledge proofs • But oracles U,V,W,X,Y,Z exist such that • Non-approximability –PU = NPU and PV ≠ NPV –NPW = co-NPW and NPX ≠ co-NPX • Classes inside P –PY = NPY ∩ co-NPY and PZ ≠ NPZ ∩ co-NPZ – LOGTIME, LOGSPACE • So none of today’s results will be any help – Parallel classes NC, AC, SC to resolve these open questions • New proof techniques are needed

4