Advanced Computing Concepts Slide Set 1-5. Turing machines

Similar documents
Theory of Programming Languages COMP360

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

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.

Propositional Logic Formal Syntax and Semantics. Computability and Logic

CS21 Decidability and Tractability

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

Decidable Problems. We examine the problems for which there is an algorithm.

CISC 4090 Theory of Computation

Variants of Turing Machines

Equivalence of NTMs and TMs

Structure of a Compiler: Scanner reads a source, character by character, extracting lexemes that are then represented by tokens.

MATH Iris Loeb.

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

Theory of Computations Spring 2016 Practice Final Exam Solutions

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

Computer Sciences Department

CSE 105 THEORY OF COMPUTATION

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2016

Theory of Computation, Homework 3 Sample Solution

Outline. Language Hierarchy

T.E. (Computer Engineering) (Semester I) Examination, 2013 THEORY OF COMPUTATION (2008 Course)

Theory of Computations Spring 2016 Practice Final

(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

CSE 105 THEORY OF COMPUTATION

Turing Machine Languages

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

The Big Picture. Chapter 3

1.0 Languages, Expressions, Automata

Lambda Calculus and Computation

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

ECS 120 Lesson 16 Turing Machines, Pt. 2

CSCI 270: Introduction to Algorithms and Theory of Computing Fall 2017 Prof: Leonard Adleman Scribe: Joseph Bebel

pp Variants of Turing Machines (Sec. 3.2)

Actually talking about Turing machines this time

Theory of Languages and Automata

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

Theory of Computation p.1/?? Theory of Computation p.2/?? A Turing machine can do everything that any computing

Does this program exist? Limits of computability. Does this program exist? A helper function. For example, if the string program is

Computability, Cantor s diagonalization, Russell s Paradox, Gödel s s Incompleteness, Turing Halting Problem.

Theory of Computer Science

Lecture 5: The Halting Problem. Michael Beeson

8 ε. Figure 1: An NFA-ǫ

6. Advanced Topics in Computability

Lec-5-HW-1, TM basics

Enumerations and Turing Machines

Reflection in the Chomsky Hierarchy

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

Recursively Enumerable Languages, Turing Machines, and Decidability

COMPUTABILITY THEORY AND RECURSIVELY ENUMERABLE SETS

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

Final Exam 1, CS154. April 21, 2010

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

COMP Logic for Computer Scientists. Lecture 25

Lecture T4: Computability

COMP 382: Reasoning about algorithms

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

We use L i to stand for LL L (i times). It is logical to define L 0 to be { }. The union of languages L and M is given by

Languages and Models of Computation

CS402 - Theory of Automata Glossary By

Languages and Finite Automata

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

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

CS6160 Theory of Computation Problem Set 2 Department of Computer Science, University of Virginia

Notes on Turing s Theorem and Computability

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

Functional Languages. Hwansoo Han

1 Finite Representations of Languages

Finite automata. III. Finite automata: language recognizers. Nondeterministic Finite Automata. Nondeterministic Finite Automata with λ-moves

CS 44 Exam #2 February 14, 2001

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

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

MAT 7003 : Mathematical Foundations. (for Software Engineering) J Paul Gibson, A207.

Programming Language Pragmatics

Definition: A context-free grammar (CFG) is a 4- tuple. variables = nonterminals, terminals, rules = productions,,

Computer Science. 18. Turing Machines. 18. Turing Machines. Computer Science Pioneering work at Princeton in the 1930s.

Theory Bridge Exam Example Questions Version of June 6, 2008

THE HALTING PROBLEM. Joshua Eckroth Chautauqua Nov

Java s Precedence. Extended Grammar for Boolean Expressions: Implication. Parse tree. Highest precedence. Lowest precedence

Programming Languages Third Edition

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

Problems, Languages, Machines, Computability, Complexity

SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION

14.1 Encoding for different models of computation

Introduction to the Lambda Calculus

Lecture 18: Turing Machines

KEY. A 1. The action of a grammar when a derivation can be found for a sentence. Y 2. program written in a High Level Language

Chapter 11 :: Functional Languages

1. Draw the state graphs for the finite automata which accept sets of strings composed of zeros and ones which:

Final Exam 2, CS154. April 25, 2010

To prove something about all Boolean expressions, we will need the following induction principle: Axiom 7.1 (Induction over Boolean expressions):

the Computability Hierarchy

THEORY OF COMPUTATION

Material from Recitation 1

THEORY OF COMPUTATION

CSE 120. Computer Science Principles

MIT Specifying Languages with Regular Expressions and Context-Free Grammars. Martin Rinard Massachusetts Institute of Technology

Diagonalization. The cardinality of a finite set is easy to grasp: {1,3,4} = 3. But what about infinite sets?

R10 SET a) Construct a DFA that accepts an identifier of a C programming language. b) Differentiate between NFA and DFA?

