THE HALTING PROBLEM. Joshua Eckroth Chautauqua Nov

Similar documents
Lambda Calculus and Computation

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

Chapter 12. Computability Mechanizing Reasoning

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

Introduction to Computer Science

Introduction to the Lambda Calculus. Chris Lomont

Programming Proofs and Proving Programs. Nick Benton Microsoft Research, Cambridge

The Eval/Apply Cycle Eval. Evaluation and universal machines. Examining the role of Eval. Eval from perspective of language designer

Kurt Gödel and Computability Theory

Theory of Programming Languages COMP360

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

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.

Menu. Lecture 25: Gödel and Computability. Computability. Proof General Idea. Gödel s Statement

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

λ-calculus Lecture 1 Venanzio Capretta MGS Nottingham

The λ-calculus. 1 Background on Computability. 2 Some Intuition for the λ-calculus. 1.1 Alan Turing. 1.2 Alonzo Church

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

Unsolvable Problems Do Not Exist Only the Absence of Input Prevents Calculation

SJTU SUMMER 2014 SOFTWARE FOUNDATIONS. Dr. Michael Clarkson

Computation Club: Gödel s theorem

Computability Mechanizing Reasoning

Computability Mechanizing Reasoning

The Undecidable and the Unprovable

Notes on Turing s Theorem and Computability

Epimenides, Gödel, Turing: an Eternal Gölden Tangle [0]

Simple Lisp. Alonzo Church. John McCarthy. Turing. David Hilbert, Jules Richard, G. G. Berry, Georg Cantor, Bertrand Russell, Kurt Gödel, Alan

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

Course notes for Data Compression - 2 Kolmogorov complexity Fall 2005

What computers just cannot do. COS 116: 2/28/2008 Sanjeev Arora

Programming Languages!

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

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

Material from Recitation 1

Machine-checked proofs of program correctness

Denotational semantics

Recursively Enumerable Languages, Turing Machines, and Decidability

Rice s Theorem and Enumeration

Announcements. CSCI 334: Principles of Programming Languages. Exam Study Session: Monday, May pm TBL 202. Lecture 22: Domain Specific Languages

Programming Languages and Techniques (CIS120)

Computability Summary

05. Turing Machines and Spacetime. I. Turing Machines and Classical Computability.

CSE 120. Computer Science Principles

Formal Methods of Software Design, Eric Hehner, segment 1 page 1 out of 5

Activity. CSCI 334: Principles of Programming Languages. Lecture 4: Fundamentals II. What is computable? What is computable?

MATH Iris Loeb.

Mathematics for Computer Scientists 2 (G52MC2)

Lecture 5: The Halting Problem. Michael Beeson

Theory of Languages and Automata

INDEPENDENT POSTULATES FOR THE "INFORMAL" PART OF PRINCIPIA MATHEMATICA*

Software System Design and Implementation

Interpretations and Models. Chapter Axiomatic Systems and Incidence Geometry

Software System Design and Implementation

MAT 7003 : Mathematical Foundations. (for Software Engineering) J Paul Gibson, A207.

λ calculus is inconsistent

CISC 4090 Theory of Computation

λ calculus Function application Untyped λ-calculus - Basic Idea Terms, Variables, Syntax β reduction Advanced Formal Methods

The λ-calculus. 1 Background on Computability. 2 Programming Paradigms and Functional Programming. 1.1 Alan Turing. 1.

Variants of Turing Machines

Lecture T4: Computability

CS-XXX: Graduate Programming Languages. Lecture 9 Simply Typed Lambda Calculus. Dan Grossman 2012

What if current foundations of mathematics are inconsistent? Vladimir Voevodsky September 25, 2010

COMP 4161 NICTA Advanced Course. Advanced Topics in Software Verification. Toby Murray, June Andronick, Gerwin Klein

Computer Sciences Department

Functional Languages. Hwansoo Han

HW1. Due: September 13, 2018

arxiv: v2 [cs.lo] 29 Sep 2015

The semantics of a programming language is concerned with the meaning of programs, that is, how programs behave when executed on computers.

On Meaning Preservation of a Calculus of Records

Discrete Mathematics Lecture 4. Harper Langston New York University

Computer Science. 18. Turing Machines. 18. Turing Machines. Computer Science Pioneering work at Princeton in the 1930s.

INTLOGS17 Test 1. Prof: S Bringsjord TA: Rini Palamittam NY

Notes for Recitation 8

Objective and Subjective Specifications

p x i 1 i n x, y, z = 2 x 3 y 5 z

n λxy.x n y, [inc] [add] [mul] [exp] λn.λxy.x(nxy) λmn.m[inc]0 λmn.m([add]n)0 λmn.n([mul]m)1

the Computability Hierarchy

CMSC 330: Organization of Programming Languages. Lambda Calculus Encodings

CSE 105 THEORY OF COMPUTATION

1.3. Conditional expressions To express case distinctions like

Big numbers, graph coloring, and Herculesʼ battle with the hydra

In order to solve the puzzle, you try to form the string MU starting with the string MI and using the following rules for forming new strings from old

5. Introduction to the Lambda Calculus. Oscar Nierstrasz

CMSC 330: Organization of Programming Languages

CSE 105 THEORY OF COMPUTATION

In this section we will study problems for which we can prove that there is no algorithm solving them.

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

A Theory of Parallel Computation The π-calculus

COMPUTABILITY THEORY AND RECURSIVELY ENUMERABLE SETS

The Lambda Calculus. notes by Don Blaheta. October 12, A little bondage is always a good thing. sk

Knowledge Representation and Reasoning Logics for Artificial Intelligence

Topic 1: What is HoTT and why?

Concepts of programming languages

Typing Control. Chapter Conditionals

Formal Systems and their Applications

