::ics 804:: theory of computation - ibrahim otieno - +254-0722-429297 sci/ict building rm. g15

Download ::ICS 804:: Theory of Computation - Ibrahim Otieno - +254-0722-429297 SCI/ICT Building Rm. G15

If you can't read please download the document

Upload: sherman-newton

Post on 06-Jan-2018

223 views

Category:

Documents


0 download

DESCRIPTION

Last Week: Additional Varieties of Turing Machines Turing Machines with One-Way-Infinite tape Turing Machines that accept by terminal state Multitape Turing Machines Encoding of Turing Machines Universal Turing Machines Nondeterministic Turing Machines Turing-Computability Turing Machines and Artificial Intelligence Turing Machines and Cognitive Science

TRANSCRIPT

::ICS 804:: Theory of Computation - Ibrahim Otieno SCI/ICT Building Rm. G15 Course Outline Mathematical Preliminaries Turing Machines Recursion Theory Markov Algorithms Register Machines Regular Languages and finite-state automata Aspects of Computability Last Week: Additional Varieties of Turing Machines Turing Machines with One-Way-Infinite tape Turing Machines that accept by terminal state Multitape Turing Machines Encoding of Turing Machines Universal Turing Machines Nondeterministic Turing Machines Turing-Computability Turing Machines and Artificial Intelligence Turing Machines and Cognitive Science Course Outline Mathematical Preliminaries Turing Machines Additional Varieties of Turing Machines Recursion Theory Markov Algorithms Register Machines Regular Languages and finite-state automata Aspects of Computability Recursion Theory The primitive recursive functions The partial recursive functions The class of partial recursive functions = class of Turing-computable functions The Primitive Recursive Functions Initial Functions Recall function forming operations: Unary inversion operator( f -1 ) must be injective Binary composition operator h (n) = f g (n) We look at 2 other function forming operators: Comp generalization of binary composition Pr Primitive Recursion Initial Functions The class of initial functions contains the following functions and no others: The unary successor function succ The k-ary constant-0 function C k 0 for k 0 k: number of arguments 0: indicates the value The projection function p k j for each k 1 and 1 j k k: number of arguments j: argument unto which the function projects Function composition Given function f: N m N with m 1 functions g 1, g 2, g m each of which is N k N with k 0. Then applying function composition to the m+1 functions f,g 1,g 2,,g m yields a new function h: N k N defined by h(n 1,,n k ) = f(g 1 (n 1,,n k ), g 2 (n 1,,n k ),,g m (n 1,,n k )) Comp[f,g 1,g 2,,g m ]: composition operator for function h Function composition Result is another k-ary function Comp[f,g 1,g 2,,g m ](n 1,,n k ) = Comp[f,g 1,g 2,,g m ] (n ) =f(g 1 (n ),g 2 (n ),,g m (n )) Illustration The class is considered as a single, multipart computer of a k-ary number-theoretic function h = Comp[f,g 1,g 2,,g m ] Example j(n,m) = n 3 +m 2 +7 Comp[j,p 3 3,p 3 2 ](57849,6,8) =j(p 3 3 (57849,6,8),p 3 2 (57849,6,8)) = j(8,6) = = 555 Composition h = f g = Comp[f,g] with m = k = 1 Summary Given function f: N m N with m 1 and functions g 1, g 2, g m each of which is N k N with k 0. Then applying function composition to the m+1 functions f, g 1,g 2,,g m yields a new function h: N k N defined by h(n 1,,n k ) = f(g 1 (n 1,,n k ), g 2 (n 1,,n k ),,g m (n 1,,n k )) Comp[f,g 1,g 2,,g m ]: composition operator for function h Exercise j(n,m) = n 3 +m 2 +7 Calculate Comp[p 2 1,p 2 2,j](8,6) = ??? Comp[p 3 2,p 2 1,j,p 2 2 ](8,6) = ??? Exercise j(n,m) = n 3 +m 2 +7 Calculate Comp[p 2 1,p 2 2,j](8,6) = p 2 1 (6,555) = 6 Comp[p 3 2,p 2 1,j,p 2 2 ](8,6) = p 3 2 (8,555,6) = 555 Exercise If j(n 1,n 2,n 3 ) = n 1.n 2 +n 3 (a) What is j(6,0,7) (b) What is the value of m and k in case of h = Comp[plus,j,p 3 3 ] h(n 1,,n k ) = f(g 1 (n 1,,n k ), g 2 (n 1,,n k ),,g m (n 1,,n k )) (c) How many arguments does h have (d) What is f, g 1 and g 2 ? (e) What is h(6,0,7) h(6,1,14) Exercise If j(n 1,n 2,n 3 ) = n1.n2+n3 (a) What is j(6,0,7) 7 (b) What is the value of m and k in case of h = Comp[plus,j,p 3 3 ] m=2 k=3 h(n 1,,n k ) = f(g 1 (n 1,,n k ), g 2 (n 1,,n k ),,g m (n 1,,n k )) (c) How many arguments does h have 3 (d) What is f, g 1 and g 2 ?f=plus g 1 =j g 2 =p 3 3 (e) What is h(6,0,7) 14 h(6,1,14)34 Primitive Recursion Plus function (recap) (i) plus(n,0) = n (ii) plus(n,m+1) = succ(plus(n,m)) plus(5,2) = plus(5,1+1) = succ(plus(5,1)) = succ(plus(5,0+1)) = succ(succ(plus(5,0)))) = succ(succ(5)) = succ(6) = 7 Primitive Recursion Definition of plus is recursive: applying plus to decreasing values (5,1) and (5,0) Function forming operation to construct plus from the function succ Given Function f: N k N with k 0 and function g: N k+2 N, we can form a new function h: N k+1 N defined by (i) h(n 1,,n k,0) = f(n 1,,n k ) (ii) h(n 1,,n k,m+1) = g(n 1,,n k,m,h(n 1,,n k,m)) We write Pr[f,g] for the function h formed by applying primitive recursion to given functions f and g Primitive Recursion Given Function f: N k N with k 0 and function g: N k+2 N, we can form a new function h: N k+1 N defined by (i) h(n 1,,n k,0) = f(n 1,,n k ) (ii) h(n 1,,n k,m+1) = g(n 1,,n k,m,h(n 1,,n k,m)) We write Pr[f,g] for the function h formed by applying primitive recursion to given functions f and g or: (i) h(n ,0) = f(n ) (ii) h(n ,m+1) = g(n ,m,h(n ,m)) illustration Classroom with two students StudentA is good at computing (k+2)-ary function g StudentB is good at computing k-ary function f Instructor provides (k+1)-tuple (i) h(n ,0) = f(n ) (ii) h(n ,m+1) = g(n ,m,h(n ,m)) illustration Classroom with two students Instructor provides (k+1)-tuple If m=0, StudentB reports the value of f right away, because that means clause (i) applies (i) h(n ,0) = f(n ) (ii) h(n ,m+1) = g(n ,m,h(n ,m)) illustration Classroom with two students Instructor provides (k+1)-tuple If m0, StudentB must still first compute the value of f for k-tuple before Student A can start This is passed on to StudentA who computes g(n 1,,n k,0,h(n 1,,n k,0)) (i) h(n ,0) = f(n ) (ii) h(n ,m+1) = g(n ,m,h(n ,m)) illustration This is passed on to StudentA who computes g(n 1,,n k,0,h(n 1,,n k,0)) = h(n 1,,n k,1) StudentA then computes the value of g(n 1,,n k,1,h(n 1,,n k,1)) Until the 2 nd argument of his function equals the one on the blackboard (i) h(n ,0) = f(n ) (ii) h(n ,m+1) = g(n ,m,h(n ,m)) Definition The class of primitive recursive functions: An initial function is a primitive recursive function If g 1,,g m are each k-ary primitive recursive functions for some k 0 and f is an m-ary primitive recursive function for some m 1 then Comp[f,g 1,,g m ] is a k-ary primitive recursive function If f is a k-ary primitive recursive function and g is a (k+2)-ary primitive function for some k 0, then Pr[f,g] is a (k+1)-ary primitive recursive function No other number-theoretic functions are primitive recursive except those listed above illustration (i)plus(n,0) = n (ii)plus(n,m+1) = succ(plus(n,m)) (i) plus(n,0) = p 1 1 (n) (ii) plus(n,m+1) = succ(p 3 3 (n,m,plus(n,m))) = Comp[succ,p 3 3 ](n,m,plus(n,m)) So plus: Pr[p 1 1,Comp[succ,p 3 3 ]] (i) h(n ,0) = f(n ) (ii) h(n ,m+1) = g(n ,m,h(n ,m)) illustration (i) plus(n,0) = p 1 1 (n) (ii) plus(n,m+1) = succ(p 3 3 (n,m,plus(n,m))) = Comp[succ,p 3 3 ](n,m,plus(n,m)) Classroom scenario: + teacher writes k+1 tuple on the blackboard, in this case a 2-tuple, e.g. + m0 so the calculation will include StudentA + StudentB calculates the value for 1-tuple p 1 1 (5) = 5 + and passes the answer on to StudentA (i) h(n ,0) = f(n ) (ii) h(n ,m+1) = g(n ,m,h(n ,m)) illustration (i) plus(n,0) = p 1 1 (n) (ii) plus(n,m+1) = succ(p 3 3 (n,m,plus(n,m))) = Comp[succ,p 3 3 ](n,m,plus(n,m)) Classroom scenario: + StudentA then calculates the g-function, in this case Comp[succ,p 3 3 ](5,1,plus(5,1)) (i) Expanding plus(5,1) = succ(p 3 3 (5,0,plus(5,0))) = succ(p 3 3 (5,0,5)) plus(5,0) = p 1 1 (5) = succ(5) = 6 Replacing in (i) Comp[succ,p 3 3 ](5,1,6) = succ(6) = 7 Other primitive recursive functions Comment: every primitive recursive function is total Multiplication and Exponentiation are primitive recursive functions Monus(n,m) =n m if n m 0 otherwise Sg(n) = 1 if n = 0 0otherwise Partial Recursive Functions Partial recursive functions Compared to Turing-computable functions New definition of a class: partial recursive functions The smallest class of number-theoretic functions containing certain basic functions and closing under certain function-forming operations (cf. class of primitive recursive functions) Primitive recursive functions constitute an infinite class, but are effectively enumerable Partial recursive functions Theorem: there exists a computable function that is total, but not primitive recursive Proof Let f 0,f 1,f 2, be the enumeration of unary primitive recursive functions. Consider f* f*(n) = f n (n) + 1 f* is unary and total If f* is primitive recursive, it occurs in the enumeration (above) Assume f* is f k for some k Ask for the value of f*(k) f*(k) = f k (k) Substituting n for k (above) this means f*(k) = f k (k) + 1 as well (Proof by) Contradiction!!!! f* is computable: for any n, find the nth function in the enumerable list of primitive recursive functions, compute the value of f n and add 1 f* is Turing-computable Number-theoretic Predicates (recap) Properties of objects, relations, holding between pairs of objects, relations, holding among triples of objects are expressed using predicates. If the objects are members of N, then one speaks of number-theoretic predicates e.g. prime(n) is a unary number-theoretic predicate that is satisfied by 2 and 3, but not by 4 or 6 Least number operator : least number operator m[C(n ,m)] the least natural number m such that predicate C(n ,m) holds m[C(n ,m)] = 0: the least natural number such that f(n ,m) is equal to 0 Minimization New function-forming operation, Mn suppose that f:N k+1 N with k 0 is given. We write Mn[f] for the function g:N k N defined as: g(n ) = m[Cf(n ,m) = 0 and such that for all j < m, f(n ,j) is defined and 0 Minimization e.g.f(3,0) = 7 f(3,1) = 4 f(3,2) = 4 f(3,3) = 2 f(3,4) = 9 f(3,5) = 0 f(3,6) = 4 Then g(3) = Mn[f](3) = m[f(3,m) and such that for all j < m, f(3,j) is defined and 0] = 5 Minimization e.g.f(3,0) = 7 f(3,1) is undefined f(3,2) = 4 f(3,3) = 2 f(3,4) = 9 f(3,5) = 0 f(3,6) = 4 m[f(3,m)= 0] = 5 but g(3) = Mn[f](3) is undefined Minimization e.g.f(3,0) = 7 f(3,1) = 4 f(3,2) = 4 f(3,3) = 2 f(3,4) = 9 f(3,5) = 5 f(3,6) = 4 g(3) = Mn[f](3) is undefined Exercise f(0,0) = 6f(1,0) = 8f(2,0) = 3f(3,0) =9f(4,0) = 6 f(0,1) = 4f(1,1) = 8f(2,1) = 1f(3,1) =6f(4,1) = 6 f(0,2) = 6f(1,2) = 6f(2,2) = 6f(3,2) =4f(4,2) = 6 f(0,3) = 0f(1,3) = 6f(2,3) is undefinedf(3,3) =6f(4,3) = 6 f(0,4) = 6f(1,4) = 5f(2,4) = 6f(3,4) =0f(4,4) = 6 f(0,5) = 8f(1,5) = 0f(2,5) = 0f(3,5) =6f(4,5) = 6 with f(4,m) = 6 for all m Calculate g(0) = Mn[f](0) g(1) = Mn[f](1) g(2) = Mn[f](2) g(3) = Mn[f](3) g(4) = Mn[f](4) Exercise f(0,0) = 6f(1,0) = 8f(2,0) = 3f(3,0) =9f(4,0) = 6 f(0,1) = 4f(1,1) = 8f(2,1) = 1f(3,1) =6f(4,1) = 6 f(0,2) = 6f(1,2) = 6f(2,2) = 6f(3,2) =4f(4,2) = 6 f(0,3) = 0f(1,3) = 6f(2,3) is undefinedf(3,3) =6f(4,3) = 6 f(0,4) = 6f(1,4) = 5f(2,4) = 6f(3,4) =0f(4,4) = 6 f(0,5) = 8f(1,5) = 0f(2,5) = 0f(3,5) =6f(4,5) = 6 with f(4,m) = 6 for all m Calculate g(0) = Mn[f](0) = 3 g(1) = Mn[f](1) = 5 g(2) = Mn[f](2) is undefined g(3) = Mn[f](3) = 4 g(4) = Mn[f](4) is undefined Even if f(2,3) were defined, Mn[f](n) = g(n) would still be partial Partial The exercise shows that applying minimization operator Mn to a total function may result in a partial function Partial recursive functions defined The class of partial recursive functions is the smallest class containing all initial functions and closed under the operations Comp, Pr, Mn So: every primitive recursive function is also a partial recursive function A total partial recursive function = recursive function World of number-theoretic functions The class of partial recursive functions = class of Turing-computable functions Theorems A number-theoretic function is partial recursive if and only if it is Turing Computable If number-theoretic function h is partial recursive, then h is Turing-computable Forward Proof (partial recursive Turing Computable): Initial functions Comp functions Pr functions Mn functions Proof: initial functions Successor function Proof: initial functions Constant-k function Erases k groups of 1s off to the right, writes a single 1 and halts e.g. C 0 0 B:1 01 Proof: initial functions Projection function. Erase all sequences of 1s on the tape, except the one that is projected unto, e.g. p 3 2 B:R 01 1:B B:R 2 1:R B:R 3 1:B B:R 4 5 B:L 6 1:L 7 B:R Proof: Comp h = Comp[f,g 1,g m ] f is an m-ary partial recursive function g 1,,g m are k-ary partial recursive functions We have Turing Machines M f,M g,M m M comp will simulate the composition of Turing Machines M f,M g,M m 1111B1111B1111BB Input tape Argument n 1 Argument n 2 Argument n k 1111B1111B1111BB Worktape-1 Argument n 1 Argument n 2 Argument n k 1111B1111B1111BB Worktape-m Argument n 1 Argument n 2 Argument n k BB Output tape Copy k arguments from input tape to m worktapes 1111B1111B1111BB Input tape Argument n 1 Argument n 2 Argument n k 1111B Worktape-1 g 1 (n 1,n 2,,n k ) 1111B... Worktape-m BB Output tape M comp simulates M g,M m on m worktapes g m (n 1,n 2,,n k ) 1111B1111B1111BB Input tape Argument n 1 Argument n 2 Argument n k Worktape-1 g 1 (n 1,n 2,,n k ) 1111B... Worktape-m BB Output tape M comp copies the contents of m worktapes unto worktape-1 g m (n 1,n 2,,n k ) 1111B1111B1111BB g 2 (n 1,n 2,,n k )g m (n 1,n 2,,n k ) 1111B1111B1111BB Input tape Argument n 1 Argument n 2 Argument n k Worktape-1 g 1 (n 1,n 2,,n k ) Output tape M comp simulate M f on worktape-1 1111B1111B1111BB g 2 (n 1,n 2,,n k )g m (n 1,n 2,,n k ) BB f(g 1 (n 1,n 2,,n k ), g 2 (n 1,n 2,,n k ),, g m (n 1,n 2,,n k )) 1111B1111B1111BB Input tape Argument n 1 Argument n 2 Argument n k Worktape-1 Output tape M comp copies the contents to the output tape 1111B f(g 1 (n 1,n 2,,n k ), g 2 (n 1,n 2,,n k ),, g m (n 1,n 2,,n k )) 1111B Proof: Pr[f,g] f is a k-ary partial recursive function g is a k+2-ary partial recursive function Both are Turing Computable We have M f and M g that compute f and g M Pr : 5 tape Turing Machine that will simulate primitive recursion Proof: Pr[f,g] In case (i) (i.e. n 1,,n k,0), are represented on input tape. M Pr copies arguments n to worktape-1 and simulates the operation of M f on worktape-1. When it halts in a value- representing configuration, the value is copied onto the output tape Proof: Pr[f,g] In case (ii) (i.e. n 1,,n k,m+1), are represented on the input tape. M Pr copies arguments n to worktape-1 and simulates the operation of M f on worktape-1. When it halts in a value-representing configuration, M Pr writes a single 1 on worktape-3 (indicating iteration0 has been completed). Then several items are copied onto worktape-2: arguments n from the input tape The contents of worktape-3 Contents of worktape-1, currently representing h(n 0) = f(n ) 1111B1111B1111B1B11B Argument n 1 Argument n 2 Argument n k Argument m+1 1111B f(n 1,,n k ) = h(n 1,,n k,0) 1111B1111B1111B1B11B n1n1 n2n2 nknk f(n 1,,n k ) = h(n 1,,n k,0) 0 Copied from input tape Copied from worktape3 Copied from worktape1 1B BB input work1 work2 work3 output After 1 iteration Proof: Pr[f,g] M pr then simulates operation of M g on worktape-2, obtaining a representation of h(n ,1) on that tape. This value is copied onto worktape-1 and the representation on worktape-3 is incremented by 1. Then the contents of worktape-2 are overwritten: arguments n from the input tape The contents of worktape-3 Contents of worktape-1, currently representing h(n ,1) = f(g(n ,0,h(n ,0)) 1111B1111B1111B1B11B Argument n 1 Argument n 2 Argument n k Argument m+1 1111B h(n 1,,n k,1) 1111B1111B1111B11B11B n1n1 n2n2 nknk 1 Copied from input tape Copied from worktape3 Copied from worktape1 11B BB input work 1 work 2 work 3 output After 2 iterations Proof: Pr[f,g] M pr then simulates operation of M g on worktape-2, obtaining a representation of h(n ,2) on that tape. This process is iterated until the representation on worktape-3 exceeds the rightmost argument on the input tape. At that point, the representation on worktape-2 represents h(n ,m+1) Pr[f,g] for plus(n,m) The plus function: (i) plus(n,0) = n (ii) plus(n,m+1) = succ(plus(n,m)) The schema for Pr[f,g]: (i) h(n ,0) = f(n ) (ii) h(n ,m+1) = g(n ,m,h(n ,m)) Applied to plus (see Slide 28) : (i) plus(n,0) = f(n) = p 1 1 (n) = n (ii) plus(n,m+1) = g(n,m,h(n,m)) = s ucc(p 3 3 (n,m,plus(n,m))) Case-study: plus(3,2) Pr[f,g] for plus(n,m) (i) plus(n,0) = f(n) = p 1 1 (n) = n (ii) plus(n,m+1) = g(n,m,h(n,m)) = s ucc(p 3 3 (n,m,plus(n,m))) Case-study: plus(3,2) The 2 nd argument is not 0, so: M Pr copies argument n to worktape-1 and simulates the operation of M f on worktape-1 (f(n)=n=plus(n,0)) M Pr writes a single 1 on worktape-3 (indicating 1 st iteration has been completed). Then several items are copied onto worktape-2: argument n from the input tape The contents of worktape-3 Contents of worktape-1, currently representing plus(3,0) = 3 1111B1111B Argument nArgument m B f(n) = n 1111B1B1111B n 0 1B BB input work1 work2 work3 output After 1 iteration Pr[f,g] for plus(n,m) M pr then simulates operation of M g on worktape-2 Worktape-2 contains, the 3 arguments for function g 1 st argument: n (=3) 2 nd argument: m (=0) 3 rd argument: plus(3,0) =3 Function g is defined as s ucc(p 3 3 (n,m,plus(n,m))) g(3,0,3) = s ucc(p 3 3 (3,0,plus(3,0))) = succ(3) = 4 Worktape-2 now contains the representation of plus(3,1) This value is copied onto worktape-1 The representation on worktape-3 is incremented by 1 Then the contents of worktape-2 are overwritten: arguments n from the input tape The contents of worktape-3 Contents of worktape-1, currently representing plus(3,1) 1111B1111B Argument nArgument m B g(3,0,3) = succ(3) = B11B11111B n 1 11B BB input work1 work2 work3 output After 2 iterations Pr[f,g] for plus(n,m) M pr then simulates operation of M g on worktape-2 Worktape-2 contains g(3,1,4) = s ucc(p 3 3 (3,1,plus(3,1))) = succ(4) = 5 Worktape-2 now contains the representation of plus(3,2) This value is copied onto worktape-1 The representation on worktape-3 is incremented by 1 Then the contents of worktape-2 are overwritten: arguments n from the input tape The contents of worktape-3 Contents of worktape-1, currently representing plus(3,2) 1111B1111B Argument nArgument m B g(3,1,4) = succ(4) = B111B111111B n2 111B BB input work1 work2 work3 output After 3 iterations g(3,1,4) = succ(4) = 5 Pr[f,g] for plus(n,m) M pr then simulates operation of M g on worktape-2 Worktape-2 contains g(3,2,5) = s ucc(p 3 3 (3,2,plus(3,2))) = succ(5) = 6 Worktape-2 now contains the representation of plus(3,3) This value is copied onto worktape-1 The representation on worktape-3 is incremented by 1 Then the contents of worktape-2 are overwritten: arguments n from the input tape The contents of worktape-3 Contents of worktape-1, currently representing plus(3,3) 1111B1111B Argument nArgument m B g(3,2,5) = succ(5) = B1111B B n3 1111B BB input work1 work2 work3 output After 4 iterations g(3,2,5) = succ(5) = 6 Pr[f,g] for plus(n,m) M pr then simulates operation of M g on worktape-2 Worktape-2 contains g(3,3,6) = s ucc(p 3 3 (3,3,plus(3,3))) = succ(6) = 7 Worktape-2 now contains the representation of plus(3,4) This value is copied onto worktape-1 The representation on worktape-3 is incremented by 1 Then the contents of worktape-2 are overwritten: arguments n from the input tape The contents of worktape-3 Contents of worktape-1, currently representing plus(3,4) 1111B1111B Argument nArgument m B g(3,3,6) = succ(6) = B11111B B n B BB input work1 work2 work3 output After 5 iterations g(3,3,6) = succ(6) = 7 Pr[f,g] for plus(n,m) Now the representation on worktape-3 exceeds the rightmost argument on the input tape. At that point, the representation on worktape-2 represents plus(3,3+1) and it can be copied to the output tape Proof: Mn[f] Suppose Mn[f] where f is a (k+1)-ary partial recursive function. Let M f be a single-tape Turing Machine that computes f. M Mn will compute h = Mn[f] Four-tape Turing machine Arguments n appear on input tape M Mn will write a single 1 on worktape-1 (=0) Copies arguments n and the single 1 from worktape-1 onto worktape-2 1111B1111B1111BB Input tape Argument n 1 Argument n 2 Argument n k 1B Worktape-1 Worktape-2 BB Output tape 1111B1111B1111B1B n1n1 n2n2 nknk From worktape-1 M Mn simulates M f on worktape-2 Proof: Mn[f] After execution of M f on worktape-2, M Mn checks whether the value representing configuration equals to 0 (i.e. scanning a single 1 on an otherwise blank tape). If this is the case: The contents of worktape-1 will represent the least number operator The contents of worktape-1 are then copied unto the output tape 1111B1111B1111BB Input tape Argument n 1 Argument n 2 Argument n k 1B Worktape-1 Worktape-2 BB Output tape 11B f(n ,0) In this example f(n ,0) = 1, so 0 is not the least number operator Proof: Mn[f] If that is not the case M Mn will add a 1 to worktape-1 Copy the k arguments of the input tape unto worktape-2 Copy the contents of worktape-1 unto worktape-2 Simulate M f on worktape-2 This process is repeated until worktape-2s value representing configuration equals to 0. 1111B1111B1111BB Input tape Argument n 1 Argument n 2 Argument n k 11B Worktape-1 Worktape-2 BB Output tape 1111B1111B1111B11B n1n1 n2n2 nknk From worktape-1 M Mn simulates M f on worktape-2 1111B1111B1111BB Input tape Argument n 1 Argument n 2 Argument n k Worktape-1 Worktape-2 Output tape 1B f(n ,1) In this example f(n ,1) = 0, so 1 is the least number operator and contents of worktape-1 can be copied to output tape 11B 11B