CS21 Decidability and Tractability

Similar documents
CS21 Decidability and Tractability

More Completeness, conp, FNP,etc. CS254 Chris Pollett Oct 30, 2006.

Theory of Computation Chapter 9

CSCI 1590 Intro to Computational Complexity

Lecture 7: Polynomial time hierarchy

NP-Complete Reductions 1

Essential facts about NP-completeness:

NP Complete Problems. COMP 215 Lecture 20

CS154, Lecture 15: Cook-Levin Theorem SAT, 3SAT

Intro to Theory of Computation

NP-Hardness reductions

NP-COMPLETE PROBLEMS. 1. Characterizing NP. Proof

NP-Complete Reductions 2

CS151 Complexity Theory. Lecture 13 May 15, 2017

Lecture 19: Finish NP-Completeness, conp and Friends

Classes of Problems. CS 461, Lecture 23. NP-Hard. Today s Outline. We can characterize many problems into three classes:

More NP-Complete Problems

Approximation Preserving Reductions

CSCI 1010 Models of Computa3on. Lecture 11 Proving Languages NP-Complete

NP-Complete problems

NP-Completeness Part II

NP-complete Problems

UC Berkeley CS 170: Efficient Algorithms and Intractable Problems Handout 22 Lecturer: David Wagner April 24, Notes 22 for CS 170

CS 301: Complexity of Algorithms (Term I 2008) Alex Tiskin Harald Räcke. Hamiltonian Cycle. 8.5 Sequencing Problems. Directed Hamiltonian Cycle

Limits to Approximability: When Algorithms Won't Help You. Note: Contents of today s lecture won t be on the exam

Algorithm Design and Analysis

NP Completeness. CS 374: Algorithms & Models of Computation, Spring Lecture 23. November 19, 2015

Hardness of Approximation

Computational Intractability 2010/4/15. Lecture 2

NP-Complete Problems. More reductions

NP-Complete Reductions 3

CS256 Applied Theory of Computation

CSE 421 NP-Completeness

NP-Completeness Part II

SAT, Coloring, Hamiltonian Cycle, TSP

A.Antonopoulos 18/1/2010

NP and Computational Intractability

Lecture 17: Cook-Levin Theorem, NP-Complete Problems

Umans Complexity Theory Lectures

Complete problems for classes in PH, The Polynomial-Time Hierarchy (PH) oracle is like a subroutine, or function in

CSCI3390-Lecture 17: A sampler of NP-complete problems

Polynomial time reduction and NP-completeness. Exploring some time complexity limits of polynomial time algorithmic solutions

NP-Complete Problems

COMP 382. Unit 10: NP-Completeness

Introduction. Pvs.NPExample

Lecture 15 - NP Completeness 1

Lecture Notes Each circuit agrees with M on inputs of length equal to its index, i.e. n, x {0, 1} n, C n (x) = M(x).

CS154, Lecture 13: P vs NP

CS311 Computational Structures. NP-completeness. Lecture 18. Andrew P. Black Andrew Tolmach. Thursday, 2 December 2010

Harvard CS 121 and CSCI E-121 Lecture 22: The P vs. NP Question and NP-completeness

Lecture 24 : Even more reductions

Limitations of Algorithm Power

Notes for Lecture 21

max bisection max cut becomes max bisection if we require that It has many applications, especially in VLSI layout.

A Collection of Problems in Propositional Logic

CS154, Lecture 13: P vs NP

COP 4531 Complexity & Analysis of Data Structures & Algorithms

1. Introduction Recap

Lecture 20: conp and Friends, Oracles in Complexity Theory

Theory of Computation CS3102 Spring 2014 A tale of computers, math, problem solving, life, love and tragic death

Lecture 20: PSPACE. November 15, 2016 CS 1010 Theory of Computation

Lecture #14: NP-Completeness (Chapter 34 Old Edition Chapter 36) Discussion here is from the old edition.

No Harder Than. We want these transformations to effectively be a problem-hardness version of #, which we will call No Harder Than.

NP and Computational Intractability

NP-Completeness. Andreas Klappenecker. [based on slides by Prof. Welch]

1 PSPACE-Completeness

Lecture 18: More NP-Complete Problems

NP and NP-Completeness

ECE 695 Numerical Simulations Lecture 2: Computability and NPhardness. Prof. Peter Bermel January 11, 2017

8.5 Sequencing Problems

Theory of Computation Time Complexity

NP-Completeness Review

Correctness of Dijkstra s algorithm

Geometric Steiner Trees

Algorithms and Theory of Computation. Lecture 22: NP-Completeness (2)

