Transcript
Page 1: 1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of

11

Page 2: 1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of

22

Lecture outlineLecture outline Basic definitions:Basic definitions:

PP, , NPNP complexity classes complexity classes the notion of a the notion of a certificatecertificate..

• reductionsreductions, various types:, various types:• KarpKarp, , CookCook and and LevinLevin..

• SearchSearch vs vs DecisionDecision problems problems• self-reducibilityself-reducibility..

• NP-CompleteNP-Complete languages and relations languages and relations• NPNP Complete relation and self-reducibility. Complete relation and self-reducibility.

• Introducing some NP-Complete problems.Introducing some NP-Complete problems.• Showing Showing RRSATSAT is NP-hard. is NP-hard.

Page 3: 1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of

33

The The PP, , NPNP complexity complexity classesclasses

DefDef:: AA Decision problemDecision problem for a language for a language

L L {0,1} {0,1}** is to decide whether a given is to decide whether a given string string xx belongs to the language belongs to the language LL..

DefDef:: PP is the class of languages (decision is the class of languages (decision problems) that can be recognized by a problems) that can be recognized by a deterministicdeterministic polynomial time polynomial time Turing Turing machinemachine..

DefDef:: NPNP is the class of languages that can be is the class of languages that can be recognized by a recognized by a non-deterministicnon-deterministic polynomial-time polynomial-time Turing-machineTuring-machine..

Page 4: 1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of

44

Polynomially Verifiable Polynomially Verifiable RelationsRelations

DefDef:: A binary relation A binary relation RR is is polynomially polynomially boundedbounded if: if:

(x,y) (x,y) R R |y| |y| |x| |x|o(1)o(1)

DefDef:: RR is is polynomial-time-decidablepolynomial-time-decidable if if the corresponding languagethe corresponding language

LLRR = { (x,y) : (x,y) = { (x,y) : (x,y) R } R } is in is in PP. .

DefDef:: A relation that is both A relation that is both polynomially-bounded polynomially-bounded && polynomial- polynomial-time-decidabletime-decidable is is polynomially-polynomially-verifiableverifiable..

Page 5: 1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of

55

NPNP – Alternative Definition – Alternative DefinitionDefDef:: L L is an is an NPNP language if there is a language if there is a

polynomially-verifiablepolynomially-verifiable relation relation RRLL s.t. s.t.

X X L L w w for which for which (x,w) (x,w) RRLL

ww is a is a witnesswitness or a or a certificatecertificate..Given a witness, Given a witness, membership can membership can

be verified in be verified in polynomial time.polynomial time.

Given a witness, Given a witness, membership can membership can

be verified in be verified in polynomial time.polynomial time.

P=NPP=NP implies: implies: witness witness can can bebe found found efficientlyefficiently

P=NPP=NP implies: implies: witness witness can can bebe found found efficientlyefficiently

Page 6: 1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of

66

The NP gameThe NP gameThe notion of a certificate can be thought of a The notion of a certificate can be thought of a

game between a prover and a verifiergame between a prover and a verifier

proverproverproverprover

verifieverifierr

verifieverifierr

Given input Given input XXGiven input Given input XX The all powerful prover sends The all powerful prover sends a a certificate certificate for membership for membership of of XX

The all powerful prover sends The all powerful prover sends a a certificate certificate for membership for membership of of XX

Which the verifier can validate efficientlyWhich the verifier can validate efficientlyWhich the verifier can validate efficientlyWhich the verifier can validate efficiently

Page 7: 1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of

77

NDTM NDTM PolyVerRel PolyVerRel Assume Assume MMLL is a non-deterministic TM is a non-deterministic TM

that decides that decides LL within within PPLL( |x| )( |x| ) steps steps

Let Let RRLL be the set of all pairs be the set of all pairs (x,y)(x,y) s.t. s.t.– xx is an input to is an input to MMLL

– YY is an accepting, legal computation of is an accepting, legal computation of MMLL

on on xx RRLL is is polynomially-verifiablepolynomially-verifiable

XXLL a computation a computation yy s.t. s.t. (x,y) (x,y) R RLL

1.2.1

Page 8: 1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of

88

PolyVerRel PolyVerRel NDTM NDTM Let Let RRLL be the relation for be the relation for LL, decided , decided

by a deterministic TM by a deterministic TM MM**LL

