• No results found

CS310 : Automata Theory 2020

N/A
N/A
Protected

Academic year: 2022

Share "CS310 : Automata Theory 2020"

Copied!
99
0
0

Loading.... (view fulltext now)

Full text

(1)

CS310 : Automata Theory 2020

Lecture 32: The complexity class NP and NP completeness

Instructor: S. Akshay

IITB, India

Spring 2020

(2)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 2

Recap

Turing machines and computability 1. Turing machines

(i) Definition & variants

(ii) Decidable and Turing recognizable languages (iii) Church-Turing Hypothesis

2. Undecidability

(i) A proof technique by diagonalization (ii) Via reductions

(iii) Rice’s theorem

3. Applications: showing (un)decidability of other problems (i) A string matching problem: Post’s Correspondance Problem (ii) A problem for compilers: Unambiguity of Context-free languages 4. Efficiency in computation: run-time complexity.

(i) Running time complexity

(ii) Polynomial and exponential time complexity

(3)

Recap

Turing machines and computability 1. Turing machines

(i) Definition & variants

(ii) Decidable and Turing recognizable languages (iii) Church-Turing Hypothesis

2. Undecidability

(i) A proof technique by diagonalization (ii) Via reductions

(iii) Rice’s theorem

3. Applications: showing (un)decidability of other problems (i) A string matching problem: Post’s Correspondance Problem (ii) A problem for compilers: Unambiguity of Context-free languages 4. Efficiency in computation: run-time complexity.

(i) Running time complexity

(ii) Polynomial and exponential time complexity

(4)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 2

Recap

Turing machines and computability 1. Turing machines

(i) Definition & variants

(ii) Decidable and Turing recognizable languages (iii) Church-Turing Hypothesis

2. Undecidability

(i) A proof technique by diagonalization (ii) Via reductions

(iii) Rice’s theorem

3. Applications: showing (un)decidability of other problems (i) A string matching problem: Post’s Correspondance Problem (ii) A problem for compilers: Unambiguity of Context-free languages

4. Efficiency in computation: run-time complexity. (i) Running time complexity

(ii) Polynomial and exponential time complexity

(5)

Recap

Turing machines and computability 1. Turing machines

(i) Definition & variants

(ii) Decidable and Turing recognizable languages (iii) Church-Turing Hypothesis

2. Undecidability

(i) A proof technique by diagonalization (ii) Via reductions

(iii) Rice’s theorem

3. Applications: showing (un)decidability of other problems (i) A string matching problem: Post’s Correspondance Problem (ii) A problem for compilers: Unambiguity of Context-free languages 4. Efficiency in computation: run-time complexity.

(6)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 3

This lecture

The complexity class NP

In this lecture we will cover I The NP complexity class I The P vs NP problem I NP completeness

I The Cook-Levin Theorem Reading Material

I Section 10.1, 10.2, 10.3 , Introduction to Automata Theory, Languages and Computation, Hopcroft, Motwani and Ullman

I Section 7.3, 7.4, Introduction to the Theory of Computation, Michael Sipser

(7)

This lecture

The complexity class NP

In this lecture we will cover I The NP complexity class I The P vs NP problem I NP completeness

I The Cook-Levin Theorem Reading Material

I Section 10.1, 10.2, 10.3, Introduction to Automata Theory, Languages and Computation, Hopcroft, Motwani and Ullman

(8)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 4

The class NP

NTIME(t(n)) is set of all languages decidable by aO(t(n)) 1-tape non-det Turing machine

Definition

NP is the class of languages that are decidable in polynomial time on a non-deterministic single-tape Turing machine, i.e.,

