Foundations of Computer Science Lecture 27 Unsolvable Problems

Similar documents
Turing Machine Recap

Decidable Languages - relationship with other classes.

Undecidability and Rice s Theorem. Lecture 26, December 3 CS 374, Fall 2015

TURING MAHINES

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

Foundations of Computer Science Lecture 23 Languages: What is Computation?

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

Lecture Notes: The Halting Problem; Reductions

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

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

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

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

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

Theory of Computation

Decidability and Undecidability

UNIT-VIII COMPUTABILITY THEORY

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

CS154, Lecture 10: Rice s Theorem, Oracle Machines

Final Exam Comments. UVa - cs302: Theory of Computation Spring < Total

Complexity Theory Part I

CSE 105 THEORY OF COMPUTATION

Chap. 4,5 Review. Algorithms created in proofs from prior chapters

Lecture 12: Mapping Reductions

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

Lecture 20: conp and Friends, Oracles in Complexity Theory

CS154, Lecture 17: conp, Oracles again, Space Complexity

ACS2: Decidability Decidability

Computational Models Lecture 8 1

1 Reals are Uncountable

CS151 Complexity Theory. Lecture 1 April 3, 2017

The Turing Machine. Computability. The Church-Turing Thesis (1936) Theory Hall of Fame. Theory Hall of Fame. Undecidability

Turing & the Uncomputable; Intro to Time Complexity

1 Computational Problems

CP405 Theory of Computation

The decision problem (entscheidungsproblem), halting problem, & Turing machines. CS 350 Fall 2018 gilray.org/classes/fall2018/cs350/

CS6901: review of Theory of Computation and Algorithms

Introduction to Turing Machines. Reading: Chapters 8 & 9

CSCI3390-Lecture 14: The class NP

Lecture 22: Quantum computational complexity

Computational Models Lecture 8 1

conp, Oracles, Space Complexity

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

Notes for Lecture Notes 2

1 Showing Recognizability

Computational Models Lecture 8 1

CSE 105 THEORY OF COMPUTATION

Most General computer?

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

16.1 Countability. CS125 Lecture 16 Fall 2014

Automata Theory CS S-FR2 Final Review

Data Structures in Java

Today s Lecture. Mars Climate Orbiter. Lecture 21: Software Disasters. Mars Climate Orbiter, continued

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

CS3719 Theory of Computation and Algorithms

Turing s Legacy Continues

Announcements. Problem Set 6 due next Monday, February 25, at 12:50PM. Midterm graded, will be returned at end of lecture.

Turing Machines. Lecture 8

Final exam study sheet for CS3719 Turing machines and decidability.

Turing Machines Part III

Decidable and undecidable languages

Theory of Computation Lecture Notes. Problems and Algorithms. Class Information

CSCI3390-Assignment 2 Solutions

Theory of Computation

Turing Machines Part II

CS5371 Theory of Computation. Lecture 14: Computability V (Prove by Reduction)

1 Computational problems

Theory of Computation. Theory of Computation

Advanced topic: Space complexity

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

Announcements. Problem Set 7 graded; will be returned at end of lecture. Unclaimed problem sets and midterms moved!

Advanced Undecidability Proofs

CSCI 2200 Foundations of Computer Science Spring 2018 Quiz 3 (May 2, 2018) SOLUTIONS

Reducability. Sipser, pages

ECS 120 Lesson 18 Decidable Problems, the Halting Problem

Computability Crib Sheet

Definition: Alternating time and space Game Semantics: State of machine determines who

Turing Machines Part II

Decidability (What, stuff is unsolvable?)

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

DRAFT. Algebraic computation models. Chapter 14

CSE 105 THEORY OF COMPUTATION

Lecture 21: Algebraic Computation Models

CSCI3390-Lecture 6: An Undecidable Problem

Announcements. Final exam review session tomorrow in Gates 104 from 2:15PM 4:15PM Final Friday Four Square of the quarter!

Space Complexity. The space complexity of a program is how much memory it uses.

Finish K-Complexity, Start Time Complexity

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

Great Theoretical Ideas in Computer Science. Lecture 9: Introduction to Computational Complexity

CS5371 Theory of Computation. Lecture 10: Computability Theory I (Turing Machine)

A Note on Turing Machine Design

Definition: Alternating time and space Game Semantics: State of machine determines who

CSE 105 THEORY OF COMPUTATION

Computer Sciences Department

Decidability. Overview. Preliminaries to Halting Problem. Decidable Problems of Regular Languages. Decidable Problems of Context-Free Languages

CS154, Lecture 13: P vs NP

Definition: conp = { L L NP } What does a conp computation look like?

Announcements. Using a 72-hour extension, due Monday at 11:30AM.

CS5371 Theory of Computation. Lecture 10: Computability Theory I (Turing Machine)

CS187 - Science Gateway Seminar for CS and Math

Complexity. Complexity Theory Lecture 3. Decidability and Complexity. Complexity Classes

Transcription:

Foundations of Computer Science Lecture 27 Unsolvable Problems A Powerful but Dangerous Technique Analyzing Recursions and Recursions with Induction Recursive Sets Recursive Structures

