UNIT 14C The Limits of Computing: Non computable Functions. Problem Classifications

Similar documents
Chapter 3. Set Theory. 3.1 What is a Set?

Material from Recitation 1

CSE 505: Programming Languages. Lecture 10 Types. Zach Tatlock Winter 2015

How to Compute Halting

Why Types Matter. Zheng Gao CREST, UCL

This Lecture. We will first introduce some basic set theory before we do counting. Basic Definitions. Operations on Sets.

CSCI 270: Introduction to Algorithms and Theory of Computing Fall 2017 Prof: Leonard Adleman Scribe: Joseph Bebel

CSE 120. Computer Science Principles

Computability, Cantor s diagonalization, Russell s Paradox, Gödel s s Incompleteness, Turing Halting Problem.

COMP Logic for Computer Scientists. Lecture 17

Discrete Mathematics Lecture 4. Harper Langston New York University

Automated Reasoning Systems

Chapter 12. Computability Mechanizing Reasoning

The Undecidable and the Unprovable

Turing Machine Languages

THEORY OF COMPUTATION

CS61A Lecture 38. Robert Huang UC Berkeley April 17, 2013

NP and computational intractability. Kleinberg and Tardos, chapter 8

Limitations of Algorithmic Solvability In this Chapter we investigate the power of algorithms to solve problems Some can be solved algorithmically and

the Computability Hierarchy

CS 275 Automata and Formal Language Theory. First Problem of URMs. (a) Definition of the Turing Machine. III.3 (a) Definition of the Turing Machine

CPSC 467b: Cryptography and Computer Security

CS103 Handout 50 Fall 2018 November 30, 2018 Problem Set 9

Lecture T4: Computability

Final Exam May 8, 2018

Name: CS 341 Practice Final Exam. 1 a 20 b 20 c 20 d 20 e 20 f 20 g Total 207

Today, we will dispel the notion that Java is a magical language that allows us to solve any problem we want if we re smart enough.

Lecture 15: Algorithms. AP Computer Science Principles

What is a Procedure?

System Correctness. EEC 421/521: Software Engineering. System Correctness. The Problem at Hand. A system is correct when it meets its requirements

Fuzzy Reasoning. Outline

Binary Search and Worst-Case Analysis

Notes on Turing s Theorem and Computability

Computer Sciences Department

8.1 Polynomial-Time Reductions

Fixed Parameter Algorithms

Reductions. Linear Time Reductions. Desiderata. Reduction. Desiderata. Classify problems according to their computational requirements.

Lecture 5: The Halting Problem. Michael Beeson

CS 4349 Lecture October 18th, 2017

Theory of Programming Languages COMP360

Halting misconceived?

20 Models Of Computation

Reductions and Satisfiability

Programming Languages and Techniques (CIS120)

Theory of Computation, Homework 3 Sample Solution

Algorithms, Computer Systems, and Programming Languages

Lambda Calculus and Computation

NP Completeness. Andreas Klappenecker [partially based on slides by Jennifer Welch]

CSE 417 Network Flows (pt 2) Modeling with Max Flow

Presented By : Abhinav Aggarwal CSI-IDD, V th yr Indian Institute of Technology Roorkee. Joint work with: Prof. Padam Kumar

University of Nevada, Las Vegas Computer Science 456/656 Fall 2016

CS/ENGRD 2110 Object-Oriented Programming and Data Structures Spring 2012 Thorsten Joachims. Lecture 10: Asymptotic Complexity and

Does this program exist? Limits of computability. Does this program exist? A helper function. For example, if the string program is

UNIVERSITY of OSLO. Faculty of Mathematics and Natural Sciences. INF 4130/9135: Algoritmer: Design og effektivitet Date of exam: 14th December 2012

Recursively Enumerable Languages, Turing Machines, and Decidability

Diagonalization. The cardinality of a finite set is easy to grasp: {1,3,4} = 3. But what about infinite sets?

! Greed. O(n log n) interval scheduling. ! Divide-and-conquer. O(n log n) FFT. ! Dynamic programming. O(n 2 ) edit distance.

Basic Combinatorics. Math 40210, Section 01 Fall Homework 4 Solutions

In Our Last Exciting Episode

Course notes for Data Compression - 2 Kolmogorov complexity Fall 2005

Objective and Subjective Specifications

8.1 Polynomial-Time Reductions

Einführung in die Programmierung Introduction to Programming

Distributed Algorithms 6.046J, Spring, Nancy Lynch

Computability Mechanizing Reasoning

Java s Precedence. Extended Grammar for Boolean Expressions: Implication. Parse tree. Highest precedence. Lowest precedence

Typing Control. Chapter Conditionals

Computability Mechanizing Reasoning

Resolution (14A) Young W. Lim 6/14/14

CSE P 501 Exam 8/5/04

Chapter 8. NP and Computational Intractability. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

Introduction to Computer Science

1. [5 points each] True or False. If the question is currently open, write O or Open.

Artificial Intelligence Lecture 1

6.045J/18.400J: Automata, Computability and Complexity. Practice Quiz 2

COMP260 Spring 2014 Notes: February 4th

P = NP; P NP. Intuition of the reduction idea:

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF

Theory of Computations Spring 2016 Practice Final Exam Solutions

Cardinality of Sets MAT231. Fall Transition to Higher Mathematics. MAT231 (Transition to Higher Math) Cardinality of Sets Fall / 15

Chapter 9 Graph Algorithms

Simply-Typed Lambda Calculus

! Greed. O(n log n) interval scheduling. ! Divide-and-conquer. O(n log n) FFT. ! Dynamic programming. O(n 2 ) edit distance.