NP =[

k

NTIME(nk)

Verifier

for languageAis an algorithm V s.t. w ∈A iffV accepts hw,ci for some witness or proof stringc. Examples: HAMPATH, Composities

Theorem

A language is in NP iff it has a poly-time verifier

(9)

The class NP

NTIME(t(n)) is set of all languages decidable by aO(t(n)) 1-tape non-det Turing machine

Definition

NP is the class of languages that are decidable in polynomial time on a non-deterministic single-tape Turing machine, i.e.,

NP =[

k

NTIME(nk)

Verifier

for languageAis an algorithm V s.t. w ∈A iffV accepts hw,ci for some witness or proof stringc. Examples: HAMPATH, Composities

Theorem

A language is in NP iff it has a poly-time verifier

(10)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 4

The class NP

NTIME(t(n)) is set of all languages decidable by aO(t(n)) 1-tape non-det Turing machine

Definition

NP is the class of languages that are decidable in polynomial time on a non-deterministic single-tape Turing machine, i.e.,

NP =[

k

NTIME(nk)

Verifier

for language Ais an algorithm V s.t. w ∈A iffV accepts hw,ci for some witness or proof string c.

Examples: HAMPATH, Composities Theorem

A language is in NP iff it has a poly-time verifier

(11)

The class NP

NTIME(t(n)) is set of all languages decidable by aO(t(n)) 1-tape non-det Turing machine

Definition

NP is the class of languages that are decidable in polynomial time on a non-deterministic single-tape Turing machine, i.e.,

NP =[

k

NTIME(nk)

Verifier

for language Ais an algorithm V s.t. w ∈A iffV accepts hw,ci for some witness or proof string c. Examples: HAMPATH, Composities

Theorem

A language is in NP iff it has a poly-time verifier

(12)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 4

The class NP

NTIME(t(n)) is set of all languages decidable by aO(t(n)) 1-tape non-det Turing machine

Definition

NP is the class of languages that are decidable in polynomial time on a non-deterministic single-tape Turing machine, i.e.,

NP =[

k

NTIME(nk)

Verifier

for language Ais an algorithm V s.t. w ∈A iffV accepts hw,ci for some witness or proof string c. Examples: HAMPATH, Composities

Theorem

A language is in NP iff it has a poly-time verifier

(13)

Non-determinism vs Poly-time verifiers

Theorem

A language is in NP iff it has a poly-time verifier

(14)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 5

Non-determinism vs Poly-time verifiers

Theorem

A language is in NP iff it has a poly-time verifier I =⇒

(15)

Non-determinism vs Poly-time verifiers

Theorem

A language is in NP iff it has a poly-time verifier

I =⇒ SupposeN is the NTM that decidesL∈NP, we define verifier V: I On input hw,ci, where w,c are strings,

(16)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 5

Non-determinism vs Poly-time verifiers

Theorem

A language is in NP iff it has a poly-time verifier

I =⇒ SupposeN is the NTM that decidesL∈NP, we define verifier V: I On input hw,ci, where w,c are strings,

1. SimulateN onw, withc as a description of the non-det choice.

2. If this branch ofN’s computation accepts, accept, else reject.

(17)

Non-determinism vs Poly-time verifiers

Theorem

A language is in NP iff it has a poly-time verifier

I =⇒ SupposeN is the NTM that decidesL∈NP, we define verifier V: I On input hw,ci, where w,c are strings,

1. SimulateN onw, withc as a description of the non-det choice.

2. If this branch ofN’s computation accepts, accept, else reject.

I ⇐= Given verifierV which runs in timenk, we construct NTM N as follows:

I On input w of lengthn;

(18)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 5

Non-determinism vs Poly-time verifiers

Theorem

A language is in NP iff it has a poly-time verifier

I =⇒ SupposeN is the NTM that decidesL∈NP, we define verifier V: I On input hw,ci, where w,c are strings,

1. SimulateN onw, withc as a description of the non-det choice.

2. If this branch ofN’s computation accepts, accept, else reject.

I ⇐= Given verifierV which runs in timenk, we construct NTM N as follows:

I On input w of lengthn;

1. Guess (i.e., non-det choice) stringc of length at mostnk 2. RunV on hw,ci

3. Accept ifV accepts, else reject

(19)

Examples of problems in NP class

Exercises

I CLIQUE: Does an undir graph G contain a clique of sizek? I SUBSET-SUM: Given a set of numbers, does some set add up to

exactly S?

CLIQUE:{hG,ki |G is an undirected graph with ak-clique}. Give two proofs!

(20)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 6

Examples of problems in NP class

Exercises

I CLIQUE: Does an undir graph G contain a clique of sizek? I SUBSET-SUM: Given a set of numbers, does some set add up to

exactly S?

CLIQUE: {hG,ki |G is an undirected graph with ak-clique}. Give two proofs!

(21)

The start of many many questions

What about complementation?

I Is CLIQUES in NP?

I We define Co-NP for problems whose complement is in NP. I Give an example of a problem in Co-NP. COMPOSITES I Is NP separated from Co-NP?

What aboutNP vs EXPTIME? I NP ⊆EXPTIME, but is it strict?

One question to rule them all: isP =NP?

Also ifP =NP, then what happens to the earlier questions?

(22)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 7

The start of many many questions

What about complementation?

I IsCLIQUES in NP?

I We define Co-NP for problems whose complement is in NP. I Give an example of a problem in Co-NP. COMPOSITES I Is NP separated from Co-NP?

What aboutNP vs EXPTIME? I NP ⊆EXPTIME, but is it strict?

One question to rule them all: isP =NP?

Also ifP =NP, then what happens to the earlier questions?

(23)

The start of many many questions

What about complementation?

I IsCLIQUES in NP?

I We define Co-NP for problems whose complement is in NP.

I Give an example of a problem in Co-NP. COMPOSITES I Is NP separated from Co-NP?

What aboutNP vs EXPTIME? I NP ⊆EXPTIME, but is it strict?

One question to rule them all: isP =NP?

Also ifP =NP, then what happens to the earlier questions?

(24)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 7

The start of many many questions

What about complementation?

I IsCLIQUES in NP?

I We define Co-NP for problems whose complement is in NP.

I Give an example of a problem in Co-NP.

COMPOSITES I Is NP separated from Co-NP?

What aboutNP vs EXPTIME? I NP ⊆EXPTIME, but is it strict?

One question to rule them all: isP =NP?

Also ifP =NP, then what happens to the earlier questions?

(25)

The start of many many questions

What about complementation?

I IsCLIQUES in NP?

I We define Co-NP for problems whose complement is in NP.

I Give an example of a problem in Co-NP. COMPOSITES

I Is NP separated from Co-NP?

What aboutNP vs EXPTIME? I NP ⊆EXPTIME, but is it strict?

One question to rule them all: isP =NP?

Also ifP =NP, then what happens to the earlier questions?

(26)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 7

The start of many many questions

What about complementation?

I IsCLIQUES in NP?

I We define Co-NP for problems whose complement is in NP.

I Give an example of a problem in Co-NP. COMPOSITES I Is NP separated from Co-NP?

What aboutNP vs EXPTIME? I NP ⊆EXPTIME, but is it strict?

One question to rule them all: isP =NP?

Also ifP =NP, then what happens to the earlier questions?

(27)

The start of many many questions

What about complementation?

I IsCLIQUES in NP?

I We define Co-NP for problems whose complement is in NP.

I Give an example of a problem in Co-NP. COMPOSITES I Is NP separated from Co-NP?

What about NP vs EXPTIME?

I NP ⊆EXPTIME, but is it strict?

One question to rule them all: isP =NP?

Also ifP =NP, then what happens to the earlier questions?

(28)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 7

The start of many many questions

What about complementation?

I IsCLIQUES in NP?

I We define Co-NP for problems whose complement is in NP.

I Give an example of a problem in Co-NP. COMPOSITES I Is NP separated from Co-NP?

What about NP vs EXPTIME? I NP ⊆EXPTIME, but is it strict?

One question to rule them all: isP =NP?

Also ifP =NP, then what happens to the earlier questions?

(29)

The start of many many questions

What about complementation?

I IsCLIQUES in NP?

I We define Co-NP for problems whose complement is in NP.

I Give an example of a problem in Co-NP. COMPOSITES I Is NP separated from Co-NP?

What about NP vs EXPTIME? I NP ⊆EXPTIME, but is it strict?

One question to rule them all: is P =NP?

Also ifP =NP, then what happens to the earlier questions?

(30)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 7

The start of many many questions

What about complementation?

I IsCLIQUES in NP?

I We define Co-NP for problems whose complement is in NP.

I Give an example of a problem in Co-NP. COMPOSITES I Is NP separated from Co-NP?

What about NP vs EXPTIME? I NP ⊆EXPTIME, but is it strict?

One question to rule them all: is P =NP?

Also if P =NP, then what happens to the earlier questions?

(31)

The P vs NP problem

I P: class of problems solvable in polynomial time I NP: class of problems verifiable in polynomial time

= class of problems solvable in polynomial time in a non-determistic TM. I EXP: class of problems solvable in exponential time.

I Co− C: class of problems whose complement is solvable inC.

(32)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 8

The P vs NP problem

I P: class of problems solvable in polynomial time I NP: class of problems verifiable in polynomial time

= class of problems solvable in polynomial time in a non-determistic TM.

I EXP: class of problems solvable in exponential time.

I Co− C: class of problems whose complement is solvable in C.

(33)

NP completeness

The problem of satisfiability SAT

Given a Boolean formula, i.e., an expression with Boolean variables and operations, does it have a satisfying assignment?

SAT ={hφi |φis a satisfiable Boolean formula.} Example: φ= (x∧y∧z)∨(x∧z)

Theorem

SAT ∈P iff P =NP

SAT ={hφi |φ is a satisfiable 3-cnf-formula.} where 3-cnf-formula is a formula in special form:

I conjunction of “clauses”

I each clause has literals, i.e., variables or their negations, separated by disjunction

I each clause has 3 literals

(34)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 9

NP completeness

The problem of satisfiability SAT

Given a Boolean formula, i.e., an expression with Boolean variables and operations, does it have a satisfying assignment?

SAT ={hφi |φis a satisfiable Boolean formula.}

Example: φ= (x∧y∧z)∨(x∧z) Theorem

SAT ∈P iff P =NP

SAT ={hφi |φ is a satisfiable 3-cnf-formula.} where 3-cnf-formula is a formula in special form:

I conjunction of “clauses”

I each clause has literals, i.e., variables or their negations, separated by disjunction

I each clause has 3 literals

(35)

NP completeness

The problem of satisfiability SAT

Given a Boolean formula, i.e., an expression with Boolean variables and operations, does it have a satisfying assignment?

SAT ={hφi |φis a satisfiable Boolean formula.}

Example: φ= (x∧y∧z)∨(x∧z)

Theorem

SAT ∈P iff P =NP

SAT ={hφi |φ is a satisfiable 3-cnf-formula.} where 3-cnf-formula is a formula in special form:

I conjunction of “clauses”

I each clause has literals, i.e., variables or their negations, separated by disjunction

I each clause has 3 literals

(36)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 9

NP completeness

The problem of satisfiability SAT

Given a Boolean formula, i.e., an expression with Boolean variables and operations, does it have a satisfying assignment?

SAT ={hφi |φis a satisfiable Boolean formula.}

Example: φ= (x∧y∧z)∨(x∧z) Theorem

SAT ∈P iff P =NP

SAT ={hφi |φ is a satisfiable 3-cnf-formula.} where 3-cnf-formula is a formula in special form:

I conjunction of “clauses”

I each clause has literals, i.e., variables or their negations, separated by disjunction

I each clause has 3 literals

(37)

NP completeness

The problem of satisfiability SAT

Given a Boolean formula, i.e., an expression with Boolean variables and operations, does it have a satisfying assignment?

SAT ={hφi |φis a satisfiable Boolean formula.}

Example: φ= (x∧y∧z)∨(x∧z) Theorem

SAT ∈P iff P =NP

SAT ={hφi |φ is a satisfiable 3-cnf-formula.}

where 3-cnf-formula is a formula in special form:

I conjunction of “clauses”

I each clause has literals, i.e., variables or their negations, separated by

(38)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 10

Polynomial time reductions

Ptime computable functions

f : Σ →Σ is Ptime computable if there is a polytime TMM, which started on any input w halts with justf(w) on its tape.

Polynomial time reduction

LanguageApolynomtial time reducible to B, denoted A≤P B if there is a Ptime computable functionf s.t.

w ∈A⇔f(w)∈B Such a function is called a Ptime reduction ofA toB. Theorem

IfA≤pB andB ∈P, then A∈P

(Note: if there is a “halting TM” reduction fromAto B, then Aundecidable impliedB undecidable!)

(39)

Polynomial time reductions

Ptime computable functions

f : Σ →Σ is Ptime computable if there is a polytime TMM, which started on any input w halts with justf(w) on its tape.

Polynomial time reduction

Language Apolynomtial time reducible to B, denoted A≤P B if there is a Ptime computable function f s.t.

w ∈A⇔f(w)∈B Such a function is called a Ptime reduction of A toB.

Theorem

IfA≤pB andB ∈P, then A∈P

(Note: if there is a “halting TM” reduction fromAto B, then Aundecidable impliedB undecidable!)

(40)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 10

Polynomial time reductions

Ptime computable functions

f : Σ →Σ is Ptime computable if there is a polytime TMM, which started on any input w halts with justf(w) on its tape.

Polynomial time reduction

Language Apolynomtial time reducible to B, denoted A≤P B if there is a Ptime computable function f s.t.

w ∈A⇔f(w)∈B Such a function is called a Ptime reduction of A toB.

Theorem

IfA≤pB andB ∈P, then A∈P

(Note: if there is a “halting TM” reduction fromAto B, then Aundecidable impliedB undecidable!)

(41)

Polynomial time reductions

Ptime computable functions

f : Σ →Σ is Ptime computable if there is a polytime TMM, which started on any input w halts with justf(w) on its tape.

Polynomial time reduction

Language Apolynomtial time reducible to B, denoted A≤P B if there is a Ptime computable function f s.t.

w ∈A⇔f(w)∈B Such a function is called a Ptime reduction of A toB.

Theorem

IfA≤pB andB ∈P, then A∈P

(42)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 11

Exercise (H.W)

I Show that 3SAT is polytime reducible to CLIQUE.

I Show that 3SAT is polytime reducible to SUBSETSUM.

(43)

NP-completeness

Definition

A languageB is NP-complete if two conditions hold:

1. B is in NP,

2. every Ain NP is polynomial time reducible to B

If only condition 2 holdsB is said to be NP-hard. Exercises:

I IfB is NP-complete, and B∈P, thenP =NP. I IfB is NP-complete, and B≤P C, thenC is NP-hard. The Cook-Levin Theorem

SAT is NP-complete.

Proof: Reading exercise! Section 7.5 from Sipser’s book or Section 10.2 from Hopcroft, Motwani, Ullman’s book.

(44)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 12

NP-completeness

Definition

A languageB is NP-complete if two conditions hold:

1. B is in NP,

2. every Ain NP is polynomial time reducible to B If only condition 2 holds B is said to be NP-hard.

Exercises:

I IfB is NP-complete, and B∈P, thenP =NP. I IfB is NP-complete, and B≤P C, thenC is NP-hard. The Cook-Levin Theorem

SAT is NP-complete.

Proof: Reading exercise! Section 7.5 from Sipser’s book or Section 10.2 from Hopcroft, Motwani, Ullman’s book.

(45)

NP-completeness

Definition

A languageB is NP-complete if two conditions hold:

1. B is in NP,

2. every Ain NP is polynomial time reducible to B If only condition 2 holds B is said to be NP-hard.

Exercises:

I IfB is NP-complete, and B∈P, thenP =NP.

I IfB is NP-complete, and B≤P C, thenC is

NP-hard.

The Cook-Levin Theorem SAT is NP-complete.

Proof: Reading exercise! Section 7.5 from Sipser’s book or Section 10.2 from Hopcroft, Motwani, Ullman’s book.

(46)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 12

NP-completeness

Definition

A languageB is NP-complete if two conditions hold:

1. B is in NP,

2. every Ain NP is polynomial time reducible to B If only condition 2 holds B is said to be NP-hard.

Exercises:

I IfB is NP-complete, and B∈P, thenP =NP.

I IfB is NP-complete, and B≤P C, thenC is NP-hard.

The Cook-Levin Theorem SAT is NP-complete.

Proof: Reading exercise! Section 7.5 from Sipser’s book or Section 10.2 from Hopcroft, Motwani, Ullman’s book.

(47)

NP-completeness

Definition

A languageB is NP-complete if two conditions hold:

1. B is in NP,

2. every Ain NP is polynomial time reducible to B If only condition 2 holds B is said to be NP-hard.

Exercises:

I IfB is NP-complete, and B∈P, thenP =NP.

I IfB is NP-complete, and B≤P C, thenC is NP-hard.

The Cook-Levin Theorem SAT is NP-complete.

Proof: Reading exercise! Section 7.5 from Sipser’s book or Section 10.2 from Hopcroft, Motwani, Ullman’s book.

(48)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 12

NP-completeness

Definition

A languageB is NP-complete if two conditions hold:

1. B is in NP,

2. every Ain NP is polynomial time reducible to B If only condition 2 holds B is said to be NP-hard.

Exercises:

I IfB is NP-complete, and B∈P, thenP =NP.

I IfB is NP-complete, and B≤P C, thenC is NP-hard.

The Cook-Levin Theorem SAT is NP-complete.

Proof: Reading exercise! Section 7.5 from Sipser’s book or Section 10.2 from Hopcroft, Motwani, Ullman’s book.

(49)

Cook-Levin Theorem

The Cook-Levin Theorem SAT is NP-complete.

I SAT ∈NP.

I Take any language A∈NP and show it is polytime reducible to SAT. I Reduction via computation histories!

Sketch: Step 1 - language to tableau 1. Spse N is NTM decides Ain nk time.

2. Writenk×nk tableau for each computation ofN onw, rows are config. 3. Every accepting tableau (some config is acc) is an accepting

computation branch of N onw.

4. Thus, N acc w iff there exists an accepting tableau forN onw.

(50)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 13

Cook-Levin Theorem

The Cook-Levin Theorem SAT is NP-complete.

I SAT ∈NP.

I Take any language A∈NP and show it is polytime reducible to SAT. I Reduction via computation histories!

Sketch: Step 1 - language to tableau 1. Spse N is NTM decides Ain nk time.

2. Writenk×nk tableau for each computation ofN onw, rows are config. 3. Every accepting tableau (some config is acc) is an accepting

computation branch of N onw.

4. Thus, N acc w iff there exists an accepting tableau forN onw.

(51)

Cook-Levin Theorem

The Cook-Levin Theorem SAT is NP-complete.

I SAT ∈NP.

I Take any language A∈NP and show it is polytime reducible to SAT.

I Reduction via computation histories! Sketch: Step 1 - language to tableau

1. Spse N is NTM decides Ain nk time.

2. Writenk×nk tableau for each computation ofN onw, rows are config. 3. Every accepting tableau (some config is acc) is an accepting

computation branch of N onw.

4. Thus, N acc w iff there exists an accepting tableau forN onw.

(52)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 13

Cook-Levin Theorem

The Cook-Levin Theorem SAT is NP-complete.

I SAT ∈NP.

I Take any language A∈NP and show it is polytime reducible to SAT.

I Reduction via computation histories!

Sketch: Step 1 - language to tableau 1. Spse N is NTM decides Ain nk time.

2. Writenk×nk tableau for each computation ofN onw, rows are config. 3. Every accepting tableau (some config is acc) is an accepting

computation branch of N onw.

4. Thus, N acc w iff there exists an accepting tableau forN onw.

(53)

Cook-Levin Theorem

The Cook-Levin Theorem SAT is NP-complete.

I SAT ∈NP.

I Take any language A∈NP and show it is polytime reducible to SAT.

I Reduction via computation histories!

Sketch: Step 1 - language to tableau 1. Spse N is NTM decides Ain nk time.

2. Writenk×nk tableau for each computation ofN onw, rows are config. 3. Every accepting tableau (some config is acc) is an accepting

computation branch of N onw.

4. Thus, N acc w iff there exists an accepting tableau forN onw.

(54)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 13

Cook-Levin Theorem

The Cook-Levin Theorem SAT is NP-complete.

I SAT ∈NP.

I Take any language A∈NP and show it is polytime reducible to SAT.

I Reduction via computation histories!

Sketch: Step 1 - language to tableau 1. Spse N is NTM decides Ain nk time.

2. Writenk×nk tableau for each computation ofN onw, rows are config.

3. Every accepting tableau (some config is acc) is an accepting computation branch of N onw.

4. Thus, N acc w iff there exists an accepting tableau forN onw.

(55)

Cook-Levin Theorem

The Cook-Levin Theorem SAT is NP-complete.

I SAT ∈NP.

I Take any language A∈NP and show it is polytime reducible to SAT.

I Reduction via computation histories!

Sketch: Step 1 - language to tableau 1. Spse N is NTM decides Ain nk time.

2. Writenk×nk tableau for each computation ofN onw, rows are config.

3. Every accepting tableau (some config is acc) is an accepting computation branch of N onw.

4. Thus, N acc w iff there exists an accepting tableau forN onw.

(56)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 13

Cook-Levin Theorem

The Cook-Levin Theorem SAT is NP-complete.

I SAT ∈NP.

I Take any language A∈NP and show it is polytime reducible to SAT.

I Reduction via computation histories!

Sketch: Step 1 - language to tableau 1. Spse N is NTM decides Ain nk time.

2. Writenk×nk tableau for each computation ofN onw, rows are config.

3. Every accepting tableau (some config is acc) is an accepting computation branch of N onw.

4. Thus, N acc w iff there exists an accepting tableau forN onw.

(57)

Cook-Levin Theorem (Contd.)

Sketch: Step 2 - language to tableau to SAT Given N and w, produce formulaϕ:

1. Variable xi,j,s for each 1≤i,j ≤nk,s ∈C =Q∪Γ∪ {#}. 2. Idea: cell[i,j] =s iff xi,j,s = 1.

3. Design ϕs.t., SAT assignment corresponds to acc tableau forN on w. 4. ϕ=ϕcell ∧ϕstart∧ϕmove∧ϕacc

(58)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 14

Cook-Levin Theorem (Contd.)

Sketch: Step 2 - language to tableau to SAT Given N and w, produce formulaϕ:

1. Variable xi,j,s for each 1≤i,j ≤nk,s ∈C =Q∪Γ∪ {#}.

2. Idea: cell[i,j] =s iff xi,j,s = 1.

3. Design ϕs.t., SAT assignment corresponds to acc tableau forN on w. 4. ϕ=ϕcell ∧ϕstart∧ϕmove∧ϕacc

(59)

Cook-Levin Theorem (Contd.)

Sketch: Step 2 - language to tableau to SAT Given N and w, produce formulaϕ:

1. Variable xi,j,s for each 1≤i,j ≤nk,s ∈C =Q∪Γ∪ {#}.

2. Idea: cell[i,j] =s iff xi,j,s = 1.

3. Design ϕs.t., SAT assignment corresponds to acc tableau forN on w. 4. ϕ=ϕcell ∧ϕstart∧ϕmove∧ϕacc

(60)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 14

Cook-Levin Theorem (Contd.)

Sketch: Step 2 - language to tableau to SAT Given N and w, produce formulaϕ:

1. Variable xi,j,s for each 1≤i,j ≤nk,s ∈C =Q∪Γ∪ {#}.

2. Idea: cell[i,j] =s iff xi,j,s = 1.

3. Design ϕs.t., SAT assignment corresponds to acc tableau forN on w.

4. ϕ=ϕcell ∧ϕstart∧ϕmove∧ϕacc

(61)

Cook-Levin Theorem (Contd.)

Sketch: Step 2 - language to tableau to SAT Given N and w, produce formulaϕ:

1. Variable xi,j,s for each 1≤i,j ≤nk,s ∈C =Q∪Γ∪ {#}.

2. Idea: cell[i,j] =s iff xi,j,s = 1.

3. Design ϕs.t., SAT assignment corresponds to acc tableau forN on w. 4. ϕ=ϕcell ∧ϕstart∧ϕmove∧ϕacc

(62)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 15

Cook-Levin Theorem (Contd.)

Sketch: Step 3 - SAT formula

ϕ=ϕcell ∧ϕstart∧ϕmove ∧ϕacc where,

1. for each cell one variable is “on”, and only one is: ϕcell =V

1≤i,j≤nk[W

s∈Cxi,j,s∧W

s6=t∈C(xi,j,s ∨xi,j,t)] 2. start encodes that first row is starting config:

ϕstart =x1,1,#∧x1,2,q0∧. . .

3. accept says that accepting config should occur somewhere in tableau ϕacc =W

1≤i,j≤nkxi,j,qacc

4. move encodes that each row correponds to config that “legally” follows the preceding row config acc to N

ϕmove =V

1,≤i,j<nk (the (i,j)-window is legal)

(63)

Cook-Levin Theorem (Contd.)

Sketch: Step 3 - SAT formula

ϕ=ϕcell ∧ϕstart∧ϕmove ∧ϕacc where,

1. for each cell one variable is “on”, and only one is:

ϕcell =V

1≤i,j≤nk[W

s∈Cxi,j,s∧W

s6=t∈C(xi,j,s ∨xi,j,t)] 2. start encodes that first row is starting config:

ϕstart =x1,1,#∧x1,2,q0∧. . .

3. accept says that accepting config should occur somewhere in tableau ϕacc =W

1≤i,j≤nkxi,j,qacc

4. move encodes that each row correponds to config that “legally” follows the preceding row config acc to N

ϕmove =V

1,≤i,j<nk (the (i,j)-window is legal)

(64)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 15

Cook-Levin Theorem (Contd.)

Sketch: Step 3 - SAT formula

ϕ=ϕcell ∧ϕstart∧ϕmove ∧ϕacc where,

1. for each cell one variable is “on”, and only one is:

ϕcell =V

1≤i,j≤nk[W

s∈Cxi,j,s ∧W

s6=t∈C(xi,j,s∨xi,j,t)]

2. start encodes that first row is starting config: ϕstart =x1,1,#∧x1,2,q0∧. . .

3. accept says that accepting config should occur somewhere in tableau ϕacc =W

1≤i,j≤nkxi,j,qacc

4. move encodes that each row correponds to config that “legally” follows the preceding row config acc to N

ϕmove =V

1,≤i,j<nk (the (i,j)-window is legal)

(65)

Cook-Levin Theorem (Contd.)

Sketch: Step 3 - SAT formula

ϕ=ϕcell ∧ϕstart∧ϕmove ∧ϕacc where,

1. for each cell one variable is “on”, and only one is:

ϕcell =V

1≤i,j≤nk[W

s∈Cxi,j,s ∧W

s6=t∈C(xi,j,s∨xi,j,t)]

2. start encodes that first row is starting config:

ϕstart =x1,1,#∧x1,2,q0∧. . .

3. accept says that accepting config should occur somewhere in tableau ϕacc =W

1≤i,j≤nkxi,j,qacc

4. move encodes that each row correponds to config that “legally” follows the preceding row config acc to N

ϕmove =V

1,≤i,j<nk (the (i,j)-window is legal)

(66)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 15

Cook-Levin Theorem (Contd.)

Sketch: Step 3 - SAT formula

ϕ=ϕcell ∧ϕstart∧ϕmove ∧ϕacc where,

1. for each cell one variable is “on”, and only one is:

ϕcell =V

1≤i,j≤nk[W

s∈Cxi,j,s ∧W

s6=t∈C(xi,j,s∨xi,j,t)]

2. start encodes that first row is starting config:

ϕstart =x1,1,#∧x1,2,q0∧. . .

3. accept says that accepting config should occur somewhere in tableau ϕacc =W

1≤i,j≤nkxi,j,qacc

4. move encodes that each row correponds to config that “legally” follows the preceding row config acc to N

ϕmove =V

1,≤i,j<nk (the (i,j)-window is legal)

(67)

Cook-Levin Theorem (Contd.)

Sketch: Step 3 - SAT formula

ϕ=ϕcell ∧ϕstart∧ϕmove ∧ϕacc where,

1. for each cell one variable is “on”, and only one is:

ϕcell =V

1≤i,j≤nk[W

s∈Cxi,j,s ∧W

s6=t∈C(xi,j,s∨xi,j,t)]

2. start encodes that first row is starting config:

ϕstart =x1,1,#∧x1,2,q0∧. . .

3. accept says that accepting config should occur somewhere in tableau

ϕacc =W

1≤i,j≤nkxi,j,qacc

4. move encodes that each row correponds to config that “legally” follows the preceding row config acc to N

ϕmove =V

1,≤i,j<nk (the (i,j)-window is legal)

(68)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 15

Cook-Levin Theorem (Contd.)

Sketch: Step 3 - SAT formula

ϕ=ϕcell ∧ϕstart∧ϕmove ∧ϕacc where,

1. for each cell one variable is “on”, and only one is:

ϕcell =V

1≤i,j≤nk[W

s∈Cxi,j,s ∧W

s6=t∈C(xi,j,s∨xi,j,t)]

2. start encodes that first row is starting config:

ϕstart =x1,1,#∧x1,2,q0∧. . .

3. accept says that accepting config should occur somewhere in tableau ϕacc =W

1≤i,j≤nkxi,j,qacc

4. move encodes that each row correponds to config that “legally” follows the preceding row config acc to N

ϕmove =V

1,≤i,j<nk (the (i,j)-window is legal)

(69)

Cook-Levin Theorem (Contd.)

Sketch: Step 3 - SAT formula

ϕ=ϕcell ∧ϕstart∧ϕmove ∧ϕacc where,

1. for each cell one variable is “on”, and only one is:

ϕcell =V

1≤i,j≤nk[W

s∈Cxi,j,s ∧W

s6=t∈C(xi,j,s∨xi,j,t)]

2. start encodes that first row is starting config:

ϕstart =x1,1,#∧x1,2,q0∧. . .

3. accept says that accepting config should occur somewhere in tableau ϕacc =W

1≤i,j≤nkxi,j,qacc

4. move encodes that each row correponds to config that “legally” follows the preceding row config acc to N

ϕmove =V

1,≤i,j<nk (the (i,j)-window is legal)

(70)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 15

Cook-Levin Theorem (Contd.)

Sketch: Step 3 - SAT formula

ϕ=ϕcell ∧ϕstart∧ϕmove ∧ϕacc where,

1. for each cell one variable is “on”, and only one is:

ϕcell =V

1≤i,j≤nk[W

s∈Cxi,j,s ∧W

s6=t∈C(xi,j,s∨xi,j,t)]

2. start encodes that first row is starting config:

ϕstart =x1,1,#∧x1,2,q0∧. . .

3. accept says that accepting config should occur somewhere in tableau ϕacc =W

1≤i,j≤nkxi,j,qacc

4. move encodes that each row correponds to config that “legally” follows the preceding row config acc to N

ϕmove =V

1,≤i,j<nk (the (i,j)-window is legal)

(71)

Cook-Levin Theorem (Contd.)

Step 3 (Contd.) - Encoding NTM as SAT

ϕmove encodes that each row corresponds to config that “legally” follows preceding row acc to N

(72)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 16

Cook-Levin Theorem (Contd.)

Step 3 (Contd.) - Encoding NTM as SAT

ϕmove encodes that each row corresponds to config that “legally” follows preceding row acc to N

1. enough to ensure that each 2×3 window of cells is legal, i.e., does not violate the transition function of N.

(73)

Cook-Levin Theorem (Contd.)

Step 3 (Contd.) - Encoding NTM as SAT

ϕmove encodes that each row corresponds to config that “legally” follows preceding row acc to N

1. enough to ensure that each 2×3 window of cells is legal, i.e., does not violate the transition function of N.

2. legal windows are “like” the dominos that we used in PCP!

(74)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 16

Cook-Levin Theorem (Contd.)

Step 3 (Contd.) - Encoding NTM as SAT

ϕmove encodes that each row corresponds to config that “legally” follows preceding row acc to N

1. enough to ensure that each 2×3 window of cells is legal, i.e., does not violate the transition function of N.

2. legal windows are “like” the dominos that we used in PCP!

3. Ex: Give 3 examples of legal windows and 3 illegal windows, given δ(q,a) ={q,b,R},δ(q,b) ={(q0,c,L),(q0,a,R)}

(75)

Cook-Levin Theorem (Contd.)

Step 3 (Contd.) - Encoding NTM as SAT

ϕmove encodes that each row corresponds to config that “legally” follows preceding row acc to N

1. enough to ensure that each 2×3 window of cells is legal, i.e., does not violate the transition function of N.

2. legal windows are “like” the dominos that we used in PCP!

3. Claim: If top row is start, every window is legal, then each row is config that follows prev one.

(76)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 16

Cook-Levin Theorem (Contd.)

Step 3 (Contd.) - Encoding NTM as SAT

ϕmove encodes that each row corresponds to config that “legally” follows preceding row acc to N

1. enough to ensure that each 2×3 window of cells is legal, i.e., does not violate the transition function of N.

2. legal windows are “like” the dominos that we used in PCP!

3. Claim: If top row is start, every window is legal, then each row is config that follows prev one.

ϕmove = ^

1≤i,j<nk

((i,j)−window is legal)

(77)

Cook-Levin Theorem (Contd.)

Step 3 (Contd.) - Encoding NTM as SAT

ϕmove encodes that each row corresponds to config that “legally” follows preceding row acc to N

1. enough to ensure that each 2×3 window of cells is legal, i.e., does not violate the transition function of N.

2. legal windows are “like” the dominos that we used in PCP!

3. Claim: If top row is start, every window is legal, then each row is config that follows prev one.

ϕmove = ^

1≤i,j<nk

((i,j)−window is legal)

Encode this as a disjunct W

a...a is legal(xi,j−1,a1)∧xi,j,a2∧...)

(78)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 17

Cook-Levin Theorem (Completed!)

Completing the proof

I N has an acc computation onw iff ϕis SAT.

For detailed proof, read: Section 7.5 from Sipser’s book or Section 10.2 from Hopcroft, Motwani, Ullman’s book.

(79)

Cook-Levin Theorem (Completed!)

Completing the proof

I N has an acc computation onw iff ϕis SAT.

I Size of formula isO(n2k) and can be constructed in polynomial time (from w).

For detailed proof, read: Section 7.5 from Sipser’s book or Section 10.2 from Hopcroft, Motwani, Ullman’s book.

(80)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 17

Cook-Levin Theorem (Completed!)

Completing the proof

I N has an acc computation onw iff ϕis SAT.

I Size of formula isO(n2k) and can be constructed in polynomial time (from w).

1. No. of cells is (nk)2=n2k, no. of cells in top row isnk.

For detailed proof, read: Section 7.5 from Sipser’s book or Section 10.2 from Hopcroft, Motwani, Ullman’s book.

(81)

Cook-Levin Theorem (Completed!)

Completing the proof

I N has an acc computation onw iff ϕis SAT.

I Size of formula isO(n2k) and can be constructed in polynomial time (from w).

1. No. of cells is (nk)2=n2k, no. of cells in top row isnk. 2. ϕstart is O(nk) (why?)

For detailed proof, read: Section 7.5 from Sipser’s book or Section 10.2 from Hopcroft, Motwani, Ullman’s book.

(82)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 17

Cook-Levin Theorem (Completed!)

Completing the proof

I N has an acc computation onw iff ϕis SAT.

I Size of formula isO(n2k) and can be constructed in polynomial time (from w).

1. No. of cells is (nk)2=n2k, no. of cells in top row isnk. 2. ϕstart is O(nk) (why?)

3. All others are fixed size for each cell =O(n2k)

For detailed proof, read: Section 7.5 from Sipser’s book or Section 10.2 from Hopcroft, Motwani, Ullman’s book.

(83)

Cook-Levin Theorem (Completed!)

Completing the proof

I N has an acc computation onw iff ϕis SAT.

I Size of formula isO(n2k) and can be constructed in polynomial time (from w).

1. No. of cells is (nk)2=n2k, no. of cells in top row isnk. 2. ϕstart is O(nk) (why?)

3. All others are fixed size for each cell =O(n2k)

4. Can be constructed in polynomial time fromN,w, i.e., polytime reduction For detailed proof, read: Section 7.5 from Sipser’s book or Section 10.2 from Hopcroft, Motwani, Ullman’s book.

(84)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 17

Cook-Levin Theorem (Completed!)

Completing the proof

I N has an acc computation onw iff ϕis SAT.

I Size of formula isO(n2k) and can be constructed in polynomial time (from w).

1. No. of cells is (nk)2=n2k, no. of cells in top row isnk. 2. ϕstart is O(nk) (why?)

3. All others are fixed size for each cell =O(n2k)

4. Can be constructed in polynomial time fromN,w, i.e., polytime reduction Thus, we have a PTime reduction from any NP problem to SAT, i.e., SAT is NP-hard.

For detailed proof, read: Section 7.5 from Sipser’s book or Section 10.2 from Hopcroft, Motwani, Ullman’s book.

(85)

NP-completeness examples

1. 3SAT is NP-complete. (why?)

2. CLIQUE is NP-complete. 3. SUBSETSUM is NP-complete. 4. Vertex cover is NP-complete.

5. A whole growing book of NP-complete problems! (Garey-Johnson) So, why are so many natural problems either inP or NP-complete? Well, there are some natural problems that are not known to be inP, but that are inNP and not known to beNP-hard.

(86)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 18

NP-completeness examples

1. 3SAT is NP-complete. (why?) 2. CLIQUE is NP-complete.

3. SUBSETSUM is NP-complete. 4. Vertex cover is NP-complete.

5. A whole growing book of NP-complete problems! (Garey-Johnson) So, why are so many natural problems either inP or NP-complete? Well, there are some natural problems that are not known to be inP, but that are inNP and not known to beNP-hard.

(87)

NP-completeness examples

1. 3SAT is NP-complete. (why?) 2. CLIQUE is NP-complete.

3. SUBSETSUM is NP-complete.

4. Vertex cover is NP-complete.

5. A whole growing book of NP-complete problems! (Garey-Johnson) So, why are so many natural problems either inP or NP-complete? Well, there are some natural problems that are not known to be inP, but that are inNP and not known to beNP-hard.

(88)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 18

NP-completeness examples

1. 3SAT is NP-complete. (why?) 2. CLIQUE is NP-complete.

3. SUBSETSUM is NP-complete.

4. Vertex cover is NP-complete.

5. A whole growing book of NP-complete problems! (Garey-Johnson) So, why are so many natural problems either inP or NP-complete? Well, there are some natural problems that are not known to be inP, but that are inNP and not known to beNP-hard.

(89)

NP-completeness examples

1. 3SAT is NP-complete. (why?) 2. CLIQUE is NP-complete.

3. SUBSETSUM is NP-complete.

4. Vertex cover is NP-complete.

5. A whole growing book of NP-complete problems! (Garey-Johnson)

So, why are so many natural problems either inP or NP-complete? Well, there are some natural problems that are not known to be inP, but that are inNP and not known to beNP-hard.

(90)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 18

NP-completeness examples

1. 3SAT is NP-complete. (why?) 2. CLIQUE is NP-complete.

3. SUBSETSUM is NP-complete.

4. Vertex cover is NP-complete.

5. A whole growing book of NP-complete problems! (Garey-Johnson) So, why are so many natural problems either in P or NP-complete?

Well, there are some natural problems that are not known to be inP, but that are inNP and not known to beNP-hard.

(91)

NP-completeness examples

1. 3SAT is NP-complete. (why?) 2. CLIQUE is NP-complete.

3. SUBSETSUM is NP-complete.

4. Vertex cover is NP-complete.

5. A whole growing book of NP-complete problems! (Garey-Johnson) So, why are so many natural problems either in P or NP-complete?

Well, there are some natural problems that are not known to be in P, but that are in NP and not known to be NP-hard.

(92)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 19

Getting around NP-hardness

Many problems are NP-complete. So what do people do?

An algorithmician’s answer:

1. Approximate!

2. Randomize. 3. Parametrize. 4. Quantize!

5. average/amortized/smoothed complexity.

A practitioner’s answer

1. What hardness? SAT is easy (almost always)!

2. The advent of SAT-solvers. Can solve SAT queries on millions of variables in seconds!

3. Goal nowadays: develop efficient encodinginto SAT!

(93)

Getting around NP-hardness

Many problems are NP-complete. So what do people do?

An algorithmician’s answer:

1. Approximate!

2. Randomize.

3. Parametrize. 4. Quantize!

5. average/amortized/smoothed complexity.

A practitioner’s answer

1. What hardness? SAT is easy (almost always)!

2. The advent of SAT-solvers. Can solve SAT queries on millions of variables in seconds!

3. Goal nowadays: develop efficient encodinginto SAT!

(94)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 19

Getting around NP-hardness

Many problems are NP-complete. So what do people do?

An algorithmician’s answer:

1. Approximate!

2. Randomize.

3. Parametrize.

4. Quantize!

5. average/amortized/smoothed complexity.

A practitioner’s answer

1. What hardness? SAT is easy (almost always)!

2. The advent of SAT-solvers. Can solve SAT queries on millions of variables in seconds!

3. Goal nowadays: develop efficient encodinginto SAT!

(95)

Getting around NP-hardness

Many problems are NP-complete. So what do people do?

An algorithmician’s answer:

1. Approximate!

2. Randomize.

3. Parametrize.

4. Quantize!

5. average/amortized/smoothed complexity.

A practitioner’s answer

1. What hardness? SAT is easy (almost always)!

2. The advent of SAT-solvers. Can solve SAT queries on millions of variables in seconds!

3. Goal nowadays: develop efficient encodinginto SAT!

(96)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 19

Getting around NP-hardness

Many problems are NP-complete. So what do people do?

An algorithmician’s answer:

1. Approximate!

2. Randomize.

3. Parametrize.

4. Quantize!

5. average/amortized/smoothed complexity.

A practitioner’s answer

1. What hardness? SAT is easy (almost always)!

2. The advent of SAT-solvers. Can solve SAT queries on millions of variables in seconds!

3. Goal nowadays: develop efficient encodinginto SAT!

(97)

Getting around NP-hardness

Many problems are NP-complete. So what do people do?

An algorithmician’s answer:

1. Approximate!

2. Randomize.

3. Parametrize.

4. Quantize!

5. average/amortized/smoothed complexity.

A practitioner’s answer

1. What hardness? SAT is easy (almost always)!

2. The advent of SAT-solvers. Can solve SAT queries on millions of variables in seconds!

3. Goal nowadays: develop efficient encodinginto SAT!

(98)

CS310 : Automata Theory 2020 Instructor: S. Akshay IITB, India 19

Getting around NP-hardness

Many problems are NP-complete. So what do people do?

An algorithmician’s answer:

1. Approximate!

2. Randomize.

3. Parametrize.

4. Quantize!

5. average/amortized/smoothed complexity.

A practitioner’s answer

1. What hardness? SAT is easy (almost always)!

2. The advent of SAT-solvers. Can solve SAT queries on millions of variables in seconds!

3. Goal nowadays: develop efficient encodinginto SAT!

(99)

Getting around NP-hardness

Many problems are NP-complete. So what do people do?

An algorithmician’s answer:

1. Approximate!

2. Randomize.

3. Parametrize.

4. Quantize!

5. average/amortized/smoothed complexity.

A practitioner’s answer

1. What hardness? SAT is easy (almost always)!

2. The advent of SAT-solvers. Can solve SAT queries on millions of

References

Related documents

If L is the language accepted of P by empty stack , there exists PDA P 0 such that its language accepted by final state is L..

I Text processing: Given input as English alphabet, output can be capitalized words. I Translation: Given input in English, output can be

cbna CS310 : Automata Theory 2019 Instructor: Ashutosh Gupta IITB, India 10.. CFGs

cbna CS310 : Automata Theory 2019 Instructor: Ashutosh Gupta IITB, India 2.. Topic 8.1

cbna CS310 : Automata Theory 2019 Instructor: Ashutosh Gupta IITB, India 2..

cbna CS310 : Automata Theory 2019 Instructor: Ashutosh Gupta IITB, India 2.. Topic 13.1

We can club the rules for a nonterminal together and separate right hand sides using “|”. Example 21.1

Suppose string w is the yield of a parse tree of a CFG G in CNF form, and suppose the length of the longest path in the tree is n, then |w | ≤ 2 n−1 Proof: By induction on