Def a Def a nonnon-deterministic TM -deterministic TM MMLL::– GuessGuess y y of proper polynomial size of proper polynomial size– Call Call MM**

LL to check to check if if (x,y) (x,y) R RLL

– AcceptAccept x x if if MM**LL accepts accepts (x,y)(x,y)

MMLL is a non-deterministic TM for is a non-deterministic TM for LL

Page 9: 1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of

99

Search ProblemsSearch Problems DefDef:: A A search problemsearch problem over a binary relation over a binary relation

RR finds, given finds, given xx, a string , a string yy s.t. s.t. (x,y) (x,y) R R.. Given a Given a polynomiallypolynomially--verifiableverifiable relation relation RR, ,

define:define:

L(R) = { x : L(R) = { x : y y s.t.s.t. (x,y) (x,y) R } R }

Clearly, finding a solution can only be harder than just deciding whether it

exists.

Clearly, finding a solution can only be harder than just deciding whether it

exists.

NoteNote: : NP = { L(R) : R NP = { L(R) : R isis polynomially- polynomially-verifiable }verifiable }

NoteNote: : NP = { L(R) : R NP = { L(R) : R isis polynomially- polynomially-verifiable }verifiable }

Page 10: 1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of

1010

ProblemProblem:: 3-coloring graphs3-coloring graphs

InstanceInstance:: An undirected graph An undirected graph G=(V,E)G=(V,E)

Corresponding relation: Corresponding relation:

RR3COL 3COL = { (G, = { (G,) : ) : is a legalis a legal 3-coloring 3-coloring ofof G } G }

Decision problem:Decision problem: decide the language decide the language L(RL(R3COL3COL)), namely whether , namely whether GG is is 3-colorable3-colorable..

Search problem:Search problem: find a find a 3-coloring3-coloring of of GG..

ExampleExample

Page 11: 1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of

1111

ReductionsReductions The purpose of a The purpose of a reductionreduction is to show that is to show that

some problem is at least as hard as some some problem is at least as hard as some other problem.other problem.

If problem If problem AA reducesreduces to problem to problem BB, then , then solving solving BB implies solving implies solving AA. .

2.1

B is at least as hard as A, denoted A B

B is at least as hard as A, denoted A B

Page 12: 1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of

1212

Cook ReductionCook Reduction

DefDef:: An An oracleoracle for a problem for a problem is a is a magical apparatus that, given an magical apparatus that, given an input input xx to to , returns , returns (x)(x) in a single in a single step.step.

DefDef:: A A Cook reductionCook reduction from problem from problem 11 to problem to problem 22 is a polynomial-is a polynomial-time TM for solving time TM for solving 11 on input on input xx utilizing an oracle for utilizing an oracle for 22..

DenotedDenoted 1 1 cookcook 22..

Page 13: 1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of

1313

Karp ReductionKarp Reduction

DefDef:: A A Karp reductionKarp reduction of of LL11 to to LL22 is a is a polynomial-time--computable polynomial-time--computable function function ff s.t. s.t.

x x L L1 1 f(x) f(x) L L22

DefDef:: A A Karp reductionKarp reduction of of LL11 to to LL22 is a is a polynomial-time--computable polynomial-time--computable function function ff s.t. s.t.

x x L L1 1 f(x) f(x) L L22

f L2 f(x) f(x)L1

L2xL1L2

Page 14: 1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of

1414

Karp vs. Cook reductionsKarp vs. Cook reductionsCook reductionCook reduction allows calling the oracle allows calling the oracle polynomially many timespolynomially many times

Karp reduction Karp reduction allows only one call to the allows only one call to the oracle, and only at the end of the computation.oracle, and only at the end of the computation.

Cook reductionCook reduction is stronger: is stronger: given given KarpKarp reduction reduction ff,,– On input On input xx compute the value compute the value f(x)f(x)..– Present Present f(x)f(x) to the oracle, and output its answer. to the oracle, and output its answer.

There are (few) examples where a There are (few) examples where a Cook Cook reductionreduction is known, while a is known, while a Karp reductionKarp reduction is is unknown.unknown.

Solve 1

2 oracle

I/oI/o

Page 15: 1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of

1515

Levin ReductionLevin Reduction

