Michael A. Nielsen University of Queensland Introduction to computer science Goals: 1.Introduce the notion of the computational complexity of a problem,

Slides:



Advertisements
Similar presentations
University of Queensland
Advertisements

NP-Hard Nattee Niparnan.
JAYASRI JETTI CHINMAYA KRISHNA SURYADEVARA
 2004 SDU Lecture17-P,NP, NPC.  2004 SDU 2 1.Decision problem and language decision problem decision problem and language 2.P and NP Definitions of.
The Theory of NP-Completeness
CPE702 Complexity Classes Pruet Boonma Department of Computer Engineering Chiang Mai University Based on Material by Jenny Walter.
Great Theoretical Ideas in Computer Science for Some.
CSE373: Data Structures & Algorithms Lecture 24: The P vs. NP question, NP-Completeness Nicki Dell Spring 2014 CSE 373 Algorithms and Data Structures 1.
Discrete Structures & Algorithms The P vs. NP Question EECE 320.
Complexity 15-1 Complexity Andrei Bulatov Hierarchy Theorem.
Computability and Complexity 13-1 Computability and Complexity Andrei Bulatov The Class NP.
CSE332: Data Abstractions Lecture 27: A Few Words on NP Dan Grossman Spring 2010.
CPSC 411, Fall 2008: Set 12 1 CPSC 411 Design and Analysis of Algorithms Set 12: Undecidability Prof. Jennifer Welch Fall 2008.
1 Polynomial Church-Turing thesis A decision problem can be solved in polynomial time by using a reasonable sequential model of computation if and only.
The Theory of NP-Completeness
CSE 326: Data Structures NP Completeness Ben Lerner Summer 2007.
University of Queensland
NP-complete and NP-hard problems
Analysis of Algorithms CS 477/677
Chapter 11: Limitations of Algorithmic Power
Toward NP-Completeness: Introduction Almost all the algorithms we studies so far were bounded by some polynomial in the size of the input, so we call them.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 22 Instructor: Paul Beame.
Complexity Issues Mark Allen Weiss: Data Structures and Algorithm Analysis in Java Lydia Sinapova, Simpson College.
Chapter 11 Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
Complexity Theory: The P vs NP question Lecture 28 (Dec 4, 2007)
1.1 Chapter 1: Introduction What is the course all about? Problems, instances and algorithms Running time v.s. computational complexity General description.
Programming & Data Structures
Chapter 11 Limitations of Algorithm Power. Lower Bounds Lower bound: an estimate on a minimum amount of work needed to solve a given problem Examples:
Computational Complexity Polynomial time O(n k ) input size n, k constant Tractable problems solvable in polynomial time(Opposite Intractable) Ex: sorting,
CMPS 3223 Theory of Computation Automata, Computability, & Complexity by Elaine Rich ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Slides provided.
1 The Theory of NP-Completeness 2012/11/6 P: the class of problems which can be solved by a deterministic polynomial algorithm. NP : the class of decision.
Nattee Niparnan. Easy & Hard Problem What is “difficulty” of problem? Difficult for computer scientist to derive algorithm for the problem? Difficult.
Complexity Classes (Ch. 34) The class P: class of problems that can be solved in time that is polynomial in the size of the input, n. if input size is.
Lecture 30. P, NP and NP Complete Problems 1. Recap Data compression is a technique to compress the data represented either in text, audio or image form.
Tonga Institute of Higher Education Design and Analysis of Algorithms IT 254 Lecture 8: Complexity Theory.
CSC 413/513: Intro to Algorithms NP Completeness.
Week 10Complexity of Algorithms1 Hard Computational Problems Some computational problems are hard Despite a numerous attempts we do not know any efficient.
CSE 024: Design & Analysis of Algorithms Chapter 9: NP Completeness Sedgewick Chp:40 David Luebke’s Course Notes / University of Virginia, Computer Science.
CSE 3813 Introduction to Formal Languages and Automata Chapter 14 An Introduction to Computational Complexity These class notes are based on material from.
1 Lower Bounds Lower bound: an estimate on a minimum amount of work needed to solve a given problem Examples: b number of comparisons needed to find the.
CSCI 3160 Design and Analysis of Algorithms Tutorial 10 Chengyu Lin.
Michael A. Nielsen University of Queensland Quantum Shwantum Goal: To explain all the things that got left out of my earlier lectures because I tried to.
1 The Theory of NP-Completeness 2 Cook ’ s Theorem (1971) Prof. Cook Toronto U. Receiving Turing Award (1982) Discussing difficult problems: worst case.
COMPSCI 102 Introduction to Discrete Mathematics.
CSE373: Data Structures & Algorithms Lecture 22: The P vs. NP question, NP-Completeness Lauren Milne Summer 2015.
Umans Complexity Theory Lectures Lecture 1a: Problems and Languages.
Erdal Kose CC30.10 These slides are based of Prof. N. Yanofsky Lecture notes.
1 Chapter 34: NP-Completeness. 2 About this Tutorial What is NP ? How to check if a problem is in NP ? Cook-Levin Theorem Showing one of the most difficult.
NP-COMPLETE PROBLEMS. Admin  Two more assignments…  No office hours on tomorrow.
Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity.
Beauty and Joy of Computing Limits of Computing Ivona Bezáková CS10: UC Berkeley, April 14, 2014 (Slides inspired by Dan Garcia’s slides.)
Lecture 12 P and NP Introduction to intractability Class P and NP Class NPC (NP-complete)
CS 3343: Analysis of Algorithms Lecture 25: P and NP Some slides courtesy of Carola Wenk.
Computability Heap exercise. The class P. The class NP. Verifiers. Homework: Review RELPRIME proof. Find examples of problems in NP.
Fundamentals of Informatics Lecture 14 Intractability and NP-completeness Bas Luttik.
LIMITATIONS OF ALGORITHM POWER
CS6045: Advanced Algorithms NP Completeness. NP-Completeness Some problems are intractable: as they grow large, we are unable to solve them in reasonable.
NP-Completeness  For convenience, the theory of NP - Completeness is designed for decision problems (i.e. whose solution is either yes or no).  Abstractly,
Chapter 11 Introduction to Computational Complexity Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1.
NPC.
Overview of the theory of computation Episode 3 0 Turing machines The traditional concepts of computability, decidability and recursive enumerability.
Lecture. Today Problem set 9 out (due next Thursday) Topics: –Complexity Theory –Optimization versus Decision Problems –P and NP –Efficient Verification.
COSC 3101A - Design and Analysis of Algorithms 14 NP-Completeness.
1 P and NP. 2 Introduction The Traveling Salesperson problem and thousands of other problems are equally hard in the sense that if we had an efficient.
1 The Theory of NP-Completeness 2 Review: Finding lower bound by problem transformation Problem X reduces to problem Y (X  Y ) iff X can be solved by.
The NP class. NP-completeness Lecture2. The NP-class The NP class is a class that contains all the problems that can be decided by a Non-Deterministic.
Modeling Arithmetic, Computation, and Languages Mathematical Structures for Computer Science Chapter 8 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesTuring.
Attendance Syllabus Textbook (hardcopy or electronics) Groups s First-time meeting.
Chapter 34: NP-Completeness
Chapter 11 Limitations of Algorithm Power
Presentation transcript:

