SmithLogo

CSC 250

Theory of Computation

Smith Computer Science



Lecture Notes 33: More NP-Completeness, P v NP, and Poly-Time-Reductions


Outline

This class we'll discuss:




NP and P vs NP









































Activity 1 [2 minutes] How would you Prove this?:
(Wait; then Click)

To show a language is in NP using a verifier:

• Specify a certificate that can be used with a verifier to decide the language.
• Give a verifier that uses that certificate to verify membership in the given language.
• Prove that the language recognized by the verifier is the given language and that the verifier runs in polynomial time.

Certificate: a graph and a set of k vertices we claim is a clique
Verifier: loop over all pairs in the set and check to make sure there’s an edge between them, and if so: ACCEPT - O(k^2) (can’t be bigger than n^2)




Activity 2 [2 minutes] How would you Prove this?:
(Wait; then Click)

Nondeterminism: we can try multiple “branches” of computation at once

The trick: each branch can only take polynomial time

Nondeterministically test all subsets of vertices. On each subset:
    loop over all pairs in the (sub)set and check to make sure there’s an edge between them, and if so: ACCEPT - O(n^2)
if no branch accepts REJECT


Guaranteed to halt? YES (there’s nowhere to get stuck)

What would happen if we tried to serialize all the branches?
    - how many possible subsets do we have to check? \(2^n\) <-- not polynomial anymore
    - note: this just means that this particular algorithm doesn’t run in polynomial time, but it turns out we haven’t been able to find any polynomial-time deciders for this language
















Activity 3 [2 minutes] How would you Prove this?:
(Wait; then Click)

Draw graph with a clique
Invert the graph
Point out that a clique in the graph is an independent set in the inverse

How long does it take to invert a graph?
  • how many edges could there possibly be? O(n^2)








So what can we say about the relative difficulty of these problems?


This means that they are essentially equivalent
Either both CLIQUE and INDEPENDENT−SET are in 𝒫 or neither is
















Activity 4 [2 minutes] How would you Prove this?:
(Wait; then Click)

Suppose B is NP-complete and B ∈ P.

  • Let A be any language in NP;
  • We know \( A \leq_p B\) since B is NP-complete.
  • Then A ∈ P, since B ∈ P and “easiness propagates downward”.
  • Since every A in NP is also in P, this means NP ⊆ P.
  • Since we also know P ⊆ NP, it follows that P = NP.








Activity 5 [2 minutes] How would you Prove this?:
(Wait; then Click)

Our witness (certificate) would be a satisfying assignment x1, x2, ..., xn s.t xi ∈ T/F.

A deterministic TM can easily verify that the assignment satisfies all clauses, in polynomial (even linear) time in n, m.








Activity 6 [2 minutes] How would you Prove this?:
(Wait; then Click)

  • We must show that any language A in NP is efficiently reducible to SAT.
    That is, if we could solve SAT, we could solve any problem A that’s in NP.


  • Since AND, OR and NOT form a universal system, i.e, a basis for Boolean logical operators, we know we can can construct a boolean formula that simulates the transitions of a Turing Machine.


  • Since A is in NP, there must be some nondeterministic TM \(M_A\) that decides it.


  • The reduction function, given \(M_A\) (the NP-machine for A), receives a string w and produces a Boolean formula \(\Phi_{M_{A,w}}\) that simulates the run of \(M_A\) on the input w


  • An assignment to \(\Phi_{M_{A,w}}\) could represent a computational path of the NP machine,
  • And if we’re clever, we can set it up so that \(\Phi_{M_{A,w}}\) will be satisfiable iff the machine \(M_A\) accepts w.



This is called the Cook-Levin Theorem

The full proof of this theorem is a little beyond the scope of this video, but if check out the original publication on Moodle if you want all the gory details. The important takeaway is that if we had some efficient decider for SAT, we’d be able to efficiently decide anything.














3CNF = conjunctive normal form with no more than three variables per conjunct

3SAT is in NP for the same reason that regular SAT was: given a set of T/F values, it’s easy to check whether the formula evaluates to T








Reduce it to SAT (SAT ≤p 3SAT)

It turns out that ANY propositional formula can be converted into an equivalent 3CNF version by splitting it into pieces and adding some dummy variables as necessary



















































Homework


[Due for everyone]
PS07 for this Friday

[Optional]
TODO