• Keine Ergebnisse gefunden

D2.1 Polynomial Reductions

N/A
N/A
Protected

Academic year: 2022

Aktie "D2.1 Polynomial Reductions"

Copied!
6
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

Theory of Computer Science

D2. Polynomial Reductions and NP-completeness

Gabriele R¨oger

University of Basel

May 5, 2021

Gabriele R¨oger (University of Basel) Theory of Computer Science May 5, 2021 1 / 21

Theory of Computer Science

May 5, 2021 — D2. Polynomial Reductions and NP-completeness

D2.1 Polynomial Reductions

D2.2 NP-Hardness and NP-Completeness D2.3 Summary

Gabriele R¨oger (University of Basel) Theory of Computer Science May 5, 2021 2 / 21

D2. Polynomial Reductions and NP-completeness Polynomial Reductions

D2.1 Polynomial Reductions

D2. Polynomial Reductions and NP-completeness Polynomial Reductions

Polynomial Reductions: Idea

I Reductions are a common and powerful concept in computer science. We know them from Part C.

I The basic idea is that we solve a new problem byreducing it to a known problem.

I In complexity theory we want to use reductions

that allow us to prove statements of the following kind:

Problem A can be solved efficiently if problem B can be solved efficiently.

I For this, we need a reduction from AtoB that can be computed efficiently itself

(otherwise it would be useless for efficiently solving A).

(2)

D2. Polynomial Reductions and NP-completeness Polynomial Reductions

Polynomial Reductions

Definition (Polynomial Reduction)

Let A⊆Σ andB ⊆Γ be decision problems.

We say that Acan be polynomially reduced toB,

written A≤p B, if there is a function f : Σ→Γ such that:

I f can be computed inpolynomial time by aDTM I i. e., there is a polynomialpand a DTMM such thatM

computesf(w) in at mostp(|w|) steps given inputw Σ I f reducesAto B

I i. e., for allwΣ: wAifff(w)B f is called a polynomial reductionfrom Ato B German: Apolynomiell aufB reduzierbar,

German:

polynomielle Reduktion vonAauf B

Gabriele R¨oger (University of Basel) Theory of Computer Science May 5, 2021 5 / 21

D2. Polynomial Reductions and NP-completeness Polynomial Reductions

Polynomial Reductions: Remarks

I Polynomial reductions are also called Karp reductions (after Richard Karp, who wrote a famous paper describing many such reductions in 1972).

I In practice, of course we do not have to specify a DTM for f: it just has to be clear that f can be computed

in polynomial time by adeterministic algorithm.

Gabriele R¨oger (University of Basel) Theory of Computer Science May 5, 2021 6 / 21

D2. Polynomial Reductions and NP-completeness Polynomial Reductions

Polynomial Reductions: Example (1)

Definition (HamiltonCycle)

HamiltonCycle is the following decision problem:

I Given: undirected graph G =hV,Ei

I Question: DoesG contain a Hamilton cycle?

Reminder:

Definition (Hamilton Cycle)

A Hamilton cycleofG is a sequence of vertices inV, π =hv0, . . . ,vni, with the following properties:

I π is a path: there is an edge fromvi to vi+1 for all 0≤i <n I π is a cycle: v =v

D2. Polynomial Reductions and NP-completeness Polynomial Reductions

Polynomial Reductions: Example (2)

Definition (TSP)

TSP(traveling salesperson problem) is the following decision problem:

I Given: finite setS 6=∅of cities, symmetric cost function cost:S×S →N0, cost boundK ∈N0

I Question: Is there a tour with total cost at most K, i. e., a permutationhs1, . . . ,sniof the cities with

Pn−1

i=1 cost(si,si+1) +cost(sn,s1)≤K? German: Problem der/des Handlungsreisenden

(3)

D2. Polynomial Reductions and NP-completeness Polynomial Reductions

Polynomial Reductions: Example (3)

Theorem (HamiltonCycle≤p TSP) HamiltonCycle≤p TSP.

Proof.

blackboard

Gabriele R¨oger (University of Basel) Theory of Computer Science May 5, 2021 9 / 21

D2. Polynomial Reductions and NP-completeness Polynomial Reductions

Exercise: Polynomial Reduction

Definition (HamiltonianCompletion)

HamiltonianCompletionis the following decision problem:

I Given: undirected graphG =hV,Ei, number k∈N0

I Question: CanG be extended with at most k edges such that the resulting graph has a Hamilton cycle?

Show that

HamiltonCycle≤p HamiltonianCompletion.

Gabriele R¨oger (University of Basel) Theory of Computer Science May 5, 2021 10 / 21

D2. Polynomial Reductions and NP-completeness Polynomial Reductions

Reminder: P and NP

P: class of languages that are decidable in polynomial time by a deterministic Turing machine

NP: class of languages that are decidable in polynomial time by a non-deterministic Turing machine

D2. Polynomial Reductions and NP-completeness Polynomial Reductions

Properties of Polynomial Reductions (1)

Theorem (Properties of Polynomial Reductions) Let A, B and C decision problems.

1 If A≤p B and B ∈P, then A∈P.

2 If A≤p B and B ∈NP, then A∈NP.

3 If A≤p B and A∈/ P, then B ∈/P.