Last Time: Turing Machines Intuitive notion of algorithm Turing Machine Solvable problem Turing-decidable L = { G G is connected} G = 2; 1; 3; 4 # 1,2; 2,3; 1,3; 3,4 ( G is the encoding of graph G as a string.) 1 2 3 4 M = Turing Machine that solves graph connectivity input: G, the encoding of a graph G. 1: Check that G is a valid encoding of a graph and mark the first node in G. 2: repeat: Find an edge in G between a marked and an unmarked node. Mark the unmarked node or goto step 3 if there is no such edge. 3: reject if there is an unmarked node remaining in G; otherwise accept. To tell your friend on the other coast about this fancy Turing Machine M, Encode its description into the bit-string M and send over the telegraph. You want to solve a different problem? Build another Turing Machine! Creator: Malik Magdon-Ismail Unsolvable Problems: 2 / 13 Today

Today: Unsolvable Problems 1 Programmable Turing Machines. 2 Examples of unsolvable problems. Post s Correspondence Problem (PCP)? HalfSum? Auto-Grade? Ultimate-Debugger? 3 L tm : The language recognized by a Universal Turing Machine. L tm is undecidable cannot be solved! 4 Auto-Grade and Ultimate-Debugger do not exist. 5 What about HalfSum? Creator: Malik Magdon-Ismail Unsolvable Problems: 3 / 13 Programmable Turing Machine

Programmable Turing Machine: Universal Turing Machine A Turing Machine M has a binary encoding M. Its input w is a binary string. M #w can be the input to another Turing Machine U tm. U tm ( M #w) computer program program input = halt with accept halt with reject loop forever if M(w) = halt with accept; if M(w) = halt with reject; if M(w) = loop forever; U tm outputs on M #w whatever M outputs on w. U tm simulates M Challenge: U tm is fixed but can simulate any M, even one with a million states. U tm * states M instructions w # 0 0 1 0 1 Entire simulation is done on the tape. Creator: Malik Magdon-Ismail Unsolvable Problems: 4 / 13 PCP and HalfSum

Post s Correspondence Problem (PCP) and HalfSum PCP: Consider 3 dominos: d 1 d 2 d 3 0 01 110 100 00 11 d 3 d 2 d 3 d 1 = 110 11 01 00 110 11 0 100 = 110011100 110011100 Top and bottom strings match. That s the goal. input: Dominos {d 1, d 2,..., d n }. For example 10 101, 011 11, 101 011. task: Can one line up finitely many dominos so that the top and bottom strings match? HalfSum: Consider the multiset S = {1, 1, 1, 3, 4, 4, 5, 6, 9}, and subset A = {1, 3, 4, 9}. sum(a) = 17 = 1 2 sum(s). input: Multiset S = {x 1, x 2,..., x n }. For example, S = {1, 1, 1, 3, 4, 4, 5, 6, 9}. task: Is there a subset whose sum is 1 2 sum(s) = 1 2 (x 1 + x 2 + + x n )? Creator: Malik Magdon-Ismail Unsolvable Problems: 5 / 13 Auto-Grade

Auto-Grade Your first CS assignment: Write a program to print Hello World! and halt. CS1: 700+ submissions! Naturally, we do not grade these by hand. Auto-Grade: runs each submission and determines if its correct. program verification What does Auto-Grade say for this program: n = 4; while(n > 0){ if(n is not a sum of two primes){ print("hello World!") and exit; } n n + 2; } Creator: Malik Magdon-Ismail Unsolvable Problems: 6 / 13 Ultimate-Debugger

Ultimate-Debugger Wouldn t it be nice to have the Ultimate-Debugger. solves the Halting Problem Halts n = 4; while(n > 0){ if(n is not a sum of two primes){ print("hello World!") and exit; } n n + 2; } = yes no if program halts if program infinitely loops We can grade the students program correctly. We can solve Goldbach s conjecture. Just think what you could do with Ultimate-Debugger. No more infinite looping programs. Creator: Malik Magdon-Ismail Unsolvable Problems: 7 / 13 L tm

