Computational Complexity 1 Nabil Mustafa Graduate Algorithms Nabil - - PowerPoint PPT Presentation

computational complexity 1
SMART_READER_LITE
LIVE PREVIEW

Computational Complexity 1 Nabil Mustafa Graduate Algorithms Nabil - - PowerPoint PPT Presentation

Computational Complexity 1 Nabil Mustafa Graduate Algorithms Nabil Mustafa Computational Complexity 1 An Example Problem Definition A formula f ( x 1 , . . . , x n ) is in conjunctive normal form (CNF) iff f = C 1 C 2 . . . C m


slide-1
SLIDE 1

Computational Complexity 1

Nabil Mustafa Graduate Algorithms

Nabil Mustafa Computational Complexity 1

slide-2
SLIDE 2

An Example Problem

Definition A formula f (x1, . . . , xn) is in conjunctive normal form (CNF) iff f = C1 ∧ C2 ∧ . . . ∧ Cm−1 ∧ Cm

Nabil Mustafa Computational Complexity 1

slide-3
SLIDE 3

An Example Problem

Definition A formula f (x1, . . . , xn) is in conjunctive normal form (CNF) iff f = C1 ∧ C2 ∧ . . . ∧ Cm−1 ∧ Cm where each Cj is called a clause: Cj = xk1 ∨ xk2 ∨ . . . ∨ xk′

Nabil Mustafa Computational Complexity 1

slide-4
SLIDE 4

An Example Problem

Definition A formula f (x1, . . . , xn) is in conjunctive normal form (CNF) iff f = C1 ∧ C2 ∧ . . . ∧ Cm−1 ∧ Cm where each Cj is called a clause: Cj = xk1 ∨ xk2 ∨ . . . ∨ xk′ Each xi ∈ {0, 1}, and a literal is any xi, or its negation xi

Nabil Mustafa Computational Complexity 1

slide-5
SLIDE 5

An Example Problem

Definition A formula f (x1, . . . , xn) is in conjunctive normal form (CNF) iff f = C1 ∧ C2 ∧ . . . ∧ Cm−1 ∧ Cm where each Cj is called a clause: Cj = xk1 ∨ xk2 ∨ . . . ∨ xk′ Each xi ∈ {0, 1}, and a literal is any xi, or its negation xi An example of CNF (x3 ∨ x5) ∧ (x3 ∨ x3 ∨ x4) ∧ (x8 ∨ x3 ∨ x6)

Nabil Mustafa Computational Complexity 1

slide-6
SLIDE 6

An Example Problem

Definition A formula f (x1, . . . , xn) is in conjunctive normal form (CNF) iff f = C1 ∧ C2 ∧ . . . ∧ Cm−1 ∧ Cm where each Cj is called a clause: Cj = xk1 ∨ xk2 ∨ . . . ∨ xk′ Each xi ∈ {0, 1}, and a literal is any xi, or its negation xi An example of CNF (x3 ∨ x5) ∧ (x3 ∨ x3 ∨ x4) ∧ (x8 ∨ x3 ∨ x6) The size of a formula is the number of ∧’s and ∨’s it contains.

Nabil Mustafa Computational Complexity 1

slide-7
SLIDE 7

An Example Problem

Definition A formula f (x1, . . . , xn) is in conjunctive normal form (CNF) iff f = C1 ∧ C2 ∧ . . . ∧ Cm−1 ∧ Cm where each Cj is called a clause: Cj = xk1 ∨ xk2 ∨ . . . ∨ xk′ Each xi ∈ {0, 1}, and a literal is any xi, or its negation xi An example of CNF (x3 ∨ x5) ∧ (x3 ∨ x3 ∨ x4) ∧ (x8 ∨ x3 ∨ x6) The size of a formula is the number of ∧’s and ∨’s it contains. Definition A Boolean Satisfiability Problem (SAT) is the problem of determining if the variables of a given Boolean formula can be assigned in such a way as to make the formula evaluate to TRUE.

Nabil Mustafa Computational Complexity 1

slide-8
SLIDE 8

Example: Satisfiability

A clause Cj = xk1 ∨ xk2 ∨ . . . ∨ xk′ is satisfied by an assignment if at least one of its literals is 1.

Nabil Mustafa Computational Complexity 1

slide-9
SLIDE 9

Example: Satisfiability

