An Introduction to Computational Complexity Lance Fortnow University of Chicago.

61
An Introduction to An Introduction to Computational Computational Complexity Complexity Lance Fortnow Lance Fortnow University of Chicago University of Chicago

Transcript of An Introduction to Computational Complexity Lance Fortnow University of Chicago.

Page 1: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

An Introduction to An Introduction to Computational Computational

ComplexityComplexity

Lance FortnowLance Fortnow

University of ChicagoUniversity of Chicago

Page 2: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

The Round Table ProblemThe Round Table Problem

Page 3: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

Sir Lancelot

Sir Percivale

Page 4: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

Sir Galahad Sir Gareth

Page 5: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

Sir PericvaleSir Bevidere

Page 6: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

The Round Table ProblemThe Round Table Problem

Page 7: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

Map ColoringMap Coloring

Page 8: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

5 Colors5 Colors

Page 9: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

All Maps are Four ColorableAll Maps are Four Colorable

Page 10: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

Can we use only 3 colors?Can we use only 3 colors?

Page 11: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

SudokuSudoku

Page 12: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

SudokuSudoku

Page 13: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

All The Same ProblemAll The Same Problem

Solve one of these problems, you solve them Solve one of these problems, you solve them all.all.

Page 14: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

And Thousands More…And Thousands More…

► MinesweeperMinesweeper► Traveling Traveling

SalespersonSalesperson► CliquesCliques► Integer ProgrammingInteger Programming► Quadratic Quadratic

ProgrammingProgramming► Maximum CutMaximum Cut► Longest PathLongest Path

► Bin PackingBin Packing► Job SchedulingJob Scheduling► Filling a KnapsackFilling a Knapsack► Crossword Puzzle Crossword Puzzle

ConstructionConstruction► Code GenerationCode Generation► Sequencing DNASequencing DNA► Finding ArbitrageFinding Arbitrage

Page 15: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

Can We Solve These Can We Solve These Problems?Problems?

P = NP?P = NP?

Page 16: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

The P versus NP QuestionThe P versus NP Question

►P – Efficiently Computable SolutionsP – Efficiently Computable Solutions►NP – Efficiently Verifiable SolutionsNP – Efficiently Verifiable Solutions

Page 17: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

P – Efficiently ComputableP – Efficiently Computable

► Finding the shortest Finding the shortest path from point A to path from point A to point Bpoint B

Page 18: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

NP – Efficiently VerifiableNP – Efficiently Verifiable

Page 19: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

NP – Efficiently VerifiableNP – Efficiently Verifiable

Page 20: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

NP-CompleteNP-Complete

NP

P

NPC

Page 21: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

If P ≠ NPIf P ≠ NP

NP

P

NPC

Page 22: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

If P = NPIf P = NP

NP

P

NPC

Page 23: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

P versus NPP versus NP

►General Consensus: P ≠ NPGeneral Consensus: P ≠ NP►Major Open Problem: Formally prove P ≠ Major Open Problem: Formally prove P ≠

NPNP►First to do so wins $1,000,000First to do so wins $1,000,000►One of the seven “Millennium” Problems One of the seven “Millennium” Problems

of the Clay Mathematics Institute.of the Clay Mathematics Institute.►Many approaches, all have failed Many approaches, all have failed

miserably.miserably.

Page 24: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

P versus NP: A Short HistoryP versus NP: A Short History

►1936: Alan Turing tries to understand how 1936: Alan Turing tries to understand how a mathematician thinks and developed a a mathematician thinks and developed a theoretical model of computation we now theoretical model of computation we now call the Turing Machine.call the Turing Machine.

Page 25: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

P versus NP: A Short HistoryP versus NP: A Short History

►1956: The logician Kurt Gödel, in a 1956: The logician Kurt Gödel, in a letter to John van Neumann, asked a letter to John van Neumann, asked a question mathematically equivalent to question mathematically equivalent to P = NP?P = NP?

►The letter was never followed up and The letter was never followed up and soon forgotten.soon forgotten.

Page 26: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

P versus NP: A Short HistoryP versus NP: A Short History

►1962: Juris Hartmanis and Richard 1962: Juris Hartmanis and Richard Stearns develop the notion of Stearns develop the notion of “Computational Complexity” by “Computational Complexity” by suggesting we look at the time a suggesting we look at the time a program takes as a function of the size program takes as a function of the size of the input.of the input.

►They show that given more time, a They show that given more time, a computer can do solve more problems. computer can do solve more problems.

Page 27: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

P versus NP: A Short HistoryP versus NP: A Short History

►1965: Independently Alan Cobham and 1965: Independently Alan Cobham and Jack Edmonds suggest that one can Jack Edmonds suggest that one can characterize efficient computation by characterize efficient computation by having the running time run in some having the running time run in some fixed polynomial of the input length.fixed polynomial of the input length.

►This class of problems is later given This class of problems is later given the name P.the name P.

Page 28: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

P versus NP: A Short HistoryP versus NP: A Short History