Michael A. Nielsen University of Queensland Introduction to computer science Goals: 1.Introduce the notion of the computational complexity of a problem, and define the major computational complexity classes. 2.Explain how to compute reversibly.

Q: Is there a general algorithm to determine whether a mathematical conjecture is true or false? Church-Turing: NO! Church-Turing thesis: Any algorithmic process can be simulated on a Turing machine – an idealized and rigorously defined mathematical model of a computing device. Ad hoc empirical justification! Turing Machine Computer science

“Turing machines” Many different models of computation are equivalent to the Turing machine (TM). We will use a model other than the TM for reasons of both pedagogy and utility. INPUT x = “I like quantum information science” PROGRAM FOR j = 1:LENGTH(x) OUTPUT x NEXT Input: Program: Workspace: … … …………………………. Output: …………………….

How to number programs and their inputs INPUT x = “I like quantum information science” PROGRAM FOR j = 1:LENGTH(x) OUTPUT x NEXT binary … The program and input for a universal computer can be uniquely encoded as a pair of positive integers. binary …

Does program number x halt on input of x? Is there an algorithm to solve the halting problem, that is, to compute h(x)? Suppose such an algorithm exists. PROGRAM: TURING(x) IF h(x) = 1 THEN HALT ELSE loop forever Let T be the program number for TURING. TURING(T) haltsh(T) = 1h(T) = 0 Contradiction! The halting problem

