Computability Dr. Colin Campbell Course Element 2 (EMAT20531)

Slides:



Advertisements
Similar presentations
1 C Programming. 2 Operators 3 Operators in C An operator is a symbol that tells the computer to perform certain mathematical or logical manipulation.
Advertisements

By John E. Hopcroft, Rajeev Motwani and Jeffrey D. Ullman
CS4026 Formal Models of Computation Part II The Logic Model Lecture 8 – Search and conclusions.
A Simple ALU Binary Logic.
Computational Complexity
Turing Machines Part 1:. 2 Church-Turing Thesis Part 1 An effective procedure is defined as: a procedure which can be broken down into simple.
Turing Machines January 2003 Part 2:. 2 TM Recap We have seen how an abstract TM can be built to implement any computable algorithm TM has components:
CSCI 3130: Formal Languages and Automata Theory Tutorial 5
Computing functions with Turing machines
Chapter 11: Models of Computation
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.
Turing Machines.
CS2303-THEORY OF COMPUTATION
CS1022 Computer Programming & Principles
Introduction to Computability Theory
Finite-state Recognizers
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
Finite State Machines Finite state machines with output
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
1 Turing Machines and Equivalent Models Section 13.2 The Church-Turing Thesis.
1 Introduction to Computability Theory Lecture11: Variants of Turing Machines Prof. Amos Israeli.
Prof. Busch - LSU1 Decidable Languages. Prof. Busch - LSU2 Recall that: A language is Turing-Acceptable if there is a Turing machine that accepts Also.
Fall 2004COMP 3351 Turing Machines. Fall 2004COMP 3352 The Language Hierarchy Regular Languages Context-Free Languages ? ?
1 Uncountable Sets continued Theorem: Let be an infinite countable set. The powerset of is uncountable.
Courtesy Costas Busch - RPI1 Turing Machines. Courtesy Costas Busch - RPI2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
1 Computing Functions with Turing Machines. 2 A function Domain: Result Region: has:
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-
Fall 2005Costas Busch - RPI1 Recursively Enumerable and Recursive Languages.
Costas Busch - RPI1 Turing Machines. Costas Busch - RPI2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
1 Turing Machines. 2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
Prof. Busch - LSU1 Turing Machines. Prof. Busch - LSU2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
Unsolvability and Infeasibility. Computability (Solvable) A problem is computable if it is possible to write a computer program to solve it. Can all problems.
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 15-1 Mälardalen University 2012.
Dale Roberts Department of Computer and Information Science, School of Science, IUPUI CSCI 230 Models of Computation - Turing Machines Dale Roberts, Lecturer.
Halting Problem Introduction to Computing Science and Programming I.
1 Section 13.2 The Church-Turing Thesis The Church-Turing Thesis: Anything that is intuitively computable can be be computed by a Turing machine. It is.
1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)
Computability Universal Turing Machine. Countability. Halting Problem. Homework: Show that the integers have the same cardinality (size) as the natural.
Theory of computing, part 4. 1Introduction 2Theoretical background Biochemistry/molecular biology 3Theoretical background computer science 4History of.
Recursively Enumerable and Recursive Languages
Overview of the theory of computation Episode 3 0 Turing machines The traditional concepts of computability, decidability and recursive enumerability.
Automata & Formal Languages, Feodor F. Dragan, Kent State University 1 CHAPTER 3 The Church-Turing Thesis Contents Turing Machines definitions, examples,
December 3, 2009Theory of Computation Lecture 21: Turing Machines III 1 Simulation of T in L Now the MIDDLE section of Q can be generated by replacing.
1 Introduction to Turing Machines
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 12 Mälardalen University 2007.
1 Turing Machines. 2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
On computable numbers, with an application to the ENTSCHEIDUNGSPROBLEM COT 6421 Paresh Gupta by Alan Mathison Turing.
1 Computing Functions with Turing Machines. 2 A function Domain Result Region has:
Chapter 9 Turing Machines What would happen if we change the stack in Pushdown Automata into some other storage device? Truing Machines, which maintains.
Turing Machines CS 130 Theory of Computation HMU Textbook: Chap 8.
Theory of Computation Automata Theory Dr. Ayman Srour.
Universal Turing Machine
Recursively Enumerable and Recursive Languages. Definition: A language is recursively enumerable if some Turing machine accepts it.
CS 461 – Nov. 2 Sets Prepare for ATM finite vs. infinite Infinite sets
Introduction to Computing Science and Programming I
Busch Complexity Lectures: Turing Machines
Numerical Representation of Strings
Turing Machines 2nd 2017 Lecture 9.
Turing Machines Acceptors; Enumerators
Chapter 9 TURING MACHINES.
فصل سوم The Church-Turing Thesis
Theory of Computation Turing Machines.
Decidable Languages Costas Busch - LSU.
Computing Functions with Turing Machines
MA/CSSE 474 Theory of Computation
Formal Languages, Automata and Models of Computation
Recall last lecture and Nondeterministic TMs
Turing Machines Everything is an Integer
Theory of Computation Lecture 23: Turing Machines III
Presentation transcript:

