foundations of computer science lecture 27 unsolvable
play

Foundations of Computer Science Lecture 27 Unsolvable Problems No - PowerPoint PPT Presentation

Foundations of Computer Science Lecture 27 Unsolvable Problems No Automatic Program Verifier for Hello-World No Ultimate Debugger or Algorithm for PCP The Complexity Zoo Last Time: Turing Machines Intuitive notion of algorithm Turing Machine


  1. Foundations of Computer Science Lecture 27 Unsolvable Problems No Automatic Program Verifier for Hello-World No Ultimate Debugger or Algorithm for PCP The Complexity Zoo

  2. Last Time: Turing Machines Intuitive notion of algorithm Turing Machine ≡ Solvable problem Turing- decidable ≡ L = {� G � | G is connected } 1 1 1 1 1 1 4 4 4 4 4 4 � G � = 2; 1; 3; 4 # 1,2; 2,3; 1,3; 3,4 2 2 2 2 2 2 3 3 3 3 3 3 ( � G � is the encoding of graph G as a string.) 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 vertex in G . 2: repeat: Find an edge in G between a marked and an unmarked vertex. Mark the unmarked node or goto step 3 if there is no such edge. 3: reject if there is an unmarked vertex 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 →

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

  4. 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 .  halt with accept if M ( w ) = halt with accept ;          U tm ( � M � # w ) =  halt with reject if M ( w ) = halt with reject ;      loop forever if M ( w ) = loop forever ;  computer program program input     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. mark M ’s R-W head U tm mark M ’s state mark M ’s instruction � M � w � states � � instructions � ␣ * ␣ # 0 0 1 0 1 Entire simulation is done on the tape. Creator: Malik Magdon-Ismail Unsolvable Problems: 4 / 13 PCP and HalfSum →

  5. Post’s Correspondence Problem (PCP) and HalfSum d 1 d 2 d 3 PCP: Consider 3 dominos: 0 01 110 100 00 11 110 01 110 0 110011100 ← Top and bottom strings match. d 3 d 2 d 3 d 1 = = That’s the goal. 11 00 11 100 110011100     101 , 011 10 11 , 101   input: Dominos { d 1 , d 2 , . . . , d n } . For example  .   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 →

  6. 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 →

  7. Ultimate-Debugger Wouldn’t it be nice to have the Ultimate-Debugger . ← solves the Halting Problem      if program halts n = 4 ; yes        while( n > 0 ){     Halts =  if(n is not a sum of two primes){     print("Hello World!") and exit;    } if program infinitely loops    no     n ← n + 2 ;      }  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 →

  8. Verification: Does A Program Successfully Terminate? L tm = {� M � # w | M is a Turing Machine and M accepts w } . U tm is a recognizer for L tm . 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 . Question: What do these mean: M ( � M � ) and A tm ( � M � # � M � ) ? A diabolical Turing Machine D built from A tm : D = “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 does the opposite of A tm . Is D a decider? Creator: Malik Magdon-Ismail Unsolvable Problems: 8 / 13 L tm is Undecidable →

  9. Theorem. A tm does not exist ( L tm Cannot be Solved) A tm exists → D exists. D exists means it will appear on the list of all Turing Machines, � M 1 � , � M 2 � , � M 3 � , � M 4 � , � D � , . . . 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 � · · · � 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 � reject accept accept accept accept ? reject ? · · · . . . . . . ... . . . . . . . . . . . . D ( � 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 →

  10. Ultimate-Debugger and Auto-Grade Don’t Exist No Ultimate-Debugger to analyze other programs and tell if they halt. No general program/algorithm to analyze any other program M and tell if M will No Auto-Grade for CS-1 programs. accept or not a particular input. 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 Computing Landscape →

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

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

Recommend


More recommend