Ian Stewart's article "Million-Dollar Minesweeper"

Size: px
Start display at page:

Download "Ian Stewart's article "Million-Dollar Minesweeper""

Transcription

1 Page 1 of 5 Million-Dollar Minesweeper Lecture: November 1, 2000 (Video Online) Ian Stewart, Department of Mathematics, University of Warwick, UK It's not often you can win a million dollars by analysing a computer game, but by a curious conjunction of fate, there's a chance that you might. However, you'll only pick up the loot if all the experts are wrong and a problem that they think is extraordinarily hard turns out to be easy. So don't order the Corvette yet. The prize is one of seven now on offer from the newly founded Clay Mathematics Institute in Cambridge MA, set up by businessman Landon T. Clay to promote the growth and spread of mathematical knowledge, each bearing a million-buck price-tag. The computer game is Minesweeper, which is included in Microsoft's Windows operating system, and involves locating hidden mines on a grid by making guesses about where they are located and using clues provided by the computer. And the problem is one of the most notorious open questions in mathematics, which rejoices in the name 'P=NP?'. The connection between the game and the prize problem was explained by Richard Kaye of the University of Birmingham, England ('Minesweeper is NP-complete', Mathematical Intelligencer volume 22 number 4, 2000, pages 9-15). And before anyone gets too excited, you won't win the prize by winning the game. To win the prize, you will have to find a really slick method to answer questions about Minesweeper when it's played on gigantic grids and all the evidence suggests that there isn't a slick method. In fact, if you can prove that there isn't one, you can win the prize that way too. Let's start with Minesweeper. The computer starts the game by showing you a blank grid of squares. Some squares conceal mines; the rest are safe. Your task is to work out where the mines are without detonating any of them. You do this by choosing a square. If there's a mine underneath it, the mine is detonated and the game ends--- with a loss for you, of course. If there is no mine, however, the computer writes a number in that square, telling you how many mines there are in the eight immediately adjacent squares (horizontally, vertically, and diagonally). If your first guess hits a mine, you're unlucky: you get no information except that you've lost. If it doesn't, though, then you get partial information about the location of nearby mines. You use this information to influence your next choice of square, and again either you detonate a mine and lose, or you gain information about the positions of nearby mines. If you wish, you can choose to mark a square as containing a mine: if you're wrong, you lose. Proceeding in this way, you can win the game by locating and marking all the mines.

2 Page 2 of 5 Fig.1 A Typical Minesweeper Position For instance, after a few moves you might reach the position shown in Fig.1. Here a flag shows a known mine (position already deduced), the numbers are the information you've gotten from the computer, and the letters mark squares whose status is as yet untested. With a little thought, you can deduce that the squares marked A must contain mines, because of the 2's just below them. The squares marked B must also contain mines, because of the 4's and 5's nearby. In the same way, C must contain a mine; and it then follows that D and E do not. The status of F can then be deduced, after a few moves, by uncovering D and seeing what number appears. Now, the P=NP? problem. Recall that an algorithm is a procedure for solving some problem that can be run by a computer: every step is specified by some program. A central question in the mathematics of computation is: how efficiently can an algorithm solve a given problem? How does the running time--- the number of computations needed to get the answer--- depend on the initial data? For theoretical purposes the main distinction is between problems that are of type P--- polynomial time --- and those that are not. A problem is of type P if it can be solved using an algorithm whose running time grows no faster than some fixed power of the number of symbols required to specify the initial data. Otherwise the problem is non-p. Intuitively, problems in P can be solved efficiently, whereas non-p problems cannot be solved algorithmically in any practical manner because any algorithm will take a ridiculously long time to get an answer. Problems of type P are easy, non-p problems are hard. Of course it's not quite as simple as that, but it's a good rule of thumb. You can prove that a problem is of type P by exhibiting an algorithm that solves it in polynomial time. For example, sorting a list of numbers into numerical order is a type P problem, which is why commercial databases can sort data; and searching a string for some sequence of symbols is also a type P problem, which is why commercial wordprocessors can carry out search-and-replace operations. In contrast, the Travelling Salesman Problem--- find the shortest route whereby a salesman can visit every city on some itinerary--- is widely believed to be non-p, but this has never been proved. Finding the prime factors of a given integer is also widely believed to be non-p, too, but this has never been proved either. The security of certain cryptosystems, some of which are used to send personal data such as credit card numbers over the Internet, depends upon this belief being correct. Why is it so hard to prove that a problem is non-p? Because you can't do that by analysing any particular algorithm. You have to contemplate all possible algorithms and show that none of them can solve the problem in polynomial time. This is a mindboggling task. The best that has been done to date is to prove that a broad class of candidate non-p problems are all on the same footing--- if any one of them can be

