CSC373 Weeks 7 & 8: Complexity
373F19 - Nisarg Shah & Karan Singh 1
Complexity 373F19 - Nisarg Shah & Karan Singh 1 Recap Linear - - PowerPoint PPT Presentation
CSC373 Weeks 7 & 8: Complexity 373F19 - Nisarg Shah & Karan Singh 1 Recap Linear Programming Standard formulation Slack formulation Simplex Duality 373F19 - Nisarg Shah & Karan Singh 2 And Now
373F19 - Nisarg Shah & Karan Singh 1
373F19 - Nisarg Shah & Karan Singh 2
➢ Standard formulation ➢ Slack formulation ➢ Simplex ➢ Duality
373F19 - Nisarg Shah & Karan Singh 3
➢ Shortest path ➢ Network flow
➢ Turing machines, computability, efficient computation ➢ P, NP, and NP-completeness ➢ Reductions ➢ Idea behind NP-completeness of SAT and 3SAT ➢ NP vs co-NP ➢ Other complexity classes
373F19 - Nisarg Shah & Karan Singh 4
➢ Input: directed graph 𝐻 = (𝑊, 𝐹), edge capacities
𝑑: 𝐹 → ℝ≥0
➢ Output: Value 𝑤 𝑔∗ of a maximum flow 𝑔∗
➢ Capacity constraints: ∀ 𝑣, 𝑤 ∈ 𝐹: 0 ≤ 𝑔 𝑣, 𝑤 ≤ 𝑑(𝑣, 𝑤) ➢ Flow conservation: ∀𝑣: σ 𝑣,𝑤 ∈𝐹 𝑔 𝑣, 𝑤 = σ 𝑤,𝑣 ∈𝐹 𝑔 𝑤, 𝑣
Linear objective! Linear constraints
373F19 - Nisarg Shah & Karan Singh 5
(𝑡,𝑤)∈𝐹
𝑔
𝑡𝑤
0 ≤ 𝑔
𝑣𝑤 ≤ 𝑑 𝑣, 𝑤
(𝑣,𝑤)∈𝐹
𝑔
𝑣𝑤 =
(𝑤,𝑥)∈𝐹
𝑔
𝑤,𝑥
for all (𝑣, 𝑤) ∈ 𝐹 for all 𝑤 ∈ 𝑊\{𝑡, 𝑢} maximize
Exercise: Write the dual of this LP. What is the dual trying to find?
➢ Input: directed graph 𝐻 = 𝑊, 𝐹 , edge weights
𝑥: 𝐹 → ℝ≥0, source vertex 𝑡, target vertex 𝑢
➢ Output: weight of the shortest-weight path from 𝑡 to 𝑢
Why max? If objective was min., then we could set all variables 𝑒𝑤 to 0. Exercise: prove formally that this works!
373F19 - Nisarg Shah & Karan Singh 7
373F19 - Nisarg Shah & Karan Singh 8
➢ Input: directed graph 𝐻 = (𝑊, 𝐹), edge capacities 𝑑: 𝐹 →
ℝ≥0, 𝑙 commodities (𝑡𝑗, 𝑢𝑗, 𝑒𝑗), where 𝑡𝑗 is source of commodity 𝑗, 𝑢𝑗 is sink, and 𝑒𝑗 is demand.
➢ Output: valid multicommodity flow 𝑔
1, 𝑔 2, … , 𝑔 𝑙 , where
𝑗 has value 𝑒𝑗 and all 𝑔 𝑗 jointly satisfy the constraints
The only known polynomial time algorithm for this problem is based on solving LP!
373F19 - Nisarg Shah & Karan Singh 9
➢ Input: 𝑑 ∈ ℝ𝑜, 𝑐 ∈ ℝ𝑛, 𝐵 ∈ ℝ𝑛×𝑜 ➢ Goal:
➢ Harder. We’ll prove that this is “NP-complete”.
373F19 - Nisarg Shah & Karan Singh 10
➢ Microeconomics ➢ Manufacturing ➢ VLSI (very large scale integration) design ➢ Logistics/transportation ➢ Portfolio optimization ➢ Bioengineering (flux balance analysis) ➢ Operations research more broadly: maximize profits or
minimize costs, use linear models for simplicity
➢ Design of approximation algorithms ➢ Proving theorems, as a proof technique ➢ …
373F19 - Nisarg Shah & Karan Singh 11
➢ Prove that it is NP-complete, of course!
373F19 - Nisarg Shah & Karan Singh 12
➢ How do we mathematically define what a computer is?
➢ Introduced a mathematical model ➢ “Turing machine” ➢ All present-day computers can be simulated by a Turing
➢ Fun fact: So can all the quantum computers
373F19 - Nisarg Shah & Karan Singh 13
➢ Tape
➢ Head pointer
➢ Maintains an internal “state” ➢ A transition function describes how to change state,
move head pointer, and read/write symbols on tape
373F19 - Nisarg Shah & Karan Singh 14
➢ “Everything that is computable can be computed by a
Turing machine”
➢ Widely accepted, cannot be “proven” ➢ There are problems which a Turing machine cannot solve,
regardless of the amount of time available
➢ Need to define an encoding of the input and output
373F19 - Nisarg Shah & Karan Singh 15
➢ 𝑇 = a set of finite symbols ➢ 𝑇∗ = ڂ𝑜≥0 𝑇𝑜 = set of all finite strings using symbols from 𝑇
➢ Length of input = |𝑥| = length of 𝑥 on tape
➢ Length of output = 𝑔 𝑥 ➢ Decision problems: output = “YES” or “NO”
373F19 - Nisarg Shah & Karan Singh 16
➢ “Given 𝑏1, 𝑏2, … , 𝑏𝑜, compute σ𝑗=1
𝑜
𝑏𝑗”
➢ What |𝑇| should we use?
373F19 - Nisarg Shah & Karan Singh 17
➢ A TM solves a problem in polynomial time if there is a
polynomial 𝑞 such that on every instance of 𝑜-bit input and 𝑛-bit output, the TM halts in at most 𝑞(𝑜, 𝑛) steps
➢ Polynomial: 𝑜, 𝑜2, 5𝑜100 + 1000𝑜3, 𝑜 log100 𝑜 = 𝑝 𝑜1.001 ➢ Non-polynomial: 2𝑜, 2 𝑜, 2log2 𝑜
➢ “Everything that is efficiently computable is computable by
➢ Much less widely accepted, especially today ➢ But in this course, efficient = polynomial-time
If you ask the Turing machine to write a 2𝑜-bit output, it’s only reasonable to let it take 2𝑜 time…but usually, we’ll look at problems where output is O(length of input), so we can ignore this 𝑛
373F19 - Nisarg Shah & Karan Singh 18
➢ The class of all decision problems computable by a TM in
polynomial time
➢ Addition, multiplication, square root ➢ Shortest paths ➢ Network flow ➢ Fast Fourier transform ➢ Checking if a given number is a prime
[Agrawal-Kayal-Saxena 2002]
➢ …
373F19 - Nisarg Shah & Karan Singh 19
➢ Subset sum problem:
Given an array {−7, −3, −2, 5, 8}, is there a zero-sum subset?
➢ Enumerating all subsets is exponential ➢ BUT given a subset {-7, -2} or {-3, -2, 5}, we can check in
polynomial time whether it has zero sum
➢ A nondeterministic Turing machine could “guess” the
373F19 - Nisarg Shah & Karan Singh 20
➢ The class of all decision problems for which a YES answer
can be verified by a TM in polynomial time given polynomial length “advice” or “witness”.
➢ There is a polynomial-time verifier TM 𝑊 and another
𝑊(𝑦, 𝑧) returns YES
➢ Informally: “Whenever the answer is YES, there’s a short
proof of it.”
373F19 - Nisarg Shah & Karan Singh 21
➢ Same as NP, except whenever the answer is NO, we want
there to be a short proof of it
➢ NP = co-NP? ➢ P = NP ∩ co-NP? ➢ And…drum roll please…
373F19 - Nisarg Shah & Karan Singh 22
as computers become more powerful and widespread.”
373F19 - Nisarg Shah & Karan Singh 23
1Solved by Grigori Perelman (2003): Prize unclaimed
Claim: Worth >> $1M
373F19 - Nisarg Shah & Karan Singh 24
➢ (And every sane person’s belief…) ➢ 𝑄 is likely not equal to 𝑂𝑄
➢ There is a large class of problems (NP-complete) ➢ By now, contains thousands and thousands of problems ➢ Each problem is the “hardest problem in NP” ➢ If you can efficiently solve any one of them, you can
found for any of them
373F19 - Nisarg Shah & Karan Singh 25
➢ You can solve 𝐵 by making polynomially many calls to the
a) If 𝐵 cannot be solved efficiently, then neither can 𝐶. b) If 𝐶 cannot be solved efficiently, then neither can 𝐵. c) Both. d) None.
373F19 - Nisarg Shah & Karan Singh 26
➢ You can solve 𝐵 by making polynomially many calls to the
a) Reduce my problem to a known hard problem. b) Reduce a known hard problem to my problem. c) Both. d) None.
373F19 - Nisarg Shah & Karan Singh 27
➢ A problem 𝐶 is NP-complete if it is in NP and every
problem 𝐵 in NP is p-reducible to 𝐶
➢ Hardest problems in NP ➢ If one of them can be solved efficiently, every problem in
NP can be solved efficiently, implying P=NP
➢ If 𝐵 is in NP, and some NP-complete problem 𝐶 is p-
reducible to 𝐵, then 𝐵 is NP-complete too
problem in NP”
373F19 - Nisarg Shah & Karan Singh 28
➢ How do we know there are any NP-complete problems at
all?
➢ Key result by Cook ➢ First NP-complete problem: SAT
373F19 - Nisarg Shah & Karan Singh 29
➢ Boolean variables 𝑦1, 𝑦2, … , 𝑦𝑜 ➢ Their negations ҧ
𝑦1, ҧ 𝑦2, … , ҧ 𝑦𝑜
➢ Literal ℓ: a variable or its negation ➢ Clause 𝐷 = ℓ1 ∨ ℓ2 ∨ ⋯ ∨ ℓ𝑠 is a disjunction of literals ➢ CNF formula 𝜒 = 𝐷1 ∧ 𝐷2 ∧ ⋯ ∧ 𝐷𝑛 is a conjunction of clauses
𝜒 = ҧ 𝑦1 ∨ 𝑦2 ∨ 𝑦3 ∧ 𝑦1 ∨ ҧ 𝑦2 ∨ 𝑦3 ∧ ҧ 𝑦1 ∨ 𝑦2 ∨ 𝑦4 ∧ ( ҧ 𝑦3 ∨ ҧ 𝑦4 ∨ 𝑦1)
373F19 - Nisarg Shah & Karan Singh 30
𝜒 = ҧ 𝑦1 ∨ 𝑦2 ∨ 𝑦3 ∧ 𝑦1 ∨ ҧ 𝑦2 ∨ 𝑦3 ∧ ҧ 𝑦1 ∨ 𝑦2 ∨ 𝑦4 ∧ ( ҧ 𝑦3 ∨ ҧ 𝑦4 ∨ 𝑦1)
➢ A CNF formula 𝜒 is satisfiable if there is an assignment of
truth values (TRUE/FALSE) to variables under which the formula evaluates to TRUE
➢ SAT: “Given a CNF formula 𝜒, is it satisfiable?” ➢ 3SAT: “Given a 3CNF formula 𝜒, is it satisfiable?”
373F19 - Nisarg Shah & Karan Singh 31
➢ SAT (and even 3SAT) is NP-complete
➢ Directly reduces any NP problem to SAT ➢ Reduction is a bit complex, so we’ll defer it until a bit
later, after we’ve seen some other reductions and are more comfortable with the reduction framework
➢ But for now, let’s assume SAT is NP-complete, and reduce
it to a bunch of other problems (and then those problems to other problems…)
373F19 - Nisarg Shah & Karan Singh 32
➢ SAT = first NP complete problem ➢ Decision TSP: Is there a route visiting all 𝑜 cities with total
distance at most 𝑙?
➢ 3-Colorabitility: Can the vertices of a graph be colored
with at most 3 colors such that no two adjacent vertices have the same color?
➢ Karp’s 21 NP-complete problems
➢ Tautology problem (“negation” of SAT)
373F19 - Nisarg Shah & Karan Singh 33 By Behnam Esfahbod, CC BY-SA 3.0, https://commons.wikimedia.org/w/index.php?curid=3532181
373F19 - Nisarg Shah & Karan Singh 34
373F19 - Nisarg Shah & Karan Singh 35
373F19 - Nisarg Shah & Karan Singh 36
➢ Proved 3SAT is NP-complete in seminal paper
➢ Showed that 20 other problems are also NP-complete ➢ “Karp's 21 NP-complete problems” ➢ Renewed interest in this idea
➢ Input: Undirected graph 𝐻 = (𝑊, 𝐹), integer 𝑙 ➢ Question: Does there exist a subset of vertices 𝑇 ⊆ 𝑊
with 𝑇 = 𝑙 such that for each edge, at most one of its endpoints is in 𝑇?
373F19 - Nisarg Shah & Karan Singh 37
= independent set Example:
independent set of size 6?
independent set of size 7?
➢ Recall: We need to show that there is a polynomial-time
algorithm which
➢ Advice: the actual independent set 𝑇
373F19 - Nisarg Shah & Karan Singh 38
➢ Given a formula 𝜒 of 3SAT with 𝑙 clauses, construct an
instance (𝐻, 𝑙) of Independent Set as follows
373F19 - Nisarg Shah & Karan Singh 39
➢ Why does this work?
arbitrary values
373F19 - Nisarg Shah & Karan Singh 40
373F19 - Nisarg Shah & Karan Singh 41
➢ Karp reductions
a single instance of 𝐶 with the same answer
➢ Turing/Cook reductions
polynomially many calls to an oracle for solving 𝐶 and some polynomial-time extra computation
possible, see if you can construct a Karp reduction
373F19 - Nisarg Shah & Karan Singh 42
➢ Input: Set of integers 𝑇 = {𝑥1, … , 𝑥𝑜}, integer 𝑋 ➢ Question: Is there 𝑇′ ⊆ 𝑇 that adds up to exactly 𝑋?
➢ 𝑇 = {1, 4, 16, 64, 256, 1040, 1041, 1093, 1284, 1344}
and 𝑋 = 3754?
➢ Yes!
➢ Recall: We need to show that there is a polynomial-time
algorithm which
➢ Advice: the actual subset 𝑇′
373F19 - Nisarg Shah & Karan Singh 43
➢ Given a formula 𝜒 of 3SAT, we want to construct (𝑇, 𝑋) of
Subset Sum with the same answer
➢ In the table in the following slide:
373F19 - Nisarg Shah & Karan Singh 44
373F19 - Nisarg Shah & Karan Singh 45
➢ The Subset Sum instance we constructed has large numbers
➢ Can we hope to construct Subset Sum instance with
numbers that are only 𝑞𝑝𝑚𝑧(#𝑤𝑏𝑠𝑗𝑏𝑐𝑚𝑓𝑡, #𝑑𝑚𝑏𝑡𝑣𝑡𝑓𝑡) large?
(i.e. we can solve Subset Sum in polytime if the numbers are only polynomially large in value).
373F19 - Nisarg Shah & Karan Singh 46
373F19 - Nisarg Shah & Karan Singh 47
➢ Input: Undirected graph 𝐻 = (𝑊, 𝐹) ➢ Question: Can we color each vertex of 𝐻 using at most
three colors such that no two adjacent vertices have the same color?
➢ Recall: We need to show that there is a polynomial-time
algorithm which
➢ Advice: colors of the nodes in a valid 3-coloring
373F19 - Nisarg Shah & Karan Singh 48
373F19 - Nisarg Shah & Karan Singh 49
➢ Given a 3SAT formula 𝜒, we want to construct a graph 𝐻
such that 𝐻 is 3-colorable if and only if 𝜒 has a satisfying assignment
➢ We want a satisfying assignment of 𝜒 to correspond to a
valid 3-coloring of 𝐻
373F19 - Nisarg Shah & Karan Singh 50
➢ Given a 3SAT formula 𝜒, we construct a graph 𝐻 as follows
𝑦𝑗 have different colors
373F19 - Nisarg Shah & Karan Singh 51
➢ Claim: valid 3-coloring ⇒ valid truth assignment
373F19 - Nisarg Shah & Karan Singh 52
➢ What about clauses?
nodes corresponding to the literals in the clause is assigned color of T
373F19 - Nisarg Shah & Karan Singh 53
➢ Claim: Valid 3-coloring ⇒ truth assignment satisfies 𝜒
373F19 - Nisarg Shah & Karan Singh 54
➢ We just proved: valid 3-coloring ⇒ satisfying assignment ➢ Claim: satisfying assignment ⇒ valid 3-coloring
373F19 - Nisarg Shah & Karan Singh 55
➢ Some polynomial-size advice should be sufficient to verify
a YES instance in polynomial time
➢ No advice should work for a NO instance ➢ Usually, the solution of the “search version” of the
problem works
values of both primal and dual variables, as we saw in the last lecture
373F19 - Nisarg Shah & Karan Singh 56
➢ This means taking an arbitrary instance of A, and solving
complete problem to your current problem”.
polynomial in the size of the original A-instance
➢ This would show that if B can be solved in polynomial
time, then A can be as well
➢ Some reductions are trivial, some are notoriously tricky…
373F19 - Nisarg Shah & Karan Singh 57
➢ Input: 𝑑 ∈ ℝ𝑜, 𝑐 ∈ ℝ𝑛, 𝐵 ∈ ℝ𝑛×𝑜, 𝑙 ∈ ℝ ➢ Question: Does there exist 𝑦 ∈ 0,1 𝑜 such that 𝑑𝑈𝑦 ≥ 𝑙
➢ Decision variant of “maximize 𝑑𝑈𝑦 subject to 𝐵𝑦 ≤ 𝑐” but
instead of any 𝑦 ∈ ℝ𝑜 with 𝑦 ≥ 0, we are restricting 𝑦 to binary.
➢ Does restricting search space make the problem easier or
harder?
373F19 - Nisarg Shah & Karan Singh 58
➢ Special case where 𝑑 = 𝑙 = 0, so 𝑑𝑈𝑦 ≥ 𝑙 is always true
➢ Input: 𝑐 ∈ ℝ𝑛, 𝐵 ∈ ℝ𝑛×𝑜 ➢ Question: Does there exist 𝑦 ∈ 0,1 𝑜 such that 𝐵𝑦 ≤ 𝑐? ➢ Just need to find a feasible solution ➢ This is still NP-complete!
➢ Recall: We need to show that there is a polynomial-time
algorithm which
➢ Advice: simply a vector 𝑦 satisfying 𝐵𝑦 ≤ 𝑐
373F19 - Nisarg Shah & Karan Singh 59
➢ Take any formula 𝜒 of 3SAT ➢ Create a binary variable 𝑦𝑗 for each variable 𝑦𝑗 in 𝜒
𝑦𝑗 with 1 − 𝑦𝑗
➢ For each clause 𝐷, we want at least one of its three literals
to be TRUE
𝑦2 ∨ ҧ 𝑦3 ⇒ 𝑦1 + 1 − 𝑦2 + 1 − 𝑦3 ≥ 1
➢ Easy to check that
373F19 - Nisarg Shah & Karan Singh 60
373F19 - Nisarg Shah & Karan Singh 61
➢ But we can reduce any other problem A that we have
already established to be NP-complete
➢ Sometimes this might lead to a simpler reduction
because A might already be “similar” to B
373F19 - Nisarg Shah & Karan Singh 62
➢ Input: Undirected graph 𝐻 = (𝑊, 𝐹), integer 𝑙 ➢ Question: Does there exist a vertex cover of size 𝑙?
incident to at least one vertex in 𝑇?
= vertex cover Example:
vertex cover of size 4?
vertex cover of size 3?
373F19 - Nisarg Shah & Karan Singh 63
➢ Input: Undirected graph 𝐻 = (𝑊, 𝐹), integer 𝑙 ➢ Question: Does there exist a vertex cover of size 𝑙?
incident to at least one vertex in 𝑇?
= independent set Question:
the last lecture?
= vertex cover
373F19 - Nisarg Shah & Karan Singh 64
373F19 - Nisarg Shah & Karan Singh 65
➢ 𝑇 is a vertex cover ➢ IFF: For every 𝑣, 𝑤 ∈ 𝐹, at least one of {𝑣, 𝑤} is in 𝑇 ➢ IFF: For every 𝑣, 𝑤 ∈ 𝐹, at most one of {𝑣, 𝑤} is in 𝑊\S ➢ IFF: No two vertices of 𝑊\S are connected by an edge ➢ IFF: 𝑊\S is an independent set ∎
373F19 - Nisarg Shah & Karan Singh 66
➢ Take an arbitrary instance (𝐻, 𝑙) of Independent Set ➢ We want to check if there is an independent set of size 𝑙 ➢ Just convert it to the instance (𝐻, 𝑜 − 𝑙) of Vertex Cover ➢ Simple!
we already did for 3SAT ≤𝑞 Independent Set
➢ Note: I didn’t argue that Vertex Cover is in NP
373F19 - Nisarg Shah & Karan Singh 67
➢ Input: A universe of elements 𝑉, a family of subsets 𝑇, and
an integer 𝑙
➢ Question: Do there exist 𝑙 sets from 𝑇 whose union is 𝑉?
➢ 𝑉 = {1,2,3,4,5,6,7} ➢ 𝑇 =
1,3,7 , 2,4,6 , 4,5 , 1 , 1,2,6
➢ 𝑙 = 3? Yes! 1,3,7 , 4,5 , {1,2,6} ➢ 𝑙 = 2? No!
➢ Easy. Let the advice be the actual 𝑙 sets whose union is 𝑉.
➢ Given an instance of vertex cover with graph 𝐻 = (𝑊, 𝐹) and
integer 𝑙, create the following set cover instance
union of their incident edges covers all edges
373F19 - Nisarg Shah & Karan Singh 68
373F19 - Nisarg Shah & Karan Singh 69
373F19 - Nisarg Shah & Karan Singh 70
➢ We need to prove this without using any other “known
NP-complete” problem
➢ We want to directly show that every problem in NP can
be reduced to 3SAT
373F19 - Nisarg Shah & Karan Singh 71
➢ If a problem is in NP, then ∃ Turing machine 𝑈(𝑦, 𝑧) which ➢ …takes a problem instance 𝑦, an advice 𝑧 of 𝑞(𝑜) size,
and verifies in 𝑞(𝑜) time whether 𝑦 is a YES instance…
➢ …where 𝑞 is some polynomial and 𝑜 = |𝑦| ➢ 𝑦 is a YES instance iff ∃𝑧 𝑈 𝑦, 𝑧 = 𝐵𝐷𝐷𝐹𝑄𝑈
373F19 - Nisarg Shah & Karan Singh 72
➢ 𝑦 is a YES instance iff ∃𝑧 𝑈 𝑦, 𝑧 = 𝐵𝐷𝐷𝐹𝑄𝑈 ➢ We can introduce a bunch of variables…
𝑗,𝑘,𝑙 = True if machine’s tape cell 𝑗 contains symbol 𝑘 at step 𝑙 of
the computation
𝑙 of the computation
➢ Then express how these variables must be related using a
bunch of constraints (clauses)
373F19 - Nisarg Shah & Karan Singh 73
➢ Given an instance 𝜒 = 𝐷1 ∧ 𝐷2 ∧ ⋯ of SAT, we can take
each clause, and replace it with a bunch of clauses with exactly 3 literals each
ℓ1 ∨ 𝑨1 ∨ 𝑨2 ∧ ℓ1 ∨ ҧ 𝑨1 ∨ 𝑨2 ∧ ℓ1 ∨ 𝑨1 ∨ ҧ 𝑨2 ∧ ℓ1 ∨ ҧ 𝑨1 ∨ ҧ 𝑨2
ℓ1 ∨ ℓ2 ∨ 𝑨1 ∧ ℓ1 ∨ ℓ2 ∨ ҧ 𝑨1
373F19 - Nisarg Shah & Karan Singh 74
ℓ1 ∨ ℓ2 ∨ 𝑨1 ∧ ℓ3 ∨ ҧ 𝑨1 ∨ 𝑨2 ∧ ℓ4 ∨ ҧ 𝑨2 ∨ 𝑨3 ∧ ⋯ ∧ ℓ𝑙−2 ∨ ҧ 𝑨𝑙−4 ∨ 𝑨𝑙−3 ∧ ℓ𝑙−1 ∨ ℓ𝑙 ∨ ҧ 𝑨𝑙−3
appropriate values for 𝑨 variables (check!)
conjunction TRUE (check!)
373F19 - Nisarg Shah & Karan Singh 75
➢ NP = short proof for YES, co-NP = short proof for NO ➢ If a problem “Does there exist…” is in NP, then its
complement “Does there not exist…” is in co-NP, and vice-versa
➢ The same goes for NP-complete and co-NP-complete
➢ SAT is NP-complete (“Does there exist 𝑦 satisfying 𝜒?”) ➢ Tautology is coNP-complete (“Does there exist no 𝑦
satisfying 𝜒?” = “Is 𝜒 always FALSE?”)
373F19 - Nisarg Shah & Karan Singh 76
➢ No advice needed; can just solve the problem in polytime ➢ Major open question: Is P = NP ∩ co-NP?
➢ Hunt for problems not known in P but still in NP ∩ co-NP
373F19 - Nisarg Shah & Karan Singh 77
➢ [Gale–Kuhn–Tucker 1948]: LP is in NP ∩ co-NP
373F19 - Nisarg Shah & Karan Singh 78
➢ But later, we found out: ➢ [Khachiyan 1979]: LP is in P
373F19 - Nisarg Shah & Karan Singh 79
➢ [Pratt 1975]: PRIMES is in NP ∩ co-NP
interesting math
373F19 - Nisarg Shah & Karan Singh 80
➢ But later we found out: ➢ [Agrawal–Kayal–Saxena 2004]: PRIMES is in P
373F19 - Nisarg Shah & Karan Singh 81
➢ FACTOR is in NP ∩ co-NP
proof that each presented factor is a prime
know the TM can just run AKS algorithm to check primality
373F19 - Nisarg Shah & Karan Singh 82
➢ Major open question: Is FACTOR in P?
➢ Challenge: Factor the following number.
74037563479561712828046796097429573142593188889231289 08493623263897276503402826627689199641962511784399589 43305021275853701189680982867331732731089309005525051 16877063299072396380786710086096962537934650563796359 RSA-704 ($30,000 prize if you can factor it)
373F19 - Nisarg Shah & Karan Singh 83
➢ [Shor 1994]: We can factor an 𝑜-bit integer in 𝑃(𝑜3)
steps on a quantum computer.
➢ *Scalable* quantum computers can help
373F19 - Nisarg Shah & Karan Singh 84
➢ DTIME(𝑜), NTIME(𝑜2), …
➢ DSPACE(𝑜), NSPACE(log 𝑜)
➢ ZPP (expected polytime, no errors)
➢ RP (polytime, one-sided error) ➢ BPP (polytime, two-sided erros)