Example: Satisfiability (Cont.) Construct: f ( a 1 , . . . , a 2 k − 1 ) = 1 iff � i a i ≥ k , a i ∈ { 0 , 1 } � � a i i ∈ I I ⊂ 2 A , | I | = k Key point : If more than half a i ’s are 1s then all subsets of size ( n / 2 ) + 1 will have at least one 1. Nabil Mustafa Computational Complexity 1
Example: Satisfiability (Cont.) Construct: f ( a 1 , . . . , a 2 k − 1 ) = 1 iff � i a i ≥ k , a i ∈ { 0 , 1 } � � a i i ∈ I I ⊂ 2 A , | I | = k Key point : If more than half a i ’s are 1s then all subsets of size ( n / 2 ) + 1 will have at least one 1. Construct: p = ⇒ q Nabil Mustafa Computational Complexity 1
Example: Satisfiability (Cont.) Construct: f ( a 1 , . . . , a 2 k − 1 ) = 1 iff � i a i ≥ k , a i ∈ { 0 , 1 } � � a i i ∈ I I ⊂ 2 A , | I | = k Key point : If more than half a i ’s are 1s then all subsets of size ( n / 2 ) + 1 will have at least one 1. Construct: p = ⇒ q ( p ∨ q ) Nabil Mustafa Computational Complexity 1
Satisfiability Satisfiability Given a CNF formula f , is f satisfiable? Nabil Mustafa Computational Complexity 1
Satisfiability Satisfiability Given a CNF formula f , is f satisfiable? 2-Satisfiability Given a CNF formula f , where each clause has exactly 2 literals, is f satisfiable? Nabil Mustafa Computational Complexity 1
Satisfiability Satisfiability Given a CNF formula f , is f satisfiable? 2-Satisfiability Given a CNF formula f , where each clause has exactly 2 literals, is f satisfiable? 3-Satisfiability Given a CNF formula f , where each clause has exactly 3 literals, is f satisfiable? Nabil Mustafa Computational Complexity 1
Satisfiability Satisfiability Given a CNF formula f , is f satisfiable? 2-Satisfiability Given a CNF formula f , where each clause has exactly 2 literals, is f satisfiable? 3-Satisfiability Given a CNF formula f , where each clause has exactly 3 literals, is f satisfiable? f is in k -CNF form if each clause C i has at most k literals. Nabil Mustafa Computational Complexity 1
Satisfiability Satisfiability Given a CNF formula f , is f satisfiable? 2-Satisfiability Given a CNF formula f , where each clause has exactly 2 literals, is f satisfiable? 3-Satisfiability Given a CNF formula f , where each clause has exactly 3 literals, is f satisfiable? f is in k -CNF form if each clause C i has at most k literals. k -Satisfiability Given a k -CNF formula f , is f satisfiable? Nabil Mustafa Computational Complexity 1
Complexity class Different problems have different levels of hardness Nabil Mustafa Computational Complexity 1
Complexity class Different problems have different levels of hardness Each problem can be viewed as computing a function Nabil Mustafa Computational Complexity 1
Complexity class Different problems have different levels of hardness Each problem can be viewed as computing a function Definition A complexity class is a set of functions that can be computed within a given resource. Nabil Mustafa Computational Complexity 1
Complexity class Different problems have different levels of hardness Each problem can be viewed as computing a function Definition A complexity class is a set of functions that can be computed within a given resource. A Turing Machine is a primitive computational device, a basic computer Nabil Mustafa Computational Complexity 1
DTIME Definition DTIME ( T ( n )) : set of all functions computable in at most c · T ( n ) time for some constant c > 0, where n is input size. Nabil Mustafa Computational Complexity 1
DTIME Definition DTIME ( T ( n )) : set of all functions computable in at most c · T ( n ) time for some constant c > 0, where n is input size. For example, DTIME ( n 2 ) is the set of all functions computable in at most O ( n 2 ) time. Nabil Mustafa Computational Complexity 1
DTIME Definition DTIME ( T ( n )) : set of all functions computable in at most c · T ( n ) time for some constant c > 0, where n is input size. For example, DTIME ( n 2 ) is the set of all functions computable in at most O ( n 2 ) time. T 1 ( n ) = O ( T 2 ( n )) Nabil Mustafa Computational Complexity 1
DTIME Definition DTIME ( T ( n )) : set of all functions computable in at most c · T ( n ) time for some constant c > 0, where n is input size. For example, DTIME ( n 2 ) is the set of all functions computable in at most O ( n 2 ) time. T 1 ( n ) = O ( T 2 ( n )) = ⇒ DTIME ( T 1 ( n )) ⊆ DTIME ( T 2 ( n )) Nabil Mustafa Computational Complexity 1
DTIME Definition DTIME ( T ( n )) : set of all functions computable in at most c · T ( n ) time for some constant c > 0, where n is input size. For example, DTIME ( n 2 ) is the set of all functions computable in at most O ( n 2 ) time. T 1 ( n ) = O ( T 2 ( n )) = ⇒ DTIME ( T 1 ( n )) ⊆ DTIME ( T 2 ( n )) Definition � DTIME ( n c ) P = c ≥ 1 Nabil Mustafa Computational Complexity 1
DTIME Definition DTIME ( T ( n )) : set of all functions computable in at most c · T ( n ) time for some constant c > 0, where n is input size. For example, DTIME ( n 2 ) is the set of all functions computable in at most O ( n 2 ) time. T 1 ( n ) = O ( T 2 ( n )) = ⇒ DTIME ( T 1 ( n )) ⊆ DTIME ( T 2 ( n )) Definition � DTIME ( n c ) P = c ≥ 1 The class P contains all classes DTIME ( T ( n )) where T ( n ) is a polynomial of finite degree. Nabil Mustafa Computational Complexity 1
The class P The class P is considered the set of “efficiently” solvable problems Nabil Mustafa Computational Complexity 1
The class P The class P is considered the set of “efficiently” solvable problems Sort: Given a set S of n integers, sort S . Nabil Mustafa Computational Complexity 1
The class P The class P is considered the set of “efficiently” solvable problems Sort: Given a set S of n integers, sort S . Sorting n integers requires time Θ( n log n ) . Nabil Mustafa Computational Complexity 1
The class P The class P is considered the set of “efficiently” solvable problems Sort: Given a set S of n integers, sort S . Sorting n integers requires time Θ( n log n ) . 1 , 000 , 000 numbers on modern hardware in less than 10 secs. Nabil Mustafa Computational Complexity 1
The class P The class P is considered the set of “efficiently” solvable problems Sort: Given a set S of n integers, sort S . Sorting n integers requires time Θ( n log n ) . 1 , 000 , 000 numbers on modern hardware in less than 10 secs. P also includes functions computable in time High degree polynomials: O ( n 1000 ) . Nabil Mustafa Computational Complexity 1
The class P The class P is considered the set of “efficiently” solvable problems Sort: Given a set S of n integers, sort S . Sorting n integers requires time Θ( n log n ) . 1 , 000 , 000 numbers on modern hardware in less than 10 secs. P also includes functions computable in time High degree polynomials: O ( n 1000 ) . High constants for small polynomials: 1 , 000 , 000 , 000 , 000 · n Nabil Mustafa Computational Complexity 1
The class P The class P is considered the set of “efficiently” solvable problems Sort: Given a set S of n integers, sort S . Sorting n integers requires time Θ( n log n ) . 1 , 000 , 000 numbers on modern hardware in less than 10 secs. P also includes functions computable in time High degree polynomials: O ( n 1000 ) . High constants for small polynomials: 1 , 000 , 000 , 000 , 000 · n Being in P doesn’t guarantee it’ll work in practice. Nabil Mustafa Computational Complexity 1
The class P The class P is considered the set of “efficiently” solvable problems Sort: Given a set S of n integers, sort S . Sorting n integers requires time Θ( n log n ) . 1 , 000 , 000 numbers on modern hardware in less than 10 secs. P also includes functions computable in time High degree polynomials: O ( n 1000 ) . High constants for small polynomials: 1 , 000 , 000 , 000 , 000 · n Being in P doesn’t guarantee it’ll work in practice. However, if a problem is not in P , forget about solving it. Nabil Mustafa Computational Complexity 1
Checking solutions efficiently The class P : set of languages L f decidable in time O ( n c ) . Nabil Mustafa Computational Complexity 1
Checking solutions efficiently The class P : set of languages L f decidable in time O ( n c ) . Function f can be computed in poly-time. Nabil Mustafa Computational Complexity 1
Checking solutions efficiently The class P : set of languages L f decidable in time O ( n c ) . Function f can be computed in poly-time. What if don’t know how to compute f in poly-time? Nabil Mustafa Computational Complexity 1
Checking solutions efficiently The class P : set of languages L f decidable in time O ( n c ) . Function f can be computed in poly-time. What if don’t know how to compute f in poly-time? 3-CNF satisfiability. Not known how to find an assignment. Nabil Mustafa Computational Complexity 1
Checking solutions efficiently The class P : set of languages L f decidable in time O ( n c ) . Function f can be computed in poly-time. What if don’t know how to compute f in poly-time? 3-CNF satisfiability. Not known how to find an assignment. Instead, settle for languages with efficiently verifiable solutions. Nabil Mustafa Computational Complexity 1
Checking solutions efficiently The class P : set of languages L f decidable in time O ( n c ) . Function f can be computed in poly-time. What if don’t know how to compute f in poly-time? 3-CNF satisfiability. Not known how to find an assignment. Instead, settle for languages with efficiently verifiable solutions. Define a new class NP : A function f is in NP if Nabil Mustafa Computational Complexity 1
Checking solutions efficiently The class P : set of languages L f decidable in time O ( n c ) . Function f can be computed in poly-time. What if don’t know how to compute f in poly-time? 3-CNF satisfiability. Not known how to find an assignment. Instead, settle for languages with efficiently verifiable solutions. Define a new class NP : A function f is in NP if There exists a poly-sized solution of f – say u Nabil Mustafa Computational Complexity 1
Checking solutions efficiently The class P : set of languages L f decidable in time O ( n c ) . Function f can be computed in poly-time. What if don’t know how to compute f in poly-time? 3-CNF satisfiability. Not known how to find an assignment. Instead, settle for languages with efficiently verifiable solutions. Define a new class NP : A function f is in NP if There exists a poly-sized solution of f – say u Verify in polynomial time that u is a correct solution for f Nabil Mustafa Computational Complexity 1
Examples of problems in NP INDSET : Given a graph G and a integer k , decide if G has an independent set (I.S.) of size k . Nabil Mustafa Computational Complexity 1
Examples of problems in NP INDSET : Given a graph G and a integer k , decide if G has an independent set (I.S.) of size k . Language L : set of all graphs with independent set of size k Nabil Mustafa Computational Complexity 1
Examples of problems in NP INDSET : Given a graph G and a integer k , decide if G has an independent set (I.S.) of size k . Language L : set of all graphs with independent set of size k Input x : graph G and integer k Nabil Mustafa Computational Complexity 1
Examples of problems in NP INDSET : Given a graph G and a integer k , decide if G has an independent set (I.S.) of size k . Language L : set of all graphs with independent set of size k Input x : graph G and integer k Certificate u : V ′ ⊆ V , | V ′ | = k , and V ′ is an I.S. Nabil Mustafa Computational Complexity 1
Examples of problems in NP INDSET : Given a graph G and a integer k , decide if G has an independent set (I.S.) of size k . Language L : set of all graphs with independent set of size k Input x : graph G and integer k Certificate u : V ′ ⊆ V , | V ′ | = k , and V ′ is an I.S. p ( | x | ) : binary labels of k vertices, of total size k log n . Nabil Mustafa Computational Complexity 1
Examples of problems in NP INDSET : Given a graph G and a integer k , decide if G has an independent set (I.S.) of size k . Language L : set of all graphs with independent set of size k Input x : graph G and integer k Certificate u : V ′ ⊆ V , | V ′ | = k , and V ′ is an I.S. p ( | x | ) : binary labels of k vertices, of total size k log n . M ( x , u ) : TM M which verifies in polynomial time if u = ⌊ V ′ ⌋ is an independent set of size k Nabil Mustafa Computational Complexity 1
Some examples Claim: 3-CNF satisfiability is in NP Nabil Mustafa Computational Complexity 1
Some examples Claim: 3-CNF satisfiability is in NP If f is satisfiable ⇐ ⇒ ∃ a satisfying assignment u Nabil Mustafa Computational Complexity 1
Some examples Claim: 3-CNF satisfiability is in NP If f is satisfiable ⇐ ⇒ ∃ a satisfying assignment u The satisfying assignment u has polynomial size. Nabil Mustafa Computational Complexity 1
Some examples Claim: 3-CNF satisfiability is in NP If f is satisfiable ⇐ ⇒ ∃ a satisfying assignment u The satisfying assignment u has polynomial size. Given f and u , can verify in O ( nm ) that u satisfies f Nabil Mustafa Computational Complexity 1
Some examples Claim: 3-CNF satisfiability is in NP If f is satisfiable ⇐ ⇒ ∃ a satisfying assignment u The satisfying assignment u has polynomial size. Given f and u , can verify in O ( nm ) that u satisfies f Claim: k -coloring is in NP Nabil Mustafa Computational Complexity 1
Some examples Claim: 3-CNF satisfiability is in NP If f is satisfiable ⇐ ⇒ ∃ a satisfying assignment u The satisfying assignment u has polynomial size. Given f and u , can verify in O ( nm ) that u satisfies f Claim: k -coloring is in NP If G is k -colorable ⇐ ⇒ ∃ a correct coloring c Nabil Mustafa Computational Complexity 1
Some examples Claim: 3-CNF satisfiability is in NP If f is satisfiable ⇐ ⇒ ∃ a satisfying assignment u The satisfying assignment u has polynomial size. Given f and u , can verify in O ( nm ) that u satisfies f Claim: k -coloring is in NP If G is k -colorable ⇐ ⇒ ∃ a correct coloring c The correct coloring c has polynomial size Nabil Mustafa Computational Complexity 1
Some examples Claim: 3-CNF satisfiability is in NP If f is satisfiable ⇐ ⇒ ∃ a satisfying assignment u The satisfying assignment u has polynomial size. Given f and u , can verify in O ( nm ) that u satisfies f Claim: k -coloring is in NP If G is k -colorable ⇐ ⇒ ∃ a correct coloring c The correct coloring c has polynomial size Given G and c , verify in O ( m ) time that c correctly colors G Nabil Mustafa Computational Complexity 1
Some examples Claim: 3-CNF satisfiability is in NP If f is satisfiable ⇐ ⇒ ∃ a satisfying assignment u The satisfying assignment u has polynomial size. Given f and u , can verify in O ( nm ) that u satisfies f Claim: k -coloring is in NP If G is k -colorable ⇐ ⇒ ∃ a correct coloring c The correct coloring c has polynomial size Given G and c , verify in O ( m ) time that c correctly colors G Subset sum: Given n integers A 1 , . . . , A n and integer T , does there exist a subset of numbers that sum up to T Nabil Mustafa Computational Complexity 1
Some examples Claim: 3-CNF satisfiability is in NP If f is satisfiable ⇐ ⇒ ∃ a satisfying assignment u The satisfying assignment u has polynomial size. Given f and u , can verify in O ( nm ) that u satisfies f Claim: k -coloring is in NP If G is k -colorable ⇐ ⇒ ∃ a correct coloring c The correct coloring c has polynomial size Given G and c , verify in O ( m ) time that c correctly colors G Subset sum: Given n integers A 1 , . . . , A n and integer T , does there exist a subset of numbers that sum up to T Claim: Subset sum is in NP Nabil Mustafa Computational Complexity 1
P = NP ? Ultimate question The question of whether P = NP is the biggest open problem in computer science. Nabil Mustafa Computational Complexity 1
P = NP ? Ultimate question The question of whether P = NP is the biggest open problem in computer science. It would imply that if a small solution exists, then are always efficient algorithms to find it Nabil Mustafa Computational Complexity 1
P = NP ? Ultimate question The question of whether P = NP is the biggest open problem in computer science. It would imply that if a small solution exists, then are always efficient algorithms to find it Everyone believes that P � = NP Nabil Mustafa Computational Complexity 1
P = NP ? Ultimate question The question of whether P = NP is the biggest open problem in computer science. It would imply that if a small solution exists, then are always efficient algorithms to find it Everyone believes that P � = NP P = NP = ⇒ no cryptography Nabil Mustafa Computational Complexity 1
P = NP ? Ultimate question The question of whether P = NP is the biggest open problem in computer science. It would imply that if a small solution exists, then are always efficient algorithms to find it Everyone believes that P � = NP P = NP = ⇒ no cryptography P = NP = ⇒ computers can do math proofs and so on Nabil Mustafa Computational Complexity 1
P = NP ? Ultimate question The question of whether P = NP is the biggest open problem in computer science. It would imply that if a small solution exists, then are always efficient algorithms to find it Everyone believes that P � = NP P = NP = ⇒ no cryptography P = NP = ⇒ computers can do math proofs and so on P = NP = ⇒ computers can make the most beautiful music Nabil Mustafa Computational Complexity 1
P = NP ? Ultimate question The question of whether P = NP is the biggest open problem in computer science. It would imply that if a small solution exists, then are always efficient algorithms to find it Everyone believes that P � = NP P = NP = ⇒ no cryptography P = NP = ⇒ computers can do math proofs and so on P = NP = ⇒ computers can make the most beautiful music After 40 years of continuous work, no result even close. Nabil Mustafa Computational Complexity 1
P = NP ? Ultimate question The question of whether P = NP is the biggest open problem in computer science. It would imply that if a small solution exists, then are always efficient algorithms to find it Everyone believes that P � = NP P = NP = ⇒ no cryptography P = NP = ⇒ computers can do math proofs and so on P = NP = ⇒ computers can make the most beautiful music After 40 years of continuous work, no result even close. Resolving the question wins a prize of 1 million dollars. Nabil Mustafa Computational Complexity 1
Reducibility Several different languages are in the class NP . Nabil Mustafa Computational Complexity 1
Reducibility Several different languages are in the class NP . Question: Is there a fundamental language L that captures the essence of all the problems in NP ? Nabil Mustafa Computational Complexity 1
Reducibility Several different languages are in the class NP . Question: Is there a fundamental language L that captures the essence of all the problems in NP ? If one could decide L , then one could solve any problem in NP Nabil Mustafa Computational Complexity 1
Reducibility Several different languages are in the class NP . Question: Is there a fundamental language L that captures the essence of all the problems in NP ? If one could decide L , then one could solve any problem in NP Reductions Language A is polynomial-time reducible to language B if there exists a poly-time function f such that x ∈ A ⇐ ⇒ f ( x ) ∈ B We say A ≤ p B . Nabil Mustafa Computational Complexity 1
Reducibility Several different languages are in the class NP . Question: Is there a fundamental language L that captures the essence of all the problems in NP ? If one could decide L , then one could solve any problem in NP Reductions Language A is polynomial-time reducible to language B if there exists a poly-time function f such that x ∈ A ⇐ ⇒ f ( x ) ∈ B We say A ≤ p B . A language B is NP-hard if A ≤ p B for every A ∈ NP Nabil Mustafa Computational Complexity 1
Reducibility Several different languages are in the class NP . Question: Is there a fundamental language L that captures the essence of all the problems in NP ? If one could decide L , then one could solve any problem in NP Reductions Language A is polynomial-time reducible to language B if there exists a poly-time function f such that x ∈ A ⇐ ⇒ f ( x ) ∈ B We say A ≤ p B . A language B is NP-hard if A ≤ p B for every A ∈ NP A language B is NP-complete if B is NP-hard and B ∈ NP Nabil Mustafa Computational Complexity 1
Properties of Reductions A ≤ p B Computing A can be reduced to computing B Nabil Mustafa Computational Complexity 1
Properties of Reductions A ≤ p B Computing A can be reduced to computing B If we can compute B , we can compute A Nabil Mustafa Computational Complexity 1
Properties of Reductions A ≤ p B Computing A can be reduced to computing B If we can compute B , we can compute A Therefore, B must be at least as hard as A Nabil Mustafa Computational Complexity 1
Properties of Reductions A ≤ p B Computing A can be reduced to computing B If we can compute B , we can compute A Therefore, B must be at least as hard as A To show C is ‘hard’ to compute efficiently: Nabil Mustafa Computational Complexity 1
Properties of Reductions A ≤ p B Computing A can be reduced to computing B If we can compute B , we can compute A Therefore, B must be at least as hard as A To show C is ‘hard’ to compute efficiently: If possible, reduce computing B to computing C Nabil Mustafa Computational Complexity 1
Properties of Reductions A ≤ p B Computing A can be reduced to computing B If we can compute B , we can compute A Therefore, B must be at least as hard as A To show C is ‘hard’ to compute efficiently: If possible, reduce computing B to computing C Then if computing C was easy, computing B would be easy Nabil Mustafa Computational Complexity 1
Properties of Reductions A ≤ p B Computing A can be reduced to computing B If we can compute B , we can compute A Therefore, B must be at least as hard as A To show C is ‘hard’ to compute efficiently: If possible, reduce computing B to computing C Then if computing C was easy, computing B would be easy But we know that computing B is hard. Nabil Mustafa Computational Complexity 1
Properties of Reductions A ≤ p B Computing A can be reduced to computing B If we can compute B , we can compute A Therefore, B must be at least as hard as A To show C is ‘hard’ to compute efficiently: If possible, reduce computing B to computing C Then if computing C was easy, computing B would be easy But we know that computing B is hard. Some properties of reductions: If A ≤ p B and B ≤ p C , then A ≤ p C Nabil Mustafa Computational Complexity 1
Properties of Reductions A ≤ p B Computing A can be reduced to computing B If we can compute B , we can compute A Therefore, B must be at least as hard as A To show C is ‘hard’ to compute efficiently: If possible, reduce computing B to computing C Then if computing C was easy, computing B would be easy But we know that computing B is hard. Some properties of reductions: If A ≤ p B and B ≤ p C , then A ≤ p C If A is NP-hard and A ∈ P then P = NP Nabil Mustafa Computational Complexity 1
Properties of Reductions A ≤ p B Computing A can be reduced to computing B If we can compute B , we can compute A Therefore, B must be at least as hard as A To show C is ‘hard’ to compute efficiently: If possible, reduce computing B to computing C Then if computing C was easy, computing B would be easy But we know that computing B is hard. Some properties of reductions: If A ≤ p B and B ≤ p C , then A ≤ p C If A is NP-hard and A ∈ P then P = NP If A is NP-complete then A ∈ P if and only if P = NP Nabil Mustafa Computational Complexity 1
Reduction Scheme A B Reduced in NP- Member of NP Poly-time to NP Hard If member If of NP member of P NP- P=NP Complete Nabil Mustafa Computational Complexity 1
Finding hard problems To show L is NP-hard, required to show that every language in NP can be reduced to this language Nabil Mustafa Computational Complexity 1
Recommend
More recommend