A clause Cj = xk1 ∨ xk2 ∨ . . . ∨ xk′ is satisfied by an assignment if at least one of its literals is 1. A CNF formula is satisfied iff each clause is satisfied.

Nabil Mustafa Computational Complexity 1

slide-10
SLIDE 10

Example: Satisfiability

A clause Cj = xk1 ∨ xk2 ∨ . . . ∨ xk′ is satisfied by an assignment if at least one of its literals is 1. A CNF formula is satisfied iff each clause is satisfied. Input: n boolean variables x1, . . . , xn, where each xi ∈ {0, 1}

Nabil Mustafa Computational Complexity 1

slide-11
SLIDE 11

Example: Satisfiability

A clause Cj = xk1 ∨ xk2 ∨ . . . ∨ xk′ is satisfied by an assignment if at least one of its literals is 1. A CNF formula is satisfied iff each clause is satisfied. Input: n boolean variables x1, . . . , xn, where each xi ∈ {0, 1} Goal: Assign to each variable xi a value of 0 or 1.

Nabil Mustafa Computational Complexity 1

slide-12
SLIDE 12

Example: Satisfiability

A clause Cj = xk1 ∨ xk2 ∨ . . . ∨ xk′ is satisfied by an assignment if at least one of its literals is 1. A CNF formula is satisfied iff each clause is satisfied. Input: n boolean variables x1, . . . , xn, where each xi ∈ {0, 1} Goal: Assign to each variable xi a value of 0 or 1. Boolean Satisfiability: a fundamental computational problem

Nabil Mustafa Computational Complexity 1

slide-13
SLIDE 13

Example: Satisfiability

A clause Cj = xk1 ∨ xk2 ∨ . . . ∨ xk′ is satisfied by an assignment if at least one of its literals is 1. A CNF formula is satisfied iff each clause is satisfied. Input: n boolean variables x1, . . . , xn, where each xi ∈ {0, 1} Goal: Assign to each variable xi a value of 0 or 1. Boolean Satisfiability: a fundamental computational problem In general, a boolean formula f (x1, x2, . . . , xn−1, xn) is satisfiable iff there exists an assignment of the variables such that f (x1 = a1, x2 = a2, . . . , xn−1 = an−1, xn = an) = 1.

Nabil Mustafa Computational Complexity 1

slide-14
SLIDE 14

Example: Satisfiability

A clause Cj = xk1 ∨ xk2 ∨ . . . ∨ xk′ is satisfied by an assignment if at least one of its literals is 1. A CNF formula is satisfied iff each clause is satisfied. Input: n boolean variables x1, . . . , xn, where each xi ∈ {0, 1} Goal: Assign to each variable xi a value of 0 or 1. Boolean Satisfiability: a fundamental computational problem In general, a boolean formula f (x1, x2, . . . , xn−1, xn) is satisfiable iff there exists an assignment of the variables such that f (x1 = a1, x2 = a2, . . . , xn−1 = an−1, xn = an) = 1. (x3 ∨ x5) ∧ (x3 ∨ x1 ∨ x4) ∧ (x2 ∨ x3 ∨ x5)

Nabil Mustafa Computational Complexity 1

slide-15
SLIDE 15

Example: Satisfiability

A clause Cj = xk1 ∨ xk2 ∨ . . . ∨ xk′ is satisfied by an assignment if at least one of its literals is 1. A CNF formula is satisfied iff each clause is satisfied. Input: n boolean variables x1, . . . , xn, where each xi ∈ {0, 1} Goal: Assign to each variable xi a value of 0 or 1. Boolean Satisfiability: a fundamental computational problem In general, a boolean formula f (x1, x2, . . . , xn−1, xn) is satisfiable iff there exists an assignment of the variables such that f (x1 = a1, x2 = a2, . . . , xn−1 = an−1, xn = an) = 1. (x3 ∨ x5) ∧ (x3 ∨ x1 ∨ x4) ∧ (x2 ∨ x3 ∨ x5) x1 = 1, x2 = 1, x3 = 0, x4 = 1, x5 = 0

Nabil Mustafa Computational Complexity 1

slide-16
SLIDE 16

Example: Satisfiability