DefDef:: a a Levin reductionLevin reduction from from RR11 to to RR22 is 3 is 3 poly-time-computable functions poly-time-computable functions f,g,hf,g,h s.t. s.t.– x x L(R L(R11) ) f(x) f(x) L(R L(R22))– (x,y) (x,y) R R1 1 ( f(x), g(x,y) ) ( f(x), g(x,y) ) R R22

– ( f(x),z ) ( f(x),z ) R R2 2 ( x, h(x,z) ) ( x, h(x,z) ) R R11

ff translates inputs of the first problem to inputs translates inputs of the first problem to inputs of the second problem, of the second problem, gg & & hh transform transform certificates of one to the other.certificates of one to the other.

NoteNote: : A A Levin reductionLevin reduction implies implies Cook / KarpCook / Karp reductions of the corresponding search / decision reductions of the corresponding search / decision problems.problems.

2.1

Page 16: 1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of

1616

Properties of ReductionsProperties of ReductionsClaimClaim:: All reductions are transitive: All reductions are transitive:

AA reduces to reduces to BB, , BB to to CC AA reduces to reduces to CC

ClaimClaim:: Cook reductionCook reduction preserves poly preserves poly--timetime--computabilitycomputability

ProofProof:: assume assume 11 Cook-reduces to the poly-Cook-reduces to the poly-time-comp problem time-comp problem 22, and , and MM is the is the reduction algorithm.reduction algorithm. 22-oracle can be simulated by a poly-time TM-oracle can be simulated by a poly-time TM– Replacing oracle queries inReplacing oracle queries in M M by the by the

simulation - simulation - we get a poly-time TM that solves we get a poly-time TM that solves 11..

So do Karp & Levin reductions

2.1

Page 17: 1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of

1717

Search vs. Decision Search vs. Decision ProblemsProblems

RecallRecall: for poly-time verifiable relation: for poly-time verifiable relation RR,,L(R) = { x : L(R) = { x : y y s.t.s.t. (x,y) (x,y) R } R }

DefDef:: A relation A relation RR is called is called self-reducibleself-reducible if solving the search problem for if solving the search problem for RR is is Cook-reducibleCook-reducible to deciding the language to deciding the language L(R)L(R). .

1.4

The search problem can be solved using the decision problem

Page 18: 1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of

1818

InputInput:: A A CNFCNF formula formula with with nn variables. variables.

TaskTask:: find find : {1,..,N} : {1,..,N} {0,1} {0,1} such that such that ( ( (1), …, (1), …, (n) ) = True(n) ) = True

Corresponding relation:Corresponding relation:

RRSAT SAT = { ( = { (, , ) : ) : ( ( (1), …, (1), …, (n) ) = T (n) ) = T }}

SAT = L(RSAT = L(RSATSAT))

An Example: An Example: 3-SAT3-SAT

NoteNote: : Self-reducibilitySelf-reducibility is a property of a is a property of a relationrelation, not a , not a languagelanguage.. [There are many relations [There are many relations RR for which for which SAT = L(R)SAT = L(R).].]

Page 19: 1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of

1919

RRSATSAT

ThmThm: : RRsatsatisis Self-ReducibleSelf-Reducible..

ProofProof:: Assuming an oracle Assuming an oracle OO for the language for the language SATSAT = = L(RL(RSATSAT)). solving the . solving the search problemsearch problem::

Query Query OO whether whether SAT SAT. If not - stop.. If not - stop. For For kk := := 11 to to nn::

KK (x (xk+1k+1, .., x, .., xnn) := ) := ( ( 11, .., , .., k-1k-1,1, x,1, xk+1k+1,.., x,.., xnn))

– If If kk SAT SAT (Query (Query OO), ), k k = 1= 1 else else k k = 0= 0..

(1)=(1)=11, …, , …, (n)=(n)=nn satisfies satisfies !!

1.4.1

formula obtained by replacingx1, ..,xk with1, .., k-1,1

Page 20: 1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of

2020

y = 1: ( 1 1) ( 1 z)y = 1: ( 1 1) ( 1 z)

Self-reducibility of SATSelf-reducibility of SATGiven: ( x y) ( x z)

SAT oracle

x = 1: ( 1 y) ( 1 z)

Yes

y = 0: ( 1 0) ( 1 z)

z = 1: ( 1 0) ( 1 1)

( x y) ( x z)

