inspiration versus perspiration: the p = ? np question

65
Inspiration Versus Perspiration: The P = ? NP Question

Upload: clyde-mckenzie

Post on 19-Jan-2016

222 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Inspiration Versus Perspiration: The P = ? NP Question

Inspiration Versus Perspiration:The P =? NP Question

Page 2: Inspiration Versus Perspiration: The P = ? NP Question

Inspiration Versus Perspiration:The P =? NP Question

Page 3: Inspiration Versus Perspiration: The P = ? NP Question

Computational Complexity Computational Complexity TheoryTheory

Computational Complexity Theory Computational Complexity Theory is is the study of how much of a given the study of how much of a given resource (such as time, space, resource (such as time, space, parallelism, randomness, algebraic parallelism, randomness, algebraic operations, communication, or quantum operations, communication, or quantum steps) is required to perform the steps) is required to perform the computations that interest us the most.computations that interest us the most.

Page 4: Inspiration Versus Perspiration: The P = ? NP Question

WORST-CASE TIMEWORST-CASE TIME

We say that a program takes We say that a program takes worst-case time T(n), if some worst-case time T(n), if some input of size n takes T(n) steps, input of size n takes T(n) steps, and no input of size n takes and no input of size n takes longer.longer.

The input size is measured in The input size is measured in bits, unless stated otherwise. bits, unless stated otherwise.

Page 5: Inspiration Versus Perspiration: The P = ? NP Question

A Graph Named “Gadget”A Graph Named “Gadget”

Page 6: Inspiration Versus Perspiration: The P = ? NP Question

K-COLORINGK-COLORING

A k-coloring of a graph is an A k-coloring of a graph is an assignment of one color to each vertex assignment of one color to each vertex such that:such that:•No more than k colors are usedNo more than k colors are used•No two adjacent vertices receive the No two adjacent vertices receive the same colorsame color

A graph is called A graph is called k-colorablek-colorable iff it has a iff it has a k-coloringk-coloring

Page 7: Inspiration Versus Perspiration: The P = ? NP Question

A A CCRRAAYYOOLLAA Question! Question!

Is Gadget 2-colorable?Is Gadget 2-colorable?

No, it contains a triangle.

Page 8: Inspiration Versus Perspiration: The P = ? NP Question

Is Gadget 3-colorable?Is Gadget 3-colorable?

A A CCRRAAYYOOLLAA Question! Question!

Yes.

Page 9: Inspiration Versus Perspiration: The P = ? NP Question

Given a graph G, what is Given a graph G, what is a fast algorithm to decide a fast algorithm to decide

if it can be 2-colored?if it can be 2-colored?

2 2 CCRRAAYYOOLLAASS

PERSPIRATION; BRUTE FORCE: Try out all 2n ways of 2 coloring G.

Page 10: Inspiration Versus Perspiration: The P = ? NP Question
Page 11: Inspiration Versus Perspiration: The P = ? NP Question
Page 12: Inspiration Versus Perspiration: The P = ? NP Question
Page 13: Inspiration Versus Perspiration: The P = ? NP Question

Given a graph G, what is Given a graph G, what is a fast algorithm to decide a fast algorithm to decide

if it can be 3-colored?if it can be 3-colored?

3 3 CCRRAAYYOOLLAASS

Page 14: Inspiration Versus Perspiration: The P = ? NP Question

K-CLIQUESK-CLIQUES

A K-clique is a set of K nodes with all A K-clique is a set of K nodes with all k(K-1)/2 possible edges between k(K-1)/2 possible edges between them.them.

Page 15: Inspiration Versus Perspiration: The P = ? NP Question

This graph contains a 4-This graph contains a 4-cliqueclique

Page 16: Inspiration Versus Perspiration: The P = ? NP Question

Given an n-node graph G Given an n-node graph G and a number k, how can and a number k, how can

you decide if G contains a k-you decide if G contains a k-clique? clique?

PERSPIRATION: Try out all n choose PERSPIRATION: Try out all n choose k possible locations for the k cliquek possible locations for the k clique

INSPIRATION: ?INSPIRATION: ?

Page 17: Inspiration Versus Perspiration: The P = ? NP Question

INDEPENDENT SETINDEPENDENT SET

An An independent setindependent set is a set of is a set of node with no edges between them.node with no edges between them.

This graph contains an independent set of size

3.

Page 18: Inspiration Versus Perspiration: The P = ? NP Question

Given an n-node graph G Given an n-node graph G and a number k, how can and a number k, how can

you decide if G contains an you decide if G contains an independent set of size k?independent set of size k?

