**Theorem** \(SAT\) is \(NP-complete\)

**Proof** First, \(SAT\in NP\) because we can verify in polynomial time that a given assignment cause a formula to evaluate to True.

Next we want to show that \(SAT\) is \(NP-hard\). Let \(L\subseteq \{0,1\}^*\) be any language in \(NP\), we want to show that \(L\leq_p SAT\). This means that we want to construct a function \(f\) that on input \(x\in\{0,1\}^*\), outputs \(f(x)=\varphi x\) such that \(\varphi x\) is satistiable iff \(x\in L\) and \(f\) can be computed in polynomial-time.

Let \(M\) be a NTM with polynomial running time that decides \(L\). We can assume:

- \(M\) never goes to the left of the fiist symbol of \(x\) in original input
- We know that the running time of $M4 is bounded by \(t(n)=an^b\) for some constant \(a,b\in\mathbb{N}\).

**Tableau**

```
q0 0111101
q1 1111101
q2 1111101
...
qacc xxxxxxx
```

To build \(\varphi x\), we start by defining variables \(z_{i,j,s}=1\) if cell \((i,j)\) of Tableau is \(s\), and \(0\) otherwise.

There are \(3(q+1)\) possible symbols in any cell whem \(M\) has \(q\) states and \(t(n)xf(n)\) cell in the Tableau.

So the total number of variables in polynomial in \(n\).

I. Create formula that is satisfied only when variable encode a Tableau.

$^{(enc)}*{i,j}(z)={V_s z*{i,j,s})(*{s,t}(\hat{z*{i,j,t}))

**Define** \(\varphi^{enc}-\land_{i,j\in t(n)}\varphi^{enc}_{i,j}\)

Check that each row is a valid configuration. (exercise: find formula \(\varphi^{conf}\) that does this)

Check initial configuration

- \(\varphi^{init}_{j}=Z_{1,1,\binom{x_1}{q_0}}\) if \(j=1\)
- \(\varphi^{init}_{j}=Z_{1,j,x_j}\) if \(j<j\leq n\)
- \(\varphi^{init}_{j}=Z_{i,j,-}\) if \(j>n\)

\(\varphi^{init}=\land_j\varphi^{init}_j\)

Check that \(M\) reaches the accept state \(\varphi^{accept}=(Exercise)\)

Check that the transitions in the Tableau are valid.

Key idea: enforce valid transitions on \(2\times 3\) windows.

\(\varphi^{trans}=(Exercise)\)

Define \(\varphi x=\varphi^{enc}\land\varphi^{init}\land\varphi^{acc}\land\varphi^{trans}\)

**Theorem** There is a language \(L\in NP\) for which any algorithm runs in time \(c\cdot n\).