reducibility and np-completeness cosc 3101b, prof. j. elder 2 computational complexity theory...

100
Reducibility and NP-Completeness

Upload: patience-thornbrugh

Post on 01-Apr-2015

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

Reducibility and NP-Completeness

Page 2: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 2

Computational Complexity Theory

• Computational Complexity Theory is the study of how much of a given resource (such as time, space, parallelism, algebraic operations, communication) is required to solve important problems.

Page 3: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 3

Classification of Problems

• Q. Which problems will we be able to solve in practice?

• A working definition. [Cobham 1964, Edmonds 1965, Rabin 1966] Those with polynomial-time algorithms.

Yes Probably no

Shortest path Longest path

Min cut Max cut

2-SAT 3-SAT

Matching 3D-matching

Primality testing Factoring

Planar 4-color Planar 3-color

Bipartite vertex cover Vertex cover

Page 4: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 4

Tractable Problems

• We have generally studied tractable problems (solvable in polynomial time).

• Algorithm design patterns. Examples.

– Greed. O(n log n) activity scheduling.

– Divide-and-conquer. O(n log n) merge sort.

– Dynamic programming. O(n log n) activity scheduling with profits.

– Duality. O(n3) bipartite matching.

Page 5: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 5

Intractable Problems

• There are other problems that provably require exponential-time.

• Examples:

– Given a Turing machine, does it halt in at most k steps on any finite input?

– Given a board position in an n-by-n generalization of chess, can black guarantee a win?

Page 6: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 6

Impossible Problems

• There are other problems that cannot be solved by any algorithm.

Page 7: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 7

The Halting Problem

• The halting problem is a particular decision problem:

– Given a description of a program and a finite input, decide whether the program will halt or run forever on that input.

• A general algorithm to solve the halting problem for all possible program-input pairs cannot exist: The halting problem is undecidable.

Page 8: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 8

NP Completeness

• Bad news. Huge number of fundamental problems have defied classification for decades.

• Some good news. Using the technique of reduction, we can show that these fundamental problems are "computationally equivalent" and appear to be different manifestations of one really hard problem.

Page 9: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 9

Ingredients:

•Instances: The possible inputs to the problem.

•Solutions for Instance: Each instance has an exponentially large set of solutions.

•Cost of Solution: Each solution has an easy to compute cost or value.

Optimization Problems

Page 10: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 10

Specification of an Optimization Problem

•Preconditions: The input is one instance.

•Postconditions: The output is one of the valid solutions for this instance with optimal cost. (minimum or maximum)

Optimization Problems

Eg: Given graph G, find biggest clique.

Page 11: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 11

•An optimization problem

•Each solution is either valid or not (no cost)

•The output is

•Yes, it has an valid solution.

•No, it does not

•the solution is not returned

•Eg: Given graph and integer <G,k>,

does G have a clique of size k?

Non-DeterministicPoly-Time Decision Problems (NP)

Page 12: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 12

•Key: Given •an instance I (= <G,k>)•and a solution S (= subset of nodes)•there is a poly-time alg Valid(I,S) to test whether or not S is a valid solution for I.•Poly-time in |I| not in |S|.

k=4

ValidNot Valid

Non-DeterministicPoly-Time Decision Problems (NP)

Page 13: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 13

Which are more alike?

Network Flow

Graph Colouring

Circuit Satisfiability

BipartiteMatching

Best known algorithmexponential time

Polynomial timealgorithm

Non-Deterministic Poly TimeComplete

Similar structure Similar structure

Page 14: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

Reducibility

Page 15: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 15

A Graph Named “Gadget”

Page 16: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 16

K-COLORING

• A k-coloring of a graph is an assignment of one color to each vertex such that:

– No more than k colors are used

– No two adjacent vertices receive the same color

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

Page 17: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 17

Course Scheduling Problem

Given the courses students want to take and Given the courses students want to take and the time slots available, schedule courses to the time slots available, schedule courses to minimize number of conflicts (Avoid minimize number of conflicts (Avoid scheduling two courses at the same time if a scheduling two courses at the same time if a student wants to take both). student wants to take both).

Page 18: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 18

K-CRAYOLA Problem:

• Given a graph G and a k, find a way to colour G with k colours.

Rudich www.discretemath.com

