Theory of Computation Lecture 12: A Universal Program IV

Slides:



Advertisements
Similar presentations
Repetition Statements Perform the same task repeatedly Allow the computer to do the tedious, boring things.
Advertisements

TE Sessions Supported by: Basic Concepts of Programming November 3, 2012.
Programming In C++ Spring Semester 2013 Lecture 3 Programming In C++, Lecture 3 By Umer Rana.
October 13, 2009Theory of Computation Lecture 11: A Universal Program III 1 Coding Programs by Numbers Gödel numbers are usually very large, even for small.
The Little man computer
October 27, 2009Theory of Computation Lecture 12: A Universal Program IV 1Universality Then we append the following instruction: [C]IF K = Lt(Z) + 1 
CS 5000: Lecture 37 Vladimir Kulyukin Department of Computer Science Utah State University.
December 8, 2009Theory of Computation Lecture 22: Turing Machines IV 1 Turing Machines Theorem 1.1: Any partial function that can be computed by a Post-
October 8, 2009Theory of Computation Lecture 10: A Universal Program II 1 Pairing Functions and Gödel Numbers This way the equation  x, y  = z defines.
September 17, 2009Theory of Computation Lecture 4: Programs and Computable Functions III 1 Macros Now we want to use macros of the form: W  f(V 1, …,
1 CS Programming Languages Random Access Machines Jeremy R. Johnson.
Chapter 4: A Universal Program 1. Coding programs Example : For our programs P we have variables that are arranged in a certain order: Y 1 X 1 Z 1 X 2.
Vectors and Matrices In MATLAB a vector can be defined as row vector or as a column vector. A vector of length n can be visualized as matrix of size 1xn.
CPS120: Introduction to Computer Science Decision Making in Programs.
Lecture 2b Dr. Robert D. Kent.  Structured program development  Program control.
December 1, 2009Theory of Computation Lecture 21: Turing Machines II 1 Simulation of L n in T We will now construct a Post-Turing program Q that simulates.
Lecture 1: A Formal Model of Computation 虞台文 大同大學資工所 智慧型多媒體研究室.
1 Ethics of Computing MONT 113G, Spring 2012 Session 7 Computer Architecture The Internet.
2.2 Product Laws of Exponents. 2.2 Objectives O To model behavior of exponents using function machines O To understand and apply the product laws of exponents.
Program Design. The design process How do you go about writing a program? –It’s like many other things in life Understand the problem to be solved Develop.
1 A Balanced Introduction to Computer Science, 2/E David Reed, Creighton University ©2008 Pearson Prentice Hall ISBN Chapter 13 Conditional.
Theory of Computation Lecture 5: Primitive Recursive Functions I
More on Pipelining 1 CSE 2312 Computer Organization and Assembly Language Programming Vassilis Athitsos University of Texas at Arlington.
More on Pipelining 1 CSE 2312 Computer Organization and Assembly Language Programming Vassilis Athitsos University of Texas at Arlington.
Equations Inequalities = > 3 5(8) - 4 Numerical
Lecture 5: Layers of Control. Nested while Loops Problem Multiplying two numbers and outputting the result only if they are both less than 5. (i.e. Start.
Computer Architecture. Instruction Set “The collection of different instructions that the processor can execute it”. Usually represented by assembly codes,
Core Java Statements in Java.
The Little man computer
Theory of Computation Lecture 10: A Universal Program I
CS161 Introduction to Computer Science
Theory of Computation Lecture 12: A Universal Program III
Theory Of Computer Science
Exponents Scientific Notation
Exponent Rules.
Introduction to Computing
Theory of Computation Lecture 23: Turing Machines IV
Theory of Computation Lecture 14: A Universal Program V
Numerical Representation of Strings
CENTRAL PROCESSING UNIT CPU (microprocessor)
Starter Read the Feedback Click on Add new Feedback Open Realsmart
Theory of Computation Lecture 16: A Universal Program VII
11/10/2018.
Theory of Computation Lecture 5: Programs and Computable Functions III
Theory of Computation Lecture 6: Primitive Recursive Functions I
Alternate Version of STARTING OUT WITH C++ 4th Edition
Algorithms Take a look at the worksheet. What do we already know, and what will we have to learn in this term?
Theory Of Computer Science
Faculty of Computer Science & Information System
The Programming Language L
M150: Data, Computing and Information
Vectors and Matrices In MATLAB a vector can be defined as row vector or as a column vector. A vector of length n can be visualized as matrix of size 1xn.
Pairing Functions and Gödel Numbers
Theory of Computation Lecture 21: Turing Machines II
Recursively Enumerable Sets
Little Man Computer (continued).
Theory of Computation Lecture 5: Programs and Computable Functions III
The Programming Language L
Some Assembly (Part 2) set.html.
Theory of Computation Lecture 4: Programs and Computable Functions II
Theory of Computation Lecture 9: A Universal Program I
Chapter 13 Conditional Repetition
Pairing Functions and Gödel Numbers
Theory of Computation Lecture 6: Primitive Recursive Functions I
Theory of Computation Lecture 22: Turing Machines II
Theory of Computation Lecture 13: A Universal Program V
Recursively Enumerable Sets
Systems Architecture I (CS ) Lecture 1: Random Access Machines
Theory of Computation Lecture 11: A Universal Program III
Lecture 2: Limiting Models of Instruction Obeying Machine
Presentation transcript:

Theory of Computation Lecture 12: A Universal Program IV Universality Then we append the following instruction: [C] IF K = Lt(Z) + 1  K = 0 GOTO F So if the computation has ended, GOTO F, where the proper value will be output. Otherwise, the current instruction is decoded and executed: U  r((Z)K) P  pr(U)+1 Remember that (Z)K = a, b, c is the number of the K-th instruction. So U = b, c is the code of the statement to be executed. The variable mentioned in this statement is the (c + 1)-th, i.e., the (r(U) + 1)-th. March 28, 2019 Theory of Computation Lecture 12: A Universal Program IV

Theory of Computation Lecture 12: A Universal Program IV Universality Then l(U) contains the type of the instruction to be executed. IF l(U) = 0 GOTO N IF l(U) = 1 GOTO A IF (P | S) GOTO N IF l(U) = 2 GOTO M If either the instruction is V  V, or the instruction is V  V-1 and V = 0 (as indicated by the absence of P in S), or the instruction is IF V0 GOTO L and V = 0, then nothing is done to S (“nothing” - GOTO N). If the instruction is V  V+1, then the exponent of P in S needs to be incremented (“add” – GOTO A). If the instruction is V  V-1 with V > 0, then the exponent of P in S needs to be decremented (“minus” – GOTO M). March 28, 2019 Theory of Computation Lecture 12: A Universal Program IV

Theory of Computation Lecture 12: A Universal Program IV Universality If none of the four previous predicates were true, a GOTO command has to be executed: K  miniLt(Z) [l((Z)i) + 2 = l(U)] GOTO C So if the label l(U) – 2 exists in the program, the number K of the next instruction to be executed will be set to the first instruction with that label. Otherwise, K will be set to 0. As you remember, if K = 0 or K = Lt(Z) + 1, then the computation stops. In any case, our interpreter program executes a GOTO C to execute the next instruction. March 28, 2019 Theory of Computation Lecture 12: A Universal Program IV

Theory of Computation Lecture 12: A Universal Program IV Universality The program continues as follows: [M] S  S/P GOTO N [A] S  S  P [N] K  K+1 GOTO C The value of the variable in the current instruction is decremented or incremented by 1 by dividing or multiplying S by P, respectively. Then K is incremented and the next instruction executed. March 28, 2019 Theory of Computation Lecture 12: A Universal Program IV

Theory of Computation Lecture 12: A Universal Program IV Universality The program concludes with the following line: [F] Y  (S)1 This way, after termination of the interpreted program, its output value becomes the output value of the interpreter. On the next slide, we will list the entire interpreter program. March 28, 2019 Theory of Computation Lecture 12: A Universal Program IV

Theory of Computation Lecture 12: A Universal Program IV Universality Z  Xn+1 + 1 S  ni=1 (p2i)Xi K  1 [C] IF K = Lt(Z) + 1  K = 0 GOTO F U  r((Z)K) P  pr(U)+1 IF l(U) = 0 GOTO N IF l(U) = 1 GOTO A IF (P | S) GOTO N IF l(U) = 2 GOTO M K  miniLt(Z) [l((Z)i) + 2 = l(U)] GOTO C [M] S  S/P GOTO N [A] S  S  P [N] K  K+1 [F] Y  (S)1 March 28, 2019 Theory of Computation Lecture 12: A Universal Program IV

Theory of Computation Lecture 12: A Universal Program IV Universality For each n > 0, the sequence (n)(x1, …, xn, 0), (n)(x1, …, xn, 1), … enumerates all partially computable functions of n variables. We can also write: y(n)(x1, …, xn) = (n)(x1, …, xn, y). We can omit the superscript (n) when n = 1: y(x) = (x, y) = (1)(x, y). March 28, 2019 Theory of Computation Lecture 12: A Universal Program IV

Theory of Computation Lecture 12: A Universal Program IV Universality Consider the following predicates: STP(n)(x1, …, xn, y, t)  Program number y halts after t or fewer steps on inputs x1, …, xn  There is a computation of program y of length  t + 1, beginning with inputs x1, …, xn These predicates are computable, which we can easily prove: We can simply add a counter to our universal programs to determine when we have simulated t steps. March 28, 2019 Theory of Computation Lecture 12: A Universal Program IV