Chapter 3: Proving NP-completeness Results

NP-completeness. Chapter 34. Sergey Bereg

CSC 373: Algorithm Design and Analysis Lecture 15

Polynomial-Time Reductions

CSC 5170: Theory of Computational Complexity Lecture 9 The Chinese University of Hong Kong 15 March 2010

P is the class of problems for which there are algorithms that solve the problem in time O(n k ) for some constant k.

Complexity Classes V. More PCPs. Eric Rachlin

Automata Theory CS Complexity Theory I: Polynomial Time

Chapter 2. Reductions and NP. 2.1 Reductions Continued The Satisfiability Problem (SAT) SAT 3SAT. CS 573: Algorithms, Fall 2013 August 29, 2013

Lecture 4: NP and computational intractability

CSCI3390-Second Test with Solutions

CS154, Lecture 17: conp, Oracles again, Space Complexity

CSE 555 HW 5 SAMPLE SOLUTION. Question 1.

Lecture 18: PCP Theorem and Hardness of Approximation I

NP-Completeness. Algorithmique Fall semester 2011/12

Lecture 16: Time Complexity and P vs NP

NP Completeness. Richard Karp, 1972.

Announcements. Friday Four Square! Problem Set 8 due right now. Problem Set 9 out, due next Friday at 2:15PM. Did you lose a phone in my office?

4/12/2011. Chapter 8. NP and Computational Intractability. Directed Hamiltonian Cycle. Traveling Salesman Problem. Directed Hamiltonian Cycle

SAT, NP, NP-Completeness

1.1 P, NP, and NP-complete

Algorithm Design and Analysis

2 Evidence that Graph Isomorphism is not NP-complete

Comp487/587 - Boolean Formulas

Transcription:

CS21 Decidability and Tractability Lecture 20 February 23, 2018 February 23, 2018 CS21 Lecture 20 1

Outline the complexity class NP NP-complete probelems: Subset Sum NP-complete problems: NAE-3-SAT, max cut the complexity class conp the complexity class conp NP February 23, 2018 CS21 Lecture 20 2

SUBSET-SUM is NP-complete Theorem: the following language is NPcomplete: our reduction had SUBSET-SUM = {(S better = {a 1, aproduce 2, a 3,, superpolynomially of S that sums large to B} B a k }, B) : there is a subset (unless we want to Part 1: SUBSET-SUM Î NP. prove Proof? P=NP) Proof: Part 2: SUBSET-SUM is NP-hard. reduce from? February 23, 2018 CS21 Lecture 20 3

SUBSET-SUM is NP-complete We are reducing from the language: 3SAT = { φ : φ is a 3-CNF formula that has a satisfying assignment } to the language: SUBSET-SUM = {(S = {a 1, a 2, a 3,, a k }, B) : there is a subset of S that sums to B} February 23, 2018 CS21 Lecture 20 4

SUBSET-SUM is NP-complete φ = (x 1 Ú x 2 Ú x 3 ) Ù ( x 1 Úx 4 Úx 3 ) Ù Ù ( ) Need integers to play the role of truth assignments For each variable x i include two integers in our set S: x i TRUE and x i FALSE set B so that exactly one must be in sum February 23, 2018 CS21 Lecture 20 5

SUBSET-SUM is NP-complete x TRUE 1 = 1 0 0 0 0 x FALSE 1 = 1 0 0 0 0 x TRUE 2 = 0 1 0 0 0 x FALSE 2 = 0 1 0 0 0 x TRUE m = 0 0 0 0 1 x FALSE m = 0 0 0 0 1 B = 1 1 1 1 1 every choice of one from each (x i TRUE,x i FALSE ) pair sums to B every subset that sums to B must choose one from each (x i TRUE,x i FALSE ) pair February 23, 2018 CS21 Lecture 20 6

SUBSET-SUM is NP-complete φ = (x 1 Ú x 2 Ú x 3 ) Ù ( x 1 Úx 4 Úx 3 ) Ù Ù ( ) Need to force subset to choose at least one true literal from each clause Idea: add more digits one digit for each clause set B to force each clause to be satisfied. February 23, 2018 CS21 Lecture 20 7

SUBSET-SUM is NP-complete φ = (x 1 Ú x 2 Ú x 3 ) Ù ( x 1 Úx 4 Úx 3 ) Ù Ù ( ) x TRUE 1 = 1 0 0 0 0 1 x FALSE 1 = 1 0 0 0 0 0 x TRUE 2 = 0 1 0 0 0 1 x FALSE 2 = 0 1 0 0 0 0 x TRUE 3 = 0 0 1 0 0 0 x FALSE 3 = 0 0 1 0 0 1 : B = 1 1 1 1 1???? clause 1 clause 2 clause 3 : clause k February 23, 2018 CS21 Lecture 20 8

