Theory of Computer Science

Similar documents
Theory of Computer Science. D2.1 Introduction. Theory of Computer Science. D2.2 LOOP Programs. D2.3 Syntactic Sugar. D2.

Theory of Computer Science. Theory of Computer Science. D4.1 Introduction. D4.2 Basic Functions and Composition. D4.3 Primitive Recursion

Theory of Computer Science

We can create PDAs with multiple stacks. At each step we look at the current state, the current input symbol, and the top of each stack.

Computer Sciences Department

TAFL 1 (ECS-403) Unit- V. 5.1 Turing Machine. 5.2 TM as computer of Integer Function

The Turing Machine. Unsolvable Problems. Undecidability. The Church-Turing Thesis (1936) Decision Problem. Decision Problems

2.8 Universal Turing Machines and the Halting Problem

COMP 382: Reasoning about algorithms

arxiv: v1 [cs.cc] 9 Jan 2015

Lecture 7: Primitive Recursion is Turing Computable. Michael Beeson

Equivalence of NTMs and TMs

CSE 105 THEORY OF COMPUTATION

6.045J/18.400J: Automata, Computability and Complexity. Practice Quiz 2

CSE 105 THEORY OF COMPUTATION

Variants of Turing Machines

Computation Engineering Applied Automata Theory and Logic. Ganesh Gopalakrishnan University of Utah. ^J Springer

Source of Slides: Introduction to Automata Theory, Languages, and Computation By John E. Hopcroft, Rajeev Motwani and Jeffrey D.

Static Program Analysis

CS21 Decidability and Tractability

Course notes for Data Compression - 2 Kolmogorov complexity Fall 2005