A clause Cj = xk1 ∨ xk2 ∨ . . . ∨ xk′ is satisfied by an assignment if at least one of its literals is 1. A CNF formula is satisfied iff each clause is satisfied. Input: n boolean variables x1, . . . , xn, where each xi ∈ {0, 1} Goal: Assign to each variable xi a value of 0 or 1. Boolean Satisfiability: a fundamental computational problem In general, a boolean formula f (x1, x2, . . . , xn−1, xn) is satisfiable iff there exists an assignment of the variables such that f (x1 = a1, x2 = a2, . . . , xn−1 = an−1, xn = an) = 1. (x3 ∨ x5) ∧ (x3 ∨ x1 ∨ x4) ∧ (x2 ∨ x3 ∨ x5) x1 = 1, x2 = 1, x3 = 0, x4 = 1, x5 = 0 (x1 ∨ x3) ∧ (x3 ∨ x1) ∧ (x2 ∨ x4) ∧ (x4 ∨ x2)

Nabil Mustafa Computational Complexity 1

slide-17
SLIDE 17

Digression: Expressiveness of boolean formulae

Boolean formulae are a lot more descriptive than apparent.

Nabil Mustafa Computational Complexity 1

slide-18
SLIDE 18

Digression: Expressiveness of boolean formulae

Boolean formulae are a lot more descriptive than apparent. Construct: f (a, b) = 1 iff a = b, where a, b ∈ {0, 1}

Nabil Mustafa Computational Complexity 1

slide-19
SLIDE 19

Digression: Expressiveness of boolean formulae

Boolean formulae are a lot more descriptive than apparent. Construct: f (a, b) = 1 iff a = b, where a, b ∈ {0, 1} (a ∨ b) ∧ (a ∨ b)

Nabil Mustafa Computational Complexity 1

slide-20
SLIDE 20

Digression: Expressiveness of boolean formulae

Boolean formulae are a lot more descriptive than apparent. Construct: f (a, b) = 1 iff a = b, where a, b ∈ {0, 1} (a ∨ b) ∧ (a ∨ b) Construct: f (a, b) = 1 iff a = b, where a, b ∈ {0, 1}n

Nabil Mustafa Computational Complexity 1

slide-21
SLIDE 21

Digression: Expressiveness of boolean formulae

Boolean formulae are a lot more descriptive than apparent. Construct: f (a, b) = 1 iff a = b, where a, b ∈ {0, 1} (a ∨ b) ∧ (a ∨ b) Construct: f (a, b) = 1 iff a = b, where a, b ∈ {0, 1}n

  • 1≤i≤n

(ai ∨ bi) ∧ (ai ∨ bi)

Nabil Mustafa Computational Complexity 1

slide-22
SLIDE 22

Digression: Expressiveness of boolean formulae

Boolean formulae are a lot more descriptive than apparent. Construct: f (a, b) = 1 iff a = b, where a, b ∈ {0, 1} (a ∨ b) ∧ (a ∨ b) Construct: f (a, b) = 1 iff a = b, where a, b ∈ {0, 1}n

  • 1≤i≤n

(ai ∨ bi) ∧ (ai ∨ bi) Construct: f (a, b) = 1 iff a = b, where a, b ∈ {0, 1}

Nabil Mustafa Computational Complexity 1

slide-23
SLIDE 23

Digression: Expressiveness of boolean formulae

Boolean formulae are a lot more descriptive than apparent. Construct: f (a, b) = 1 iff a = b, where a, b ∈ {0, 1} (a ∨ b) ∧ (a ∨ b) Construct: f (a, b) = 1 iff a = b, where a, b ∈ {0, 1}n

  • 1≤i≤n

(ai ∨ bi) ∧ (ai ∨ bi) Construct: f (a, b) = 1 iff a = b, where a, b ∈ {0, 1} (a ∨ b) ∧ (a ∨ b)

Nabil Mustafa Computational Complexity 1

slide-24
SLIDE 24

Example: Satisfiability (Cont.)

Construct: f (a1, . . . , a2k−1) = 1 iff

i ai ≥ k,

ai ∈ {0, 1}

Nabil Mustafa Computational Complexity 1

slide-25
SLIDE 25

Example: Satisfiability (Cont.)

Construct: f (a1, . . . , a2k−1) = 1 iff

i ai ≥ k,

ai ∈ {0, 1}

  • I⊂2A,|I|=k
  • i∈I

ai

