David Evans CS150: Computer Science University of Virginia Computer Science Class 32: Computability in Theory and Practice.

Slides:



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

David Evans CS150: Computer Science University of Virginia Computer Science Lecture 26: Proving Uncomputability Visualization.
CS 345: Chapter 9 Algorithmic Universality and Its Robustness
Class 21: Imperative Programming University of Virginia cs1120 David Evans.
Cs1120 Fall 2009 David Evans Lecture 16: Power Analysis.
David Evans CS200: Computer Science University of Virginia Computer Science Class 30: Models of Computation.
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.
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.
November 3, 2009Introduction to Cognitive Science Lecture 15: Theory of Computation II 1 Languages Accepted by Turing Machines Example 2: Language L =
January 28, 2015CS21 Lecture 101 CS21 Decidability and Tractability Lecture 10 January 28, 2015.
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 ( )
Cs1120 Fall 2009 David Evans Lecture 20: Programming with State.
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 Class 13: Quicksort, Problems and Procedures CS150: Computer Science University of Virginia Computer Science.
Class 37: Computability in Theory and Practice cs1120 Fall 2011 David Evans 21 November 2011 cs1120 Fall 2011 David Evans 21 November 2011.
David Evans CS200: Computer Science University of Virginia Computer Science Class 35: Cookie Monsters and Semi-Secure.
CSCI 2670 Introduction to Theory of Computing September 28, 2005.
Introduction to CS Theory Lecture 15 –Turing Machines Piotr Faliszewski
David Evans CS200: Computer Science University of Virginia Computer Science Class 38: Fixed Points and Biological Computing.
Lecture 8: The Meaning of Life, Searching for Truth and The Stuff Primitives are Made Of (and a smattering of Quantum Physics) David Evans
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.
CSE 311 Foundations of Computing I Lecture 26 Computability: Turing machines, Undecidability of the Halting Problem Spring
CSE 311 Foundations of Computing I Lecture 29 Computability: Turing machines, Undecidability of the Halting Problem Autumn 2012 CSE 3111.
Class 21: Introducing Complexity David Evans cs302: Theory of Computation University of Virginia Computer Science.
David Evans cs302: Theory of Computation University of Virginia Computer Science Lecture 16: Universality and Undecidability.
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.
David Evans CS200: Computer Science University of Virginia Computer Science Class 32: The Meaning of Truth.
Fundamentals of Informatics Lecture 12 The Halting Problem Bas Luttik.
David Evans CS200: Computer Science University of Virginia Computer Science Lecture 14: P = NP?
David Evans CS200: Computer Science University of Virginia Computer Science Class 32: The Meaning of Truth.
Undecidability and The Halting Problem
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:
Turing Machines- Cont. Theory of Computation Lecture 11 Tasneem Ghnaimat.
MA/CSSE 474 Theory of Computation Universal Turing Machine Church-Turing Thesis (Winter 2016, these slides were also used for Day 33)
David Evans CS200: Computer Science University of Virginia Computer Science Class 26: Halting Problem It is plain at any.
David Evans CS200: Computer Science University of Virginia Computer Science Lecture 8: Cons car cdr sdr wdr.
Fall 2013 Lecture 27: Turing machines and decidability CSE 311: Foundations of Computing.
Lecture 6: Lambda Calculus
Class 27: Universal Turing Machines CS150: Computer Science
Class 30: Models of Computation CS200: Computer Science
Lecture 7: List Recursion CS200: Computer Science
Lecture 37: A Universal Computer
Lambda Calculus Revisited
Pumping Lemma Revisited
Chapter 3: The CHURCH-Turing thesis
Class 36: The Meaning of Truth CS200: Computer Science
Lecture 24: Metalinguistics CS200: Computer Science
Class 37: Making Lists, Numbers and Recursion from Glue Alone
CS21 Decidability and Tractability
Class 33: Making Recursion M.C. Escher, Ascending and Descending
Class 24: Computability Halting Problems Hockey Team Logo
CS21 Decidability and Tractability
Class 31: Universal Turing Machines CS200: Computer Science
Class 34: Models of Computation CS200: Computer Science
Class 33: Learning to Count CS200: Computer Science
Class 26: Modeling Computing CS150: Computer Science
Lecture 15: Quicker Sorting CS150: Computer Science
The Church-Turing Thesis and Turing-completeness
Presentation transcript:

David Evans CS150: Computer Science University of Virginia Computer Science Class 32: Computability in Theory and Practice

2 CS150 Fall 2005: Lecture 32: Computability Menu Lambda Calculus Review Computability in Theory and Practice Learning to Count