PERSPIRATION: Try out all n choose PERSPIRATION: Try out all n choose k possible locations for independent k possible locations for independent setset

INSPIRATION: ?INSPIRATION: ?

Page 19: Inspiration Versus Perspiration: The P = ? NP Question

Combinational CircuitsCombinational Circuits

AND, OR, NOT, 0, 1 gates wired AND, OR, NOT, 0, 1 gates wired together with no feedback allowed. together with no feedback allowed.

Page 20: Inspiration Versus Perspiration: The P = ? NP Question

x3x2x1

OR

AND

AND

AND

OR

OR

OR

Page 21: Inspiration Versus Perspiration: The P = ? NP Question

CIRCUIT-SATISFIABILITYCIRCUIT-SATISFIABILITY(decision version)(decision version)

Given a circuit with n-inputs Given a circuit with n-inputs and one output, is there a and one output, is there a way to assign 0-1 values to way to assign 0-1 values to the input wires so that the the input wires so that the output value is 1 (true)?output value is 1 (true)?

Page 22: Inspiration Versus Perspiration: The P = ? NP Question

CIRCUIT-SATISFIABILITYCIRCUIT-SATISFIABILITY(search version)(search version)

Given a circuit with n-inputs Given a circuit with n-inputs and one output, find an and one output, find an assignment of 0-1 values to assignment of 0-1 values to the input wires so that the the input wires so that the output value is 1 (true), or output value is 1 (true), or determine that no such determine that no such assignment exists?assignment exists?

Page 23: Inspiration Versus Perspiration: The P = ? NP Question

Given a circuit, is it Given a circuit, is it satisfiable?satisfiable?

PERSPIRATION: Try out all 2PERSPIRATION: Try out all 2nn assignmentsassignments

INSPIRATION: ?INSPIRATION: ?

Page 24: Inspiration Versus Perspiration: The P = ? NP Question

We have seen 4 problems: coloring, clique,

independent set, and circuit SAT.

They all have a common story: A large space of possibilities only a tiny fraction of which satisfy the constraints. Brute

force takes too long, and no feasible algorithm is

known.

Page 25: Inspiration Versus Perspiration: The P = ? NP Question

CLIQUE / INDEPENDENT SETCLIQUE / INDEPENDENT SET

Two problems that Two problems that are cosmetically are cosmetically different, but different, but substantially the substantially the samesame

Page 26: Inspiration Versus Perspiration: The P = ? NP Question

Complement Of GComplement Of G

Given a graph G, let GGiven a graph G, let G**, the , the complement of G, be the complement of G, be the graph obtained by the rule graph obtained by the rule that two nodes in Gthat two nodes in G** are are connected if and only if the connected if and only if the corresponding nodes of G are corresponding nodes of G are not connected not connected

Page 27: Inspiration Versus Perspiration: The P = ? NP Question

Let G be an n-node graph.

GIVEN:Clique Oracle

<G,k>

BUILD:Indep.

SetOracle

<G*, k>

Page 28: Inspiration Versus Perspiration: The P = ? NP Question

Let G be an n-node graph.

GIVEN: Indep.

Set Oracle

<G,k>

BUILD: Clique

Oracle

<G*, k>

Page 29: Inspiration Versus Perspiration: The P = ? NP Question

Thus, we can quickly reduce clique problem to an independent set

problem and vice versa.

There is a fast method for one if and only if

there is a fast method for the other.

Page 30: Inspiration Versus Perspiration: The P = ? NP Question

Given an oracle for circuit SAT, how can you quickly

solve 3-colorability?

Page 31: Inspiration Versus Perspiration: The P = ? NP Question

VVnn(X,Y)(X,Y)

Let VLet Vn n be a circuit that takes an n-node be a circuit that takes an n-node graph X and an assignment of colors to graph X and an assignment of colors to nodes Y, and nodes Y, and verifiesverifies that Y is a valid 3 that Y is a valid 3 coloring of X. I.e., Vcoloring of X. I.e., Vnn(X,Y)=1 iff Y is a 3 (X,Y)=1 iff Y is a 3 coloring of X.coloring of X.

X is expressed as an n choose 2 bit X is expressed as an n choose 2 bit sequence. Y is expressed as a 2n bit sequence. Y is expressed as a 2n bit sequence. sequence.

Given n, we can construct VGiven n, we can construct Vn n in time O(nin time O(n22).).

Page 32: Inspiration Versus Perspiration: The P = ? NP Question

Let G be an n-node graph.

GIVEN:SAT

Oracle

G