3 Page 3 of 5 solved in polynomial time, then they all can. The problems involved here are said to have 'nondeterministic polynomial' running time: type NP. NP is not the same as non-p. A problem is NP if you can check whether a proposed solution actually is a solution in polynomial time. This is --- or at least, seems to be --- a much less stringent condition than being able to find that solution in polynomial time. My favourite example here is a jigsaw puzzle. Solving the puzzle can be very hard, but if someone claims they've solved it, it usually takes no more than a quick glance to check whether they're right. To get a quantitative estimate of the running time, just look at each piece in turn and make sure that it fits the limited number of neighbours that adjoin it. The number of calculations required to do this is roughly proportional to the number of pieces, so the check runs in polynomial time. But you can't solve the puzzle that way. Neither can you try every potential solution in turn and check each as you go along, because the number of potential solutions grows much faster than any fixed power of the number of pieces. It turns out that a lot of NP problems have 'equivalent' running times. Specifically, an NP problem is said to be NP-complete if the existence of a polynomial time solution for that problem implies that all NP problems have a polynomial time solution. Solve one in polynomial time, and you've solved them all in polynomial time. A vast range of problems are known to be NP-complete. The P=NP? problem asks whether types P and NP are (despite all appearances to the contrary) the same. The expected answer is 'no'. However, if any NP-complete problem turns out to be of type P--- to have a polynomial time solution--- than NP must equal P. We therefore expect all NPcomplete problems to be non-p, but no one can yet prove this. One of the simplest known NP-complete problems is SAT, the logical satisfiability of a Boolean condition. Boolean circuits are built from logic gates with names like AND, OR and NOT. The inputs to these circuits are either T (true) or F (false). Each gate accepts a number of inputs, and outputs the logical value of that combination. For instance an AND gate takes inputs p, q and outputs p AND q, which is T provided p and q are both T, and F otherwise. A NOT gate turns input T into output F and input F into output T. The SAT problem asks, for a given Boolean circuit, whether there exist choices of inputs that produce the output T. If this sounds easy, don't forget that a circuit may contain huge numbers of gates and have huge numbers of inputs. Fig.2 Impossible Minesweeper position. The link to the computer game comes when we introduce the Minesweeper Consistency Problem. This is not to find the mines, but to determine whether a given state of what purports to be a Minesweeper game is or is not logically consistent. For example, if during the state of play you encountered Fig.2, you would know that the programmer had made a mistake: there is no allocation of mines consistent with the information shown. Kaye proves that Minesweeper is equivalent to SAT, in the following sense. The SAT problem for a given Boolean circuit can be 'encoded' as a Minesweeper Consistency Problem for some position in the game, using a code procedure that runs in polynomial time. Therefore, if you could solve the Minesweeper

4 Page 4 of 5 Consistency Problem in polynomial time, you would have solved the SAT problem for that circuit in polynomial time. In other words, Minesweeper is NP-complete. So, if some bright spark finds a polynomial-time solution to Minesweeper, or alternately proves that no such solution exists, then the P=NP? problem is solved (one way or the other). Fig.3 A Minesweeper wire. Kaye's proof involves a systematic procedure for converting Boolean circuits into Minesweeper positions. Here a grid square has state T if it contains a mine, and F if not. The first step involves not gates, but the wires that connect them. Fig.3 shows a Minesweeper wire. All squares marked x either contain a mine (T) or do not contain a mine (F), but we don't know which. All squares marked x' do the opposite of x. You should check that all the numbers shown are correct whether x is T or F. The effect of the wire is to 'propagate' the signal T or F along its length, ready to be input into a gate. Fig.4 shows a NOT gate. The numbers marked on the block in the middle force an interchange of x and x' on the exit wire, compared to the input wire. Fig.4 The NOT gate. The AND gate (Fig. 5) is more complicated. Fig. 5 The AND gate. It has two input wires U, V, and one output W. To establish that this is an AND gate, we assume that the output is T and show that both inputs have to be T as well. Since the output is T, every symbol t must indicate a mine and every t' a non-mine. Now the 3 above and below a3 implies that a2 and a3 are mines, so a1 is not a mine, so s is a mine. Similarly, r is a mine. Then the central 4 already has four mines as neighbours, which implies that u' and v' are non-mines, so u and v are mines--- and this means that

5 Page 5 of 5 U and V have truth-value T. Conversely, if U and V have value T then so does W. In short, we have an AND gate as claimed. There's more to Minesweeper electronics than this--- for example, we need to be able to bend wires, split them, join them, or make them cross without connecting. Kaye solves all these problems, and other more subtle ones, in his article. The upshot is that solving the Minesweeper Consistency Problem is algorithmically equivalent to the SAT problem, and is thus NP-complete. To virtually every mathematician and computer scientist, this means that the Minesweeper Consistency Problem must be inherently hard. It is astonishing that such a simple game should have such intractable consequences, but mathematical games are like that. If you're interested in those million-dollar prizes, a word of warning. The Clay Institute imposes strict rules before it will accept a solution as being valid. In particular, it must be published by a major refereed journal, and it must have been 'generally accepted' by the mathematical community within two years of publication. But even if you're not going to tackle anything as daunting as that, you can have a lot of fun playing Minesweeper, secure in the knowledge that it encompasses one of the great unsolved problems of our age. Authoritative Minesweeper thanks Ian Stewart for permission to host this article. The original article appeared 1 Nov 2000 as one of seven popular lectures sponsored by the Clay Mathematics Institute. Richard Kaye at the University of Birmingham discovered Minesweeper to be NP-complete, his work being published as "Minesweeper is NP-complete" in The Mathematical Intelligencer, 22(2):9--15, Spring 2000.

CS 350 Algorithms and Complexity

CS 350 Algorithms and Complexity 1 CS 350 Algorithms and Complexity Fall 2015 Lecture 15: Limitations of Algorithmic Power Introduction to complexity theory Andrew P. Black Department of Computer Science Portland State University Lower

More information

CS 350 Algorithms and Complexity

CS 350 Algorithms and Complexity CS 350 Algorithms and Complexity Winter 2019 Lecture 15: Limitations of Algorithmic Power Introduction to complexity theory Andrew P. Black Department of Computer Science Portland State University Lower

More information

10.3: Intractability. Overview. Exponential Growth. Properties of Algorithms. What is an algorithm? Turing machine.

