# Lecture 16

## P

Definition $$P=\cup_{k\geq 1}TIME(n^k)$$

Definition A polynomial-time TM is a TM with running time $$O(n^k)$$ for some $$k\in\mathbb{N}$$

A language $$L\in P$$ iff it can be decided by a single-tape polynomial-time TM.

### Why care about $$P$$

#### Robustness

Theorem $$L\in P$$ iff it can be decided by a polynomial-time

1. single tape TM
2. multi-tape TM
3. RAM algorithm.
4. ...

Proof Idea Show that single tape TM can simulate other models with only a polynomail slowdown.

Cobham-Edmonds Thesis Any problem that can be solved efficiently, by some physical computer has a corresponding language that is in $$P$$.

Challenge Quantum Computation

#### Closure

Theorem For any polynomial-time TM $$A$$ and any polynomial-time subroutine TM $$B$$ that calls $$A$$ as a black box (and counts as $$1$$ transition), there is a single-tape TM $$C$$ also runs in polynomial-time and behaves exactly as $$B$$.

$$TIME(n^k)$$ is not closed under subroutine calls for any $$k\geq 1$$.

• $$TIME(1)$$ (constant time) is closed.
• $$E=\cup_{k\geq 1}TIME(k^n)=\cup_{k\geq 1}TIME(2^{kn})$$ is not closed
• $$EXP=\cup_{k\geq 1}TIME(2^{n^k})$$

#### Meaning

For many languages, there is a simple brute-force search algorithm that decides the language in exponential time.

• 2COL: $$2^n$$ possible coloring to check
• 3COL: $$3^n$$ possible coloring to check
• SAT: $$2^n$$ assignments
• PRIMES: $$2^n$$ factors to check for a # w n binary digits

For each of these language $$L$$, showing that $$L\in P$$ means that we can do exponentially better than brute force search.

## NP

Definition The running time of NTM is a function $$t:\mathbb{N}\rightarrow\mathbb{N}$$ where $$t(n)$$ is the maximum number of transitions followed on any valid computation path before the NTM halts and over any input of length n.

Definition $$NTIME(t(n))$$ is the class of languages that can be decided by an NTM with running time $$O(t(n))$$

Definition NP=$$\cup_{k\geq 1}NTIME(n^k)$$.

Definition The language $$L$$ is efficiently verifiable, if there is a polynomail-time deterministic TM $$M$$ that satisties

1. $$\forall x\in L$$, there exist $$C=\{0,1\}^*$$ of length $$|c|=poly(|x|)$$ such that $$M$$ accepts $$<x,c>$$

2. $$\forall x\not\in L$$, $$\forall C=\{0,1\}^*$$ of length $$|c|=poly(|x|)$$, $$M$$ rejects $$<x, c>$$

Theorem $$L\in NP$$ iff $$L$$ is efficiently verifiable.

Proof Efficient verifiable $$\Rightarrow$$ $$L\in NP$$.

We can build a NTM to guess the certificant and call the verifunc as a subroutine

NP $$\Rightarrow$$ Efficient verifable

Use the certificate to determine which transitions to follow in a (deterministic) simulator of the NTM that decides $$L$$.