Colour each node.each node.

Nodes with lines between Nodes with lines between them must have different them must have different colours.colours.

Page 19: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 19

Schedule each course.Courses that conflict can’t be at same time.

Colour each node.each node.Nodes with lines Nodes with lines between them must between them must have different colours.have different colours.

Two problems that are cosmetically Two problems that are cosmetically different, but substantially the samedifferent, but substantially the same

Two Different Problems

Page 20: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 20

Problems are the Same!

Schedule each course.Courses that conflict can’t be at same time.

Colour each node.each node.Nodes with lines between Nodes with lines between them must have different them must have different colours.colours.

English

MathScience

course course nodenode

can’t be scheduled can’t be scheduled at same timeat same time line between themline between them

scheduled time scheduled time colourcolour

1pm Mon

1pm Mon

3pm Fri

Page 21: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 21

A CRAYOLA Question!• Is Gadget 2-colorable?

No: it contains a triangle!

Page 22: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 22

• Is Gadget 3-colorable?

A CRAYOLA Question!

Yes!

Page 23: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 23

• Given a graph G, how do we decide if it can be 2-colored?

2 CRAYOLAS

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

Page 24: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 24

Page 25: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 25

Page 26: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 26

Page 27: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 27

• Given a graph G, what is a fast algorithm to decide if it can be 3-

colored?

3 CRAYOLAS

? ? ? ? ? ? ? ?

Page 28: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

Let’s consider a completely different problem.

Page 29: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 29

k-CLIQUES

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

Page 30: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 30

This graph contains a 4-clique

Page 31: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 31

Given an n-node graph G and a number k, how can you decide if G contains a k-

clique?

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

• INSPIRATION:

? ? ? ? ? ? ? ?

! possibilities

!( )!

n n

k k n k

3e.g., 3 ( )k n

In general, ( )kn

Page 32: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

OK, how about a slightly different problem?

Page 33: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 33

INDEPENDENT SET

• An independent set is a set of vertices with no edges between them.

This graph contains an independent set of size

3.

Page 34: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 34

Given an n-node graph G and a number k, how can you decide if G contains an

independent set of size k?

• PERSPIRATION: Try out all n-choose-k possible locations for independent set

• INSPIRATION:

? ? ? ? ? ? ? ?

Page 35: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

One more completely different problem

Page 36: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 36

Combinational Circuits

• AND, OR, NOT, gates wired together with no feedback allowed (acyclic).

Page 37: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 37

Logic Gates

Not And Or

Page 38: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 38

Example Circuit

Page 39: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 39

CIRCUIT-SATISFIABILITY(decision version)

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

Page 40: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 40

CIRCUIT-SATISFIABILITY(search version)

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

Page 41: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 41

Satisfiable Circuit Example

Page 42: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 42

Satisfiable?

No!

Page 43: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 43

Given a circuit, is it satisfiable?

• PERSPIRATION: Try out all 2n assignments

• INSPIRATION:

? ? ? ? ? ? ? ?

Page 44: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 44

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 45: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 45

CLIQUE / INDEPENDENT SET

• Two problems that are cosmetically different, but substantially the same

Page 46: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 46

Complement Of G

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

Page 47: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 47

Example

G *G

3-Clique Independent set of size 3

Page 48: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 48

Reduction

– Suppose you have a method for solving the k-clique problem.

– How could it be used to solve the independent set problem?

Page 49: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 49

Or what if you have an Oracle?

• or·a·cle

• Pronunciation: 'or-&-k&l, 'är-

• Function: noun

• Etymology: Middle English, from Middle French, from Latin oraculum, from orare to speak

• 1 a : a person (as a priestess of ancient Greece) through whom a deity is believed to speak

• 2 a : a person giving wise or authoritative decisions or opinions

Page 50: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 50

Let G be an n-node graph.

GIVEN:Clique Oracle

<G,k>

BUILD:Indep.

SetOracle

<G*, k>

Page 51: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 51

Let G be an n-node graph.

GIVEN: Indep.

Set Oracle

<G,k>

BUILD: Clique

Oracle

<G*, k>

Page 52: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 52

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 53: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 53

Given an oracle for circuit SAT, how can you quickly

solve 3-colorability?

Page 54: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 54

Vn(X,Y)

