Download presentation

Presentation is loading. Please wait.

Published byJesus Bennett Modified over 4 years ago

1
Computability Dr. Colin Campbell Course Element 2 (EMAT20531)

2
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))

3
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.

4
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.

5
Turing Machines 1 0010 - 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.

6
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

7
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

8
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

9
Implementation 0100 q1q1 1100 q1q1 1100 q2q2 1100 q3q3 1110 q3q3 q 1 01q 1 q 1 1Rq 2 q 2 1Rq 3 q 3 01q 3

10
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

11
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

12
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)

13
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

14
Example 1 1 11 0 2 111 q1q1 1:L 0 3 0111 q2q2 1:L 0:L q3q3 q4q4 1:L 0:1 1:R 0 4 10111 1 4 10111 1 3 011111 5 0111 q5q5 q6q6 1:R 0:R 1:R 0:L 110 5 111 1101 6 1111011 6 1110111 6 1101110 6 110111 7

15
Example: 2 q7q7 1:0 0:L 110110 7 11011 8 q8q8 q9q9 1:L 0:L 1101 9 1110 9 1111 10 011 q 10 1:L 0:R q2q2 1 10 10110 10 110111 2 1011

16
Example: 3 q2q2 1:L 0:L 0 3 11011 q3q3 q4q4 1:L 0:1 1:R 1 3 110110 4 1110111 4 11101111 5 11011 q5q5 q6q6 1:R 0:R 1:R 0:L 111 5 10111111 5 01111110 5 11 111101 6 11111011 6 11110110 6 1111011 7

17
Example: 4 q7q7 1:0 0:L 1111010 7 111101 8 q8q8 q9q9 1:L 0:L 11110 9 11111 10 01 q 10 1:L 0:R q2q2 1111 10 011 2 11101

18
Example: 5 q2q2 1:L 0:L 0 3 111101 q3q3 q4q4 1:L 0:1 1:R 1 3 11110111 5 111101 q5q5 q6q6 1:R 0:R 1:R 0:L 11111101 7 q7q7 1:0 0:L 1111110 8 0 q8q8 q 11 q 12 0:L 1:L 0:R 1 12 11111

19
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.

20
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.

21
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.

22
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

23
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.

24
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 i0 1 1 2 L 3 R 4 2,1,4,2,2,2,4,3,2,3,2,3 2 2 3 1 5 4 7 2 11 2 13 2 17 4 19 3 23 2 29 3 31 2 37 3

25
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

26
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.

27
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. 01 1 110 is returned 01 n 110111

28
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 1 1 1 11 2 1 3 1 halt 1 1 10 2 1 1 loop

29
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.

30
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.

Similar presentations

OK

1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 12 Mälardalen University 2007.

1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 12 Mälardalen University 2007.

© 2018 SlidePlayer.com Inc.

All rights reserved.

To ensure the functioning of the site, we use **cookies**. We share information about your activities on the site with our partners and Google partners: social networks and companies engaged in advertising and web analytics. For more information, see the Privacy Policy and Google Privacy & Terms.
Your consent to our cookies if you continue to use this website.

Ads by Google

Ppt on bluetooth broadcasting devices Ppt on state government of india Ppt on sound navigation and ranging system of a down Perspective view ppt on mac Ppt on covalent bonding animation Ppt on formal education is a required Ppt on limits and continuity worksheets Ppt on various types of web browsers and their features Ppt on data collection methods for teachers Ppt on omission of articles in english