Class 37: Computability in Theory and Practice cs1120 Fall 2011 David Evans 21 November 2011 cs1120 Fall 2011 David Evans 21 November 2011.

Slides:



Advertisements
Similar presentations
David Evans cs302: Theory of Computation University of Virginia Computer Science Lecture 17: ProvingUndecidability.
Advertisements

Cs3102: Theory of Computation Class 21: Undecidability in Theory and Practice Spring 2010 University of Virginia David Evans Exam 2: Out at end of class.
Computational Models The exam. Models of computation. –The Turing machine. –The Von Neumann machine. –The calculus. –The predicate calculus. Turing.
CS 345: Chapter 9 Algorithmic Universality and Its Robustness
THE CHURCH-TURING T H E S I S “ TURING MACHINES” Pages COMPUTABILITY THEORY.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen Department of Computer Science University of Texas-Pan American.
Class 39: Universality cs1120 Fall 2009 David Evans University of Virginia.
David Evans CS150: Computer Science University of Virginia Computer Science Lecture 39: Lambda Calculus.
Nathan Brunelle Department of Computer Science University of Virginia Theory of Computation CS3102 – Spring 2014 A tale.
David Evans CS150: Computer Science University of Virginia Computer Science Lecture 40: Computing with Glue and Photons.
CS 310 – Fall 2006 Pacific University CS310 Turing Machines Section 3.1 November 6, 2006.
1 Foundations of Software Design Fall 2002 Marti Hearst Lecture 29: Computability, Turing Machines, Can Computers Think?
Computability and Complexity 3-1 Turing Machine Computability and Complexity Andrei Bulatov.
Slide 1 of No. Insert Unit Name Here Lecture L: Computability Unit L1: What is Computation?
Turing Machines CS 105: Introduction to Computer Science.
David Evans cs302: Theory of Computation University of Virginia Computer Science Lecture 2: Modeling Computers.
Class 19: Undecidability in Theory and Practice David Evans cs302: Theory of Computation University of Virginia Computer.
David Evans CS150: Computer Science University of Virginia Computer Science Lecture 28: Implementing Interpreters.
Cs3102: Theory of Computation Class 20: Busy Beavers Spring 2010 University of Virginia David Evans Office hours: I am not able to hold my Thursday morning.
David Evans CS200: Computer Science University of Virginia Computer Science Class 31: Universal Turing Machines.
Lecture 14: Church-Turing Thesis Alonzo Church ( ) Alan Turing ( )
More Theory of Computing
Lecture 20: λ Calculus λ Calculus & Computability Yan Huang Dept. of Comp. Sci. University of Virginia.
Cs3102: Theory of Computation Class 18: Proving Undecidability Spring 2010 University of Virginia David Evans.
David Evans Turing Machines, Busy Beavers, and Big Questions about Computing.
Class 37: Uncomputability David Evans University of Virginia cs1120 Halting Problems Hockey Team.
Lambda Calculus History and Syntax. History The lambda calculus is a formal system designed to investigate function definition, function application and.
1 CO Games Development 2 Week 21 Turing Machines & Computability Gareth Bellaby.
David Evans University of Virginia cs1120 Fall Lecture 38: Modeling Computing.
The Recursion Theorem Pages 217– ADVANCED TOPICS IN C O M P U T A B I L I T Y THEORY.
Introduction to CS Theory Lecture 15 –Turing Machines Piotr Faliszewski
Great Theoretical Ideas in Computer Science for Some.
1 ML fun x -> e e 1 e 2 0, 1, 2,..., +, -,... true, false, if e then e else e patterns datatypes exceptions structures functors let f x = e variables These.
Great Theoretical Ideas in Computer Science about AWESOME Some Generating Functions Probability Infinity Computability With Alan! (not Turing) Mind-
David Evans CS150: Computer Science University of Virginia Computer Science Class 33: Computing with Photons From The.
Cs3102: Theory of Computation Class 14: Turing Machines Spring 2010 University of Virginia David Evans.
THE CHURCH-TURING T H E S I S “ TURING MACHINES” Part 1 – Pages COMPUTABILITY THEORY.
CSE 311 Foundations of Computing I Lecture 26 Computability: Turing machines, Undecidability of the Halting Problem Spring
David Evans CS150: Computer Science University of Virginia Computer Science Lecture 36: Modeling Computing.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
-Calculus Kangwon National University 임현승 Programming Languages These slides are based on the slides by Prof. Sungwoo Park at POSTECH.
Capabilities of computing systems Numeric and symbolic Computations A look at Computability theory Turing Machines.
David Evans CS200: Computer Science University of Virginia Computer Science Class 32: The Meaning of Truth.
Automata & Formal Languages, Feodor F. Dragan, Kent State University 1 CHAPTER 3 The Church-Turing Thesis Contents Turing Machines definitions, examples,
1 Introduction to Turing Machines
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 12 Mälardalen University 2007.
David Evans CS200: Computer Science University of Virginia Computer Science Class 32: The Meaning of Truth.
David Evans CS150: Computer Science University of Virginia Computer Science Class 32: Computability in Theory and Practice.
The Church-Turing Thesis Chapter Are We Done? FSM  PDA  Turing machine Is this the end of the line? There are still problems we cannot solve:
David Evans CS200: Computer Science University of Virginia Computer Science Class 26: Halting Problem It is plain at any.
Fall 2013 Lecture 27: Turing machines and decidability CSE 311: Foundations of Computing.
Class 27: Universal Turing Machines CS150: Computer Science
Class 30: Models of Computation CS200: Computer Science
Lecture 37: A Universal Computer
CSE 105 theory of computation
CSE 105 theory of computation
Turing Machines, Busy Beavers, and Big Questions about Computing
Theory of Computation Turing Machines.
Class 36: The Meaning of Truth CS200: Computer Science
Lecture 24: Metalinguistics CS200: Computer Science
Class 24: Computability Halting Problems Hockey Team Logo
Class 31: Universal Turing Machines CS200: Computer Science
Class 34: Models of Computation CS200: Computer Science
CSE 105 theory of computation
Class 26: Modeling Computing CS150: Computer Science
The Church-Turing Thesis and Turing-completeness
CO Games Development 2 Week 21 Turing Machines & Computability
Lecture 23: Computability CS200: Computer Science
CSE 105 theory of computation
Presentation transcript:

