MIT 6.1220 — Lecture 13

Intractability (Part I)

§ Problem Types

We need to distinguish problems from instances.

The size of an instance is the number of bits needed to encode it.

We say an algorithm runs in time O(t(n))O(t(n)) if it can solve any instance of size nn in time O(t(n))O(t(n)).

Remark. Instead of time, we could also consider space, or in-place-ness, or randomness as limited resources…

A problem is tractable if it has an algorithm with runtime O(nk)O(n^k) for some constant kk, and intractable otherwise.

There are many variants of problems.

So the MST problem can have the following variants:

§ P, NP, coNP, EXP, and R

Only consider problems π\pi that are decision variants.

Definition (P). A problem π\pi is solvable in (deterministic) polynomial time iff there exists a (deterministic) algorithm AπA_{\pi} and a constant cc such that for every instance xx, we have:

Aπ(x) runs in time O(xc).    AND    Aπ(x)=π(x).A_{\pi}(x) \text{ runs in time } O(|x|^c). ~~~ \textbf{ AND } ~~~ A_{\pi}(x) = \pi(x).

Definition (NP). A problem π\pi is solvable in non-deterministic polynomial time iff there exists a (deterministic) verifier algorithm VπV_{\pi} and constants c,cc, c' such that for every instance xx of size x=n|x| = n, we have:

Vπ(x,y) runs in time O((x+y)c). AND    π(x)=YES iff there is a y with ync and Vπ(x,y)=YES.\begin{align*}& V_{\pi}(x, y) \text{ runs in time } O((|x| + |y|)^c). \\ \textbf{ AND } ~~~ & \pi(x) = \text{YES} \text{ iff there is a } y \text{ with } |y| \leq n^{c'} \text{ and } V_{\pi}(x, y) = \text{YES}.\end{align*}

All of min-cut, max-cut, min-path, and max-path are NP, with the desired yy being the cut / path itself.

Remark. Reminder that we're considering the decision variants of min-cut, max-cut, min-path, and max-path.

Definition (coNP). A problem π\pi is solvable in co-non-deterministic polynomial time iff there exists a (deterministic) verifier algorithm VπV_{\pi} and constants c,cc, c' such that for every instance xx of size x=n|x| = n, we have:

Vπ(x,y) runs in time O((x+y)c). AND    π(x)=NO iff there is a y with ync and Vπ(x,y)=YES.\begin{align*}& V_{\pi}(x, y) \text{ runs in time } O((|x| + |y|)^c). \\ \textbf{ AND } ~~~ & \pi(x) = \text{NO} \text{ iff there is a } y \text{ with } |y| \leq n^{c'} \text{ and } V_{\pi}(x, y) = \text{YES}.\end{align*}

It's easy to find coNP problems by negating NP problems; “are all paths of weight k\leq k?”, for example.

Claim. If πP\pi \in \textbf{P}, then πNP\pi \in \textbf{NP} and πcoNP\pi \in \textbf{coNP}.

Proof: The desired NP and coNP algorithms just run the P algorithm (negated, for coNP).   \blacksquare

These are the possible relationships between P, NP, and coNP.

Claim. It is not possible that P=NPcoNP\textbf{P} = \textbf{NP} \neq \textbf{coNP}.

Proof: The intuition is that if a problem is in P, then NP and coNP are equally easy.

Formally, take any πcoNP\pi \in \textbf{coNP}. Then πNP=PcoNP\overline{\pi} \in \textbf{NP} = \textbf{P} \subseteq \textbf{coNP}, so πcoNP\overline{\pi} \in \textbf{coNP}. But then π=πNP=P\pi = \overline{\overline{\pi}} \in \textbf{NP} = \textbf{P}, done.   \blacksquare

Definition (EXP). A problem π\pi is solvable in (deterministic) exponential time iff there exists a (deterministic) algorithm AπA_{\pi} and a constant cc such that for every instance xx, we have:

Aπ(x) runs in time O(2xc).    AND    Aπ(x)=π(x).A_{\pi}(x) \text{ runs in time } O(2^{|x|^c}). ~~~ \textbf{ AND } ~~~ A_{\pi}(x) = \pi(x).

Claim. All of P, NP, and coNP are in EXP.

Proof: Obviously PEXP\textbf{P} \subseteq \textbf{EXP} because polynomial-time is faster than exponential-time.

For any πNP\pi \in \textbf{NP} (or coNP\textbf{coNP}), we can solve π\pi by checking all 2(nc)2^{\left(n^{c'}\right)} possible certificates.   \blacksquare

Remark. We know that PEXP\textbf{P} \neq \textbf{EXP}. This is the Deterministic Time Hierarchy Theorem.

The reason why we care about EXP is because it's a “higher level” of difficulty than NP and coNP.

Definition (R). A problem π\pi is solvable iff there exists a (deterministic) algorithm AπA_{\pi} such that for every instance xx, we have:

Aπ(x) runs in finite time.    AND    Aπ(x)=π(x).A_{\pi}(x) \text{ runs in finite time.} ~~~ \textbf{ AND } ~~~ A_{\pi}(x) = \pi(x).

Remark. Primality testing is in P, which means it is solvable in O((logn)c)O((\log n)^c) time for some constant cc.

CYU: Why is logn\log n here? This also implies primality testing is in NP; isn't that surprising?