David Evans CS200: Computer Science University of Virginia Computer Science Class 31: Universal Turing Machines.

Slides:



Advertisements
Similar presentations
Turing Machines Memory = an infinitely long tape Persistent storage A read/write tape head that can move around the tape Initially, the tape contains only.
Advertisements

CS 345: Chapter 9 Algorithmic Universality and Its Robustness
Elements of Lambda Calculus Functional Programming Academic Year Alessandro Cimatti
1 Programming Languages (CS 550) Lecture Summary Functional Programming and Operational Semantics for Scheme Jeremy R. Johnson.
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 CS200: Computer Science University of Virginia Computer Science Class 27: Modeling Computation.
David Evans CS200: Computer Science University of Virginia Computer Science Lecture 3: Rules of Evaluation.
David Evans CS150: Computer Science University of Virginia Computer Science Lecture 39: Lambda Calculus.
Computability and Complexity 4-1 Existence of Undecidable Problems Computability and Complexity Andrei Bulatov.
David Evans CS150: Computer Science University of Virginia Computer Science Lecture 40: Computing with Glue and Photons.
1 Scheme Scheme is a functional language. Scheme is based on lambda calculus. lambda abstraction = function definition In Scheme, a function is defined.
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.
Lecture 14: Church-Turing Thesis Alonzo Church ( ) Alan Turing ( )
Cs3102: Theory of Computation Class 17: Undecidable Languages Spring 2010 University of Virginia David Evans.
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.
Class 37: Computability in Theory and Practice cs1120 Fall 2011 David Evans 21 November 2011 cs1120 Fall 2011 David Evans 21 November 2011.
CSE S. Tanimoto Lambda Calculus 1 Lambda Calculus What is the simplest functional language that is still Turing complete? Where do functional languages.
David Evans CS588: Security and Privacy University of Virginia Computer Science Lecture 15: Complexity Notes This is selected.
David Evans CS200: Computer Science University of Virginia Computer Science Lecture 18: Think Globally, Mutate Locally.
David Evans CS200: Computer Science University of Virginia Computer Science Class 38: Fixed Points and Biological Computing.
David Evans CS150: Computer Science University of Virginia Computer Science Class 33: Computing with Photons From The.
David Evans CS200: Computer Science University of Virginia Computer Science Lecture 3: Rules of Evaluation.
Cs3102: Theory of Computation Class 14: Turing Machines Spring 2010 University of Virginia David Evans.
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.
Strings Basic data type in computational biology A string is an ordered succession of characters or symbols from a finite set called an alphabet Sequence.
CS 208: Computing Theory Assoc. Prof. Dr. Brahim Hnich
David Evans CS200: Computer Science University of Virginia Computer Science Class 32: The Meaning of Truth.
Overview of the theory of computation Episode 3 0 Turing machines The traditional concepts of computability, decidability and recursive enumerability.
Lecture 3: Rules of Evaluation CS150: Computer Science
1 Turing Machines - Chap 8 Turing Machines Recursive and Recursively Enumerable Languages.
1 Introduction to Turing Machines
David Evans CS200: Computer Science University of Virginia Computer Science Class 32: The Meaning of Truth.
Recall last lecture and Nondeterministic TMs Ola Svensson.
David Evans CS150: Computer Science University of Virginia Computer Science Class 32: Computability in Theory and Practice.
Turing Machines CS 130 Theory of Computation HMU Textbook: Chap 8.
David Evans CS200: Computer Science University of Virginia Computer Science Class 26: Halting Problem It is plain at any.
A Universal Computer. #2#2 One-Slide Summary The Turing machine is a fundamental model of computation. It models input, output, processing and memory.
(Thunking about Thunks)
Operational Semantics of Scheme
Functional Programming
Lecture 6: Lambda Calculus
Lecture 4: Evaluation Rules Recursion CS200: Computer Science
Class 27: Universal Turing Machines CS150: Computer Science
Class 30: Models of Computation CS200: Computer Science
Lecture 37: A Universal Computer
September 4, 1997 Programming Languages (CS 550) Lecture 6 Summary Operational Semantics of Scheme using Substitution Jeremy R. Johnson TexPoint fonts.
Lambda Calculus Revisited
Class 36: The Meaning of Truth CS200: Computer Science
What would be our focus ? Geometry deals with Declarative or “What is” knowledge. Computer Science deals with Imperative or “How to” knowledge 12/25/2018.
Lecture 25: Metalinguistics > (meval '((lambda (x) (* x x)) 4)
Lecture 24: Metalinguistics CS200: Computer Science
Class 37: Making Lists, Numbers and Recursion from Glue Alone
Lecture 27: In Praise of Idleness CS200: Computer Science
Lecture 26: The Metacircular Evaluator Eval Apply
Class 33: Making Recursion M.C. Escher, Ascending and Descending
What would be our focus ? Geometry deals with Declarative or “What is” knowledge. Computer Science deals with Imperative or “How to” knowledge 2/23/2019.
Recall last lecture and Nondeterministic TMs
Class 24: Computability Halting Problems Hockey Team Logo
Class 31: Universal Turing Machines CS200: Computer Science
Class 34: Models of Computation CS200: Computer Science
Lecture 3: Rules of Evaluation CS200: Computer Science
Class 26: Modeling Computing CS150: Computer Science
The Church-Turing Thesis and Turing-completeness
Presentation transcript:

David Evans CS200: Computer Science University of Virginia Computer Science Class 31: Universal Turing Machines

5 April 2004CS 200 Spring Menu Review: Modeling Computation Universal Turing Machines Lambda Calculus

5 April 2004CS 200 Spring Describing Turing Machines zzzzzzzzzzzzzzzzzzzzzz TuringMachine ::= Alphabet ::= { Symbol* } Tape ::= OneSquare ::= Symbol | # Current ::= OneSquare LeftSide ::= [ Square* ] RightSide ::= [ Square* ] Everything to left of LeftSide is #. Everything to right of RightSide is #. 1 Start HALT ), X, L 2: look for ( #, 1, -  ), #, R  (, #, L (, X, R #, 0, - Finite State Machine

5 April 2004CS 200 Spring Describing Finite State Machines TuringMachine ::= FSM ::= States ::= { StateName* } InitialState ::= StateName must be element of States HaltingStates ::= { StateName* }all must be elements of States TransitionRules ::= { TransitionRule* } TransitionRule ::= < StateName, ;; Current State OneSquare, ;; Current square StateName, ;; Next State OneSquare, ;; Write on tape Direction > ;; Move tape Direction ::= L, R, # 1 Start HALT ), X, L 2: look for (  ), #, R  (, #, L (, X, R #, 0, # #, 1, # Transition Rule is a procedure: StateName X OneSquare  StateName X OneSquare X Direction

5 April 2004CS 200 Spring Enumerating Turing Machines Now that we’ve decided how to describe Turing Machines, we can number them TM = balancing parens TM = even number of 1s TM = Photomosaic Program TM = WindowsXP Not the real numbers – they would be much bigger!

5 April 2004CS 200 Spring Universal Turing Machines

5 April 2004CS 200 Spring Universal Turing Machine Universal Turing Machine P Number of TM I Input Tape also, just a number! Output Tape for running TM-P in tape I Can we make a Universal Turing Machine?

5 April 2004CS 200 Spring Yes! People have designed Universal Turing Machines with –4 symbols, 7 states (Marvin Minsky) –4 symbols, 5 states –2 symbols, 22 states –18 symbols, 2 states No one knows what the smallest possible UTM is

5 April 2004CS 200 Spring Manchester Illuminated Universal Turing Machine, #9 from

5 April 2004CS 200 Spring Church-Turing Thesis Any mechanical computation can be performed by a Turing Machine There is a TM-n corresponding to every decidable problem We can simulate one step on any “normal” (classical mechanics) computer with a constant number of steps on a TM: –If a problem is in P on a TM, it is in P on an iMac, CM5, Cray, Palm, etc. –But maybe not a quantum computer!

5 April 2004CS 200 Spring Universal Language Is Scheme as powerful as a Universal Turing Machine? Is a Universal Turing Machine as powerful as Scheme?

5 April 2004CS 200 Spring Complexity in Scheme Special Forms –if, cond, define, etc. Primitives –Numbers (infinitely many) –Booleans: #t, #f –Functions (+, -, and, or, etc.) Evaluation Complexity –Environments (more than ½ of our meval code) Can we get rid of all this and still have a useful language? If we have lazy evaluation and don’t care about abstraction, we don’t need these. Hard to get rid of?

5 April 2004CS 200 Spring calculus Alonzo Church, 1940 (LISP was developed from -calculus, not the other way round.) term = variable | term term | (term) | variable. term

5 April 2004CS 200 Spring What is Calculus? In High School: d/dx x n = nx n-1 [Power Rule] d/dx (f + g) = d/dx f + d/dx g [Sum Rule] Calculus is a branch of mathematics that deals with limits and the differentiation and integration of functions of one or more variables...

5 April 2004CS 200 Spring Real Definition A calculus is just a bunch of rules for manipulating symbols. People can give meaning to those symbols, but that’s not part of the calculus. Differential calculus is a bunch of rules for manipulating symbols. There is an interpretation of those symbols corresponds with physics, slopes, etc.

5 April 2004CS 200 Spring Lambda Calculus Rules for manipulating strings of symbols in the language: term = variable | term term | (term) | variable. term Humans can give meaning to those symbols in a way that corresponds to computations.

5 April 2004CS 200 Spring Why? Once we have precise and formal rules for manipulating symbols, we can use it to reason with. Since we can interpret the symbols as representing computations, we can use it to reason about programs.

5 April 2004CS 200 Spring Evaluation Rules  -reduction(renaming) y. M   v. (M [y v]) where v does not occur in M.  -reduction(substitution) ( x. M)N   M [ x N ]

5 April 2004CS 200 Spring Reduction (Uninteresting Rules) y. M  v. (M [y v]) where v does not occur in M. M  M M  N  PM  PN M  N  MP  NP M  N  x. M  x. N M  N and N  P  M  P

5 April 2004CS 200 Spring  - Reduction (the source of all computation) ( x. M)N  M [ x N ]

5 April 2004CS 200 Spring 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 (redices). To evaluate a lambda expression, keep doing reductions until you get to normal form.

5 April 2004CS 200 Spring Recall Apply in Scheme “To apply a procedure to a list of arguments, evaluate the procedure in a new environment that binds the formal parameters of the procedure to the arguments it is applied to.” We’ve replaced environments with substitution. We’ve replaced eval with reduction.

5 April 2004CS 200 Spring Some Simple Functions I  x.x C  xy.yx Abbreviation for x.( y. yx) CII = ( x.( y. yx)) ( x.x) ( x.x)   ( y. y ( x.x)) ( x.x)   x.x ( x.x)   x.x = I

5 April 2004CS 200 Spring Example f. (( x. f (xx)) ( x. f (xx))) …we’ll work on this Wednesday

5 April 2004CS 200 Spring Charge PS7 Due Wednesday (2:00) PS8 Team Requests Due Wednesday (11:59pm) –If you don’t make a team request, you will be assigned randomly into a team Wednesday: show Lambda calculus is equivalent to a Turing Machine