Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Class 36: What Cannot Be Computed

David Evans
April 25, 2016

Class 36: What Cannot Be Computed

cs1120: Introduction to Computing
Explorations in Language, Logic, and Machine
University of Virginia, Spring 2016

http://xplorecs.org/class36

Class 36:
Countability of Languages
Halting Problem
Reduction Proofs

David Evans

April 25, 2016
Tweet

More Decks by David Evans

Other Decks in Science

Transcript

  1. Class 36: What Cannot Be Computed Introduction to Computing: Explorations

    in Language, Logic, and Machines cs1120 Spring 2016 David Evans University of Virginia
  2. Class Update • Red Belt Qualifiers (8) – Will receive

    exam by email before midnight tonight – Some resources allowed (read front directions page carefully) • Blue Belts who haven’t yet qualified (15) – Need to qualify for Red Belt by last day of class (1 week from today) – Project 5 and Project 6 • Not yet Blue Belt (10) – Need to complete Blue Belt qualification soon!
  3. What Cannot be Computed Church-Turing Thesis: A Turing Machine can

    simulate any “mechanical computer”. Alan Turing, 1912-1954 2 What cannot be computed by a TM? What cannot be computed by any mechanical computer? Weds/Fri: What cannot be computed by any mechanical computer in a reasonable time?
  4. Computable Numbers Countable: Natural Numbers Set of strings in {0,

    1}* Set of all Turing Machines Computable numbers Not Countable: Real Numbers
  5. How many languages in {0, 1}* are there? Countable: Natural

    Numbers Set of strings in {0, 1}* Set of all Turing Machines Computable Numbers Not Countable: Real Numbers
  6. All strings in {0, 1}*: ε 0 1 00 01

    10 11 000 001 010 011 … All languages in {0, 1}?
  7. Computable Numbers Countable: Natural Numbers Set of strings in {0,

    1}* Set of all Turing Machines Computable numbers Not Countable: Real Numbers Set of all languages in {0, 1}*
  8. Languages that can be recognized by any mechanical computing machine

    All Languages What is an example of a language that is not Turing-recognizable?
  9. The Halting Problem Input: a description of a Turing Machine

    Output: 1 if it eventually halts, 0 if it never halts when running on an empty input tape Is it possible to design a Turing Machine that solves the Halting Problem?
  10. Possibility of Halting Problem Solver Halting Problem Solver Is it

    possible to design a Halting Problem Solver machine that solves the Halting Problem (for all TM descriptions)?
  11. Halting Problem Solver Halting Problem Solver ? F H 0,

    * 1, * Paradox Alert! Something in this picture must not exist
  12. Proving Non-Existence by Contradiction 1. Show X is nonsensical. 2.

    Show that if you have A you can make X. 3. Therefore, A must not exist.
  13. Proving Non-Existence by Contradiction 1. Show X is nonsensical. 2.

    Show that if you have A you can make X. 3. Therefore, A must not exist. Noncomputability (Alan Turing) X = paradox procedure A = algorithm that solves HALTING Problem
  14. Halting Problem is Non-Computable Are there any other noncomputable problems?

    def paradox(): if halts('paradox()'): while True: pass 1. paradox leads to a contradiction. 2. If we have halts, an algorithm that solves the Halting Problem, we can define paradox. 3. Therefore, halts must not exist.
  15. Evaluates-to-3 Problem Input: A string, s, representing a Python program.

    Output: True if s evaluates to 3; otherwise, False. Is “Evaluates-to-3” computable?
  16. Proof by Contradiction X = halts algorithm A = Evaluates-to-3

    algorithm 1. Show X is nonsensical. 2. Show that if you have A you can make X. 3. Therefore, A must not exist.
  17. Undecidability Proof def halts(s): return evaluates_to_3( cleanreturns(s) + '''''' return

    3 ''''') The only way the program s passed to evaluates_to_3could not evaluate to 3, is if s doesn’t halt. (Note: assumes evaluating s cannot produce an error, but we can use error handling to deal with this case.) Where cleanreturns(s) is a procedure that replaces all return x statements in s with x; return 3
  18. Charge • Wednesday: – Using hard problems in computing to

    make movies! (Jack Doerner, UVA 2015) • Friday: computing in reasonable time Is All-of-Mathematics solvable in a reasonable time?