Computability, Undeciability and the Halting Problem

Similar documents
Undecidability COMS Ashley Montanaro 4 April Department of Computer Science, University of Bristol Bristol, UK

CSCI3390-Lecture 6: An Undecidable Problem

CSCE 551: Chin-Tser Huang. University of South Carolina

Turing Machines Part III

ECS 120 Lesson 18 Decidable Problems, the Halting Problem

Undecidability. Andreas Klappenecker. [based on slides by Prof. Welch]

Undecidability. We are not so much concerned if you are slow as when you come to a halt. (Chinese Proverb)

15-251: Great Theoretical Ideas in Computer Science Lecture 7. Turing s Legacy Continues

Decidability: Church-Turing Thesis

Automata & languages. A primer on the Theory of Computation. Laurent Vanbever. ETH Zürich (D-ITET) October,

Decidability. Human-aware Robotics. 2017/10/31 Chapter 4.1 in Sipser Ø Announcement:

15-251: Great Theoretical Ideas in Computer Science Fall 2016 Lecture 6 September 15, Turing & the Uncomputable

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

CSE 4111/5111/6111 Computability Jeff Edmonds Assignment 3: Diagonalization & Halting Problem Due: One week after shown in slides

Decidable Languages - relationship with other classes.

ACS2: Decidability Decidability

Undecibability. Hilbert's 10th Problem: Give an algorithm that given a polynomial decides if the polynomial has integer roots or not.

Turing Machines, diagonalization, the halting problem, reducibility

Section 14.1 Computability then else

Discrete Mathematics for CS Spring 2007 Luca Trevisan Lecture 27

Lecture Notes: The Halting Problem; Reductions

Undecidability. Almost all Languages are undecidable. Question: Is it just weird languages that no one would care about which are undecidable?

CS20a: Turing Machines (Oct 29, 2002)

Decision Problems with TM s. Lecture 31: Halting Problem. Universe of discourse. Semi-decidable. Look at following sets: CSCI 81 Spring, 2012

Turing Machine Recap

COMP/MATH 300 Topics for Spring 2017 June 5, Review and Regular Languages

CSE 311: Foundations of Computing. Lecture 27: Undecidability

A Note on Turing Machine Design

Understanding Computation

CPSC 421: Tutorial #1

Automata Theory CS S-FR2 Final Review

Turing Machines Part II

Turing s Legacy Continues

Warm-Up Problem. Please fill out your Teaching Evaluation Survey! Please comment on the warm-up problems if you haven t filled in your survey yet.

The Unsolvability of the Halting Problem. Chapter 19

Computability Theory. CS215, Lecture 6,

Intro to Theory of Computation

Turing Machines. Lecture 8

CSE 105 THEORY OF COMPUTATION

CS 275 Automata and Formal Language Theory

Harvard CS 121 and CSCI E-207 Lecture 6: Regular Languages and Countability

CSE 311: Foundations of Computing. Lecture 26: Cardinality

Chapter 20. Countability The rationals and the reals. This chapter covers infinite sets and countability.

} Some languages are Turing-decidable A Turing Machine will halt on all inputs (either accepting or rejecting). No infinite loops.

Decidability and Undecidability

Theory of Computation (IX) Yijia Chen Fudan University

Theory of Computation CS3102 Spring 2014 A tale of computers, math, problem solving, life, love and tragic death

CS 275 Automata and Formal Language Theory

SD & Turing Enumerable. Lecture 33: Reductions and Undecidability. Lexicographically Enumerable. SD & Turing Enumerable

1 Reals are Uncountable

Decidability (What, stuff is unsolvable?)

ENEE 459E/CMSC 498R In-class exercise February 10, 2015

Turing Machines Part II

CS4026 Formal Models of Computation

CSCI3390-Assignment 2 Solutions

Turing Machines Part Two

TURING MAHINES

Lecture 19: Universality and Computability

Lecture 23: Rice Theorem and Turing machine behavior properties 21 April 2009

acs-07: Decidability Decidability Andreas Karwath und Malte Helmert Informatik Theorie II (A) WS2009/10

1 Showing Recognizability

Turing & the Uncomputable; Intro to Time Complexity

Turing Machines A Turing Machine is a 7-tuple, (Q, Σ, Γ, δ, q0, qaccept, qreject), where Q, Σ, Γ are all finite

CSE 105 THEORY OF COMPUTATION