10.3: Intractability. Overview. Exponential Growth. Properties of Algorithms. What is an algorithm? Turing machine. Overview 10.3: Intractability What is an algorithm? Turing machine. What problems can be solved on a computer? Computability. What ALGORITHMS will be useful in practice? Analysis of algorithms. Which PROBLEMS

More information

Computational Complexity

Computational Complexity p. 1/24 Computational Complexity The most sharp distinction in the theory of computation is between computable and noncomputable functions; that is, between possible and impossible. From the example of

More information

Minesweeper is NP-Complete

Minesweeper is NP-Complete Minesweeper is NP-Complete Moti Ben-Ari Department of Science Teaching Weizmann Institute of Science http://www.weizmann.ac.il/sci-tea/benari/ c by Moti Ben-Ari. This work is licensed under the Creative

More information

2 n Minesweeper Consistency Problem is in P

2 n Minesweeper Consistency Problem is in P 2 n Minesweeper Consistency Problem is in P Shu-Chiung Hu Department of Computer Science, National Chiao Tung University linear.hu@gmail.com Abstract Minesweeper is a popular single-player game included

More information

P, NP, NP-Complete. Ruth Anderson

P, NP, NP-Complete. Ruth Anderson P, NP, NP-Complete Ruth Anderson A Few Problems: Euler Circuits Hamiltonian Circuits Intractability: P and NP NP-Complete What now? Today s Agenda 2 Try it! Which of these can you draw (trace all edges)

More information

Announcements. Friday Four Square! Problem Set 8 due right now. Problem Set 9 out, due next Friday at 2:15PM. Did you lose a phone in my office?

Announcements. Friday Four Square! Problem Set 8 due right now. Problem Set 9 out, due next Friday at 2:15PM. Did you lose a phone in my office? N P NP Completeness Announcements Friday Four Square! Today at 4:15PM, outside Gates. Problem Set 8 due right now. Problem Set 9 out, due next Friday at 2:15PM. Explore P, NP, and their connection. Did

More information

6.080 / Great Ideas in Theoretical Computer Science Spring 2008

6.080 / Great Ideas in Theoretical Computer Science Spring 2008 MIT OpenCourseWare http://ocw.mit.edu 6.080 / 6.089 Great Ideas in Theoretical Computer Science Spring 2008 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.

More information

CSCI3390-Lecture 17: A sampler of NP-complete problems

CSCI3390-Lecture 17: A sampler of NP-complete problems CSCI3390-Lecture 17: A sampler of NP-complete problems 1 List of Problems We now know that if L is any problem in NP, that L P SAT, and thus SAT is NP-hard. Since SAT is also in NP we find that SAT is

More information

Notes for Lecture 21

Notes for Lecture 21 U.C. Berkeley CS170: Intro to CS Theory Handout N21 Professor Luca Trevisan November 20, 2001 Notes for Lecture 21 1 Tractable and Intractable Problems So far, almost all of the problems that we have studied

More information

Classes of Problems. CS 461, Lecture 23. NP-Hard. Today s Outline. We can characterize many problems into three classes:

Classes of Problems. CS 461, Lecture 23. NP-Hard. Today s Outline. We can characterize many problems into three classes: Classes of Problems We can characterize many problems into three classes: CS 461, Lecture 23 Jared Saia University of New Mexico P is the set of yes/no problems that can be solved in polynomial time. Intuitively

More information

The Inductive Proof Template

The Inductive Proof Template CS103 Handout 24 Winter 2016 February 5, 2016 Guide to Inductive Proofs Induction gives a new way to prove results about natural numbers and discrete structures like games, puzzles, and graphs. All of

More information

Checkpoint Questions Due Monday, October 1 at 2:15 PM Remaining Questions Due Friday, October 5 at 2:15 PM

Checkpoint Questions Due Monday, October 1 at 2:15 PM Remaining Questions Due Friday, October 5 at 2:15 PM CS103 Handout 03 Fall 2012 September 28, 2012 Problem Set 1 This first problem set is designed to help you gain a familiarity with set theory and basic proof techniques. By the time you're done, you should

More information

Computer Science 385 Analysis of Algorithms Siena College Spring Topic Notes: Limitations of Algorithms

Computer Science 385 Analysis of Algorithms Siena College Spring Topic Notes: Limitations of Algorithms Computer Science 385 Analysis of Algorithms Siena College Spring 2011 Topic Notes: Limitations of Algorithms We conclude with a discussion of the limitations of the power of algorithms. That is, what kinds

More information

P P P NP-Hard: L is NP-hard if for all L NP, L L. Thus, if we could solve L in polynomial. Cook's Theorem and Reductions

P P P NP-Hard: L is NP-hard if for all L NP, L L. Thus, if we could solve L in polynomial. Cook's Theorem and Reductions Summary of the previous lecture Recall that we mentioned the following topics: P: is the set of decision problems (or languages) that are solvable in polynomial time. NP: is the set of decision problems

More information

The Game of Cubic is NP-complete Erich Friedman Stetson University

The Game of Cubic is NP-complete Erich Friedman Stetson University The Game of Cubic is NP-complete Erich Friedman Stetson University efriedma@stetson.edu Introduction In the puzzle solitaire game of Cubic, there are variously colored unit blocks in some configuration.

More information

Recap from Last Time

Recap from Last Time NP-Completeness Recap from Last Time Analyzing NTMs When discussing deterministic TMs, the notion of time complexity is (reasonably) straightforward. Recall: One way of thinking about nondeterminism is

More information