No

Page 21: 1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of

2121

Another Example: Another Example: GIGIGraph IsomorphismGraph Isomorphism: given two (: given two (simplesimple) ) graphs, are they isomorphic?graphs, are they isomorphic?

Natural relationNatural relation: : RRGIGI contains all contains all ( (G1,G2),( (G1,G2),)) s.t.s.t. is an isomorphism between is an isomorphism between GG11 and and GG22..

Unlike Unlike SATSAT, , GI GI is not known to be is not known to be NP-CompleteNP-Complete

in fact GI is unlikely to be NP-hard, as

we’ll see later in the course

Page 22: 1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of

2222

ThmThm:: RRGIGI is Self-Reducible. is Self-Reducible.

ProofProof:: construct construct piecemeal, 1 vertex at a time piecemeal, 1 vertex at a timecheck if check if u u G G11 can be mapped by can be mapped by to to v v GG22::

Connect bothConnect both v v and and uu to new to new nn leaf-vertices leaf-verticesto obtain 2 new graphs, to obtain 2 new graphs, G’G’11 & & G’G’22

If If G’G’11 isomorphic to isomorphic to G’G’22 - - uu must be mapped to must be mapped to vv

Iterating this - deleting matching vertices - Iterating this - deleting matching vertices - determines the isomorphism, a vertex at a timedetermines the isomorphism, a vertex at a time

RRGIGI1.4.2

u and v are distinguished from other vertices so any isomorphism must map u to v

Page 23: 1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of

2323

Graph IsomorphismGraph Isomorphism

Page 24: 1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of

2424

Non Self-ReducibilityNon Self-Reducibility There are many non-selfThere are many non-self--reducible relations, reducible relations,

but it is hard to find an but it is hard to find an NPNP language, whose language, whose “natural” relation is non-self-reducible.“natural” relation is non-self-reducible.

LLCOMPCOMP = { N : N = n1 = { N : N = n1 n2 } n2 } is poly- time is poly- time decidable via a decidable via a randomizedrandomized algorithm. algorithm.

The natural choice is The natural choice is RRCOMPCOMP = { ( N, (n1,n2) ) : N = n1 = { ( N, (n1,n2) ) : N = n1

n2 }n2 } It is widely believed the It is widely believed the searchsearch of of RRCOMPCOMP is is

not poly-time-comp (factoring), which would not poly-time-comp (factoring), which would imply it is not self-reducible (by a random imply it is not self-reducible (by a random algorithm) algorithm)

deterministic!

Page 25: 1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of

2525

NP-completenessNP-completenessDefDef:: A language A language LL is is NP-CompleteNP-Complete if: if:

1. 1. LLNPNP..

2. 2. L’L’NP: L’NP: L’KarpKarpLL . .

DefDef:: A relation A relation RR is is NP-CompleteNP-Complete if: if:1. 1. L(R)L(R)NPNP..

2. 2. R’R’ s.t. s.t. L(R’)L(R’)NP: R’NP: R’LevinLevinRR..

Generalize: L’CookL

Page 26: 1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of

2626

NP-completeness & Self-NP-completeness & Self-ReducibilityReducibility

ThmThm:: For every relation For every relation RR,,

R R isis NP-Complete NP-Complete R R isis self-reducible self-reducible..

ProofProof: : Let Let RR be an NP-complete relation be an NP-complete relation..

RSAT is NP-hard under Levin reduction (to be proven later), namely, there is a Levin reduction (f,g,h) from R to RSAT

Since R is NP-complete, there exists a Karp reduction k from SAT to L(R).

2.2

Page 27: 1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of

2727

ProofProof (continue): (continue): an an algorithm algorithm that finds that finds yy s.t. s.t. (x,y)(x,y)RR,, using using the the LevinLevin & & karpkarp reductions: reductions:

1.1. Query Query L(R)L(R)’s oracle whether ’s oracle whether xxL(R)L(R)

2.2. If “no”, announce: If “no”, announce: xxL(R)L(R)3.3. If “yes”, translate If “yes”, translate xx into a into a CNFCNF formula formula

f(x)f(x) [using Levin’s [using Levin’s ff function] function]

4.4. Compute a satisfying assignment Compute a satisfying assignment ((11,,…,…,nn)) for for