BUILD:3-

colorOracle

Vn(G,Y)

Page 33: Inspiration Versus Perspiration: The P = ? NP Question

Given an oracle for circuit SAT, how can you quickly

solve k-clique?

Page 34: Inspiration Versus Perspiration: The P = ? NP Question

VVn,kn,k(X,Y)(X,Y)

Let VLet Vn n be a circuit that takes an n-node be a circuit that takes an n-node graph X and a subset of nodes Y, and graph X and a subset of nodes Y, and verifiesverifies that Y is a k-clique X. I.e., that Y is a k-clique X. I.e., VVnn(X,Y)=1 iff Y is a k-clique of X.(X,Y)=1 iff Y is a k-clique of X.

X is expressed as an n choose 2 bit X is expressed as an n choose 2 bit sequence. Y is expressed as an n bit sequence. Y is expressed as an n bit sequence. sequence.

Given n, we can construct VGiven n, we can construct Vn,k n,k in time O(nin time O(n22).).

Page 35: Inspiration Versus Perspiration: The P = ? NP Question

Let G be an n-node graph.

GIVEN:SAT

Oracle

<G,k>

BUILD:CliqueOracle

Vn,k(G,Y)

Page 36: Inspiration Versus Perspiration: The P = ? NP Question

Given an oracle for 3-colorability, how

can you quickly solve

circuit SAT?

Page 37: Inspiration Versus Perspiration: The P = ? NP Question
Page 38: Inspiration Versus Perspiration: The P = ? NP Question

T F

XY

Output

Page 39: Inspiration Versus Perspiration: The P = ? NP Question

T FX Y

Output

XX YY

FF FF FF

FF TT TT

TT FF TT

TT TT TT

Page 40: Inspiration Versus Perspiration: The P = ? NP Question

T FX Y

Output

XX YY OROR

FF FF FF

FF TT TT

TT FF TT

TT TT TT

Page 41: Inspiration Versus Perspiration: The P = ? NP Question

T F

X NOT gate

Page 42: Inspiration Versus Perspiration: The P = ? NP Question

OR

OR

NOT

x y z

xy

z

Page 43: Inspiration Versus Perspiration: The P = ? NP Question

OR

OR

NOT

x y z

xy

z

Satisfiabilty of this circuit = 3-colorability of this graph

Page 44: Inspiration Versus Perspiration: The P = ? NP Question

Let C be an n-input circuit.

GIVEN:3-colorOracle

C

BUILD:SAT

Oracle

Graph composed of gadgets that mimic

the gates in C

Page 45: Inspiration Versus Perspiration: The P = ? NP Question

Formal StatementFormal Statement

There is a polynomial-time function f There is a polynomial-time function f such that:such that:

C is satisfiable <-> f(C) is 3 C is satisfiable <-> f(C) is 3 colorablecolorable

Page 46: Inspiration Versus Perspiration: The P = ? NP Question

4 4 Problems All EquivalentProblems All Equivalent

If you can solve one quickly then you If you can solve one quickly then you can solve them all quickly:can solve them all quickly:

Circuit-SATCircuit-SAT

CliqueClique

Independent SetIndependent Set

3 Colorability3 Colorability

Page 47: Inspiration Versus Perspiration: The P = ? NP Question
Page 48: Inspiration Versus Perspiration: The P = ? NP Question
Page 49: Inspiration Versus Perspiration: The P = ? NP Question
Page 50: Inspiration Versus Perspiration: The P = ? NP Question
Page 51: Inspiration Versus Perspiration: The P = ? NP Question
Page 52: Inspiration Versus Perspiration: The P = ? NP Question
Page 53: Inspiration Versus Perspiration: The P = ? NP Question
Page 54: Inspiration Versus Perspiration: The P = ? NP Question
Page 55: Inspiration Versus Perspiration: The P = ? NP Question
Page 56: Inspiration Versus Perspiration: The P = ? NP Question
Page 57: Inspiration Versus Perspiration: The P = ? NP Question
Page 58: Inspiration Versus Perspiration: The P = ? NP Question
Page 59: Inspiration Versus Perspiration: The P = ? NP Question
Page 60: Inspiration Versus Perspiration: The P = ? NP Question
Page 61: Inspiration Versus Perspiration: The P = ? NP Question
Page 62: Inspiration Versus Perspiration: The P = ? NP Question
Page 63: Inspiration Versus Perspiration: The P = ? NP Question
Page 64: Inspiration Versus Perspiration: The P = ? NP Question
Page 65: Inspiration Versus Perspiration: The P = ? NP Question