(a) Give inductive definitions of the relations M N and M N of single-step and many-step β-reduction between λ-terms M and N. (You may assume the

CS 275 Automata and Formal Language Theory. First Problem of URMs. (a) Definition of the Turing Machine. III.3 (a) Definition of the Turing Machine

A Characterization of the Chomsky Hierarchy by String Turing Machines

Static Program Analysis

Lecture 5: The Halting Problem. Michael Beeson

Lecture T4: Computability

Outline. Language Hierarchy

Universal Turing Machine Chomsky Hierarchy Decidability Reducibility Uncomputable Functions Rice s Theorem Decidability Continued

Elementary Recursive Function Theory

Midterm Practice Exam Sample Solutions

p x i 1 i n x, y, z = 2 x 3 y 5 z

Limitations of Algorithmic Solvability In this Chapter we investigate the power of algorithms to solve problems Some can be solved algorithmically and

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2016

Examples of P vs NP: More Problems

Recursively Enumerable Languages, Turing Machines, and Decidability

CONVENTIONAL EXECUTABLE SEMANTICS. Grigore Rosu CS522 Programming Language Semantics

Non-Deterministic Space

CONVENTIONAL EXECUTABLE SEMANTICS. Grigore Rosu CS422 Programming Language Semantics

MATH Iris Loeb.

CISC 4090 Theory of Computation

CS 531: Notes II. January 31, 2014

Formal languages and computation models

pp Variants of Turing Machines (Sec. 3.2)

Final Course Review. Reading: Chapters 1-9

Syllabi of the Comprehensive Examination in Computer Science

We ve studied the main models and concepts of the theory of computation:

Introduction to Automata Theory. BİL405 - Automata Theory and Formal Languages 1

University of Nevada, Las Vegas Computer Science 456/656 Fall 2016

CIS 1.5 Course Objectives. a. Understand the concept of a program (i.e., a computer following a series of instructions)

Regular Languages (14 points) Solution: Problem 1 (6 points) Minimize the following automaton M. Show that the resulting DFA is minimal.

Binary Code Analysis: Concepts and Perspectives

Languages and Automata

CpSc 421 Final Solutions

CSCI 340: Computational Models. Turing Machines. Department of Computer Science

Computability Summary

Automata Theory CS F-14 Counter Machines & Recursive Functions

14.1 Encoding for different models of computation

Lecture 9: More Lambda Calculus / Types

- M ::= v (M M) λv. M - Impure versions add constants, but not necessary! - Turing-complete. - true = λ u. λ v. u. - false = λ u. λ v.

Recursive Function Theory

Turing Machine Languages

More Simulations. CS154 Chris Pollett Apr 25, 2007.

Introduction to the Lambda Calculus

Skyup's Media. PART-B 2) Construct a Mealy machine which is equivalent to the Moore machine given in table.

Turing Machines. A transducer is a finite state machine (FST) whose output is a string and not just accept or reject.

More than a Name? On Implications of Preconditions and Effects of Compound HTN Planning Tasks

CHAPTER 4. COMPUTABILITY AND DECIDABILITY

CSE 105 THEORY OF COMPUTATION

Computability Theory XI

Log-Space. A log-space Turing Machine is comprised of two tapes: the input tape of size n which is cannot be written on, and the work tape of size.

NP-Completeness. Algorithms

Theory Bridge Exam Example Questions Version of June 6, 2008

1. true / false By a compiler we mean a program that translates to code that will run natively on some machine.

1. [5 points each] True or False. If the question is currently open, write O or Open.

Two Problems. Programming Languages and Compilers (CS 421) Type Inference - Example. Type Inference - Outline. Type Inference - Example

Register Machines. Connecting evaluators to low level machine code

Rule Formats for Nominal Modal Transition Systems

The Eval/Apply Cycle Eval. Evaluation and universal machines. Examining the role of Eval. Eval from perspective of language designer

Cover Page. The handle holds various files of this Leiden University dissertation

We show that the composite function h, h(x) = g(f(x)) is a reduction h: A m C.

UNIT I PART A PART B

Lexical Analysis. COMP 524, Spring 2014 Bryan Ward

Solution Set 8 Date: 1 December, 1992

University of Waterloo Undergraduate Catalog Report Faculty of Mathematics Page No. 1 Run Date 20-AUG-2007 Meeting Number(s) 25

Rice s Theorem and Enumeration

COMPUTABILITY THEORY AND RECURSIVELY ENUMERABLE SETS

ONE-STACK AUTOMATA AS ACCEPTORS OF CONTEXT-FREE LANGUAGES *

(a) R=01[((10)*+111)*+0]*1 (b) ((01+10)*00)*. [8+8] 4. (a) Find the left most and right most derivations for the word abba in the grammar

The Formal Semantics of Programming Languages An Introduction. Glynn Winskel. The MIT Press Cambridge, Massachusetts London, England

Lambda Calculus and Computation

CSCI 3130: Formal Languages and Automata Theory Lecture 16 The Chinese University of Hong Kong, Fall 2010

Note that in this definition, n + m denotes the syntactic expression with three symbols n, +, and m, not to the number that is the sum of n and m.

Name: CS 341 Practice Final Exam. 1 a 20 b 20 c 20 d 20 e 20 f 20 g Total 207

Computability and Complexity Sample Exam Questions

Computability and Complexity

Reflection in the Chomsky Hierarchy

05. Turing Machines and Spacetime. I. Turing Machines and Classical Computability.

CS 242. Fundamentals. Reading: See last slide

Semantics of COW. July Alex van Oostenrijk and Martijn van Beek

Transcription:

Theory of Computer Science D3. GOTO-Computability Malte Helmert University of Basel April 25, 2016

Overview: Computability Theory Computability Theory imperative models of computation: D1. Turing-Computability D2. LOOP- and WHILE-Computability D3. GOTO-Computability functional models of computation: D4. Primitive Recursion and µ-recursion D5. Primitive/µ-Recursion vs. LOOP-/WHILE-Computability undecidable problems: D6. Decidability and Semi-Decidability D7. Halting Problem and Reductions D8. Rice s Theorem and Other Undecidable Problems Post s Correspondence Problem Undecidable Grammar Problems Gödel s Theorem and Diophantine Equations

Further Reading (German) Literature for this Chapter (German) Theoretische Informatik kurz gefasst by Uwe Schöning (5th edition) Chapter 2.3

Further Reading (English) Literature for this Chapter (English) Introduction to the Theory of Computation by Michael Sipser (3rd edition) This topic is not discussed by Sipser!

WHILE vs. Turing

WHILE-Computability vs. Turing-Computability Theorem Every WHILE-computable function is Turing-computable. (We will discuss the converse statement later.)

WHILE-Computability vs. Turing-Computability Proof sketch. Given any WHILE program, we construct an equivalent deterministic Turing machine. Let x 1,..., x k be the input variables of the WHILE program, and let x 0,..., x m be all used variables. General ideas: The DTM simulates the individual execution steps of the WHILE program. Before and after each WHILE program step the tape contains the word bin(n 0 )#bin(n 1 )#... #bin(n m ), where n i is the value of WHILE program variable x i. It is enough to simulate minimalistic WHILE programs (x i := x i + 1, x i := x i 1, composition, WHILE loop)....

WHILE-Computability vs. Turing-Computability Proof sketch (continued). The DTM consists of three sequential parts: initialization: Write 0# in front of the used part of the tape. (m k) times, write #0 behind the used part of the tape. execution: Simulate the WHILE program (see next slide). clean-up: Replace all symbols starting from the first # with, then move to the first symbol that is not....

WHILE-Computability vs. Turing-Computability Proof sketch (continued). Simulation of x i := x i + 1: 1 Move left until a blank is reached, then one step to the right. 2 (i + 1) times: move right until # or is reached. 3 Move one step to the left. We are now on the last digit of the encoding of x i. 4 Execute DTM for increment by 1. (Most difficult part: make room if the number of binary digits increases.)...

WHILE-Computability vs. Turing-Computability Proof sketch (continued). Simulation of x i := x i 1: 1 Move to the last digit of x i (see previous slide). 2 Test if the digit is a 0 and the symbol to its left is # or. If so: done. 3 Otherwise: execute DTM for decrement by 1. (Most difficult part: contract the tape if the decrement reduces the number of digits.)...

WHILE-Computability vs. Turing-Computability Proof sketch (continued). Simulation of P 1 ; P 2 : 1 Recursively build DTMs M 1 for P 1 and M 2 for P 2. 2 Combine these to a DTM for P 1 ; P 2 by letting all transitions to end states of M 1 instead go to the start state of M 2....

WHILE-Computability vs. Turing-Computability Proof sketch (continued). Simulation of WHILE x i 0 DO P END: 1 Recursively build DTM M for P. 2 Build a DTM M for WHILE x i 0 DO P END that works as follows: 1 Move to the last digit of x i. 2 Test if that symbol is 0 and the symbol to its left is # or. If so: done. 3 Otherwise execute M, where all transitions to end states of M are replaced by transitions to the start state of M.

Questions Questions?

GOTO Programs

Intermediate Summary We now know: WHILE programs are strictly more powerful than LOOP programs. Deterministic Turing machines are at least as powerful as WHILE programs. Are DTMs strictly more powerful than WHILE programs or equally powerful? To answer this question, we make a detour over one more programming formalism.

GOTO Programs: Syntax Definition (GOTO Program) A GOTO program is given by a finite sequence L 1 : A 1, L 2 : A 2,..., L n : A n of labels and statements. Statements are of the following form: x i := x j + c for every i, j, c N 0 (addition) x i := x j c for every i, j, c N 0 (modified subtraction) HALT (end of program) GOTO L j for 1 j n (jump) IF x i = c THEN GOTO L j for i, c N 0, 1 j n (conditional jump) German: GOTO-Programm, Marken, Anweisungen, Programmende, Sprung, bedingter Sprung

GOTO Programs: Semantics Definition (Semantics of GOTO Programs) Input, output and variables work exactly as in LOOP and WHILE programs. Addition and modified subtraction work exactly as in LOOP and WHILE programs. Execution begins with the statement A 1. After executing A i, the statement A i+1 is executed. (If i = n, execution finishes.) exceptions to the previous rule: HALT stops the execution of the program. After GOTO L j execution continues with statement A j. After IF x i = c THEN GOTO L j execution continues with A j if variable x i currently holds the value c.

GOTO-Computable Functions Definition (GOTO-Computable) A function f : N k 0 N 0 is called GOTO-computable if a GOTO program that computes f exists. German: GOTO-berechenbar

Questions Questions?

GOTO vs. WHILE

GOTO-Computability vs. WHILE-Computability Theorem Every GOTO-computable function is WHILE-computable. If we allow IF statements, a single WHILE loop is sufficient for this. (We will discuss the converse statement later.)

GOTO-Computability vs. WHILE-Computability Proof sketch. Given any GOTO program, we construct an equivalent WHILE program with a single WHILE loop (and IF statements). Ideas: Use a fresh variable to store the number of the statement to be executed next. The variable of course has the form x i, but for readability we write it as pc for program counter. GOTO is simulated as an assignment to pc. If pc has the value 0, the program terminates....

GOTO-Computability vs. WHILE-Computability Proof sketch (continued). Let L 1 : A 1, L 2 : A 2,..., L n : A n be the given GOTO program. basic structure of the WHILE program: pc := 1; WHILE pc 0 DO IF pc = 1 THEN (translation of A 1 ) END;... IF pc = n THEN (translation of A n ) END; IF pc = n + 1 THEN pc := 0 END END...

GOTO-Computability vs. WHILE-Computability Proof sketch (continued). Translation of the individual statements: x i := x j + c x i := x j + c; pc := pc + 1 x i := x j c x i := x j c; pc := pc + 1 HALT pc := 0 GOTO L j pc := j IF x i = c THEN GOTO L j pc := pc + 1; IF x i = c THEN pc := j END

Intermediate Summary We now know: WHILE programs are strictly more powerful than LOOP programs. Deterministic Turing machines are at least as powerful as WHILE programs. WHILE programs are at least as powerful as GOTO programs. We now show that GOTO programs are at least as powerful as DTMs, closing the cycle DTM WHILE GOTO.

Questions Questions?

Turing vs. GOTO

Turing-Computability vs. GOTO-Computability Theorem (Turing-Computability vs. GOTO-Computability) Every Turing-computable numerical function is GOTO-computable. Proof. blackboard.

Final Result Corollary Let f : N k 0 p N 0 be a function. The following statements are equivalent: f is Turing-computable. f is WHILE-computable. f is GOTO-computable. Moreover: Every LOOP-computable function is Turing-/WHILE-/GOTO-computable. The converse is not true in general.

Questions Questions?

Summary

Summary results of the investigation: another new model of computation: GOTO programs Turing machines, WHILE and GOTO programs are equally powerful. LOOP programs are strictly less powerful.