Reducibilities relations with applications to symbolic dynamics

Programs with infinite loops: from primitive recursive predicates to the arithmetic hierarchy

Transcription:

Turing machines istory: 1900 David ilert asked: Given an axiomatization of an area of mathematics (e.g. ilert s axiomatization of Geometry, or Frege s axiomatization of natural numers), is there a procedure that will determine the truth of any conjecture? ilert did not mathematically define the concept of a procedure. 1930 Gödel showed that every true sentence in firstorder predicate logic can e proved. It remained to develop a procedure of determining whether the a sentence in first order predicate logic is true or false. 1936 Alan Turing proposed the Turing machine to define the concept of a procedure. is conclusion: There is no procedure that can classify sentences of March 20, 2018 1

A Turing machine represents an idealized human computer: Performs one kind of computation. Never makes a mistake. Never runs out of paper, pencils, erasers, or time. Finite rain power. Syntax of a Turing Machine A Turing Machine is a tuple(s,q,q start,q halt,t) S is a finite alphaet set including the lank symol / Qis a finite state set q start Q is the start state q halt / Q is the halt pseudostate. T is a set of transitions (see elow) Each transition is a tuple(q,a,r,,d) whereq Q, a, S,r Q {q halt },andd {L,}. We require that the Turing machine e deterministic in the sense that for each(q,a) pair, there is exactly one transition (q,a,,r): q Q a S 1= {(r,,d) (q,a,r,,d) T} March 20, 2018 2

Operation of a Turing Machine: The input and output of a Turing Machine is represented y a tape, which is a two way infinite sequence of symols. Although the tape is considered to e infinite, we will restrict it to contain only a finite amount of information y insisting that all ut a finite numer of cells on the tape e lank. We imagine there is a read/write head over the tape. In each step of execution, one symol is read and that cell of the tape is then overwritten with a symol. The the head moves either left or right. A configuration of a Turing machine consists of a stateq, a value of the tapet, and a position of the headk. Letw e the input string. vart:z tot S:=[..., /, /, /,...] fori {0,.. w } dot(i):=w(i) vark:=0 varq:=q start while true do ( letr,,d (q,t(k),r,,d) T t(k):=; ifr=q halt reak ifd=l thenk:=k 1elsek:=k+1; q:=r) outputt[k,...] March 20, 2018 3