The Language of Successfully Terminating Programs U tm is a recognizer for L tm. L tm = { M #w M is a Turing Machine and M accepts w}. Is there a Turing Machine A tm which decides L tm? A decider must always halt with an answer. U tm may loop forever if M loops forever on w. What do these mean: M( M ) and A tm ( M # M )? A diabolical Turing Machine D tm built from A tm : D tm = Diagonal Turing Machine derived from A tm (the decider for L tm ) input: M where M is a Turing Machine. 1: Run A tm with input M # M. 2: If A tm accepts then reject; otherwise (A tm rejects) accept D tm does the opposite of A tm. Is D tm a decider? Creator: Malik Magdon-Ismail Unsolvable Problems: 8 / 13 L tm is Undecidable

Theorem. A tm does not exist (L tm Cannot be Solved) A tm exists D tm exists. D tm exists means it will appear on the list of all Turing Machines, M 1, M 2, M 3, M 4, D tm,... Consider what happens when M i runs on M j, that is A tm ( M i # M j ). A tm ( M i # M j ) M 1 M 2 M 3 M 4 D tm M 1 accept accept reject accept accept M 2 reject reject reject accept accept M 3 accept accept reject reject accept M 4 accept reject reject reject accept D tm reject accept accept accept accept? reject?......... D tm ( M i ) does the opposite of A tm ( M i # M i ). Creator: Malik Magdon-Ismail Unsolvable Problems: 9 / 13 Ultimate-Debugger and Auto-Grade

Ultimate-Debugger and Auto-Grade Don t Exist No general program/algorithm to analyze any other program M and tell if M will accept or not a particular input. No Ultimate-Debugger to analyze other programs and tell if they halt. No Auto-Grade for CS-1 programs. No solver for PCP. Suppose Ultimate-Debugger H tm exists and decides if any other program halts. We can use H tm to construct a solver A tm for L tm. A tm = Turing Machine derived from H tm (the decider for L halt ) input: M #w where M is a Turing Machine and w an input to M. 1: Run H tm on input M #w. If H tm rejects, then reject. 2: Run U tm on input M #w and output the decision U tm gives. Exercise. Show that Auto-Grade does not exist. Exercise. Show that HalfSum is solvable by giving a decider. Creator: Malik Magdon-Ismail Unsolvable Problems: 10 / 13 The Landscape

The Landscape DFA (no external memory) (regular expressions) { 01 }, {0 3n+1 } CFG (stack) {0 n 1 n }, {ww r } TM-Decider (RAM) {ww}, {0 2n }, {0 n 1 n 0 n } HalfSum TM-Recognizer L tm Ultimate-Debugger Auto-Grade PCP Non-Recognizable L tm, L halt most languages Creator: Malik Magdon-Ismail Unsolvable Problems: 11 / 13 The Path Forward

The Path Forward: Focus on Decidable Problems FOCS Theory of Computing Decider U tm = computer TM = Algorithm CFG Parsing DFA RegExp Graph theory Linear Algebra Probability Theory Multivariate Calc. Proof, logic INDUCTION efficiency FAST (P) Polynomial FAST (NP) Unbounded Parallelism SLOW Exponential Boolean Circuits P = NP? Chapters 28 & 29 Computability&Complexity Algorithms & DS Approximation Randomized Distributed Cryptography Data ML/AI/DM/NLP Vision Graphics Comp. Finance Networks Computers Social Data (e.g. www) Robotics Security Theory Algorithms AI Introduction to Algorithms Principles of Software Discrete Math Recursion Struct. Induction Sums, Asymptotics Number theory Graphs Counting Programming Languages Compilers Distributed Program Analysis Testing Verification DB Systems Parallel computing Computer Organization Probability Operating systems Architecture Software Systems Creator: Malik Magdon-Ismail Unsolvable Problems: 12 / 13 Epic Disasters

... the high technology so celebrated today is essentially a mathematical technology. To err is human, but to really foul things up you need a computer. Paul Ehrlich Mariner rocket explodes (1962). Formula into code bug resulted in no smoothing of deviations. WWWIII (1983)? Soviet EWS detects 5 US-missiles (bug detected sunlight reflections). Luckily Stanislav... funny feeling in my gut... Petrov thought: surely they d use more missiles? Therac 25 (1985). Concurrent programming bug killed patients through massive 100 radiation overdose. AT&T Lines Go Dead (1990). 75 million calls dropped (one line of buggy code in software upgrade). Patriot missile defense fails (1991). 28 soldiers dead, 100 injured (rounding error in scud-detection). Pentium floating point long-division bug (1993). Cost: $475 million flawed division table. Ariane rocket explosion (1996). Cost: $500 million overflow in 64-bit to 16-bit conversion. Y2K (1999). Cost: $500 spent because year was stored as 2 digits to save space. Mars Climate Orbiter Crash (1998). Cost: $125 million lost due to metric to imperial units bug. Tesla Self-Driving Car (2016). 1 dead. Auto-pilot didn t see tractor-trailer. Financial Disasters: London Stock Exchange down due to single server bug (2009; billions of pounds of trading); Knight Capital computer glitch trigers stock sale (2012; 500 million lost and Knight s value drops by 75%). Airline Disasters: AirFrance 447 2009, 228 dead: pitot-tube failure feeds inconsistent data to programs which then panic pilot. Spanair 5022, 2008, 154 dead: malware virus. AdamAir 574, 2007, 102 dead: navigation system errors (and pilot errors). KoreanAir 801, 1997, 228 dead: ground proximity warning system bug. AeroPerú 603, 1996, 70 dead: altimeter failures. Scottish RAF Chinook, 1994, 29 dead: faulty test program AirFrance 296, 1988, 3 dead: altimeter bug. IranAir 655, 1988, 290 dead: shot down by US Aegis combat system (misidentified as attacking military plane). KoreanAir 007, 1983, 269 dead: autopilot took plane into Soviet airspace where it got shot down. Software errors cost the U.S. $60 billion annually in rework, lost productivity and actual damages. Put effort to make sure your program works fully correctly all the time. Creator: Malik Magdon-Ismail Unsolvable Problems: 13 / 13