The P = NP Problem Bristol Teachers Circle, June P.D.Welch, University of Bristol

The P = NP Problem Bristol Teachers Circle, June P.D.Welch, University of Bristol The P = NP Problem Bristol Teachers Circle, June 26 2013 P.D.Welch, University of Bristol The Königsberg Bridge Problem - Euler = A graph version = As Euler observed: there can be no path crossing each

More information

Algorithms: COMP3121/3821/9101/9801

Algorithms: COMP3121/3821/9101/9801 NEW SOUTH WALES Algorithms: COMP3121/3821/9101/9801 Aleks Ignjatović School of Computer Science and Engineering University of New South Wales LECTURE 9: INTRACTABILITY COMP3121/3821/9101/9801 1 / 29 Feasibility

More information

NP-Completeness. Until now we have been designing algorithms for specific problems

NP-Completeness. Until now we have been designing algorithms for specific problems NP-Completeness 1 Introduction Until now we have been designing algorithms for specific problems We have seen running times O(log n), O(n), O(n log n), O(n 2 ), O(n 3 )... We have also discussed lower

More information

NP-Completeness I. Lecture Overview Introduction: Reduction and Expressiveness

NP-Completeness I. Lecture Overview Introduction: Reduction and Expressiveness Lecture 19 NP-Completeness I 19.1 Overview In the past few lectures we have looked at increasingly more expressive problems that we were able to solve using efficient algorithms. In this lecture we introduce

More information

1 Reductions and Expressiveness

1 Reductions and Expressiveness 15-451/651: Design & Analysis of Algorithms November 3, 2015 Lecture #17 last changed: October 30, 2015 In the past few lectures we have looked at increasingly more expressive problems solvable using efficient

More information

NP Complete Problems. COMP 215 Lecture 20

NP Complete Problems. COMP 215 Lecture 20 NP Complete Problems COMP 215 Lecture 20 Complexity Theory Complexity theory is a research area unto itself. The central project is classifying problems as either tractable or intractable. Tractable Worst

More information

7.8: Intractability. Overview. Exponential Growth. Properties of Algorithms. What is an algorithm? Turing machine.

7.8: Intractability. Overview. Exponential Growth. Properties of Algorithms. What is an algorithm? Turing machine. Overview 7.8: Intractability What is an algorithm? Turing machine. Which problems can be solved on a computer? Computability. Which ALGORITHMS will be useful in practice? Analysis of algorithms. Which

More information

The complexity of Minesweeper and strategies for game playing. Kasper Pedersen

The complexity of Minesweeper and strategies for game playing. Kasper Pedersen The complexity of Minesweeper and strategies for game playing Kasper Pedersen Department of Computer Science University of Warwick 2003-2004 Supervisor: Assessor: Dr Leslie A. Goldberg Dr Paul W. Goldberg

More information

NP-Completeness. Andreas Klappenecker. [based on slides by Prof. Welch]

NP-Completeness. Andreas Klappenecker. [based on slides by Prof. Welch] NP-Completeness Andreas Klappenecker [based on slides by Prof. Welch] 1 Prelude: Informal Discussion (Incidentally, we will never get very formal in this course) 2 Polynomial Time Algorithms Most of the

More information

Lecture 15 - NP Completeness 1

Lecture 15 - NP Completeness 1 CME 305: Discrete Mathematics and Algorithms Instructor: Professor Aaron Sidford (sidford@stanford.edu) February 29, 2018 Lecture 15 - NP Completeness 1 In the last lecture we discussed how to provide

More information

Chapter 1: Logic systems

Chapter 1: Logic systems Chapter 1: Logic systems 1: Logic gates Learning Objectives: At the end of this topic you should be able to: identify the symbols and truth tables for the following logic gates: NOT AND NAND OR NOR XOR

More information

CSCI3390-Lecture 18: Why is the P =?NP Problem Such a Big Deal?