An example: Another parenthesis checker. In the pictures states are marked with or L. All transitions into a state marked haved=. All transitions into a state marked L state haved=l. The halt pseudostate is. start ) X L no X ( yes L ( no Convention: Arrows that leave state alone and don't change the tape are omitted from the diagram. E.g. ( start omitted ( X X Notice that it overwrites its input with X s two matching parentheses at a time. March 20, 2018 4

A Turing machine to convert inary to unary Convert Binary to Unary. start A 0 in input: Doule the output. 1 X X A 1 L 1 0 X 1 0 L X X 1 1 in input: Change to 0 and add 1 to output Initial Config start...110x... Final config...111111... March 20, 2018 5

alting Note a Turing machine may not halt on some inputs. Thus a Turing machine does not define a function from strings to strings, ut rather a partial function i.e. a function except that for some memers of the domain there is no result. Prolem 0 (The halting prolem): Given a Turing machine and an input tape, determine whether the TM will halt. Prolem 1: Given a Turing machine determine, if it will halt for all initial configurations. Prolem 2: (Busy Beaver): Given a numer N, find the maximum numer of 1 s that can e output y a TM with N states, and an alphaet of{1, } when started on an all lank tape. (NB the TM must halt for this input tape.) Equivalent formalisms. Idealized Programming languages Suppose C s or Java s new command never failed to find new memory. Suppose that in askell, LISP, or ML we can construct aritrarily long lists. Idealized computers. a computer in which a memory of finite words is indexed y the natural numers (rather than a finite suset thereof) a computer with a finite numer of words (at least 2), ut where every memory word contains an integer (rather than a 32-it integer). (egister Machine) March 20, 2018 6

Infinite numer of integers (andom Access Machine) a PC with an endless supply of rewritale disks and an operator to change them on request. Lamda Calculus (Church 1936). A simple Functional Programming Language. Partial recursive functions (Kleene 1936): Functions formed from addition, sutraction and a minimum operator: minf(x)=the minimum naturalxsuch thatf(x)=0. x Grammars in which more than one symol may appear on Left-hand-side L B B 0ABC2 ɛ AC 1 A1 1A 2PDAs Like PDA s ut with 2 stacks. The human computer. Any limitation that applies to an idealized programming language or a idealized computer will also apply to real programming languages and real computers. Effective computaility Defn: An effectively computale function is a function which can e evaluated y an algorithm. N.B. This is not a mathematical definition as algorithm is not a well defined concept. March 20, 2018 7

The Church-Turing Thesis: Any effectively computale function can e computed y some (always halting) Turing machine. Note: This is not a mathematical theorem. It is a generally held elief. Note: The converse is oviously true. Any function computed y a TM is effectively computale. Corollary: Any effectively computale function can e computed y any of the aove equivalent formalisms. Why Turing Machines make good models Why would we e interested in Turing Machines and similar models if all real devices have a finite amount of memory? We can not investigate time and space complexity unless we can consider inputs of unounded size. Limitations on finite memory models can e overcome y enlarging the memory. Limitations on infinite memory models are fundamental. unning out of space in software is unpredictale. The model of memory used y (good) software developers is that of an unknown amount of memory. If an algorithm won t work on a machine with unlimited memory, it certainly won t work given an unknown amount of memory. Limits on the power of Turing machines Are there well-defined mathematical prolems that no computer can solve? March 20, 2018 8

We will show that the alting Prolem can not e solved y any algorithmic method Claim: For any TM, there exists an equivalent TM with an alphaet of{0, 1, }. We can encode the original alphaet with a inary code. We can encode any such TM as a sequence of symols from a small alphaet. E.g. use inary encoding of the states. Define enc(t)= the encoding oft Theorem the halting prolem can not e solved y any Turing Machine. Proof (By contradiction) Assume to the contrary that we have a TM that solves the halting prolem. Specifically: If we start in a configuration... encoding of a T X I... then if T halts for input I, halts in a configuration:... Yes... and if T does not halt for input I, halts in a configuration... No... March 20, 2018 9

Thus computes a function (enc(t),i)= if T halts on I then output yes and halt else output no and halt We can uild another TM D using as a suroutine as follows D(I)=if(I,I)then loopelse halt I.e. D loops forever if returns yes. start Turing machine yes no start D Duplicate the input Turing machine yes Note machine will move right forever from this state. (ememer omitted arrows) no March 20, 2018 10

Consider running D with an input of enc(d). This computation must halt or not. Furthermore can tell us which. Suppose D(enc(D)) halts. D(enc(D)) = if(enc(d), enc(d))then loopelse halt = Supposition if yesthen loopelse halt = loop ThusD(enc(D)) does not halt. Contradiction. Suppose now thatd(enc(d)) does not halt D(enc D) = if(enc(d), enc(d))then loopelse halt = Supposition if nothen loopelse halt = halt ThusD(enc(D)) does halt. Contradiction Either way there is a contradiction. The culprit must e out assumption that exists. QED Note: For many TMs and specific inputs, we can determine if they halt. Corollary: Assuming the C-T thesis, there are prolems no computer (and no human) can solve. Other unsolvale prolems. Given an aritrary mathematical conjecture, does it have March 20, 2018 11

a proof? Given an aritrary polynomial such as a 3 2 c 4 +a 2 3 =0 Do there exists integer solutions? That is unsolvale was proved in 1970: 70 years after ilert asked for a solution. (Proof y showing that such equations can encode Turing Machines.) The first says there is no universal theorem proving method. The second shows there are implications for everyday mathematics. A universal TM (Optional) Claim: There exists a TM (called U) with the following properties: Suppose we have a TMT (with alphaet{0,1, }) that only uses the left half of the tape. Suppose we have an input sequencei fort We will start it in a configuration... encoding of a T X input I... IfT halts on inputi with outputothenu halts in a configuration... encoding of a T X output O... IfT does not halt on inputi thenu does not halt. Minsky (1967) descries a U with 23 states. March 20, 2018 12

U is a stored-program computer: It is capale of executing any algorithm.t is the software representing the algorithm. We only need one TM: U We only need one kind of computing machine. The rest we can do with software. March 20, 2018 13

The Chomsky ierarchy (+ Others) Type 3: (Finite space) egular languages: ecognized y Deterministic Finite ecognizers (DFs) Nondeterministic Finite ecognizers (NDFs) egular expressions & EFs Type?: (Stack memory) L(k) Deterministic Push-Down Automata Type 2: (Stack memory) Context Free Languages Nondeteriministic Push-Down Automata Context-Free Grammars Type 1 (Linear space) Context Sensitive Languages Turing Machines with memoryo(n) of input sizen. Type? (Infinite space) ecursive Languages Turing Machines (etc) that halt Type 0 (Infinite space.) ecursively Enumerale Languages Turing Machines, Unrestricted grammars, Idealized Computers and Languages, Lamda Calculus, General ecursive Functions March 20, 2018 14