Key point: If more than half ai’s are 1s then all subsets of size (n/2) + 1 will have at least one 1.

Nabil Mustafa Computational Complexity 1

slide-26
SLIDE 26

Example: Satisfiability (Cont.)

Construct: f (a1, . . . , a2k−1) = 1 iff

i ai ≥ k,

ai ∈ {0, 1}

  • I⊂2A,|I|=k
  • i∈I

ai

Key point: If more than half ai’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

slide-27
SLIDE 27

Example: Satisfiability (Cont.)

Construct: f (a1, . . . , a2k−1) = 1 iff

i ai ≥ k,

ai ∈ {0, 1}

  • I⊂2A,|I|=k
  • i∈I

ai

Key point: If more than half ai’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

slide-28
SLIDE 28

Satisfiability

Satisfiability Given a CNF formula f , is f satisfiable?

Nabil Mustafa Computational Complexity 1

slide-29
SLIDE 29

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

slide-30
SLIDE 30

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

slide-31
SLIDE 31

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 Ci has at most k literals.

Nabil Mustafa Computational Complexity 1

slide-32
SLIDE 32

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 Ci has at most k literals. k-Satisfiability Given a k-CNF formula f , is f satisfiable?

Nabil Mustafa Computational Complexity 1

slide-33
SLIDE 33

Complexity class

Different problems have different levels of hardness

Nabil Mustafa Computational Complexity 1

slide-34
SLIDE 34

Complexity class

Different problems have different levels of hardness Each problem can be viewed as computing a function

Nabil Mustafa Computational Complexity 1

slide-35
SLIDE 35

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

slide-36
SLIDE 36

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

slide-37
SLIDE 37

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

slide-38
SLIDE 38

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 (n2) is the set of all functions computable in at most O(n2) time.

Nabil Mustafa Computational Complexity 1

slide-39
SLIDE 39

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 (n2) is the set of all functions computable in at most O(n2) time. T1(n) = O(T2(n))

Nabil Mustafa Computational Complexity 1

slide-40
SLIDE 40

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 (n2) is the set of all functions computable in at most O(n2) time. T1(n) = O(T2(n)) = ⇒ DTIME (T1(n)) ⊆ DTIME (T2(n))

Nabil Mustafa Computational Complexity 1

slide-41
SLIDE 41

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 (n2) is the set of all functions computable in at most O(n2) time. T1(n) = O(T2(n)) = ⇒ DTIME (T1(n)) ⊆ DTIME (T2(n)) Definition P =

  • c≥1

DTIME (nc)

Nabil Mustafa Computational Complexity 1

slide-42
SLIDE 42

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 (n2) is the set of all functions computable in at most O(n2) time. T1(n) = O(T2(n)) = ⇒ DTIME (T1(n)) ⊆ DTIME (T2(n)) Definition P =

  • c≥1

DTIME (nc) The class P contains all classes DTIME (T(n)) where T(n) is a polynomial of finite degree.

Nabil Mustafa Computational Complexity 1

slide-43
SLIDE 43

The class P

The class P is considered the set of “efficiently” solvable problems

Nabil Mustafa Computational Complexity 1

slide-44
SLIDE 44

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

slide-45
SLIDE 45

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

slide-46
SLIDE 46

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

slide-47
SLIDE 47

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(n1000).

Nabil Mustafa Computational Complexity 1

slide-48
SLIDE 48

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(n1000). High constants for small polynomials: 1, 000, 000, 000, 000 · n

Nabil Mustafa Computational Complexity 1

slide-49
SLIDE 49

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(n1000). 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

slide-50
SLIDE 50

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(n1000). 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

slide-51
SLIDE 51

Checking solutions efficiently

The class P : set of languages Lf decidable in time O(nc).

Nabil Mustafa Computational Complexity 1

slide-52
SLIDE 52

Checking solutions efficiently

The class P : set of languages Lf decidable in time O(nc). Function f can be computed in poly-time.

Nabil Mustafa Computational Complexity 1

slide-53
SLIDE 53

Checking solutions efficiently

The class P : set of languages Lf decidable in time O(nc). 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

slide-54
SLIDE 54

Checking solutions efficiently

The class P : set of languages Lf decidable in time O(nc). 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

slide-55
SLIDE 55

Checking solutions efficiently

The class P : set of languages Lf decidable in time O(nc). 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