CSCI3390-Lecture 18: Why is the P =?NP Problem Such a Big Deal? CSCI3390-Lecture 18: Why is the P =?NP Problem Such a Big Deal? The conjecture that P is different from NP made its way on to several lists of the most important unsolved problems in Mathematics (never

More information

NP-complete problems. CSE 101: Design and Analysis of Algorithms Lecture 20

NP-complete problems. CSE 101: Design and Analysis of Algorithms Lecture 20 NP-complete problems CSE 101: Design and Analysis of Algorithms Lecture 20 CSE 101: Design and analysis of algorithms NP-complete problems Reading: Chapter 8 Homework 7 is due today, 11:59 PM Tomorrow

More information

Topics in Complexity

Topics in Complexity Topics in Complexity Please evaluate this course on Axess! Your feedback really does make a difference. Applied Complexity Theory Complexity theory has enormous practical relevance across various domains

More information

Lecture 24: How to become Famous with P and NP

Lecture 24: How to become Famous with P and NP Lecture 4: How to become Famous with P and NP Agenda for today s class: The complexity class P The complexity class NP NP-completeness The P =? NP problem Major extra-credit problem (due: whenever) Fun

More information

NP-Completeness Review

NP-Completeness Review CS124 NP-Completeness Review Where We Are Headed Up to this point, we have generally assumed that if we were given a problem, we could find a way to solve it. Unfortunately, as most of you know, there

More information

MITOCW R11. Double Pendulum System

MITOCW R11. Double Pendulum System MITOCW R11. Double Pendulum System The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high quality educational resources for

More information

Limitations of Algorithm Power

Limitations of Algorithm Power Limitations of Algorithm Power Objectives We now move into the third and final major theme for this course. 1. Tools for analyzing algorithms. 2. Design strategies for designing algorithms. 3. Identifying

More information

INTRO TO COMPUTATIONAL COMPLEXITY

INTRO TO COMPUTATIONAL COMPLEXITY MA/CSSE 473 Day 38 Problems Decision Problems P and NP Polynomial time algorithms INTRO TO COMPUTATIONAL COMPLEXITY 1 The Law of the Algorithm Jungle Polynomial good, exponential bad! The latter is obvious,

More information

Recap from Last Time

Recap from Last Time P and NP Recap from Last Time The Limits of Decidability In computability theory, we ask the question What problems can be solved by a computer? In complexity theory, we ask the question What problems

More information

Algorithm Design and Analysis

Algorithm Design and Analysis Algorithm Design and Analysis LECTURES 30-31 NP-completeness Definition NP-completeness proof for CIRCUIT-SAT Adam Smith 11/3/10 A. Smith; based on slides by E. Demaine, C. Leiserson, S. Raskhodnikova,

More information

VIDEO Intypedia008en LESSON 8: SECRET SHARING PROTOCOL. AUTHOR: Luis Hernández Encinas. Spanish Scientific Research Council in Madrid, Spain

VIDEO Intypedia008en LESSON 8: SECRET SHARING PROTOCOL. AUTHOR: Luis Hernández Encinas. Spanish Scientific Research Council in Madrid, Spain VIDEO Intypedia008en LESSON 8: SECRET SHARING PROTOCOL AUTHOR: Luis Hernández Encinas Spanish Scientific Research Council in Madrid, Spain Hello and welcome to Intypedia. We have learned many things about

More information

Lesson 6: Algebra. Chapter 2, Video 1: "Variables"

Lesson 6: Algebra. Chapter 2, Video 1: Variables Lesson 6: Algebra Chapter 2, Video 1: "Variables" Algebra 1, variables. In math, when the value of a number isn't known, a letter is used to represent the unknown number. This letter is called a variable.

More information

1.1 P, NP, and NP-complete

1.1 P, NP, and NP-complete CSC5160: Combinatorial Optimization and Approximation Algorithms Topic: Introduction to NP-complete Problems Date: 11/01/2008 Lecturer: Lap Chi Lau Scribe: Jerry Jilin Le This lecture gives a general introduction

More information

ECS 120 Lesson 24 The Class N P, N P-complete Problems

ECS 120 Lesson 24 The Class N P, N P-complete Problems ECS 120 Lesson 24 The Class N P, N P-complete Problems Oliver Kreylos Friday, May 25th, 2001 Last time, we defined the class P as the class of all problems that can be decided by deterministic Turing Machines

More information

NP-Completeness Part II

NP-Completeness Part II NP-Completeness Part II Outline for Today Recap from Last Time What is NP-completeness again, anyway? 3SAT A simple, canonical NP-complete problem. Independent Sets Discovering a new NP-complete problem.

More information

Lecture 14 - P v.s. NP 1

Lecture 14 - P v.s. NP 1 CME 305: Discrete Mathematics and Algorithms Instructor: Professor Aaron Sidford (sidford@stanford.edu) February 27, 2018 Lecture 14 - P v.s. NP 1 In this lecture we start Unit 3 on NP-hardness and approximation

More information

CSC 421: Algorithm Design & Analysis. Spring 2018

CSC 421: Algorithm Design & Analysis. Spring 2018 CSC 421: Algorithm Design & Analysis Spring 2018 Complexity & Computability complexity theory tractability, decidability P vs. NP, Turing machines NP-complete, reductions approximation algorithms, genetic

More information

P vs. NP. Data Structures and Algorithms CSE AU 1

P vs. NP. Data Structures and Algorithms CSE AU 1 P vs. NP Data Structures and Algorithms CSE 373-18AU 1 Goals for today Define P, NP, and NP-complete Explain the P vs. NP problem -why it s the biggest open problem in CS. -And what to do when a problem

More information

Chapter Finding parse trees

Chapter Finding parse trees Chapter 16 NP Some tasks definitely require exponential time. That is, we can not only display an exponential-time algorithm, but we can also prove that the problem cannot be solved in anything less than

More information

DESIGN AND ANALYSIS OF ALGORITHMS. Unit 6 Chapter 17 TRACTABLE AND NON-TRACTABLE PROBLEMS

DESIGN AND ANALYSIS OF ALGORITHMS. Unit 6 Chapter 17 TRACTABLE AND NON-TRACTABLE PROBLEMS DESIGN AND ANALYSIS OF ALGORITHMS Unit 6 Chapter 17 TRACTABLE AND NON-TRACTABLE PROBLEMS http://milanvachhani.blogspot.in COMPLEXITY FOR THE IMPATIENT You are a senior software engineer in a large software

More information

Unit 6 Chapter 17 TRACTABLE AND NON-TRACTABLE PROBLEMS

Unit 6 Chapter 17 TRACTABLE AND NON-TRACTABLE PROBLEMS DESIGN AND ANALYSIS OF ALGORITHMS Unit 6 Chapter 17 TRACTABLE AND NON-TRACTABLE PROBLEMS http://milanvachhani.blogspot.in COMPLEXITY FOR THE IMPATIENT You are a senior software engineer in a large software

More information

Algorithm Design and Analysis

Algorithm Design and Analysis Algorithm Design and Analysis LECTURE 31 P and NP Self-reducibility NP-completeness Adam Smith 12/1/2008 S. Raskhodnikova; based on slides by K. Wayne Central ideas we ll cover Poly-time as feasible most

More information

Complexity Theory Part II

Complexity Theory Part II Complexity Theory Part II Time Complexity The time complexity of a TM M is a function denoting the worst-case number of steps M takes on any input of length n. By convention, n denotes the length of the

More information

MITOCW ocw f99-lec01_300k

MITOCW ocw f99-lec01_300k MITOCW ocw-18.06-f99-lec01_300k Hi. This is the first lecture in MIT's course 18.06, linear algebra, and I'm Gilbert Strang. The text for the course is this book, Introduction to Linear Algebra. And the

More information

CS103 Handout 09 Fall 2012 October 19, 2012 Problem Set 4

CS103 Handout 09 Fall 2012 October 19, 2012 Problem Set 4 CS103 Handout 09 Fall 2012 October 19, 2012 Problem Set 4 This fourth problem set explores propositional and first-order logic, along with its applications. Once you've completed it, you should have a

More information

Artificial Intelligence. 3 Problem Complexity. Prof. Dr. Jana Koehler Fall 2016 HSLU - JK

Artificial Intelligence. 3 Problem Complexity. Prof. Dr. Jana Koehler Fall 2016 HSLU - JK Artificial Intelligence 3 Problem Complexity Prof. Dr. Jana Koehler Fall 2016 Agenda Computability and Turing Machines Tractable and Intractable Problems P vs. NP Decision Problems Optimization problems

More information

15-451/651: Design & Analysis of Algorithms October 31, 2013 Lecture #20 last changed: October 31, 2013

15-451/651: Design & Analysis of Algorithms October 31, 2013 Lecture #20 last changed: October 31, 2013 15-451/651: Design & Analysis of Algorithms October 31, 2013 Lecture #20 last changed: October 31, 2013 In the last lecture, we defined the class NP and the notion of NP-completeness, and proved that the

More information

NP-Completeness Part One

NP-Completeness Part One NP-Completeness Part One Recap from Last Time The Limits of Efficient Computation P NP R P and NP Refresher The class P consists of all problems decidable in polynomial time. The class NP consists of all

More information

Introduction to Complexity Theory

Introduction to Complexity Theory Introduction to Complexity Theory Read K & S Chapter 6. Most computational problems you will face your life are solvable (decidable). We have yet to address whether a problem is easy or hard. Complexity

More information

Instructor N.Sadagopan Scribe: P.Renjith. Lecture- Complexity Class- P and NP

Instructor N.Sadagopan Scribe: P.Renjith. Lecture- Complexity Class- P and NP Indian Institute of Information Technology Design and Manufacturing, Kancheepuram Chennai 600 127, India An Autonomous Institute under MHRD, Govt of India http://www.iiitdm.ac.in COM 501 Advanced Data

More information

MITOCW ocw f99-lec09_300k

MITOCW ocw f99-lec09_300k MITOCW ocw-18.06-f99-lec09_300k OK, this is linear algebra lecture nine. And this is a key lecture, this is where we get these ideas of linear independence, when a bunch of vectors are independent -- or

More information

arxiv: v1 [cs.cc] 1 Feb 2016

arxiv: v1 [cs.cc] 1 Feb 2016 arxiv:6.98v [cs.cc] Feb 6 A Short Note on Improved Logic Circuits in a Hexagonal Minesweeper Seunghoon Lee Department of Mathematics, Seoul National University galaxybp@snu.ac.kr September, 8 Abstract

More information

MITOCW ocw f99-lec05_300k

MITOCW ocw f99-lec05_300k MITOCW ocw-18.06-f99-lec05_300k This is lecture five in linear algebra. And, it will complete this chapter of the book. So the last section of this chapter is two point seven that talks about permutations,

More information

Harvard CS 121 and CSCI E-121 Lecture 22: The P vs. NP Question and NP-completeness

Harvard CS 121 and CSCI E-121 Lecture 22: The P vs. NP Question and NP-completeness Harvard CS 121 and CSCI E-121 Lecture 22: The P vs. NP Question and NP-completeness Harry Lewis November 19, 2013 Reading: Sipser 7.4, 7.5. For culture : Computers and Intractability: A Guide to the Theory

More information

4/19/11. NP and NP completeness. Decision Problems. Definition of P. Certifiers and Certificates: COMPOSITES

4/19/11. NP and NP completeness. Decision Problems. Definition of P. Certifiers and Certificates: COMPOSITES Decision Problems NP and NP completeness Identify a decision problem with a set of binary strings X Instance: string s. Algorithm A solves problem X: As) = yes iff s X. Polynomial time. Algorithm A runs