Computability Dr. Colin Campbell Course Element 2 (EMAT20531)

What is a Computable function? Consider a function f:N N A super-human being like God could write out the whole table for this function. Humans cant because this would require us to store an infinite number of pairs (n,f(n))

An Intuitive Definition The function f is said to be effectively computable if a finite list of instructions can be given that in principle make it possible to determine f(n) for any argument n. The instructions must be definite and explicit. Allowed – f(n+1)=f(n)+1 Not Allowed – Ask God.

Computability vs Complexity Computability refers to whether of not in principle it is possible to evaluate f(n) by following a set of instructions. We are not for the moment worried if this computation requires 1,000,000 or more consecutive steps. The latter refers to complexity which we will return to later.

Turing Machines A Turing machine consists of an infinite tape divided into square boxes. In each box is written either 1 or 0. A device runs along the tape as if on a railway track. The device can read the symbol on its current square and also write 1 or 0.

States, Instructions and Actions A Turing machine can be in any of a number of states q 1,…,q m The machine can carry out the following actions: Erase: write 0 in place of whatever is in the scanned square. Print: write 1 in place of whatever is in the scanned square. Move one square to the left. Move one square to the right. Halt the computation. Instructions require action dependent on state. e.g. If state is q i and 1 the erase and switch to state q j q i 10q j

Implementing a program State Action: New state Search rule to match state and scanned symbol. Rule= (state action state) Rules must be consistent e.g. cannot have both the following rules: q 1 10q 2 and q 1 1Lq 2 Scan E.g. 1 or 0

A Simple Program The objective is to write a sequence of three 1s on the tape There are three states q 1,q 2,q 3 one for each of the 1s q 1 01q 1 – if in q 1 and scan 0 then write 1 and remain q 1 q 1 1Rq 2 – if in q 1 and scan 1 then right and q 2 q 2 01q 2 – if in q 2 and scan 0 then write 1 and remain q 2 q 2 1Rq 3 – if in q 2 and scan 1 then right and q 3 q 3 01q 3 – if in q 3 and scan 0 then write 1 and remain q 3 Start state is q 1

Implementation 0100 q1q q1q q2q q3q q3q3 q 1 01q 1 q 1 1Rq 2 q 2 1Rq 3 q 3 01q 3

Other Program Representations Flow Chart q1q1 0:1 1:R q2q2 0:1 1:R q3q3 0:1 Machine Table scan/ state 01 q1q1 1q 1 Rq 2 q2q2 1q 2 Rq 3 q3q3 1q 3

A Harder Program Start scanning the leftmost 1 in a block of 1s on an otherwise blank tape. It ends scanning the leftmost 1 in a block of 1s of double the length. q1q1 q2q2 q3q3 q4q4 q5q5 q6q6 q7q7 q8q8 q9q9 q 10 q 11 q 12 1:L 0:L 1:L 0:1 1:R 0:R 1:R 0:L 1:0 0:L1:L 0:L 1:L 0:L 1:L 0:R

How it works …by repeatedly writing two 1s to the left and erasing single 1s to the right q1q1 1:L Move one left from leftmost 1 q2q2 1:L 0:L Move left unconditionally q3q3 q4q4 1:L 0:1 1:R Write two 1s on the left and then move right q5q5 q6q6 1:R 0:R 1:R 0:L Finds a sequence 01…10 and moves to the rightmost 1 (i.e. finds the remains of the original block of 1s)

