Title: coNP and Function Problems
1coNP and Function Problems
- coNP
- definition and its relationship with NP
- the class NP ? coNP, Pratts theorem
- Function Problems
- FSAT, FTSP
- total functions
2coNP
- NP - problems with succint certificates
- coNP problems with succint disqualifications
- Examples
- VALIDITY - is the given boolean expression
valid, i.e. is it true for all truth assignments? - succint disqualification invalidating truth
assignment - HAMILTONIAN PATH COMPEMENT given graph, is it
true that it does not have Hamiltonian path - succint disqualification a Hamiltonian path
- what about SAT COMPLEMENT?
- VALIDITY of the negated formula
3coNP Completeness
VALIDITY is coNP-complete If L ? coNP, then coL
? NP. Therefore, there is reduction R from coL to
SAT. For any input x we have x ? coL iff R(x) is
satisfiable. Reduction from L to VALIDITY is
R(x) ?R(x). More generally Theorem If L is
NP-complete, then its complement coLS-L is
coNP-complete.
4coNP vs NP
- Is it true that coNP NP?
- open problem ( NTIME classes closed under
complement) - we know coNSPACE NSPACE (Immerman
Szelepszenyi) - Which problems in coNP are least likely to be in
NP? - coNP-complete problems
- Theorem If a coNP-complete problem is in NP then
coNP NP. - If L ?NP is coNP-complete, then coNP ? NP For
any L ?coNP there is a reduction R to L. The
nondeterministic polynomial machine recognizing
L constructs R(x) from input x (reduction is
polynomial time) and then decides in polynomial
time (remember, L ? NP) whether R(x) is in L.
5The PRIMES Problem
- PRIMES is the input number prime?
- Is PRIMES in coNP?
- succint disqualification
- a divisor
- Is PRIMES in NP?
- we can check in time O(?n log2n) whether n is
prime - just by trying to divide by 2, 3, , ?n
- wait! Looks like PRIMES is in P!
- this is pseudopolynomial algorithm, it does not
even prove that PRIMES is in NP! - we will try to find succint certificate that n
is prime
6The classs coNP ? NP
- NP has succing certificate, coNP has succint
disqualification - What does coNP ? NP have?
- both succint certificate and succint
disqualification - nonsense
- each instance(input) has either succint
certificate (yes instance) or succint
disqualification (no instance) - From coP P we get P ? coNP ? NP.
- Is it true that P coNP ? NP?
- we know that R RE ? coRE (decidability
analogue) - but there are problems in coNP ? NP for which we
do not have polynomial algorithm
7PRIMES Revisited
Pratts theorem PRIMES is in NP ? coNP. It is
sufficient to show that PRIMES is in NP. We show
that there is a succint certificate for
PRIMES. We will need the following number-theory
lemma Lemma A number pgt1 is prime if and only
if there is a number r, 1 lt r lt p such that rp-1
1 mod p, and furthermore r(p-1)/q ? 1 for all
prime divisors q of p-1.
8PRIMES is in NP
- Lemma A number pgt1 is prime if and only if there
is a number r, 1 lt r lt p such that rp-1 1 mod
p, and furthermore r(p-1)/q ? 1 for all prime
divisors q of p-1. - Basic idea r from the above lemma is the
certificate - We need to verify rp-1 1 mod p in time
polynomial in log p. - compute r2, r4, r8, , and then multiply some of
them to get rp-1 - apply modulo after each multiplication, to keep
all intermediate results modulo p - multiplying/dividing two numbers ? p can be done
in time O(log 2 p) - O(log p) multiplication/division operations, so
O(log3p) overall complexity
9PRIMES is in NP
- Lemma A number pgt1 is prime if and only if there
is a number r, 1 lt r lt p such that rp-1 1 mod
p, and furthermore r(p-1)/q ? 1 for all prime
divisors q of p-1. - Problem 2021-1 1 mod 21, but 21 is not prime!
- Hah, we must also use the second part of the
lemma! - The certificate should contain not only r, but
also all prime divisors of p-1. - Second try
- the certificate is (r q1, q2, .., qk)
- we must check both properties required in the
lemma
10PRIMES is in NP
- Disaster
- C(91)(102,45), 1090 1 mod 91
- 1090/2 90 ? 1 mod 91
- 1090/45 9 ? 1 mod 91
- But 91 7 x 13!
- Where is the problem?
- misleading certificate, 45 is not prime!
- Solution?
- add primality certificates for all prime
divisors - needs to be done recursively
- C(p) (r q1, C(q1), q2, C(q2), , qk, C(qk))
11PRIMES is in NP
- Example
- C(67)(2 2, (1), 3, (2 2, (1)), 11, (82, (1),
5, (3 2, (1)))) - But the size has grown a lot!
- it is still polynomial in log(p)
- Lemma C(p) is of size at most 4 log2p.
- By induction on p trivially for C(2) and C(3).
- The number k of prime divisors of p-1 is less
then log p. - C(p) ? 4log p 5 Si2k C(qi)) ? 4log
p54Si2k log2qi - However, Si2k log2qi ? (log p -1)2 (because
Si2k log qi ? log p -1) - Substituting we get C(p) ? 4 log2p9-4log p ? 4
log2p for p?5
12FUNCTION PROBLEMS
- Decision problems are nice, but we often need to
compute a function, i.e. instead of checking
satisfiability we would like to know the
satisfying truth assignment. - Clearly, function problems are not easier then
decision problems. - However, is it possible that the function
problems to be much harder? - in other words, the decision problem to be much
easier then the corresponding function problem?
13FUNCTION PROBLEMS
- Example FSAT given formula f, find a satisfying
truth assignment, otherwise say no. - Observation If we can solve SAT polynomially, we
can also solve FSAT polynomially - use SAT to decide whether fx1true is
satisfiable - if yes, fix x1true and proceed recursively to
the next variable, othervise check whether
fx1false is satisfiable. If yes, fix x1false
and proceed recursively, othervise say no. - with at most 2n calls to SAT we can solve FSAT
- We have seen Self-reducibility in action.
14FUNCTION PROBLEMS
- Example FTSP Given set of intercity distances,
find the shortest TSP path. - Observation If we can solve TSP polynomially, we
can also solve FTSP polynomially - use binary search using TSP as decision
subroutine to find the smallest D such that
TSP(B) exists. - works if we can solve TSP polynomially, as P
coP - sequentially for each edge we increase its
weight by one and ask whether there is TSP(D).
The edge is used in the optimal TSP iff the
answer is no
15FUNCTION CLASSES
- Let L?NP. We know that there exists
polynomiallydecidable, polynomially bounded
relation RL such that for all strings x There is
a string y with RL(x,y) if and only if x ?L. The
function problem FL associated with L is the
following computational problem - Given x, find a string y such that RL(x,y) if
such string exists, otherwise return no - FNP FL L? NP
- FP those that can be solved in polynomial time
- FSAT ?FNP, but not expected to be in FP
- given the assignment, it is easy to verify in NP
time - FTSP is not expected to be in FNP
- given the shortest path, there is no known way
to verify it in NP time
16FUNCTION CLASSES REDUCTIONS
How would reductions work between function
classes? Definition A function problem A reduces
to function problem B if there are string
functions R and S, both computable in logarithmic
space, such that for any string x and z the
following holds If x is instance of A then R(x)
is instance of B. Furthermore, if z is a correct
ouput of R(x) then S(z) is correct output of x. A
function problem A is comnplete in a class FC of
function problems if A is in FC and all problems
in that class reduce to A. FP and FNP are closed
under reductions, and compositions of reductions
are reductions as well. FSAT is FNP
complete. Theorem FP FNP if and only if P NP.
17TOTAL FUNCTIONS
- Studying problems in FNP is not very interesting
it is the same as studying NP. - Exception Total functions for given x there is
always an answer y - The corresponding decision problem is trivial
always yes. - Still, the subject might be interesting
- FACTORING given number x, find its prime
decomposition p1k1p2k2pmkm, together with the
primality certificates of p1, p2, , pm - Note Without the primality certificates it is
not obvious that FACTORING is in FNP. - There are no known polynomial algorithms for
FACTORING. - despite trying really hard
- used in many cryptography schemes
18TOTAL FUNCTIONS
Example Given undirected graph G(V,E) with
integer edge weights. State is mapping from V to
-1, 1. We say that a node v is happy in state S
if S(i)xSi,j?E S(j)wi,j?0 HAPPYNET Given a
graph with weights, find a state in which every
node is happy. Proposition All instances of
HAPPYNET have solution. Proof Consider the sum
f(S) Si,j?ES(i)S(j)wi,j. Suppose node i is
unhappy in S. That means S(i)xSi,j?E
S(j)wi,j-dlt0. Consider now S S with i
flipped (i.e. S(i)-S(i)). Then f(S)
f(S)2d. Since f(S) is bounded from below and
above by the sum of all weights, it can be
increased only a finite number of steps, i.e.
there will not be an unhappy node.
19HAPPYNET DISCUSSION
The above algorithm is pseudopolynomial, not
polynomial. HAPPYNET is equivalent to finding
stable states in neural networks in Hopfield
model. HAPPYNET is in the class TFNP the class
of total function problems. TFNP is a subclass of
FNP, and superclass of FP