More information

THE SIMPLE PROOF OF GOLDBACH'S CONJECTURE. by Miles Mathis

THE SIMPLE PROOF OF GOLDBACH'S CONJECTURE. by Miles Mathis THE SIMPLE PROOF OF GOLDBACH'S CONJECTURE by Miles Mathis miles@mileswmathis.com Abstract Here I solve Goldbach's Conjecture by the simplest method possible. I do this by first calculating probabilites

More information

A Note on Turing Machine Design

A Note on Turing Machine Design CS103 Handout 17 Fall 2013 November 11, 2013 Problem Set 7 This problem explores Turing machines, nondeterministic computation, properties of the RE and R languages, and the limits of RE and R languages.

More information

Chapter 2. Reductions and NP. 2.1 Reductions Continued The Satisfiability Problem (SAT) SAT 3SAT. CS 573: Algorithms, Fall 2013 August 29, 2013

Chapter 2. Reductions and NP. 2.1 Reductions Continued The Satisfiability Problem (SAT) SAT 3SAT. CS 573: Algorithms, Fall 2013 August 29, 2013 Chapter 2 Reductions and NP CS 573: Algorithms, Fall 2013 August 29, 2013 2.1 Reductions Continued 2.1.1 The Satisfiability Problem SAT 2.1.1.1 Propositional Formulas Definition 2.1.1. Consider a set of