How it works: 2 q7q7 1:0 0:L Replace rightmost 1 with 0 q8q8 q 11 q 12 0:L 1:L 0:R If all original 1s deleted then move left until at the leftmost 1 of the new block q8q8 q9q9 1:L 0:L Else find the rightmost 1 in new block q 10 1:L 0:R q2q2 Move to the leftmost 1 in the new block and repeat from q 2

Example q1q1 1:L q2q2 1:L 0:L q3q3 q4q4 1:L 0:1 1:R q5q5 q6q6 1:R 0:R 1:R 0:L

Example: 2 q7q7 1:0 0:L q8q8 q9q9 1:L 0:L q 10 1:L 0:R q2q

Example: 3 q2q2 1:L 0:L q3q3 q4q4 1:L 0:1 1:R q5q5 q6q6 1:R 0:R 1:R 0:L

Example: 4 q7q7 1:0 0:L q8q8 q9q9 1:L 0:L q 10 1:L 0:R q2q

Example: 5 q2q2 1:L 0:L q3q3 q4q4 1:L 0:1 1:R q5q5 q6q6 1:R 0:R 1:R 0:L q7q7 1:0 0:L q8q8 q 11 q 12 0:L 1:L 0:R

Turing Computable Functions A function f:N N is Turing computable if there is a Turing machine… Which given input 01 1 …..10 containing a block of n 1s Terminates on 01 n ….10 containing a block of f(n) 1s We are only considering totally defined functions here but Turing machines can also deal with partial functions.

Church/Turing Thesis Clearly any Turing computable function is effectively computable in the intuitive sense that we can write a set of instructions to evaluate it for any n. Turings thesis is that all effectively computable functions are Turing computable. i.e. Turing computability is a complete formalization of what it means to be intuitively computable.

Non-Turing Computable Functions Its clear that not all functions are Turing computable. The are uncountably many functions f:N N However there are only countably many Turing machines. Because each is characterised by a finite set of instructions.

Enumeration of Turing Machines We can allocate a unique natural number to every Turing machine. There are many ways of doing this and I will present just one… Recall the Turing machine q 1 01q 1, q 1 1Rq 2, q 2 01q 2, q 2 1Rq 3, q 3 01q 3 q1q1 0:1 1:R q2q2 0:1 1:R q3q3 0:1

Enumerating: 2 We will base the mapping on the instruction set representation. If there are n states assume that q 1 is the start state and q n is the termination state. If not simply add an extra termination state. Up to now if the machine encounter a state and scan for which there is no instruction then it halts. We now add an explicit termination state so that there is an explicit instruction for each state/scan combination.

Enumerating: 3 q 1 01q 1, q 1 1Rq 2, q 2 01q 2, q 2 1Rq 3, q 3 01q 3 q 1 01q 1, q 1 1Rq 2, q 2 01q 2, q 2 1Rq 3, q 3 01q 3,q 3 11q 3 1q 1, Rq 2, 1q 2,Rq 3, 1q 3,1q 3 Order instructions and remove redundant first terms q i i L 3 R 4 2,1,4,2,2,2,4,3,2,3,2,

The Diagonal Function For Turing machine M let (M) be its allocated number. Consider the set of Turing computable functions of 1 variable. Let them be ordered f 1,f 2,f 3,….., where (M i ) < (M i+1 ) for M i is the Turing machine with the smallest number for computing f i. Define the diagonal function

The Diagonal Function: 2 The diagonal function d(n) is not computable Suppose d(n) is computable then d(n)=f m (n) for some function f m in the list of computable functions. Hence, for n=m But this is a contradiction.

The Halting Problem The halting function h(n,m)=1 if Turing machine with number n halts given input m and = 2 otherwise. The function h is not Turing computable. Suppose that h was computable by Turing machine H Further consider a Turing machine D that takes and input and copies it. So e.g is returned 01 n

The Halting Problem: 2 We also design the following Turing machine L which loops given input 1 and halts given input >1 q1q1 1:R q2q2 1:L q3q3 0:L halt loop

The Halting Problem: 3 We can now combine the three Turing machines in sequence to give a new machine C C=D H L Let n be the Turing number of C C(n) halts if H(n,n) returns 2 C(n) does not halt if H(n,n) returns 1 So C halts if and only if C does not halt.

Universal Turing Machines A universal Turing machine takes 2 inputs n and m and returns the corresponding output of Turing machine with number n given in put m. Modern digital computers are universal Turing machines.