►1972: Steve Cook gave the first NP-1972: Steve Cook gave the first NP-complete problem, Boolean Formula complete problem, Boolean Formula Satisfiability, and formally defined the Satisfiability, and formally defined the P versus NP problem.P versus NP problem.

u v w u w x v w x

Page 29: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

P versus NP: A Short HistoryP versus NP: A Short History

►1973: Richard Karp showed that 1973: Richard Karp showed that several natural problems, such as several natural problems, such as Clique and Traveling Salesperson are Clique and Traveling Salesperson are NP-complete.NP-complete.

►The rest is history.The rest is history.

Page 30: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

Suppose P = NPSuppose P = NP

►What a beautiful world…What a beautiful world…

Page 31: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

We Can Efficiently SolveWe Can Efficiently Solve

► MinesweeperMinesweeper► Traveling Traveling

SalespersonSalesperson► CliquesCliques► Integer ProgrammingInteger Programming► Quadratic Quadratic

ProgrammingProgramming► Maximum CutMaximum Cut► Longest PathLongest Path

► Bin PackingBin Packing► Job SchedulingJob Scheduling► Filling a KnapsackFilling a Knapsack► Crossword Puzzle Crossword Puzzle

ConstructionConstruction► Code GenerationCode Generation► Sequencing DNASequencing DNA► Finding ArbitrageFinding Arbitrage

Page 32: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

Occam’s RazorOccam’s Razor

►William of OckhamWilliam of Ockham Entities should not Entities should not

be multiplied beyond be multiplied beyond necessitynecessity..

► The shortest The shortest explanation of the explanation of the data is the best one.data is the best one.

Page 33: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

TranslationTranslation► In the beginning God created In the beginning God created

the heavens and the earth. the heavens and the earth. Now the earth was formless Now the earth was formless and empty, darkness was and empty, darkness was over the surface of the deep, over the surface of the deep, and the Spirit of God was and the Spirit of God was hovering over the waters. hovering over the waters. And God said, "Let there be And God said, "Let there be light," and there was light. light," and there was light. God saw that the light was God saw that the light was good, and He separated the good, and He separated the light from the darkness. God light from the darkness. God called the light "day," and called the light "day," and the darkness he called the darkness he called "night." And there was "night." And there was evening, and there was evening, and there was morning—the first day. morning—the first day.

► Im Anfang schuf Gott die Im Anfang schuf Gott die Himmel und die Erde. Und Himmel und die Erde. Und die Erde war wüst und leer, die Erde war wüst und leer, und Finsternis war über der und Finsternis war über der Tiefe; und der Geist Gottes Tiefe; und der Geist Gottes schwebte über den Wassern. schwebte über den Wassern. Und Gott sprach: Es werde Und Gott sprach: Es werde Licht! Und es wurde Licht. Licht! Und es wurde Licht. Und Gott sah das Licht, daß Und Gott sah das Licht, daß es gut war; und Gott schied es gut war; und Gott schied das Licht von der Finsternis. das Licht von der Finsternis. Und Gott nannte das Licht Und Gott nannte das Licht Tag, und die Finsternis Tag, und die Finsternis nannte er Nacht. Und es nannte er Nacht. Und es wurde Abend, und es wurde wurde Abend, und es wurde Morgen: ein Tag. Morgen: ein Tag.

Page 34: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

TranslationTranslation► In the beginning God created the heavens and In the beginning God created the heavens and

the earth. Now the earth was formless and the earth. Now the earth was formless and empty, darkness was over the surface of the empty, darkness was over the surface of the deep, and the Spirit of God was hovering over deep, and the Spirit of God was hovering over the waters. And God said, "Let there be light," the waters. And God said, "Let there be light," and there was light. God saw that the light was and there was light. God saw that the light was good, and He separated the light from the good, and He separated the light from the darkness. God called the light "day," and the darkness. God called the light "day," and the darkness he called "night." And there was darkness he called "night." And there was evening, and there was morning—the first day. evening, and there was morning—the first day.

► Im Anfang schuf Gott die Himmel und die Erde. Im Anfang schuf Gott die Himmel und die Erde. Und die Erde war wüst und leer, und Finsternis Und die Erde war wüst und leer, und Finsternis war über der Tiefe; und der Geist Gottes war über der Tiefe; und der Geist Gottes schwebte über den Wassern. Und Gott sprach: schwebte über den Wassern. Und Gott sprach: Es werde Licht! Und es wurde Licht. Und Gott Es werde Licht! Und es wurde Licht. Und Gott sah das Licht, daß es gut war; und Gott schied sah das Licht, daß es gut war; und Gott schied das Licht von der Finsternis. Und Gott nannte das Licht von der Finsternis. Und Gott nannte das Licht Tag, und die Finsternis nannte er das Licht Tag, und die Finsternis nannte er Nacht. Und es wurde Abend, und es wurde Nacht. Und es wurde Abend, und es wurde Morgen: ein Tag. Morgen: ein Tag.

Page 35: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

If P = NP…If P = NP…

►Can efficiently find the smallest Can efficiently find the smallest program to translate documents.program to translate documents.

►Recognizing FacesRecognizing Faces►Speech to Text, Pictures to TextSpeech to Text, Pictures to Text►Recognizing MusicRecognizing Music►……