Binary Search and Worst-Case Analysis

How convincing is our Halting Problem proof? Lecture 36: Modeling Computing. Solutions. DrScheme. What is a model? Modeling Computation

Enumerations and Turing Machines

11/22/2016. Chapter 9 Graph Algorithms. Introduction. Definitions. Definitions. Definitions. Definitions

(How Not To Do) Global Optimizations

Chapter 9 Graph Algorithms

Discrete Mathematics and Probability Theory Fall 2016 Seshia and Walrand Midterm 1

COMP4418 Knowledge Representation and Reasoning

Time Complexity of an Algorithm

Problems, Algorithms, Programs

Introduction to Algorithms / Algorithms I Lecturer: Michael Dinitz Topic: Approximation algorithms Date: 11/18/14

Chapter 9 Graph Algorithms

Fall Recursion and induction. Stephen Brookes. Lecture 4

COMMENTS. AC-1: AC-1 does not require all processes to reach a decision It does not even require all correct processes to reach a decision

Second-Order Type Systems

Lecture 20 : Trees DRAFT

Chapter 16: Greedy Algorithm

Transcription:

UNIT 14C The Limits of Computing: Non computable Functions 1 Problem Classifications Tractable Problems Problems that have reasonable, polynomialtime solutions Intractable Problems Problems that may have no reasonable, polynomial time solutions Noncomputable Problems Problems that have no algorithms at all to solve them 2 1

Today s Lecture We will look the Halting Problem that is a canonical problem in the study of limits of computing. We will show using proof by contradiction that it cannot be solved Along the way, we will think about termination and programs that have some form of self reference. 3 The Barber Paradox Suppose there is a town with just one barber, who is male. In this town, every man keeps himself clean shaven, and he does so by doing exactly one of two things: 1. Shaving himself, or 2. Going to the barber. Another way to state this is: The barber is a man in town who shaves those and only those men in town who do not shave themselves. Who shaves the barber? 4 2

Program Termination Can we determine if a program will terminate given a valid input? Example: def mystery1(x) while (x!= 1) do x = x 2 end end oes this algorithm terminate when x = 15? oes this algorithm terminate when x = 110? 5 Another Example def mystery2(x) while (x!= 1) do if x % 2 == 0 then x = x / 2 else x = 3 * x + 1 end end oes this algorithm terminate when x = 15? oes this algorithm terminate when x = 110? oes this algorithm terminate for any positive x? 6 3

The Halting Problem oes a universal program H exist that can take any program P and any input I for program P and determine if P terminates/halts when run with input I? Alan Turing showed that such a universal program H cannot exist. This is known as the Halting Problem. 7 Proof by Contradiction (example) Suppose you want to prove the proposition One cannot get an A in this course without doing the homeworks. 1. You first assume the opposite: One can get an A in this course without doing the homeworks. 2. From that assumption and using what you know about the course you arrive at a conclusion, which is not true (e.g. Homeworks are worth less than 10%). 3. Since you know that this conclusion is false (contradicts with what is known), the initial assumption must be wrong. One can get an A in this course without doing the homeworks. Must be false false f8 4

Proof by Contradiction (first step) Assume a program H exists that requires a program P and an input I. H determines if program P will halt when P is executed using input I. P I H HALT CHECKER YES NO H outputs YES if P halts when run with input I H outputs NO if P does not halt when run with input I We will show that H cannot exist by showing that if it did exist we would get a logical contradiction. 9 Programs Computing with Their Own Representation A compiler is a program that takes as its input a program that needs to be translated from a high level language (e.g. Ruby) to a low level language (e.g. machine language). In general, a program can process any data, so it can have a program as its input to process. Can a compiler compile itself? YES! 10 5

Proof (cont d) Let be a program that takes input <M> where <M> is a program description. asks the halt checker H what happens if M runs with itself <M> as input? If H answers that M will halt if it runs with itself as input, then goes into an infinite loop (and does not halt). If H answers that M will not halt if it runs with itself as input, then halts. 11 How Works M M M H HALT CHECKER YES NO OK asks H what happens if we run program M on with input <M>. Loops if it says yes. Stops and returns OK if it says no. 12 6

gets evil What happens if tests itself? If H answers yes ( halts), then goes into an infinite loop and does not halt. H HALT CHECKER YES NO OK 13 Proof By Contradiction (last step) What happens if tests itself? If does not halt on <>, then halts on <>. If halts on <>, then does not halt on <>. contradiction H HALT CHECKER YES NO OK 14 7

Contradiction No matter what H answers about, does the opposite, so H can never answer the halting problem for the specific program. Therefore, a universal halting checker H cannot exist. We can never write a computer program that determines if ANY program halts with ANY input. It doesn t matter how powerful the computer is. It doesn t matter how much time we devote to the computation. 15 Why Is Halting Problem Special? One of the first problems to be shown to be noncomputable (i.e. undecidable, unsolveable) A problem can be shown to be noncomputable by transforming the halting problem into that problem For example, a virus detection software cannot detect if a program is a virus for all possible programs. To be computable, they need to give up correctness for some cases. 16 8

What Should You Know? The fact that there are limits to what we can compute at all and what we can compute efficiently. What do we mean when we call a problem tractible/intractable? What do we mean when we call a problem solveable (i.e. computable) vs. unsolveable (noncomputable)? What the question N vs. NP is about. Name some NP complete problems and reason about the work needed to solve them using brute force algorithms. The fact that Halting Problem is unsolveable and that there are many others that are unsolveable. 17 9