• Let Vn be a circuit that takes an n-node graph X and an assignment Y of colors to these nodes, and verifies that Y is a valid 3-colouring of X. i.e., Vn(X,Y)=1 iff Y is a 3-colouring of X.

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

• Given n, we can construct Vn in time O(n2).

Page 55: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 55

Let G be an n-node graph.

GIVEN:SAT

Oracle

G

BUILD:3-

colorOracle

Vn(G,Y)

Page 56: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 56

Given an oracle for circuit SAT, how can you quickly

solve k-clique?

Page 57: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 57

Vn,k(X,Y)

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

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

• Given n, we can construct Vn,k in time O(n2).

Page 58: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 58

Let G be an n-node graph.

GIVEN:SAT

Oracle

<G,k>

BUILD:CliqueOracle

Vn,k(G,Y)

Page 59: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 59

Given an oracle for 3-colorability, how

can you quickly solve

circuit SAT?

Page 60: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 60

Reducing Circuit-SAT to 3-Colouring

• Goal: map circuit to graph that is 3-colourable only if circuit is satisfiable.

• How do we represent a logic gate as a 3-colouring problem?

Page 61: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 61

X Y

Output

ExampleExample

X and Y and Output are boolean variables in circuit.

Without loss of generality, map truth values to colours, e.g.

0 red

1 green

Add base colour for encoding purposes, e.g. blue.

XY

Page 62: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 62

X Y

Output

ExampleExample

Note that in a valid 3-colouring, this node cannot have the same colour as X, Y or Output.

Thus, without loss of generality, we can assign it the base colour, blue.

XY

Page 63: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 63

X Y

Output

ExampleExample

Now suppose we fix this node to represent false.

XY

Page 64: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 64

X Y

Output

ExampleExampleF

Now suppose we fix this node to represent false.

XY

Page 65: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 65

Example

T FX Y

Output

Now build a truth table for (X, Y, Output).

What if X=Y=0?

XY

Page 66: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 66

Example

T FX Y

Output

Now build a truth table for (X, Y, Output).

What if X=Y=0?

XY

Page 67: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 67

Example

T FX Y

Output

Now build a truth table for (X, Y, Output).

What if X=Y=0?

XY

Page 68: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 68

Example

T FX Y

Output

Now build a truth table for (X, Y, Output).

What if X=Y=0?

XY

Page 69: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 69

Example

T FX Y

Output

Thus (X,Y)=0Output=0

XY

Page 70: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 70

Example

T FX Y

Output

Conversely, what if Output=0?

XY

Page 71: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 71

Example

T FX Y

Output

Conversely, what if Output=0?

XY

Page 72: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 72

Example

T FX Y

Output

Conversely, what if Output=0?

XY

Page 73: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 73

Example

T FX Y

Output

Conversely, what if Output=0?

XY

Page 74: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 74

Example

T FX Y

Output

Thus Output=0X=Y=0.

XY

Page 75: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 75

ExampleT F

X Y

Output

X Y Output

F F F

F T T

T F T

T T T

What type of gate is this?

An OR gate!

XY

Page 76: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

End of Final Lecture

Nov 29, 2007

Page 77: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 77

T F

X What type of gate is this?

A NOT gate!

Output

X

Page 78: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 78

OR

OR

NOT

x y z

xy

z

Page 79: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 79

OR

OR

NOT

x y z

xy

z

Satisfiability of this circuit = 3-colorability of this graph

Page 80: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 80

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 81: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 81

Formal Statement

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

• C is satisfiable <-> f(C) is 3 colorable

Page 82: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 82

4 Problems All Equivalent

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

• Circuit-SAT

• Clique

• Independent Set

• 3 Colorability

Page 83: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 83

Page 84: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 84

Page 85: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 85

Page 86: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 86

Page 87: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 87

Page 88: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 88

Page 89: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 89

Page 90: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 90

Page 91: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 91

Page 92: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 92

Page 93: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 93

Page 94: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 94

Page 95: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 95

Page 96: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 96

Page 97: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 97

Page 98: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 98

Page 99: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 99

Page 100: Reducibility and NP-Completeness COSC 3101B, PROF. J. ELDER 2 Computational Complexity Theory Computational Complexity Theory is the study of how much

COSC 3101B, PROF. J. ELDER 100