Exercise: Show that there is no algorithm to determine whether program number x halts with input y. Exercise: Show that there is no algorithm to determine whether program number x halts with input 0.

Conjecture: Program number x halts on input of x. No algorithm exists to prove or refute this conjecture, in general. Isn’t this a rather artificial conjecture? Conjecture: Topological space X is topologically equivalent to topological space Y. Many other “natural” mathematical conjectures cannot be algorithmically decided. What is the relationship of the halting problem to Hilbert’s problem?

Computational complexity theory What types of resources? What types of computational problems? time space energy Goal: A general theory of the resources needed to solve computational problems. composing a poem sorting a database optimization decision problem

Decision problems Example: Is the number n prime? Why focus on decision problems? A decision problem is a computational problem with a yes or no answer. Decision problems are simple: This makes it easy to develop a rigorous mathematical theory. Decision problems are surprisingly general: Many other problems can be recast in terms of decision problems that are essentially equivalent.

Recasting other problems as decision problems Multiplication decision problem: Is the kth bit of the product of m and n a one? Factoring problem: What is the smallest non-trivial factor of n? Multiplication problem: What is the product of m and n? Factoring decision problem: Does n have a non-trivial factor smaller than k? Time required to solve one of these problems is the same (to within a small overhead) as the time required to solve the other. Time required to solve one of these problems is the same (to within a small overhead) as the time required to solve the other.

Efficiency insoluble soluble insoluble soluble hard easy Nomenclature: easy = “tractable” = “efficiently computable” hard = “intractable” = “not efficiently computable” Definition: A problem is easy if there is a Turing machine to solve the problem that runs in time polynomial in the size of the problem input. Otherwise the problem is hard. This definition is usually applied to both decision problems and more general problems.

Why polynomial-time = “easy” It’s a rule of thumb: in practice, problems with polynomial-time solutions are usually found to be easily soluble, while problems without are usually found to be rather difficult. The way to think about the polynomial versus non-polynomial distinction is as a first-cut analysis. Finer distinctions can wait until later.

Why polynomial-time = “easy” Christos H. Papadimitriou, “Computational Complexity”: “It should not come as a surprise that our choice of polynomial algorithms as the mathematical concept that is supposed to capture the informal notion of “practically efficient computation” is open to criticism from all sides.” “[…] Ultimately, our argument for our choice must be this: Adopting polynomial worst-case performance as our criterion of efficiency results in an elegant and useful theory that says something meaningful about practical computation, and would be impossible without this simplification.”

Our first computational complexity class: “P” Definition: The set of all decision problems soluble in polynomial time on a Turing machine is denoted P. decision problems P “easy” problems Terminology: “Multiplication is in P” means “The multiplication decision problem is in P”. “Factoring is thought not to be in P” means “The factoring decision problem is thought not to be in P”. Technical caveat: Allowing the Turing machine to do random coin flips appears to help. The set of all decision problems soluble on a (randomized) Turing machine is denoted BPP.