3 CS150 Fall 2005: Lecture 32: Computability Universal Computation zzzzzzzzzzzzzzzzzzzz 1 Start HALT ), X, L 2: look for ( #, 1, -  ), #, R  (, #, L (, X, R #, 0, - Finite State Machine Read/Write Infinite Tape Mutable Lists Finite State Machine Numbers to keep track of state Processing Way of making decisions (if) Way to keep going To prove Lambda Calculus is as powerful as a UTM, we must show we can make everything we need to simulate any TM.

4 CS150 Fall 2005: Lecture 32: Computability Don’t search for T, search for if T  x ( y. x)  xy. x F  x ( y. y)) if  pca. pca

5 CS150 Fall 2005: Lecture 32: Computability Finding the Truth T  x. ( y. x) F  x. ( y. y) if  p. ( c. ( a. pca))) if T M N (( pca. pca) ( xy. x)) M N   ( ca. ( x.( y. x)) ca)) M N     ( x.( y. x)) M N   ( y. M )) N   M Is the if necessary?

6 CS150 Fall 2005: Lecture 32: Computability and and or? and  x ( y. if x y F)) or  x ( y. if x T y))

7 CS150 Fall 2005: Lecture 32: Computability Lambda Calculus is a Universal Computer? zzzzzzzzzzzzzzzzzzzz 1 Start HALT ), X, L 2: look for ( #, 1, -  ), #, R  (, #, L (, X, R #, 0, - Finite State Machine Read/Write Infinite Tape ?Mutable Lists Finite State Machine ?Numbers to keep track of state Processing Way of making decisions (if) ?Way to keep going

8 CS150 Fall 2005: Lecture 32: Computability Computability in Theory and Practice (Intellectual Computability Discussion on TV Video)

9 CS150 Fall 2005: Lecture 32: Computability Ali G Multiplication Problem Input: a list of 2 numbers with up to d digits each Output: the product of the 2 numbers Is it decidable? Yes – a straightforward algorithm solves it. Is it tractable? (how much work?) Yes – it using elementary multiplication techniques it is O( d 2 ) Can real computers solve it?

12 CS150 Fall 2005: Lecture 32: Computability What about C++? int main (void) { int alig = ; printf ("Value: %d\n", alig); alig = alig * 99; printf ("Value: %d\n", alig); alig = alig * 99; printf ("Value: %d\n", alig); alig = alig * 99; printf ("Value: %d\n", alig); } Value: Value: Value: Value: Results from SunOS 5.8:

13 CS150 Fall 2005: Lecture 32: Computability 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 numbers do matter

14 CS150 Fall 2005: Lecture 32: Computability Lambda Calculus is a Universal Computer? zzzzzzzzzzzzzzzzzzzz 1 Start HALT ), X, L 2: look for ( #, 1, -  ), #, R  (, #, L (, X, R #, 0, - Finite State Machine Read/Write Infinite Tape ?Mutable Lists Finite State Machine ?Numbers to keep track of state Processing Way of making decisions (if) ?Way to keep going

15 CS150 Fall 2005: Lecture 32: Computability What is 42? 42 forty-two XLII cuarenta y dos

16 CS150 Fall 2005: Lecture 32: Computability Meaning of Numbers “42-ness” is something who’s successor is “43-ness” “42-ness” is something who’s predecessor is “41-ness” “Zero” is special. It has a successor “one-ness”, but no predecessor.

17 CS150 Fall 2005: Lecture 32: Computability Meaning of Numbers pred (succ N )  N N succ (pred N )  N N succ (pred (succ N ))  succ N

18 CS150 Fall 2005: Lecture 32: Computability Meaning of Zero zero? zero  T zero? (succ zero)  F zero? (pred (succ zero))  T

19 CS150 Fall 2005: Lecture 32: Computability Is this enough? Can we define add with pred, succ, zero? and zero? add  xy. if ( zero? x) y ( add ( pred x) ( succ y))

20 CS150 Fall 2005: Lecture 32: Computability Can we define lambda terms that behave like zero, zero?, pred and succ? Hint: what if we had cons, car and cdr?

21 CS150 Fall 2005: Lecture 32: Computability Numbers are Lists... zero?  null? pred  cdr succ  x. cons F x

22 CS150 Fall 2005: Lecture 32: Computability Making Pairs (define (make-pair x y) (lambda (selector) (if selector x y))) (define (car-of-pair p) (p #t)) (define (cdr-of-pair p) (p #f))

23 CS150 Fall 2005: Lecture 32: Computability cons and car cons  x. y. z.zxy cons M N = ( x. y. z.zxy) M N   ( y. z.z M y) N   z.z MN car  p.p T car (cons M N)  car ( z.z MN)  ( p.p T) ( z.z MN)   ( z.z MN) T   TMN   ( x. y. x ) MN   ( y. M)N   M T  x. y. x

24 CS150 Fall 2005: Lecture 32: Computability cdr too! cons  xyz.zxy car  p.p T cdr  p.p F cdr cons M N cdr z.z MN = ( p.p F) z.z MN   ( z.z MN) F   FMN   N

25 CS150 Fall 2005: Lecture 32: Computability Null and null? null  x. T null?  x.(x y. z. F) null? null  x.(x y. z. F) ( x. T)   ( x. T) ( y. z. F)   T

26 CS150 Fall 2005: Lecture 32: Computability Null and null? null  x. T null?  x.(x y. z. F) null? (cons M N)  x.(x y. z. F) z.z MN   ( z.z MN) ( y. z. F)   ( y. z. F) MN   F

27 CS150 Fall 2005: Lecture 32: Computability Counting 0  null 1  cons F 0 2  cons F 1 3  cons F 2... succ  x.cons F x pred  x.cdr x

28 CS150 Fall 2005: Lecture 32: Computability 42 = xy.( z.z xy) xy. y xy.( z.z xy) xy. y xy.( z.z xy) xy. y xy.( z.z xy) xy. y xy.( z.z xy) xy. y xy.( z.z xy) xy. y xy.( z.z xy) xy. y xy.( z.z xy) xy. y xy.( z.z xy) xy. y xy.( z.z xy) xy. y xy.( z.z xy) xy. y xy.( z.z xy) xy. y xy.( z.z xy) xy. y xy.( z.z xy) xy. y xy.( z.z xy) xy. y xy.( z.z xy) xy. y xy.( z.z xy) xy. y xy.( z.z xy) xy. y xy.( z.z xy) xy. y xy.( z.z xy) xy. y xy.( z.z xy) xy. y xy.( z.z xy) xy. y xy.( z.z xy) xy. y xy.( z.z xy) xy. y xy.( z.z xy) xy. y xy.( z.z xy) xy. y xy.( z.z xy) xy. y xy.( z.z xy) xy. y xy.( z.z xy) xy. y xy.( z.z xy) xy. y xy.( z.z xy) xy. y xy.( z.z xy) xy. y xy.( z.z xy) xy. y xy.( z.z xy) xy. y xy.( z.z xy) xy. y xy.( z.z xy) xy. y xy.( z.z xy) xy. y xy.( z.z xy) xy. y xy.( z.z xy) xy. y xy.( z.z xy) xy. y xy.( z.z xy) xy. y xy.( z.z xy) xy. y x. T

29 CS150 Fall 2005: Lecture 32: Computability Arithmetic zero?  null? succ  x. cons F x pred  x.x F pred 1 = ( x.x F ) cons F null   ( cons F null ) F  ( xyz.zxy F null ) F   ( z.z F null ) F   F F null   null  0  0

30 CS150 Fall 2005: Lecture 32: Computability Lambda Calculus is a Universal Computer zzzzzzzzzzzzzzzzzzzz 1 Start HALT ), X, L 2: look for ( #, 1, -  ), #, R  (, #, L (, X, R #, 0, - Finite State Machine Read/Write Infinite Tape Mutable Lists Finite State Machine Numbers to keep track of state Processing Way of making decisions (if)  Way to keep going We have this, but we cheated using  to make recursive definitions!

31 CS150 Fall 2005: Lecture 32: Computability Way to Keep Going ( f. (( x. f (xx)) ( x. f (xx)))) ( z.z)   ( x. ( z.z)(xx)) ( x. ( z.z)(xx))   ( z.z) ( x.( z.z)(xx)) ( x.( z.z)(xx))   ( x.( z.z)(xx)) ( x.( z.z)(xx))   ( z.z) ( x.( z.z)(xx)) ( x.( z.z)(xx))   ( x.( z.z)(xx)) ( x.( z.z)(xx))  ... This should give you some belief that we might be able to do it. We won’t cover the details of why this works in this class. (CS655 sometimes does.)

32 CS150 Fall 2005: Lecture 32: Computability Lambda Calculus is a Universal Computer zzzzzzzzzzzzzzzzzzzz 1 Start HALT ), X, L 2: look for ( #, 1, -  ), #, R  (, #, L (, X, R #, 0, - Finite State Machine Read/Write Infinite Tape Mutable Lists Finite State Machine Numbers to keep track of state Processing Way of making decisions (if) Way to keep going

33 CS150 Fall 2005: Lecture 32: Computability Universal Computer Lambda Calculus can simulate a Turing Machine –Everytime a Turing Machine can compute, Lambda Calculus can compute also Turing Machine can simulate Lambda Calculus (we didn’t prove this) –Everything Lambda Calculus can compute, a Turing Machine can compute also Church-Turing Thesis: this is true for any other mechanical computer also

34 CS150 Fall 2005: Lecture 32: Computability Charge Exam 2 out Friday –Covers through today –Links to example exams on the web –Review session Wednesday, 7pm PS8 Project Ideas due tomorrow (11:59pm) –Short is fine, just explain who your team is and what you plan to do