SUBSET-SUM is NP-complete B = 1 1 1 1 1???? if clause i is satisfied sum might be 1, 2, or 3 in corresponding column. want? to mean ³ 1 solution: set? = 3 add two filler elements for each clause i: FILL1 i = 0 0 0 0... 0 0... 0 1 0... 0 FILL2 i = 0 0 0 0... 0 0... 0 1 0... 0 column for clause i February 23, 2018 CS21 Lecture 20 9

SUBSET-SUM is NP-complete Reduction: m variables, k clauses for each variable x i : x i TRUE has ones in positions k + i and {j : clause j includes literal x i } x i FALSE has ones in positions k + i and {j : clause j includes literal x i } for each clause i: FILL1 i and FILL2 i have one in position i bound B has 3 in positions 1 k and 1 in positions k+1 k+m February 23, 2018 CS21 Lecture 20 10

SUBSET-SUM is NP-complete Reduction computable in poly-time? YES maps to YES? choose one from each (x i TRUE,x i FALSE ) pair corresponding to a satisfying assignment choose 0, 1, or 2 of filler elements for each clause i depending on whether it has 3, 2, or 1 true literals first m digits add to 1; last k digits add to 3 February 23, 2018 CS21 Lecture 20 11

SUBSET-SUM is NP-complete NO maps to NO? at most 5 ones in each column, so no carries to worry about first m digits of B force subset to choose exactly one from each (x i TRUE,x i FALSE ) pair last k digits of B require at least one true literal per clause, since can only sum to 2 using filler elements resulting assignment must satisfy φ February 23, 2018 CS21 Lecture 20 12

Not-All-Equal 3SAT (x 1 Ú x 2 Ú x 3 ) Ù ( x 1 Úx 4 Úx 3 ) Ù Ù ( ) Theorem: the following language is NPcomplete: NAE3SAT = {φ : φ is a 3-CNF formula for which there exists a truth assignment in which every clause has at least 1 true literal and at least 1 false literal} Proof: Part 1: NAE3SAT Î NP. Proof? Part 2: NAE3SAT is NP-hard. Reduce from? February 23, 2018 CS21 Lecture 20 13

NAE3SAT is NP-complete We are reducing from the language: CIRCUIT-SAT = {C : C is a Boolean circuit for which there exists a satisfying truth assignment} to the language: NAE3SAT = {φ : φ is a 3-CNF formula for which there exists a truth assignment in which every clause has at least 1 true literal and at least 1 false literal} February 23, 2018 CS21 Lecture 20 14

NAE3SAT is NP-complete Recall reduction to 3SAT variables x 1, x 2,,x n, gates g 1, g 2,, g m produce clauses: Ú g ( z 1 Ú g i ) i ( z 2 Ú g i ) z 1 z 2 z 1 not all true in a satisfying assignment gi (g i Ú z) output ( g i Ú z 1 Ú z 2 ) z ( z Ú g i ) Ù g ( g i Ú z 1 ) i ( g i Ú z 2 ) gate g m : z 2 ( z 1 Ú z 2 Ú g i ) (g m ) February 23, 2018 CS21 Lecture 20 15

NAE3SAT is NP-complete modified reduction to NAE3SAT variables x 1, x 2,,x n, gates g 1, g 2,, g m produce clauses: z 1 z 1 Ú g i z 2 ( z 1 Ú g i Ú w) ( z 2 Ú g i Ú w) gi (g i Ú z Ú w) output ( g i Ú z 1 Ú z 2 ) z ( z Ú g i Ú w) Ù g ( g i Ú z 1 Ú w) i ( g i Ú z 2 Ú w) gate g m : z 2 ( z 1 Ú z 2 Ú g i ) (g m Ú w) February 23, 2018 CS21 Lecture 20 16

NAE3SAT is NP-complete Does the reduction run in polynomial time? ( z 1 Ú g i Ú w) ( z 2 Ú g i Ú w) ( g i Ú z 1 Ú z 2 ) YES maps to YES already know how to get a satisfying assignment to the BLUE variables set w = FALSE ( g i Ú z 1 Ú w) ( g i Ú z 2 Ú w) ( z 1 Ú z 2 Ú g i ) (g i Ú z Ú w) ( z Ú g i Ú w) (g m Ú w) February 23, 2018 CS21 Lecture 20 17