The strong Church-Turing thesis Doesn’t the definition of P depend upon the computational model used in the statement of the definition, namely, the Turing machine? Church-Turing thesis: Any algorithmic process can be simulated on a Turing machine. Strong Church-Turing thesis: Any physically reasonable algorithmic process can be simulated on a Turing machine, with at most a polynomial slowdown in the number of steps required to do the simulation. The strong Church-Turing thesis implies that the problems in P are precisely those for which a polynomial-time solution is the best possible, in any physically reasonable model of computation. Ad hoc empirical justification!

The strong Church-Turing thesis Deutsch: Maybe computers based on quantum mechanics might violate the strong Church-Turing thesis? Strong Church-Turing thesis: Any physically reasonable algorithmic process can be simulated on a Turing machine, with at most a polynomial slowdown in the number of steps required to do the simulation. Nonetheless, a remarkably wide range of computational models satisfy the strong Church-Turing thesis, and it can serve as the basis for a useful theory of computational complexity.

Many important problems aren’t known to be in P Example: Factoring. Example: The traveling salesman problem (TSP). 22 km 16 km 12 km 15 km 23 km 14 km 19 km Goal: Find the shortest tour through all the cities. Traveling salesman decision problem: Given a network and a number, k, is there a tour through all the cities of length less than k? It is widely believed that neither of these problems is in P.

Witnesses Determining whether 7747 has a factor less than 70 is thought to be hard. Verifying that 61 is a factor of 7747 (= 127 x 61) less than 70 is easy: just check that 61 < 70 and use the efficient long-division algorithm you learnt in school. The factoring decision problem has witnesses to yes instances of the problem – informally, solutions to the factoring problem, which can be checked in polynomial time. It does not follow that there are easily-checkable witnesses for no instances, like “Does 7747 have a factor less than 60?” TSP seems to be hard, but also has easily-checked witnesses for yes instances.

NP Definition: The complexity class NP consists of all decision problems for which yes instances of the problem have witnesses checkable in polynomial time on a Turing machine. Examples: The factoring and TSP decision problems. Many important optimization problems are in NP – it is often hard to find a solution, but easy to verify a solution once it is found. Example: The Hamiltonian cycle problem: is there a tour that goes through each vertex in the graph exactly once?

The relationship of P to NP decision problems P NP (US) $1,000,000 dollars for a solution:

Intuition: There is no better way of finding a solution than searching through most possible witness. Intuition: To determine whether there is a Hamiltonian cycle, the best way is to search through all possible cycles. Example: The Hamiltonian cycle problem: is there a tour that goes through each vertex in the graph exactly once? Euler’s problem: Is there a tour of a graph that visits each edge exactly once? Exercise: Prove Euler’s theorem: A connected graph contains an Euler cycle iff each vertex has an even number of incident edges. Use this to argue that Euler’s problem is in P.

Example: Graph isomorphism problem Graph 1 Graph 2 Problem: Is Graph 1 isomorphic to Graph 2? Worked exercise: Prove that the graph isomorphism problem is in NP. Research problem: Prove that the graph isomorphism problem is not in P.

Reducibility We say problem X is reducible to problem Y if, given an oracle to solve problem Y in one step, there is an algorithm to solve problem X in polynomial time. Example: The Hamiltonian cycle problem can be reduced to the travelling salesman problem. Does this graph have a Hamiltonian cycle? 1km Is there a tour of less than 8 kilometers?

The structure of NP P NP Definition: A problem is NP-complete if it is in NP and every other problem in NP reduces to it. Not obvious that NP-complete problems even exist! Cook-Levin Theorem: Provided the first example of an NP-complete problem – the satisfiability problem. NP- complete NPI Thousands of other problems are now known to be NP-complete, including the travelling salesman and Hamiltonian cycle problems. Many people believe that quantum computers won’t efficiently solve NP-complete problems, but maybe can solve some problems in NPI. Candidates for NPI include factoring and graph isomorphism. Ladner