slide-56
SLIDE 56

Checking solutions efficiently

The class P : set of languages Lf decidable in time O(nc). 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

slide-57
SLIDE 57

Checking solutions efficiently

The class P : set of languages Lf decidable in time O(nc). 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

slide-58
SLIDE 58

Checking solutions efficiently

The class P : set of languages Lf decidable in time O(nc). 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

slide-59
SLIDE 59

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

slide-60
SLIDE 60

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

slide-61
SLIDE 61

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

slide-62
SLIDE 62

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

slide-63
SLIDE 63

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

slide-64
SLIDE 64

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

slide-65
SLIDE 65

Some examples

Claim: 3-CNF satisfiability is in NP

Nabil Mustafa Computational Complexity 1

slide-66
SLIDE 66

Some examples

Claim: 3-CNF satisfiability is in NP

If f is satisfiable ⇐ ⇒ ∃ a satisfying assignment u

Nabil Mustafa Computational Complexity 1

slide-67
SLIDE 67

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

slide-68
SLIDE 68

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

slide-69
SLIDE 69

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

slide-70
SLIDE 70

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

slide-71
SLIDE 71

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

slide-72
SLIDE 72

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

slide-73
SLIDE 73

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 A1, . . . , An and integer T, does there exist a subset of numbers that sum up to T

Nabil Mustafa Computational Complexity 1

slide-74
SLIDE 74

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 A1, . . . , An 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

slide-75
SLIDE 75

P = NP ?

Ultimate question The question of whether P = NP is the biggest open problem in computer science.

Nabil Mustafa Computational Complexity 1

slide-76
SLIDE 76

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

slide-77
SLIDE 77

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

slide-78
SLIDE 78

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

slide-79
SLIDE 79

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

slide-80
SLIDE 80

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

slide-81
SLIDE 81

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

slide-82
SLIDE 82

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

slide-83
SLIDE 83

Reducibility

Several different languages are in the class NP .

Nabil Mustafa Computational Complexity 1

slide-84
SLIDE 84

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

slide-85
SLIDE 85

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

slide-86
SLIDE 86

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

slide-87
SLIDE 87

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

slide-88
SLIDE 88

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

slide-89
SLIDE 89

Properties of Reductions

A ≤p B

Computing A can be reduced to computing B

Nabil Mustafa Computational Complexity 1

slide-90
SLIDE 90

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

slide-91
SLIDE 91

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

slide-92
SLIDE 92

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

slide-93
SLIDE 93

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

slide-94
SLIDE 94

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

slide-95
SLIDE 95

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

slide-96
SLIDE 96

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

slide-97
SLIDE 97

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

slide-98
SLIDE 98

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

slide-99
SLIDE 99

Reduction Scheme

NP NP

NP- Hard A

Reduced in Poly-time to

B

Member of

P=NP

If member

  • f P

If member

  • f NP

NP- Complete

Nabil Mustafa Computational Complexity 1

slide-100
SLIDE 100

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

slide-101
SLIDE 101

Finding hard problems

To show L is NP-hard, required to show that every language in NP can be reduced to this language Much work! For each language, thousands of reductions!

Nabil Mustafa Computational Complexity 1

slide-102
SLIDE 102

Finding hard problems

To show L is NP-hard, required to show that every language in NP can be reduced to this language Much work! For each language, thousands of reductions! Saving idea: Reductions are transitive!

Nabil Mustafa Computational Complexity 1

slide-103
SLIDE 103

Finding hard problems

To show L is NP-hard, required to show that every language in NP can be reduced to this language Much work! For each language, thousands of reductions! Saving idea: Reductions are transitive!

If we could find one problem, say A, that is NP-complete, we are done

Nabil Mustafa Computational Complexity 1

slide-104
SLIDE 104

Finding hard problems

To show L is NP-hard, required to show that every language in NP can be reduced to this language Much work! For each language, thousands of reductions! Saving idea: Reductions are transitive!

If we could find one problem, say A, that is NP-complete, we are done Then to show B is NP-hard, just reduce A to B.

Nabil Mustafa Computational Complexity 1

slide-105
SLIDE 105

Finding hard problems

To show L is NP-hard, required to show that every language in NP can be reduced to this language Much work! For each language, thousands of reductions! Saving idea: Reductions are transitive!