5.5. Translate Translate ((11,…,,…,nn)) to a witness to a witness y=h(x, y=h(x, ((11,…,,…,nn)))) [Using Levin’s [Using Levin’s hh function] function]

NP-completeness & Self-NP-completeness & Self-ReducibilityReducibility

f(x,z) L(RSAT) (x,h(x,z))L(R)show later

xL(R) f(x)L(RSAT)

Page 28: 1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of

2828

ProofProof (continue): (continue): given a partial given a partial assignment assignment ((11,…,,…,ii)),, compute a satisfying compute a satisfying assignment assignment ((11,…,,…,nn)) for for , , Trying to assign Trying to assign xxi+1i+1::

check check L(R)L(R)’s oracle to see if’s oracle to see if((11,…,,…,ii,1,x,1,xi+2i+2,…, x,…, xnn)) is satisfiable is satisfiable[By translating the [By translating the CNFCNF formula formula ((11,…,,…,ii,1,x,1,xi+2i+2,…, x,…, xnn)) to to the language the language L(R)L(R), using the Karp function , using the Karp function kk]]

If the oracle answers “yes” assign If the oracle answers “yes” assign i+1i+1, , otherwise assign otherwise assign i+1i+1

Iterate until Iterate until iinn..

NP-completeness & Self-NP-completeness & Self-reducibilityreducibility

SATKarpL(R) and since L(R) is NP-

completeSAT k()L(R)

same as in self-reducibility of SAT.

instead of SAT’s oracle, use L(R)’s

oracle

Page 29: 1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of

2929

L oracle

SAT L

NP-completeness & Self-NP-completeness & Self-reducibilityreducibility

y = 1: ( 1 1) ( 1 z)y = 1: ( 1 1) ( 1 z)

Given: ( x y) ( x z)

x = 1: ( 1 y) ( 1 z)

Yes

y = 0: ( 1 0) ( 1 z)

z = 1: ( 1 0) ( 1 1)

( x y) ( x z)

No

Page 30: 1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of

3030

Bounded-HaltingBounded-HaltingTwo Equivalent Definitions:Two Equivalent Definitions:

BHBH { { <M>,x,1<M>,x,1t t | | <M><M> is the is the description of a description of a non-deterministicnon-deterministic TMTM that accepts input that accepts input xx within within tt steps. }steps. }

BHBH { { <M>,x,1<M>,x,1t t | | <M><M> is the is the description of a description of a deterministic TMdeterministic TM, , and and yy s.t. s.t. |y||y||x||x|O(1)O(1) and and MM accepts accepts (x,y)(x,y) within within tt steps } steps }

2.3

Page 31: 1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of

3131

Bounded-Halting Cont.Bounded-Halting Cont.DefDef:: Bounded-Halting RelationBounded-Halting Relation

RRBHBH { { ((<M>,x,1<M>,x,1t t , y), y)|| <M><M> is the is the description of a description of a deterministicdeterministic machine, which accepts input machine, which accepts input (x,y)(x,y) within within tt steps steps }}

NoteNote: : The length of The length of yy is bounded by is bounded by tt,,

therefore it is polynomial in the length oftherefore it is polynomial in the length of

the input the input <M>,x,1<M>,x,1t t ..

Page 32: 1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of

3232

Bounded-Halting is NP-Bounded-Halting is NP-CompleteComplete

ClaimClaim:: BH is NP-Complete.BH is NP-Complete.

ProofProof:: BHBHNPNP (immediate from definition) (immediate from definition) Any Any LL in in NPNP, Karp-reduces to , Karp-reduces to BHBH::

LetLet L L be in be in NPNP, then:, then: There exists a poly-time verifiable There exists a poly-time verifiable

witness-relation witness-relation RRLL, recognized by , recognized by MMLL. . MMLL accepts every accepts every (x,y)(x,y) in in p(|x|)p(|x|) steps steps

The reduction transformsThe reduction transforms x x to to MMLL,x,1,x,1p(|x|) p(|x|)

Page 33: 1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of

3333

ProofProof (continue): (continue):

XXLL Exists a polynomially bounded witness Exists a polynomially bounded witness

yy such such that that (x,y)(x,y)RRLL

Exists a polynomial time computationExists a polynomial time computation

of of MMLL accepting accepting (x,y)(x,y)