Research problem: Find an efficient quantum algorithm to solve the graph isomorphism problem.

The circuit model of computation Real computers are finite devices, not infinite, like the Turing machine. We will investigate a circuit model of computation, and explain how to define computational complexity classes in that model. Quantum computers are most conveniently understood in terms of the quantum circuit model of computation.

Examples of circuits NOT NAND Basic elements wires (memory) one- and two-bit gates NOT AND fanout NAND ancilla – bits in pre-prepared states. controlled-not gate (CNOT)

Universality in the circuit model Exercise: Prove that the NAND gate can be used to simulate the AND, XOR and NOT gates, provided wires, fanout, and ancilla are available. Exercise: Prove that the NAND gate, wires, fanout and ancilla can be used to compute an arbitrary function f(.) with n input bits, and one output bit. (Hint: Induct on n.) Exercise: Prove that there is a function f(.), as above, that takes at least 2 n gates to compute. We say that the NAND gate, wires, fanout and ancilla form a universal set of operations for computation.

The circuit model and complexity classes Can we connect the circuit model to complexity classes like P and NP? Basic idea is to introduce a family of circuits, C n, indexed by the problem size, n. CnCn Main point is that (modulo some technicalities) a problem is in P iff there is a family of circuits to solve the problem, C n, containing a number of elements polynomial in n. n-bit input Technicalities (in brief): Our intrepid engineer needs a construction algorithm (i.e. a Turing machine) to build the circuit C n, given n. This algorithm should run in polynomial time. Such a circuit family is called a uniform circuit family.

Irreversibility of circuit elements NAND From the output of the NAND gate it is impossible to determine if the input was (0,1), (1,0), or (0,0). The NAND gate is irreversible: there is no logic gate capable of inverting the NAND. Landauer’s principle: Any irreversible operation in a circuit is necessarily accompanied by the dissipation of heat. Can we compute without dissipating heat? The trick is to compute using only reversible circuit elements! Importance to us: not heat dissipation, but the fact that quantum gates are most naturally viewed as reversible gates.

Some reversible circuit elements The Toffoli gate (or controlled-controlled-not).

Idea: embed irreversible gates in reversible gates, making use of extra ancilla bits. Example: The reversible NAND gate. How to compute using reversible circuit elements

Example: fanout. How to compute using reversible circuit elements

Original circuit: uses NAND gates, wires, fanout, and ancilla Reversible circuit: uses CNOT and Toffoli gates, wires, and ancilla How to compute using reversible circuit elements Up to constant factors the resource requirements in the two models are the same, so complexity classes like P and NP do not change in a reversible circuit model of computation.

Can we eliminate the garbage? Exercise: Show that it is impossible to do universal computation using only one- and two-bit reversible logic gates. Complexity classes like P and NP are again unchanged.

Digression: what can be measured in quantum mechanics? Computer science can inspire fundamental questions about physics. We may take an “informatic” approach to physics. (Compare the physical approach to information.) Problem: What measurements can be performed in quantum mechanics?

Digression: what can be measured in quantum mechanics? “Traditional” approach to quantum measurements: A quantum measurement is described by an observable, M, that is, a Hermitian operator acting on the state space of the system. Measuring a system prepared in an eigenstate of M gives the corresponding eigenvalue of M as the measurement outcome. “The question now presents itself – Can every observable be measured? The answer theoretically is yes. In practice it may be very awkward, or perhaps even beyond the ingenuity of the experimenter, to devise an apparatus which could measure some particular observable, but the theory always allows one to imagine that the measurement could be made.” - Paul A. M. Dirac

The halting observable Can we build a measuring device capable of measuring the halting observable? Yes: Would give us a procedure to solve the halting problem. No: There is an interesting class of “superselection” rules controlling what observables may, in fact, be measured.

Research problem: Is the halting observable really measurable? If so, how? If not, why not?