Class 37: Computability in Theory and Practice cs1120 Fall 2011 David Evans 21 November 2011 cs1120 Fall 2011 David Evans 21 November 2011

Plan Questions for Exam 2 Computability Practice Universal Languages (including Java) Philosophical Discussion on Computability in Theory and Practice 2

3

Inverse Problem Input: strings p, q that each define Python procedures Output: True if p and q are inverses (e.g., for all possible inputs x, p(q(x)) = x ). Otherwise, False. 4

Inverse Problem is Noncomputable If we had an algorithm, inverse(p, q) that solves the InverseProblem, we could use it to define an algorithm halts(s) that solves the HaltingProblem: 5

Inverse Problem is Noncomputable If we had an algorithm, inverse(p, q) that solves the InverseProblem, we could use it to define an algorithm halts(s) that solves the HaltingProblem: 6 def halts(s): inverse(“lambda x: x”, “lambda x: begin(eval(s), x)”) To make proof convincing: argue that this correctly defines halts If s doesn’t finish the inputs are not inverses, hence inverse returns false (correct) If s does finish, the inputs are inverses, hence inverse returns true (correct) To make proof convincing: argue that this correctly defines halts If s doesn’t finish the inputs are not inverses, hence inverse returns false (correct) If s does finish, the inputs are inverses, hence inverse returns true (correct)

Python-Scheme-Equivalence Problem Input: string s defines a Python program Output: if there exists a Scheme program the defines the same function as s, output True. Otherwise, False. 7

Python-Scheme-Equivalence Problem Input: string s that defines a Python program Output: if there exists a Scheme program the defines the same function as s, output True. Otherwise, False. 8 Python-Scheme-Equivalence is Computable. “Proof”: def pythonSchemeEquivalence(s): return True Python-Scheme-Equivalence is Computable. “Proof”: def pythonSchemeEquivalence(s): return True

Universal Programming Language Definition: a programming language that can describe every algorithm. Equivalently: a programming language that can simulate every Turing Machine. Equivalently: a programming language in which you can implement a Universal Turing Machine.

Are Python, Scheme, Charme, Java, and Aazda Universal Programming Languages? 10

Yes! Proof: implement a Turing Machine simulator in the language. 11 What do you need to simulate a TM?

