Motivation Example: HAMPATH
def
HAMPATH = {hG , s, ti |
G is a digraph with a Hamiltonian path from s to t }
Computability and Complexity
Last time we showed that HAMPATH ∈ NP.
Lecture 11
Another view:
Assume that some solution, called certificate (in our case a
path in G ), is given to us.
Polynomial time verifiers
More problems in NP
Polynomial time reducibility
In polynomial time we can verify whether it is a Hamiltonian
path from s to t or not.
given by Jiri Srba
Hence HAMPATH has a polynomial time verifiable.
Lecture 11
Computability and Complexity
1/13
Polynomial Time Verifiable Languages
Lecture 11
Computability and Complexity
Poly-Time Verifiers vs. Nondeterministic Poly-Time TMs
Theorem
A language L is polynomial time verifiable if and only if
L is decidable in polynomial time by a nondeterministic TM.
Definition
A verifier for a language L is a decider V such that
L = {w | V accepts hw , ci for some string c}
The string c is called a certificate or a proof.
”⇒”: Let V be a verifier for L running in time O(nk ). We
construct a nondeterministic decider M for L:
A verifier is called polynomial time verifier if it runs in a
polynomial time in the length of w (hence the length of c is
irrelevant).
M = ”On input w of length n:
1. Nondeterministically select a string c of length ≤ k1 nk .
2. Run V on hw , ci. Accept if and only if V accepted.”
A language L is polynomial time verifiable language if it has a
polynomial time verifier.
”⇐”: Let M be a nondeterministic polynomial time decider for L.
We construct a polynomial time verifier V for L:
Example:
V = ”On input hw , ci where w and c are strings:
1. Simulate one particular branch of M run on w
where nondeterministic choices are given by c.
2. Accept if and only if this branch accepted.”
HAMPATH is a polynomial time verifiable language.
We do not know whether HAMPATH has a polynomial time
verifier or not.
Lecture 11
Computability and Complexity
2/13
3/13
Further Languages in NP and the Class co-NP
Lecture 11
Computability and Complexity
4/13
Summary of Time Complexity Classes
def
CLIQUE = {hG , ki | G is a graph with a k-clique }
Complexity Class P
contains languages decidable in deterministic polynomial time
Theorem
CLIQUE is in NP.
Complexity Class NP
contains languages decidable in nondeterm. polynomial time
def
SUBSET-SUM = {hS, ti |
P
S = {x1 , . . . , xk } ⊆ N, t ∈ N, and there is X ⊆ S s.t.
X =t }
contains languages that have polynomial time verifiers
Theorem
SUBSET-SUM is in NP.
Complexity Class co-NP
contains complements of all languages that are in NP
Observe, that CLIQUE and SUBSET-SUM are not necessarily in
NP (in fact, we do not know if they are or not).
Complexity Class EXPTIME
contains languages decidable in deterministic exponential time
k
def S
EXPTIME = k≥0 TIME(2n )
Definition (The class co-NP)
def
co-NP = {L | L ∈ NP}
Lecture 11
Computability and Complexity
5/13
Lecture 11
Computability and Complexity
6/13
Time Complexity Classes
Polynomial Time Reducibility
Definition (Polynomial Time Computable Function)
A function f : Σ∗ → Σ∗ is a polynomial time computable function
iff there exists a TM Mf running in polynomial time which on any
given input w ∈ Σ∗
always halts, and
leaves just f (w ) on its tape.
Definition (Polynomial Time Mapping Reducibility, A ≤P B)
Let A, B ⊆ Σ∗ . We say that language A is polynomial time
(mapping) reducible to language B, written A ≤P B, iff
Remarks:
P ⊆ NP ⊆ EXPTIME, and P ⊆ co-NP ⊆ EXPTIME
1
We know that P 6= EXPTIME, but
the strictness of the other inclusions, as well as the question
whether NP = co-NP, are still open!
Lecture 11
Computability and Complexity
2
there is a polynomial time computable function f : Σ∗ → Σ∗
such that
for every w ∈ Σ∗ :
7/13
Theorem
w ∈A
Lecture 11
if and only if
f (w ) ∈ B
Computability and Complexity
8/13
SAT Problem
Theorem
If A ≤P B and B ∈ P, then A ∈ P.
Let V = {x1 , x2 , . . . , y , z, . . .} be a set of Boolean variables.
Definition (Boolean Formulae)
Proof:
The set of Boolean formulae is defined by the abstract syntax:
Let f be a polynomial time reduction from A to B computed
by a machine Mf running in time O(nk ).
Let MB be a decider for B running in time
φ ::= x | φ1 ∧ φ2 | φ1 ∨ φ2 | ¬φ
O(n` ).
where x ranges of the set of variables.
We construct a polynomial time decider MA for A:
A Boolean formula φ is satisfiable if there is an assignment of truth
values to the variables on which φ evaluates to true.
MA = ”On input w :
1. Run Mf on w (it halts and leaves f (w ) on the tape).
2. Run MB on f (w ) and accept iff MB accepted.”
Definition (The language SAT )
def
SAT = {hφi | φ is a satisfiable Boolean formula }
Step 1. runs in time O(nk ) and outputs f (w ) of length O(nk ).
`
Step 2. runs in time O((nk ) ) = O(nk·` ).
Lecture 11
Computability and Complexity
9/13
3SAT Problem
Lecture 11
Computability and Complexity
10/13
Polynomial Time Reduction from 3SAT to CLIQUE
Theorem
3SAT ≤P CLIQUE
Literal is a variable or a negation of a variable.
Instead of ¬x we usually write x.
Proof: For a 3SAT instance with k clauses
Clause of size 3 is a disjunction of three literals.
A formula in 3-cnf (3 conjunctive normal form) is a
conjunction of clauses of size 3.
φ = (a1 ∨ b1 ∨ c1 ) ∧ (a2 ∨ b2 ∨ c2 ) ∧ . . . ∧ (ak ∨ bk ∨ ck )
construct in poly-time an instance G = (V , E ), k of CLIQUE s.t.
Example of a 3-cnf formula with 4 clauses:
formula φ is satisfiable if and only if G has a k-clique.
(x1 ∨ x2 ∨ x3 ) ∧ (x2 ∨ x2 ∨ x3 ) ∧ (x1 ∨ x3 ∨ x3 ) ∧ (x2 ∨ x3 ∨ x3 )
V ... every occurence of a literal in φ is a node (3k nodes)
E ... all possible connections, without
Definition (The language 3SAT )
edges between literals in the same clause, and without
def
3SAT = {hφi | φ is a satisfiable 3-cnf formula }
Lecture 11
Computability and Complexity
edges between contradictory literals (x and x).
11/13
Lecture 11
Computability and Complexity
12/13
Exam Questions
Polynomial time verifiers and their equivalence with
nondeterministic polynomial time TMs.
CLIQUE , SUBSET-SUM are in NP.
Classes co-NP and EXPTIME.
Polynomial time reducibility and 3SAT ≤P CLIQUE .
Next time there is a TEST! More detailed topics are on the
web-page.
Lecture 11
Computability and Complexity
13/13
© Copyright 2026 Paperzz