(a) Definition of TMs. First Problem of URMs

CS 301. Lecture 18 Decidable languages. Stephen Checkoway. April 2, 2018

CS 361 Meeting 26 11/10/17

Computability and Complexity

Foundations of

Decidability. Linz 6 th, Chapter 12: Limits of Algorithmic Computation, page 309ff

Theory of Computation

Introduction to Turing Machines

highlights proof by contradiction what about the real numbers?

17.1 The Halting Problem

CS3719 Theory of Computation and Algorithms

CSE 105 THEORY OF COMPUTATION. Spring 2018 review class

CS20a: Turing Machines (Oct 29, 2002)

Theory of Computation

Discrete Mathematics and Probability Theory Spring 2014 Anant Sahai Note 20. To Infinity And Beyond: Countability and Computability

Most General computer?

CS154, Lecture 10: Rice s Theorem, Oracle Machines

CS 21 Decidability and Tractability Winter Solution Set 3

CS6901: review of Theory of Computation and Algorithms

Mapping Reducibility. Human-aware Robotics. 2017/11/16 Chapter 5.3 in Sipser Ø Announcement:

The Church-Turing Thesis

Midterm Exam 2 CS 341: Foundations of Computer Science II Fall 2016, face-to-face day section Prof. Marvin K. Nakayama

Predicate Logic - Undecidability

Exam Computability and Complexity

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

CS5371 Theory of Computation. Lecture 12: Computability III (Decidable Languages relating to DFA, NFA, and CFG)

Computational Models Lecture 7, Spring 2009

A non-turing-recognizable language

Farewell (for now) to modular arithmetic...

CS5371 Theory of Computation. Lecture 15: Computability VI (Post s Problem, Reducibility)

1 Acceptance, Rejection, and I/O for Turing Machines

CSE 105 THEORY OF COMPUTATION

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lec. 16 : Turing Machines

Notes for Lecture Notes 2

CSE355 SUMMER 2018 LECTURES TURING MACHINES AND (UN)DECIDABILITY

6.045: Automata, Computability, and Complexity Or, Great Ideas in Theoretical Computer Science Spring, Class 8 Nancy Lynch

Transcription:

Computability, Undeciability and the Halting Problem 12/01/16 http://www.michael-hogg.co.uk/game_of_life.php Discrete Structures (CS 173) Lecture B Gul Agha 1 Based on slides by Derek Hoiem, University of Illinois

Today s class: Computability, Undecidability and the Halting Problem Review of basic concepts from Tuesday The halting problem Examples of infinitely varying patterns Game of life Penrose tilings 2

Previous lecture Some infinite sets are bigger than others A countable set is the same size (or smaller) than the natural numbers We can compare sizes of infinite sets using bijections or one to one functions Diagonalization is a useful technique for constructing a new element that is different than every element of a countably infinite set 3

Size of infinite sets Powerset(Naturals) = Naturals = Integers = Odd Numbers < Reals < Powerset(Reals) < Countably Infinite 4

Functions and Relations on Natural Numbers { } What is the cardinality of? Notice that this encodes the power set of natural numbers! 5

Uncomputability A computer program is just a string (finite series of characters), so the set of all programs is countable. But the set of functions is uncountable (e.g., functions that map reals to reals) So there are more functions than programs some functions cannot be computed by any program 6

Cardinality of the Set of all Programs Programs are from a countable grammar (rules, kinds of statements) and of finite (though arbitrary) length. How many programs may have: Length 1 Length 2 7

Example: not all real numbers are computable 3/4 http://keisan.casio.com/calculator 8

Halting problem: Is there a general purpose algorithm that can determine whether a program will terminate? On a given input? On all inputs? Example: Suppose you have written a machine learning algorithm that has been running for days. Will it ever stop on its own? 9

Potential solutions to halting problem Run program for a really long time and see if it stops. Analyze code to see if there are infinite loops. Check if loop exit conditions become closer to being met over time (Induction proofs). 10

Halting problem is undecidable Suppose we have a magic program that solves the halting function: p = a program i = the input Now we write this evil program: What happens if we call trouble(trouble)? Example source: http://faculty.ycp.edu/~dhovemey/fall2009/cs340/lecture/lecture22.html 11