4 If A≤p B and A∈/ NP, then B∈/ NP.

5 If A≤p B and B ≤p C , then A≤p C .

(4)

D2. Polynomial Reductions and NP-completeness Polynomial Reductions

Properties of Polynomial Reductions (2)

Proof.

for 1.:

We must show that there is a DTM acceptingA in polynomial time.

We know:

I There is a DTMMB that accepts B in time p, where p is a polynomial.

I There is a DTMMf that computes a reduction fromA toB in time q, whereq is a polynomial.

. . .

Gabriele R¨oger (University of Basel) Theory of Computer Science May 5, 2021 13 / 21

D2. Polynomial Reductions and NP-completeness Polynomial Reductions

Properties of Polynomial Reductions (3)

Proof (continued).

Consider the machineM that first behaves likeMf, and then (afterMf stops) behaves likeMB on the output ofMf. M acceptsA:

I M behaves on input w asMB does on input f(w), so it acceptsw if and only if f(w)∈B.

I Becausef is a reduction, w ∈A ifff(w)∈B.

. . .

Gabriele R¨oger (University of Basel) Theory of Computer Science May 5, 2021 14 / 21

D2. Polynomial Reductions and NP-completeness Polynomial Reductions

Properties of Polynomial Reductions (4)

Proof (continued).

Computation time ofM on inputw:

I firstMf runs on inputw: ≤q(|w|) steps I thenMB runs on inputf(w): ≤p(|f(w)|) steps I |f(w)| ≤ |w|+q(|w|) because in q(|w|) steps,

Mf can write at most q(|w|) additional symbols onto the tape total computation time≤q(|w|) +p(|f(w)|)

≤q(|w|) +p(|w|+q(|w|)) this is polynomial in|w| A∈P.

D2. Polynomial Reductions and NP-completeness Polynomial Reductions

Properties of Polynomial Reductions (5)

Proof (continued).

for 2.:

analogous to 1., only thatMB andM are NTMs of 3.+4.:

equivalent formulations of 1.+2. (contraposition) of 5.:

LetA≤p B with reduction f andB≤p C with reductiong. Theng ◦f is a reduction of AtoC.

The computation time of the two computations in sequence

(5)

D2. Polynomial Reductions and NP-completeness NP-Hardness and NP-Completeness

D2.2 NP-Hardness and NP-Completeness

Gabriele R¨oger (University of Basel) Theory of Computer Science May 5, 2021 17 / 21

D2. Polynomial Reductions and NP-completeness NP-Hardness and NP-Completeness

NP-Hardness and NP-Completeness

Definition (NP-Hard, NP-Complete) LetB be a decision problem.

B is called NP-hardifA≤p B for allproblemsA∈NP.

B is called NP-completeifB ∈NP andB is NP-hard.

German: NP-hart (selten: NP-schwer), NP-vollst¨andig

Gabriele R¨oger (University of Basel) Theory of Computer Science May 5, 2021 18 / 21

D2. Polynomial Reductions and NP-completeness NP-Hardness and NP-Completeness

NP-Complete Problems: Meaning

I NP-hard problems are “at least as difficult”

as all problems in NP.

I NP-complete problems are “the most difficult” problems in NP: allproblems in NP can be reduced to them.

I If A∈P foranyNP-complete problem, then P = NP. (Why?) I That means that either there are efficient algorithms

forallNP-complete problems or fornone of them.

I Do NP-complete problems actually exist?

D2. Polynomial Reductions and NP-completeness Summary

D2.3 Summary

(6)

D2. Polynomial Reductions and NP-completeness Summary

Summary

I polynomial reductions: A≤p B if

there is a total functionf computable in polynomial time, such that for all wordsw: w ∈Aiff f(w)∈B

I A≤pB implies thatAis “at most as difficult”asB I polynomial reductions aretransitive

I NP-hardproblems B: A≤p B forallA∈NP

I NP-completeproblems B: B ∈NP and B is NP-hard

Gabriele R¨oger (University of Basel) Theory of Computer Science May 5, 2021 21 / 21

Referenzen

ÄHNLICHE DOKUMENTE

I If you read a 1 at the first tape position, move every non-blank symbol on the tape one position to the right, write a 1 in the first tape position and accept...

for 2.: identical to (1), only that M B only recognizes B and therefore the simulation does not necessarily terminate if y 6∈ B. Since y 6∈ B iff x 6∈ A, the procedure still

for 2.: identical to (1), only that M B only recognizes B and therefore the simulation does not necessarily terminate if y 6∈ B. Since y 6∈ B iff x 6∈ A, the procedure still

I Polynomial reductions are also called Karp reductions (after Richard Karp, who wrote a famous paper describing many such reductions in 1972). I In practice, of course we do not

An oracle machine is like a Turing machine that has access to an oracle which can solve some decision problem in constant timeE. Example

by Uwe Sch¨ oning (5th edition) covers the part on logic, but also advanced topics beyond the scope of the course Theoretische Informatik – kurz gefasst by Uwe Sch¨ oning

by Uwe Sch¨ oning (5th edition) I covers large parts of the course,.. but not the part

All functions that can be computed in the intuitive sense can be computed by a Turing machine. German: Church-Turing-These cannot be proven