Simulating a Turing Machine zzzzzzzzzzzzzzzzzzzz 1 Start HALT ), X, L 2: look for ( #, 1, -  ), #, R  (, #, L (, X, R #, 0, - Finite State Machine Read/Write Infinite Tape Lists Finite State Machine Numbers Processing Way to make decisions (if) Way to keep going

Can even simpler languages do this? 13

Lambda Calculus Rules for manipulating strings of symbols term = variable | term term | (term) | variable. term One main rule:  -reduction ( ( x. M)N )   M with all x ’s in M replaced by N This is a lot like Scheme, without primitives, special forms, mutation! Note: I have slightly altered the traditional syntax to make it more like Scheme.

Church’s Computing Model: Lambda Calculus Developed in 1930s in attempt to formalize mathematics (similar to Bertrand Russell’s goals) Ran into similar paradoxes: solution: model computing not mathematics! Basis of LISP and Scheme Alonzo Church,

Evaluating Lambda Expressions redex: Term of the form ( ( x. M)N ) Something that can be  - reduced An expression is in normal form if it contains no redexes. To evaluate a lambda expression, keep doing reductions until you get to normal form. Why does Scheme/Charme need special forms to be universal, but lambda calculus can do everything with “application”? Why does Scheme/Charme need special forms to be universal, but lambda calculus can do everything with “application”?

Simulating a Turing Machine zzzzzzzzzzzzzzzzzzzz 1 Start HALT ), X, L 2: look for ( #, 1, -  ), #, R  (, #, L (, X, R #, 0, - Finite State Machine Read/Write Infinite Tape Lists Finite State Machine Numbers Processing Way to make decisions (if) Way to keep going

Way to Keep Going: The Y-Combinator Y = λf (λx. (f (x x)) (λx. f (x x)) This finds the fixed point of any function! (Y G) = (G (Y G)) Y = λf (λx. (f (x x)) (λx. f (x x)) This finds the fixed point of any function! (Y G) = (G (Y G))

Church-Turing Thesis All mechanical computers are equally powerful (except for practical limits like memory size, time, display, energy, etc.) There exists some Turing machine that can simulate any mechanical computer Any computer that is powerful enough to simulate a Turing machine, can simulate any mechanical computer Alan Turing, Alonzo Church,

All universal programming language are equivalent in power: they can all simulate a TM, which can carry out any mechanical algorithm.

Why so many equally powerful programming languages?

Proliferation of Universal PLs “Aesthetics” Some people like :=, others prefer =. Some people think whitespace shouldn’t matter (e.g., Java, Scheme), others think programs should be formatted like they mean (e.g., Python) Some people like goto (BASIC, C) others like throw (Java, Python) Expressiveness vs. Simplicity Python is more expressive than Scheme Expressiveness vs. “Truthiness” How much you can say with a little code vs. how likely it is your code means what you think it does

Programming Language Design Space Expressiveness “Truthiness” Scheme Python Java C low high Spec# Ada strict typing, static more mistake prone less mistake prone public class HelloWorld { public static void main(String[] args) { System.out.println ("Hello!"); } public class HelloWorld { public static void main(String[] args) { System.out.println ("Hello!"); } print ("Hello!") (display “Hello!”) x86

Leading Philosopher on Computability in Theory and Practice

Ali G Problem

Input: whole numbers x and y with up to d digits each (mostly nines) Output: x  y Input: whole numbers x and y with up to d digits each (mostly nines) Output: x  y Theorist’s Question: Is the Ali G Problem computable?

Multiplication is Computable 27

Ali G Problem Input: whole numbers x and y with up to d digits each (mostly nines) Output: x  y Input: whole numbers x and y with up to d digits each (mostly nines) Output: x  y Ali G’s Question: Can real computers solve it for a given d ?

Ali G was Right! Theory assumes ideal computers: Unlimited, perfect memory Unlimited (finite) time Real computers have: Limited memory, time, power outages, flaky programming languages, etc. There are many decidable problems we cannot solve with real computer: the actual inputs do matter (in practice, but not in theory!)

Things Real Computers Can Do That Turing Machines Cannot Generate Heat Stop a Door Provide an adequate habitat for fish

33 flickrcc: martha_chapa95 Happy Thanksgiving! Don’t spend your Thanksgiving doing Exam 2! If you are well prepared, it should only take a few hours. If you’re spending longer then that on it, you are doing something wrong, or grossly misinterpreting the questions.