Liar s paradox In some primitive kingdom, they had not abolished the death penalty. A King ruled that his critics should be executed. But to torture them further, he decreed that they could make a statement. If the statement is true, they should be beheaded. If the statement is false, they should be hanged. One of his critics was a logician. She said: I will be hanged. True or False: This statement is false 12

Halting problem is undecidable bool does_it_halt( char * program, char * input ) { if( some terribly clever test for halting ) { return TRUE; } else { return FALSE; } } bool evil_program( char * program ) { if( does_it_halt( program, program ) ) { while( 1 ) {} return FALSE; } else { return TRUE; } } What does evil_program(evil_program)do? Turing s Proof. Example from: http://www.cgl.uwaterloo.ca/~csk/halt/ 13

Why the halting problem matters We often want to know if a program converges (halts), but not possible to provide one algorithm that answers this for all programs. In practice, convergence can be proven in many cases First example of a decidability problem Many other problems are shown to be undecidable by being reduced to halting problem E.g., there cannot be a general algorithm that decides whether a given statement about natural numbers is true or not 14

Halting behaviors Program halts Program loops but keeps repeating itself Sometimes detectable, unless loop is really long Program continues changing without repetition Hard to tell if it will stop or start repeating or keep changing forever 15

Example: is there a finite or repeating set of digits? 3/4 1/7 102/103 http://keisan.casio.com/calculator 16

Another example: game of life Simple rules Any live cell with fewer than two live neighbours dies, as if caused by under population. Any live cell with two or three live neighbours lives on to the next generation. Any live cell with more than three live neighbours dies, as if by overcrowding. Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction. Complex outputs Some programs halt, some loop repeatedly, some continually change 17

Historical significance of Conway s Game of Life Proposed in answer to question of whether self replicating machines are possible artificial life Invented in 1970 (on paper) Example of emergence and self organization Game of life online: http://www.bitstorm.org/gameoflife/ http://www.ibiblio.org/lifepatterns/ 18

Aperiodic tilings Examples from http://www.ams.org/samplings/feat ure-column/fcarc-penrose Tiles that lead to periodic tilings Tiles that can create periodic or aperiodic tilings 19

Question asked by Hao Wang in 1961: Is it possible to create tiles that always lead to aperiodic tilings? First solved by his student Berger in 1963 with 20,000+ tiles 20

Is it possible to create tiles that always lead to aperiodic tilings? Penrose tilings Examples from http://www.ams.org/samplings/feat ure-column/fcarc-penrose 21

Application: quasicrystals Eventually understood to be analogous to 3D Penrose tilings Image from Ron Lifschitz More on this here: http://en.wikipedia.org/wiki/quasicrystal 22

Universal Model of Computing Church s Thesis: Anything that is computable can be computed by a Turing Machine. A model or programming language is Turing Complete if it can compute anything a TM can. Examples: 1. the calculus (theory of functions) 2. C, C++, algol, Java, Scheme, What is a Turing Machine? 23

Turing Machines A description of the Finite State automata for control can be entered on the tape to be interpreted by a Turing Machine (called a Universal Turing Machine because it can execute an arbirtrary given TM on a given input) https://csustan.csustan.edu/~tom/lecture- Notes/Computation/Turing-Machine.jpg http://web.mit.edu/manoli/turing/www/turing.gif See also: https://en.wikipedia.org/wiki/turing_machine 24

Some Undecidable Problems Given an arbitrary function Is a total function? Is defined? Is there a natural number for which is defined? The Equivalence Problem Post s Correspondence Problem Hilbert s Tenth Problem 25

The Equivalence Problem Given two (arbitrary) computable functions (programs) is there an algorithm that can decide if the functions produce the same output? Example: Simpler version: given an arbitrary computable function, is there an algorithm to decide if it is equivalent to the identity function? Neither is decidable. But if two computable functions are not equivalent, you can find that they are not. 26

Post s Correspondence Problem Introduced by Post in 1946. Best illustrated with an instance. Given a finite sequence of pairs of strings:, Is there a sequence of indices repetitions allowed, such that:, with 27

Two instances: A solution: sequence 1, 2, 1, 3, 4 gives: 28

Hilbert s Tenth Problem Does a polynomial with integer coefficients have a solution such that each of are integers? (Posed by Hilbert in 1900). Some instances can be solved: + In 1970, Matiyasevich proved that Hilbert s Tenth Problem is undecidable. (There is no algorithm that can say if a polynomial has integer solutions). 29