More information

COP 4531 Complexity & Analysis of Data Structures & Algorithms

COP 4531 Complexity & Analysis of Data Structures & Algorithms COP 4531 Complexity & Analysis of Data Structures & Algorithms Lecture 18 Reductions and NP-completeness Thanks to Kevin Wayne and the text authors who contributed to these slides Classify Problems According

More information

NP and NP Completeness

NP and NP Completeness CS 374: Algorithms & Models of Computation, Spring 2017 NP and NP Completeness Lecture 23 April 20, 2017 Chandra Chekuri (UIUC) CS374 1 Spring 2017 1 / 44 Part I NP Chandra Chekuri (UIUC) CS374 2 Spring

More information

3: Linear Systems. Examples. [1.] Solve. The first equation is in blue; the second is in red. Here's the graph: The solution is ( 0.8,3.4 ).

3: Linear Systems. Examples. [1.] Solve. The first equation is in blue; the second is in red. Here's the graph: The solution is ( 0.8,3.4 ). 3: Linear Systems 3-1: Graphing Systems of Equations So far, you've dealt with a single equation at a time or, in the case of absolute value, one after the other. Now it's time to move to multiple equations

More information

SAT, NP, NP-Completeness

SAT, NP, NP-Completeness CS 473: Algorithms, Spring 2018 SAT, NP, NP-Completeness Lecture 22 April 13, 2018 Most slides are courtesy Prof. Chekuri Ruta (UIUC) CS473 1 Spring 2018 1 / 57 Part I Reductions Continued Ruta (UIUC)

More information

MITOCW ocw f99-lec17_300k

MITOCW ocw f99-lec17_300k MITOCW ocw-18.06-f99-lec17_300k OK, here's the last lecture in the chapter on orthogonality. So we met orthogonal vectors, two vectors, we met orthogonal subspaces, like the row space and null space. Now

More information

Principles of Computing, Carnegie Mellon University. The Limits of Computing

Principles of Computing, Carnegie Mellon University. The Limits of Computing The Limits of Computing Intractability Limits of Computing Announcement Final Exam is on Friday 9:00am 10:20am Part 1 4:30pm 6:10pm Part 2 If you did not fill in the course evaluations please do it today.

More information

Nondeterministic Turing Machines

Nondeterministic Turing Machines Nondeterministic Turing Machines Remarks. I The complexity class P consists of all decision problems that can be solved by a deterministic Turing machine in polynomial time. I The complexity class NP consists

More information

CS103 Handout 08 Spring 2012 April 20, 2012 Problem Set 3

CS103 Handout 08 Spring 2012 April 20, 2012 Problem Set 3 CS103 Handout 08 Spring 2012 April 20, 2012 Problem Set 3 This third problem set explores graphs, relations, functions, cardinalities, and the pigeonhole principle. This should be a great way to get a

More information

On the Computational Hardness of Graph Coloring

On the Computational Hardness of Graph Coloring On the Computational Hardness of Graph Coloring Steven Rutherford June 3, 2011 Contents 1 Introduction 2 2 Turing Machine 2 3 Complexity Classes 3 4 Polynomial Time (P) 4 4.1 COLORED-GRAPH...........................

More information

A Working Knowledge of Computational Complexity for an Optimizer

A Working Knowledge of Computational Complexity for an Optimizer A Working Knowledge of Computational Complexity for an Optimizer ORF 363/COS 323 Instructor: Amir Ali Ahmadi 1 Why computational complexity? What is computational complexity theory? It s a branch of mathematics

More information

MITOCW ocw-18_02-f07-lec02_220k

MITOCW ocw-18_02-f07-lec02_220k MITOCW ocw-18_02-f07-lec02_220k The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high quality educational resources for free.

More information

CSC 1700 Analysis of Algorithms: P and NP Problems

CSC 1700 Analysis of Algorithms: P and NP Problems CSC 1700 Analysis of Algorithms: P and NP Problems Professor Henry Carter Fall 2016 Recap Algorithmic power is broad but limited Lower bounds determine whether an algorithm can be improved by more than

More information

NP-Complete Problems. More reductions

NP-Complete Problems. More reductions NP-Complete Problems More reductions Definitions P: problems that can be solved in polynomial time (typically in n, size of input) on a deterministic Turing machine Any normal computer simulates a DTM

More information

Direct Proof and Counterexample I:Introduction

Direct Proof and Counterexample I:Introduction Direct Proof and Counterexample I:Introduction Copyright Cengage Learning. All rights reserved. Goal Importance of proof Building up logic thinking and reasoning reading/using definition interpreting :

More information

4/22/12. NP and NP completeness. Efficient Certification. Decision Problems. Definition of P

4/22/12. NP and NP completeness. Efficient Certification. Decision Problems. Definition of P Efficient Certification and completeness There is a big difference between FINDING a solution and CHECKING a solution Independent set problem: in graph G, is there an independent set S of size at least

More information

Direct Proof and Counterexample I:Introduction. Copyright Cengage Learning. All rights reserved.

