Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Lecture 6

In-class notes: CS 505 Spring 2025 Lecture 6

Brief Aside on Reductions

When we say that a language is polynomial-time reducible to a language , denoted as , we are saying the following.

Given ANY string , I can transform into SOME in polynomial time such that

Looking back at our proof that is NP-complete, we showed how to transform ANY 3CNF formula into SOME PARTICULAR graph such that was satisfiable if and only if has an independent set of size . This is NOT saying that given ANY graph , I can solve ANY 3CNF formula.

More NP-Complete Problems

We’ll show one more problem is NP-complete. Given an undirected graph , a -clique is a set of vertices such that and , we have .1 Let be the set of all graphs that have a -clique.

Theorem. is NP-complete.

Proof. Again, is immediate.

To show that is NP-hard, we reduce 3SAT to . That is, we show . As with , let be a 3CNF formula. Given , we construct a graph with vertices as follows. Label each literal of each clause as , so . For each clause , add a cluster of nodes to the graph with labels . So we have clusters of nodes, where cluster has nodes .

We now add edges to the graph . The graph will have every node connected with edge , except for the following.

  • Nodes , , and in cluster (corresponding to ) will not be connected to each other.
  • If node is in cluster and node is in cluster , we do not connect and if they are a literal and their negation. For example, if and , then we do not connect the nodes. We argue this graph has a -clique if and only if is satisfiable.

First assume that has a satisfying assignment. Assume has literals and let be the satisfying assignment. Now, we construct a -clique in using the satisfying assignment . Since is satisfying, there is at least one literal in each that has a satisfied variable. For example, in , we can have under the assignment .

For each clause , pick one of the literals that is satisfied by . Suppose this is . Then, add the node in the graph to the set . Repeat this process for all for . Clearly . Now, we claim that is a -clique. By construction of the graph , we know that

  • All clusters of nodes are not connected to each other; and
  • Nodes corresponding to labels and are not connected to each other; and
  • All other nodes are connected to each other. This implies that every node is connected to every other node , so it is a -clique.

Now, assume that has a -clique, denoted by . We construct a satisfying assignment for using . Again, by our construction, we know that:

  • All clusters of nodes are not connected to each other; and
  • Nodes corresponding to labels and are not connected to each other; and
  • All other nodes are connected to each other. Since is a -clique, we know that and for all , we have . We know that and cannot correspond to conflicting variables (i.e., and is not possible if both ). So to construct the satisfying assignment for , for any , we assign the literal correspoding to a . Again by our construction of the graph , we know that each cluster of nodes corresponding to the clause are not connected to each other, but they are connected to everything else. So we know contains exactly node from each cluster of nodes. Thus, we have created an assignment which satisfies all clauses. This completes the proof.

Search vs. Decision Problems

We’ve stated complexity classes as decision problems, but one may naturally consider search variants where we are asked to find solutions. For the class , these two notions are the same: if I can decide a problem, then I can search for an actual solution (and vice versa).

If , then we cannot efficiently search for solutions (i.e, certificates) for decision problems in . On the other hand, if , then we can.

Theorem. If , then for every with efficient deterministic verifier , there exists a polynomial-time deterministic machine such that for all , and .

Proof. We show this is true for SAT, which implies it holds for all of NP since SAT is NP-complete. Suppose that is a decider for . That is, if is a Boolean formula, then if and only if is satisfiable. Since , we know that is deterministic and runs in polynomial time.

Now we build a new machine which outputs a satisfying assignment for if . Suppose that has literals . The algorithm operate as follows.

  • On input , the machine :
    • Runs .
    • If , output reject.
    • Else if , we know has a satisfying assignment.
    • Set and set (the empty string).
    • For :
      • Let and be the Boolean formulas obtained by setting literal in to and , respectively.
      • Compute and .
      • If then set and .
      • Else if then set and .
    • Output .

Clearly, since runs in polynomial time, then runs in polynomial time (in the length of ). By our construction, if is satisfiable, then the machine correctly reconstructs a satisfying assignment. In particular, during every step of the for loop, at least one of or will be equal to . If not, then the original formula would not be satisfiable, which means we would have already rejected.

The Complexity Class coNP

We’ll now discuss the co-class to NP, which we call coNP. This is defined by the set of languages with complements in NP. That is,

Warning

In fact, we know that .

Theorem. .

At a high level, this theorem follows since if , then .

Alternative view of coNP

The above definition of coNP isn’t very useful for understanding what languages in the class look like. So we consider the following equivalent definition.

Definition (). We say a language if there exists a polynomial and a polynomial-time deterministic Turing machine such that

Notice this is the opposite of NP! In the similar definition of NP, we have a “there exists” () rather than the “for all” () in the above definition.

Theorem. If , then . Or, equivalently stated, if , then .

In general, we do not believe that .

coNP-complete Problems

Just like with the NP, we can equivalently define coNP-complete problems. A language is coNP-complete if and for all .

We’ll look at the following problem: deciding if a formula is a tautology. That is, every assignment of variables in is a satisfying assignment.

Theorem. is coNP-complete.

Proof. Clearly since we can build a machine such that for any , and any assignment of variables , if and only if is satisfied. By definition of coNP, this machine must output for all assignments , which is true if is a tautology.

Now we show that is coNP-hard. Let be any language. Consider , its complement language that is in NP (which follows by definition of coNP).

By the Cook-Levin theorem, let be the formula such that is satisfiable, for any . Then, we know Thus, every is polynomial-time reducible to .

The Complexity Class NEXP

Recall the definition of EXP:

We can equivalently define the class of languages decidable in non-deterministic exponential time: NEXP.

Given this, we have a DTIME/NTIME hierarchy of classes:

Perhaps surprisingly, we get a “collapse” if .

Theorem. If , then . Or, equivalently stated, if , then .


  1. Note this is the opposite of a -independent set.