NAE3SAT is NP-complete NO maps to NO given NAE assignment A complement A is a NAE assignment A or A has w = FALSE must have TRUE BLUE variable in every clause we know this implies C satisfiable ( z 1 Ú g i Ú w) ( z 2 Ú g i Ú w) ( g i Ú z 1 Ú z 2 ) ( g i Ú z 1 Ú w) ( g i Ú z 2 Ú w) ( z 1 Ú z 2 Ú g i ) (g i Ú z Ú w) ( z Ú g i Ú w) (g m Ú w) February 23, 2018 CS21 Lecture 20 18

MAX CUT Given graph G = (V, E) a cut is a subset S Ì V an edge (x, y) crosses the cut if x Î S and y Î V S or x Î V S and y Î S search problem: find cut maximizing number of edges crossing the cut February 23, 2018 CS21 Lecture 20 19

MAX CUT Given graph G = (V, E) a cut is a subset S Ì V an edge (x, y) crosses the cut if x Î S and y Î V S or x Î V S and y Î S search problem: find cut maximizing number of edges crossing the cut February 23, 2018 CS21 Lecture 20 20

MAX CUT Theorem: the following language is NPcomplete: MAX CUT = {(G = (V, E), k) : there is a cut S Ì V with at least k edges crossing it} Proof: Part 1: MAX CUT Î NP. Proof? Part 2: MAX CUT is NP-hard. reduce from? February 23, 2018 CS21 Lecture 20 21

MAX CUT is NP-complete We are reducing from the language: NAE3SAT = {φ : φ is a 3-CNF formula for which there exists a truth assignment in which every clause has at least 1 true literal and at least 1 false literal} to the language: MAX CUT = {(G = (V, E), k) : there is a cut S Ì V with at least k edges crossing it} February 23, 2018 CS21 Lecture 20 22

MAX CUT is NP-complete The reduction: given instance of NAE3SAT (n nodes, m clauses): (x 1 Ú x 2 Ú x 3 ) Ù ( x 1 Úx 4 Úx 5 ) Ù Ù ( x 2 Úx 3 Úx 3 ) produce graph G = (V, E) with node for each literal x 3 x 4 x 4 triangle for each x 2 x 1 x 5 x 1 x 2 x 5 x 3 3-clause parallel edges for each 2-clause February 23, 2018 CS21 Lecture 20 23

MAX CUT is NP-complete x 3 x 4 x 4 triangle for each x 2 x 1 x 5 x 1 x 2 x 5 x 3 3-clause parallel edges for each 2-clause if cut selects TRUE literals, each clause contributes 2 if NAE, and < 2 otherwise need to penalize cuts that correspond to inconsistent truth assignments add n i parallel edges from x i to x i (n i = # occurrences) (repeat variable in 2-clause to make 3-clause for this calculation) February 23, 2018 CS21 Lecture 20 24

MAX CUT is NP-complete x 3 triangle for each 3-clause x 4 x 2 x 1 x 5 x 1 x 2 x 5 x 3 YES maps to YES x 4 parallel edges for each 2- clause take cut to be TRUE literals in a NAE truth assignment contribution from clause gadgets: 2m n i parallel edges from x i to x i set k = 5m contribution from (x i, x i ) parallel edges: 3m February 23, 2018 CS21 Lecture 20 25

MAX CUT is NP-complete x 3 x 4 triangle for each 3-clause x 2 x 1 x 5 x 1 x 2 x 3 x 5 x 4 parallel edges for each 2- clause n i parallel edges from x i to x i set k = 5m NO maps to NO Claim: if cut has x i, x i on same side, then can move one to opposite side without decreasing # edges crossing cut contribution from (x i, x i ) parallel edges: 3m contribution from clause gadgets must be 2m conclude: there is a NAE assignment February 23, 2018 CS21 Lecture 20 26

MAX CUT is NP-complete Claim: if cut has x i, x i on same side, then can move one to opposite side without decreasing # edges crossing cut Proof: n i edges x i x i... a edges b edges a+b 2n i x i a + n i February 23, 2018 CS21 Lecture 20 27... x i x i... x i a + n i a + b or b + n i a + b b + n i

conp Is NP closed under complement? Can we transform this machine: x Î L x Ï L x Î L x Ï L q accept q reject q reject q accept into this machine? February 23, 2018 CS21 Lecture 20 28

conp language L is in conp iff its complement (co-l) is in NP it is believed that NP conp note: P = NP implies NP = conp proving NP conp would prove P NP another major open problem February 23, 2018 CS21 Lecture 20 29