Direct Proof and Counterexample I:Introduction. Copyright Cengage Learning. All rights reserved. Direct Proof and Counterexample I:Introduction Copyright Cengage Learning. All rights reserved. Goal Importance of proof Building up logic thinking and reasoning reading/using definition interpreting statement:

More information

Some unsolved problems in mathematics and computation

Some unsolved problems in mathematics and computation Some unsolved problems in mathematics and computation Dartmouth College Odyssey Series - JHU Center for Talented Youth - 10/4/14 Mathematics is... 1. Universal It is the same in any place of the world

More information

NP-completeness. Chapter 34. Sergey Bereg

NP-completeness. Chapter 34. Sergey Bereg NP-completeness Chapter 34 Sergey Bereg Oct 2017 Examples Some problems admit polynomial time algorithms, i.e. O(n k ) running time where n is the input size. We will study a class of NP-complete problems

More information

COMP Analysis of Algorithms & Data Structures

COMP Analysis of Algorithms & Data Structures COMP 3170 - Analysis of Algorithms & Data Structures Shahin Kamali Computational Complexity CLRS 34.1-34.4 University of Manitoba COMP 3170 - Analysis of Algorithms & Data Structures 1 / 50 Polynomial

More information

Week 2: Defining Computation

Week 2: Defining Computation Computational Complexity Theory Summer HSSP 2018 Week 2: Defining Computation Dylan Hendrickson MIT Educational Studies Program 2.1 Turing Machines Turing machines provide a simple, clearly defined way

More information

Instructor N.Sadagopan Scribe: P.Renjith

Instructor N.Sadagopan Scribe: P.Renjith Indian Institute of Information Technology Design and Manufacturing, Kancheepuram Chennai 600 127, India An Autonomous Institute under MHRD, Govt of India http://www.iiitdm.ac.in COM 501 Advanced Data

More information

6: Polynomials and Polynomial Functions

6: Polynomials and Polynomial Functions 6: Polynomials and Polynomial Functions 6-1: Polynomial Functions Okay you know what a variable is A term is a product of constants and powers of variables (for example: x ; 5xy ) For now, let's restrict

More information

DIFFERENTIAL EQUATIONS

DIFFERENTIAL EQUATIONS DIFFERENTIAL EQUATIONS Basic Concepts Paul Dawkins Table of Contents Preface... Basic Concepts... 1 Introduction... 1 Definitions... Direction Fields... 8 Final Thoughts...19 007 Paul Dawkins i http://tutorial.math.lamar.edu/terms.aspx

More information

The Beauty and Joy of Computing

The Beauty and Joy of Computing The Beauty and Joy of Computing Lecture #23 Limits of Computing UC Berkeley EECS Sr Lecturer SOE Dan You ll have the opportunity for extra credit on your project! After you submit it, you can make a 5min

More information

6.080/6.089 GITCS Apr 15, Lecture 17

6.080/6.089 GITCS Apr 15, Lecture 17 6.080/6.089 GITCS pr 15, 2008 Lecturer: Scott aronson Lecture 17 Scribe: dam Rogal 1 Recap 1.1 Pseudorandom Generators We will begin with a recap of pseudorandom generators (PRGs). s we discussed before

More information

Lecture Notes Each circuit agrees with M on inputs of length equal to its index, i.e. n, x {0, 1} n, C n (x) = M(x).

Lecture Notes Each circuit agrees with M on inputs of length equal to its index, i.e. n, x {0, 1} n, C n (x) = M(x). CS 221: Computational Complexity Prof. Salil Vadhan Lecture Notes 4 February 3, 2010 Scribe: Jonathan Pines 1 Agenda P-/NP- Completeness NP-intermediate problems NP vs. co-np L, NL 2 Recap Last time, we

More information

intro to the theory of computation

intro to the theory of computation intro to the theory of computation Instructor: Prof. James R. Lee TA: Yiqing Ai CSE 431 Winter 2018 Course web page: http://www.cs.washington.edu/cse431 Sign up for the mailing list! Textbook: Primary:

More information

Limits of Computation. Antonina Kolokolova

Limits of Computation. Antonina Kolokolova Limits of Computation Antonina Kolokolova What is computation? What is information? What is learning? Are there any limits of our ability to solve problems? Theoretical Computer Science Is there a perfect

More information

Discrete Mathematics and Probability Theory Spring 2016 Rao and Walrand Note 1

Discrete Mathematics and Probability Theory Spring 2016 Rao and Walrand Note 1 CS 70 Discrete Mathematics and Probability Theory Spring 2016 Rao and Walrand Note 1 1 A Brief Introduction Welcome to Discrete Math and Probability Theory! You might be wondering what you ve gotten yourself

More information

Guide to Negating Formulas

Guide to Negating Formulas Guide to Negating Formulas Hi everybody! We spent a little bit of time in class talking about how to negate formulas in propositional or frst-order logic. This is a really valuable skill! If you ever need

More information

P, NP, NP-Complete, and NPhard

P, NP, NP-Complete, and NPhard P, NP, NP-Complete, and NPhard Problems Zhenjiang Li 21/09/2011 Outline Algorithm time complicity P and NP problems NP-Complete and NP-Hard problems Algorithm time complicity Outline What is this course

More information

Algorithms and Theory of Computation. Lecture 22: NP-Completeness (2)

Algorithms and Theory of Computation. Lecture 22: NP-Completeness (2) Algorithms and Theory of Computation Lecture 22: NP-Completeness (2) Xiaohui Bei MAS 714 November 8, 2018 Nanyang Technological University MAS 714 November 8, 2018 1 / 20 Set Cover Set Cover Input: a set

More information