MMLL,x,1,x,1p(|x|) p(|x|) BHBH

Bounded-Halting is NP-Bounded-Halting is NP-completecomplete

NoteNote:: The reduction can be transformed into The reduction can be transformed into Levin Levin reductionreduction of of RRLL to to RRBHBH with the identity function with the identity function supplying the two missing functions.supplying the two missing functions.

(x,y) ( M,x,1t ,y)

Page 34: 1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of

3434

Circuit-SatisfiabilityCircuit-SatisfiabilityDefDef: : a a circuitcircuit is a directed acyclic graph is a directed acyclic graph

G=(V,E)G=(V,E) with vertices labeled with vertices labeled outputoutput,,,,,,,,xx11,…, ,…, xxmm,, s.t.s.t. A vertex labeled A vertex labeled xxii has in-degree has in-degree 00 A vertex labeled A vertex labeled 00 (or (or 11) has in-degree ) has in-degree 00 The in-degree of vertices labeled The in-degree of vertices labeled , , is is 2 2

(bounded fan-in)(bounded fan-in) A vertex labeled A vertex labeled has in-degree has in-degree 11 a single sink (of out-degree a single sink (of out-degree 00), of in-degree ), of in-degree 11, ,

labeled “output”labeled “output”

2.4

Xi

1

Out

Page 35: 1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of

3535

Circuit-SatisfiabilityCircuit-SatisfiabilityGiven an assignment Given an assignment mm to the to the variables variables xx11,…,x,…,xmm, , C(C()) will denote the will denote the value of the circuit’s output value of the circuit’s output

DefDef:: Circuit-SatisfiabiltyCircuit-SatisfiabiltyCS CS {circuit C : exists {circuit C : exists s.t. C( s.t. C()=1})=1}

RRCSCS {(C, {(C, ) : C() : C()=1})=1}

The value is defined by setting the value of each vertex to the natural value imposed by the Boolean operation it is labeled by

Page 36: 1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of

3636

CSCS is NP-complete is NP-completeClaimClaim:: CSCS isis NP-CompleteNP-Complete..

ProofProof:: CSCSNPNP

RRCSCS is polynomialy-bounded: the is polynomialy-bounded: the witness witness is an assignment - it has is an assignment - it has one bit for each one bit for each xxii

Given a pair Given a pair (C, (C, )) evaluating one evaluating one gate takes gate takes O(1)O(1) steps, therefore steps, therefore total evaluation time is polynomial in total evaluation time is polynomial in |C||C|..

2.4,2.6

Page 37: 1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of

3737

ProofProof (continue): (continue): CSCS is is NP-hard NP-hard (show a reduction from (show a reduction from BHBH):):

Given Given M,x,1 M,x,1t t the computation of the computation of MM can be can be fully described by a fully described by a tttt matrix in which entry matrix in which entry (i,j)(i,j) is: is: The content of cellThe content of cell j j at timeat time i i (constant) (constant) An indicator to whether the head is on cell An indicator to whether the head is on cell

jj at time at time ii ( (11 bit). bit). In case the head is indeed there: the state In case the head is indeed there: the state

of the machine ( of the machine ( O(log |M|)O(log |M|) ). ).

CS CS is NP-completeis NP-complete

Each row of the matrix corresponds to a configuration of the machine

Page 38: 1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of

3838

CSCS is NP-complete is NP-completeProof (continue):Proof (continue): The transition between following configurations can The transition between following configurations can

be simulated by a series of be simulated by a series of tt circuits circuits C Ctt as shown as shown later.later.

The reduction constructs a circuit The reduction constructs a circuit C’C’ from the from the t t t t CCtt circuits, where thecircuits, where the i ithth series is the input of the series is the input of the i+1i+1 series.series.

The input to the circuit is built of The input to the circuit is built of |x||x| vertices vertices corresponding to the input corresponding to the input xx, and , and t-|x|t-|x| “variable “variable vertices”.vertices”.

Finally, we add to Finally, we add to C’ C’ the ability to identify that a the ability to identify that a certain configuration has reached certain configuration has reached acceptingaccepting state, state, so that the circuit will output so that the circuit will output 11..

It is shown that the whole circuit can be built using It is shown that the whole circuit can be built using O(nO(n55)) gates. gates.

Page 39: 1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of

3939