STRUCTURES AND STRATEGIES FOR STATE SPACE SEARCH

CS 374: Algorithms & Models of Computation

From the λ-calculus to Functional Programming Drew McDermott Posted

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

CSC 501 Semantics of Programming Languages

Critical Analysis of Computer Science Methodology: Theory

Transcription:

THE HALTING PROBLEM Joshua Eckroth Chautauqua Nov 10 2015

The year is 1928 Sliced bread is invented. Calvin Coolidge is President. David Hilbert challenged mathematicians to solve the Entscheidungsproblem: Is there an algorithm that can determine whether or not any arbitrary statement of logic is provable or not given a set of logical premises?

Why did Hilbert ask? 1910-1913, Principia Mathematica is published by Whitehead and Russell. It was an attempt to describe a set of axioms and inference rules in symbolic logic from which all mathematical truths could in principle be proven. (Wikipedia)

The year is 1931 Kurt Gödel proves two things: First Incompleteness Theorem: for any consistent theory of mathematics, one can construct a mathematical statement that is true but not provable. Crazy technique: This statement cannot be proved in the theory. If the statement can be proved, it is false (which is inconsistent), and if it cannot be proved, it is true but the theory is incomplete (cannot prove all true things). Second Incompleteness Theorem: If a theory contains a statement about its own consistency, then the theory is inconsistent. So, no theory can provide proof of its own consistency.

Turing s proof of the Entscheidungsproblem (1936) Using a similar technique (self-reference), Turing proved Hilbert s decision problem cannot be solved. Turing invented Turing Machines to assist with his proof. Turing Machines are still the foundation of computer science; every computer you ve ever met is a Turing Machine. Alonzo Church proved the same result independently at the same time, using the Lambda Calculus instead of Turing Machines.

Turing reformulated the problem as The Halting Problem Does this program ever quit?

A fancy analyzer of programs Suppose we have a function, FancyAnalyze(P, s) that can do the following: Analyze how P (represented as source code) behaves on input string s (without actually simulating P). P only says Yes or No. If P(s) would have halted with Yes, then FancyAnalyze returns Yes. If P(s) would have halted with No, then FancyAnalyze returns No. If FancyAnalyze determines that P(s) would get stuck in an infinite loop, then FancyAnalyze returns Loops. Could a fancy programmer write FancyAnalyze? (Hint: No.)

Using FancyAnalyze to create a self-decider P-yes is a program that identifies those programs that say Yes to their own source code: Program P-yes(s): Answer ß FancyAnalyze(s, s) If Answer = Yes then return Yes Else If Answer = No or Answer = Loops then return No

Applying P-yes to itself P-yes(P-yes): Answer ß FancyAnalyze(P-yes, P-yes) FancyAnalyze code: If Answer = Yes then return Yes if P-yes(P-yes) halts with Yes, return Yes else if P-yes(P-yes) halts with No, return No else if P-yes(P-yes) loops forever, return Loops Else If Answer = No or Answer = Loops then return No

A quick self-check What does P-yes do on its own source code? If FancyAnalyze(P-yes, P-yes) returns Yes, then P-yes(P-yes) returns Yes. If FancyAnalyze(P-yes, P-yes) returns No ( Loop is impossible), then P-yes(P-yes) returns No. Loop is impossible output of FancyAnalyze(P-yes, P-yes) because the P-yes program always just says Yes or No without any loops.

A quick self-check (in other words) What does P-yes do on its own source code? If P-yes(P-yes) returns Yes (as determined by FancyAnalyze), then P-yes(P-yes) returns Yes. (duh) If P-yes(P-yes) returns No (as determined by FancyAnalyze), then P-yes(P-yes) returns No. (duh)

A backwards self-decider (why not?) Program P-no(s): Answer ß FancyAnalyze(s, s) If Answer = Yes then return No Else If Answer = No or Answer = Loops then return Yes If you believed we could write P-yes, you have to allow P-no.

The sucker punch What does P-no do on its own source code? If FancyAnalyze(P-no, P-no) returns Yes, then P-no(P-no) returns No. If FancyAnalyze(P-no, P-no) returns No, then P-no(P-no) returns Yes.

The sucker punch (in other words) What does P-no do on its own source code? If P-no(P-no) returns Yes (as determined by FancyAnalyze), then P-no(P-no) returns No (!!) If P-no(P-no) returns No (as determined by FancyAnalyze), then P-no(P-no) returns Yes (!!)

So, uh FancyAnalyze cannot exist. P-yes wasn t the problem. It was a trivial program. P-no wasn t the problem. It was a trivial program.

So, uh Thus, You cannot write a algorithm that is capable of determining if any arbitrary program behaves a certain way. Because, if you tried, We could just write a variant of that algorithm that behaved contradictory to the expected behavior in the special case when it is applied to itself. In other words, we could make the algorithm appear to contradict itself in at least one special scenario (when it is applied to its own code). No matter what the algorithm is trying to determine about arbitrary programs!

Implications No program can do any of the following: Determine if some arbitrary program prints a particular message (e.g., program verification). Determine if some particular line of code in some arbitrary program ever executes. Determine if some arbitrary program has any infinite loops.

Implications No program can do any of the following: Given two programs, determine if they are equivalent in behavior. Determine if any arbitrary program ever throws a NullPointerException. Rice s Theorem: For any non-trivial property of a program, determine if any arbitrary program has that property. Non-trivial means some programs have the property and some don t.

Implications No program can do any of the following: Given two programs, determine if they are equivalent in behavior. Determine if any arbitrary program ever throws a NullPointerException. Rice s Theorem: For any non-trivial property of a program, determine if any arbitrary program has that property. Non-trivial means some programs have the property and some don t.

Derek Jacobi as Alan Turing https://www.youtube.com/watch?v=gv67sj2jkvg