Page 36: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

No Such LuckNo Such Luck

► Life can’t be so Life can’t be so good so we all good so we all believebelieveP ≠ NP.P ≠ NP.

►Once we show a Once we show a problem is “NP-problem is “NP-Complete” we Complete” we should stop looking should stop looking for an efficient for an efficient algorithm.algorithm.

Page 37: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

What to do about hard What to do about hard problems?problems?

►Solve it anyway.Solve it anyway. Computers are very fast these days.Computers are very fast these days.

►Heuristics.Heuristics. Your specific instance might not be that Your specific instance might not be that

hard.hard.

►Approximation.Approximation. Can’t get best algorithm but perhaps one Can’t get best algorithm but perhaps one

can get a “good enough” solution.can get a “good enough” solution.

Page 38: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

Solve It AnywaySolve It Anyway

► There are about There are about 2x102x107575 possible possible numbers to try.numbers to try.

► A simple A simple backtracking backtracking algorithm can solve algorithm can solve the problem on a PC the problem on a PC in a few seconds.in a few seconds.

Page 39: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

HeuristicsHeuristics

►Most puzzles are Most puzzles are designed to be designed to be solved by humans.solved by humans.

Page 40: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

ApproximationApproximation

Page 41: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

Clique ProblemClique Problem

► Find a large group Find a large group of people all of of people all of whom are friends whom are friends with each other.with each other.

► Coming up with a Coming up with a clique anywhere clique anywhere close to the largest close to the largest clique is as hard as clique is as hard as solving NP-complete solving NP-complete problems.problems.

Page 42: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

Good News with Hard Good News with Hard ProblemsProblems

►Pseudorandom GeneratorsPseudorandom Generators Hard functions can help us create fake Hard functions can help us create fake

random coins that are as good as real random coins that are as good as real random coins.random coins.

►Public-Key CryptographyPublic-Key Cryptography

Page 43: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

Public-Key CryptographyPublic-Key Cryptography

Page 44: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

Impossible if P = NPImpossible if P = NP

Page 45: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

Possible if Factoring is HardPossible if Factoring is Hard

Page 46: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

NP as Proof SystemNP as Proof System

Page 47: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

NP as Proof SystemNP as Proof System

Page 48: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

Zero-Knowledge Proof Zero-Knowledge Proof SystemSystem

► Can convince Can convince someone that a someone that a solution exists solution exists without revealing without revealing any details of the any details of the solution.solution.

► Requires Requires cryptography and cryptography and verification process verification process is randomized. is randomized.

Page 49: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

Interactive ProofsInteractive Proofs

55

► Can convince Can convince someone there is no someone there is no solution.solution.

► Verification process Verification process is randomized.is randomized.

Page 50: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

Proof CheckingProof Checking

Page 51: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

Probabilistically Checkable Probabilistically Checkable ProofProof

► There is a proof that There is a proof that a solution exists a solution exists where we need to where we need to only see three only see three randomly chosen randomly chosen bits of the proof.bits of the proof.

► This is the tool that This is the tool that shows that Clique is shows that Clique is hard to hard to approximate.approximate.

Page 52: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

Quantum ComputingQuantum Computing

Page 53: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

Quantum BitsQuantum Bits

Page 54: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

EntanglementEntanglement

Page 55: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

InterferenceInterference

►Use entanglement to search many states.Use entanglement to search many states.►Use interference to eliminate the ones that Use interference to eliminate the ones that

don’t solve your problem.don’t solve your problem.

Page 56: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

Shor’s AlgorithmShor’s Algorithm

►Factor quickly with a quantum Factor quickly with a quantum computer.computer.

Page 57: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

Complexity of FactoringComplexity of Factoring

NP

P

NPC

Page 58: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

Complexity of QuantumComplexity of Quantum

NP

P

NPC

Quantum

Page 59: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

Grover’s AlgorithmGrover’s Algorithm

► Search a trillion Search a trillion pieces of hay to find pieces of hay to find the needle by the needle by making only a making only a million quantum hay million quantum hay searches.searches.

► Can be used to give Can be used to give quadratic quadratic improvement to improvement to solving NP problems.solving NP problems.

Page 60: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

Quantum Computers in Our Quantum Computers in Our Future?Future?

►A very very long way from building A very very long way from building quantum computers that can quantum computers that can outperform current machines in any outperform current machines in any task.task.

►Even if we build quantum computers, Even if we build quantum computers, factoring is only good for breaking factoring is only good for breaking some codes. Quantum computers some codes. Quantum computers could end up being a very specialized could end up being a very specialized tool.tool.

Page 61: An Introduction to Computational Complexity Lance Fortnow University of Chicago.

The Future of ComplexityThe Future of Complexity

►Solve the P versus NP problem.Solve the P versus NP problem.►Understanding complexity issues in Understanding complexity issues in

the computational processes outside the computational processes outside of traditional digital computers.of traditional digital computers. Biological Systems (Protein Folding)Biological Systems (Protein Folding) WeatherWeather Social InteractionsSocial Interactions Financial MarketsFinancial Markets