The circuit The circuit CCtt The The j’thj’th triple in the triple in the i’thi’th configuration, is determined by configuration, is determined by

the the j-1, j, j+1j-1, j, j+1 triples in the triples in the i-1i-1 configuration. This can be configuration. This can be described by boolean functions implemented by described by boolean functions implemented by CCtt..

Log |M| state bits

SymbolHead indicator

Log |M| state bits

SymbolHead indicator

Log |M| state bits

SymbolHead indicator

J-1

J

J+1

Log |M| state bits

Symbol

Head indicatorCt

I’th-1 configurtion I’th configurationIt is shown that Ct can be described in O(n3) gates

Page 40: 1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of

4040

CSCS is NP-complete is NP-completeProofProof (continue): (continue): The accepting states can be encoded into a The accepting states can be encoded into a

Boolean function, which will returnBoolean function, which will return 1 1, on input , on input an accepting state. The output of the entire an accepting state. The output of the entire circuit is an circuit is an OROR over all the state outputs of all over all the state outputs of all CCtt circuits. This can be described by circuits. This can be described by O(nO(n2 2 log n)log n) gates.gates.

Page 41: 1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of

4141

RRSATSAT is NP-hard is NP-hardClaimClaim::

RRSATSAT is NP-hard under Levin reductionis NP-hard under Levin reduction..ProofProof::

Since Circuit-satisfiability is NP-CompleteSince Circuit-satisfiability is NP-Completeit suffices to show a reduction it suffices to show a reduction from from RRCSCS to to RRSATSAT: : The reduction maps a circuit The reduction maps a circuit CC to a to a CNFCNF formula formula CC, and an input , and an input yy for the circuit for the circuit to an assignment to an assignment y’y’**to the formula and to the formula and vice versa.vice versa.

2.5

Page 42: 1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of

4242

RRSATSAT is NP-hard is NP-hardProofProof (continue): (continue): Mapping Mapping

circuit circuit CC to CNF formula to CNF formula CC Every vertex of the circuit-graph Every vertex of the circuit-graph

is mapped into a variable. is mapped into a variable. For every such variable For every such variable VVii we we

define a define a CNFCNF formula formula ii that that forces the variable to have the forces the variable to have the same value as the gate same value as the gate represented by represented by VVii

We define We define c c 11 … … nn

Page 43: 1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of

4343

RRSATSAT is NP-hard is NP-hardProofProof (continue): (continue): mapping a gate to a mapping a gate to a

formula:formula: For a For a vertex vertex vv with an in-edge from with an in-edge from uu::

i i (v, u) (v, u) (u (u v) v) ( (u u v)v) For a For a vertex vertex vv with in-edges from with in-edges from uu, , ww::

i i (v, u, w) (v, u, w) (u (u w w v) v) (u (u w w v) v) ( (u u w w v) v) ( (u u w w v) v)

For a For a vertex vertex vv with in-edges from with in-edges from uu, , ww::

i i (v, u, w) (v, u, w) (u (u w w v) v) (u (u w w v) v) ( (u u w w v) v) ( (u u w w v) v)

For the vertex marked For the vertex marked outputoutput with an in-edge with an in-edge from from uu::

outputoutput(u)(u) uu

Page 44: 1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of

4444

RRSATSAT is NP-hard is NP-hardProofProof (continue): (continue): CCCS CS ccSATSAT: given an : given an

assignment to assignment to cc it’s easy to it’s easy to construct an assignment to construct an assignment to CC, , and vice versaand vice versa

NoteNote:: The reduction is poly-time - the The reduction is poly-time - the size of the CNF formula size of the CNF formula cc is linear in is linear in the size of the size of CC, therefore, it can be , therefore, it can be constructed in polynomial timeconstructed in polynomial time

Page 45: 1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of

4545

Bibliographic NotesBibliographic Notes Lecture notes for a course by Oded Lecture notes for a course by Oded

Goldreich.Goldreich.

M. Bellare and s. Goldwasser, “The M. Bellare and s. Goldwasser, “The Complexity of Decision vs Search”Complexity of Decision vs Search”

M. Sipser, “The History and Status of the P M. Sipser, “The History and Status of the P vs NP Problems”vs NP Problems”

M. Sipser, “Introduction to the Theory of M. Sipser, “Introduction to the Theory of Computation”Computation”


Top Related