If we could find one problem, say A, that is NP-complete, we are done Then to show B is NP-hard, just reduce A to B. Since we can reduce any problem in NP to A, this implies we can reduce any problem in NP to B

Nabil Mustafa Computational Complexity 1

slide-106
SLIDE 106

Finding hard problems

To show L is NP-hard, required to show that every language in NP can be reduced to this language Much work! For each language, thousands of reductions! Saving idea: Reductions are transitive!

If we could find one problem, say A, that is NP-complete, we are done Then to show B is NP-hard, just reduce A to B. Since we can reduce any problem in NP to A, this implies we can reduce any problem in NP to B

The catch How does one find even one NP hard problem? Seems impossible, have to construct infinite number of reductions!

Nabil Mustafa Computational Complexity 1

slide-107
SLIDE 107

Finding a NP hard problem

The Cook-Levin Theorem 3-CNF is NP hard. It is also NP complete.

Nabil Mustafa Computational Complexity 1

slide-108
SLIDE 108

Summary

Class NP : problems whose solutions can be verified in poly-time

Nabil Mustafa Computational Complexity 1

slide-109
SLIDE 109

Summary

Class NP : problems whose solutions can be verified in poly-time Cook-Levin: All L ∈ NP can be reduced to SAT

∃ polynomial g(·) such that x ∈ L ⇐ ⇒ g(x) ∈ SAT

Nabil Mustafa Computational Complexity 1

slide-110
SLIDE 110

Summary

Class NP : problems whose solutions can be verified in poly-time Cook-Levin: All L ∈ NP can be reduced to SAT

∃ polynomial g(·) such that x ∈ L ⇐ ⇒ g(x) ∈ SAT Very important to remember the implication goes both ways

Nabil Mustafa Computational Complexity 1

slide-111
SLIDE 111

Summary

Class NP : problems whose solutions can be verified in poly-time Cook-Levin: All L ∈ NP can be reduced to SAT

∃ polynomial g(·) such that x ∈ L ⇐ ⇒ g(x) ∈ SAT Very important to remember the implication goes both ways 2-CNF SAT is in P through a poly-time algorithm.

Nabil Mustafa Computational Complexity 1

slide-112
SLIDE 112

Summary

Class NP : problems whose solutions can be verified in poly-time Cook-Levin: All L ∈ NP can be reduced to SAT

∃ polynomial g(·) such that x ∈ L ⇐ ⇒ g(x) ∈ SAT Very important to remember the implication goes both ways 2-CNF SAT is in P through a poly-time algorithm.

3-CNF SAT then becomes a very important problem. Also,

Nabil Mustafa Computational Complexity 1

slide-113
SLIDE 113

Summary

Class NP : problems whose solutions can be verified in poly-time Cook-Levin: All L ∈ NP can be reduced to SAT

∃ polynomial g(·) such that x ∈ L ⇐ ⇒ g(x) ∈ SAT Very important to remember the implication goes both ways 2-CNF SAT is in P through a poly-time algorithm.

3-CNF SAT then becomes a very important problem. Also,

An elementary problem, very simple to understand

Nabil Mustafa Computational Complexity 1

slide-114
SLIDE 114

Summary

Class NP : problems whose solutions can be verified in poly-time Cook-Levin: All L ∈ NP can be reduced to SAT

∃ polynomial g(·) such that x ∈ L ⇐ ⇒ g(x) ∈ SAT Very important to remember the implication goes both ways 2-CNF SAT is in P through a poly-time algorithm.

3-CNF SAT then becomes a very important problem. Also,

An elementary problem, very simple to understand Captures the ‘pure’ combinatorial choices of algorithms

Nabil Mustafa Computational Complexity 1

slide-115
SLIDE 115

Summary

Class NP : problems whose solutions can be verified in poly-time Cook-Levin: All L ∈ NP can be reduced to SAT

∃ polynomial g(·) such that x ∈ L ⇐ ⇒ g(x) ∈ SAT Very important to remember the implication goes both ways 2-CNF SAT is in P through a poly-time algorithm.

3-CNF SAT then becomes a very important problem. Also,

An elementary problem, very simple to understand Captures the ‘pure’ combinatorial choices of algorithms

Given 3-CNF SAT , can construct a host of other reductions.

Nabil Mustafa Computational Complexity 1