::ics 804:: theory of computation - ibrahim otieno - [email protected] +254-0722-429297
DESCRIPTION
::ICS 804:: Theory of Computation - Ibrahim Otieno - [email protected] +254-0722-429297 SCI/ICT Building Rm. G15. Course Outline. Mathematical Preliminaries Turing Machines Recursion Theory Markov Algorithms Register Machines Regular Languages and finite-state automata - PowerPoint PPT PresentationTRANSCRIPT
::ICS 804::Theory of
Computation
- Ibrahim Otieno -
+254-0722-429297
SCI/ICT Building Rm. G15
Course OutlineCourse 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 Last Week: Additional Varieties of Turing MachinesTuring 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 OutlineCourse 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 TheoryRecursion Theory
The primitive recursive functions The partial recursive functions The class of partial recursive
functions = class of Turing-computable functions
The Primitive Recursive The Primitive Recursive FunctionsFunctions
Initial FunctionsInitial 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 FunctionsInitial Functions The class of initial functions contains the
following functions and no others:◦ The unary successor function succ
◦ The k-ary constant-0 function Ck0 for k 0
k: number of arguments 0: indicates the value
◦ The projection function pkj for each k 1
and 1 j kk: number of argumentsj: argument unto which the function projects
Function compositionFunction composition
Given function◦ f: Nm N with m 1 ◦ functions g1, g2, … gm each of which is Nk N
with k 0. Then applying function composition to the m+1
functions f,g1,g2,…,gm yields a new function h: Nk N defined by
h(n1,…,nk) = f(g1(n1,…,nk), g2(n1,…,nk),…,gm(n1,…,nk))
Comp[f,g1,g2,…,gm]: composition operator for function h
Function compositionFunction composition
Result is another k-ary function Comp[f,g1,g2,…,gm](n1,…,nk)
= Comp[f,g1,g2,…,gm] (n)
= f(g1(n),g2(n),…,gm(n))
IllustratiIllustrationon
The class is considered as a single, multipart computer of a k-ary number-theoretic function
h = Comp[f,gh = Comp[f,g11,g,g22,…,g,…,gmm]]
ExampleExample
j(n,m) = n3+m2+7Comp[j,p3
3,p32](57849,6,8)
= j(p33(57849,6,8),p3
2(57849,6,8))
= j(8,6)= 83 + 62 + 7= 555
CompositionComposition
h = f g= Comp[f,g] with m = k = 1
SummaryGiven function f: Nm N with m 1 and functions g1, g2, … gm each of which is Nk N with k 0. Then applying function composition to the m+1 functions f, g1,g2,…,gm yields a new function h: Nk N defined by
h(n1,…,nk) = f(g1(n1,…,nk), g2(n1,…,nk),…,gm(n1,…,nk))
Comp[f,g1,g2,…,gm]: composition operator for function h
ExerciseExercise
j(n,m) = n3+m2+7Calculate
Comp[p21,p2
2,j](8,6) = ???
Comp[p32,p2
1,j,p22](8,6) = ???
ExerciseExercise
j(n,m) = n3+m2+7Calculate
Comp[p21,p2
2,j](8,6) = p21(6,555) = 6
Comp[p32,p2
1,j,p22](8,6) = p3
2(8,555,6) = 555
ExerciseExercise
If j(n1,n2,n3) = n1.n2+n3
(a)What is j(6,0,7) (b)What is the value of m and k in case
of h = Comp[plus,j,p33]
h(n1,…,nk) = f(g1(n1,…,nk), g2(n1,…,nk),…,gm(n1,…,nk))
(c) How many arguments does h have (d) What is f, g1 and g2? (e) What is h(6,0,7)
h(6,1,14)
ExerciseExerciseIf j(n1,n2,n3) = 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,p33] m=2 k=3
h(n1,…,nk) = f(g1(n1,…,nk), g2(n1,…,nk),…,gm(n1,…,nk))
(c) How many arguments does h have 3(d) What is f, g1 and g2? f=plus g1=j
g2=p33
(e) What is h(6,0,7) 14 h(6,1,14) 34
Primitive RecursionPrimitive RecursionPlus 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 RecursionPrimitive 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: NkN with k 0 and function g: Nk+2N, we can form a new function h: Nk+1N defined by
(i) h(n1,…,nk,0) = f(n1,…,nk)
(ii) h(n1,…,nk,m+1) = g(n1,…,nk,m,h(n1,…,nk,m))
We write Pr[f,g] for the function h formed by applying primitive recursion to given functions f and g
Primitive RecursionPrimitive Recursion
Given Function f: NkN with k 0 and function g: Nk+2N, we can form a new function h: Nk+1N defined by
(i) h(n1,…,nk,0) = f(n1,…,nk)
(ii) h(n1,…,nk,m+1) = g(n1,…,nk,m,h(n1,…,nk,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))
illustrationillustration
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 <n1,…,nk,m>
(i) h(n,0) = f(n)(ii) h(n,m+1) = g(n,m,h(n,m))
illustrationillustration
Classroom with two students◦ Instructor provides (k+1)-tuple <n1,…,nk,m>
◦ 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))
illustrationillustration
Classroom with two students◦ Instructor provides (k+1)-tuple <n1,…,nk,m>
◦ If m≠0, StudentB must still first compute the value of f for k-tuple <n1,…,nk> before Student A can start
◦ This is passed on to StudentA who computes g(n1,…,nk,0,h(n1,…,nk,0))
(i) h(n,0) = f(n)(ii) h(n,m+1) = g(n,m,h(n,m))
illustrationillustration
◦ This is passed on to StudentA who computes g(n1,…,nk,0,h(n1,…,nk,0))
= h(n1,…,nk,1)◦ StudentA then computes the value of g(n1,…,nk,1,h(n1,
…,nk,1))◦ Until the 2nd 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))
DefinitionDefinition The class of primitive recursive
functions: An initial function is a primitive recursive
function If g1,…,gm 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,g1,…,gm] 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
illustrationillustration
(i) plus(n,0) = n(ii) plus(n,m+1) = succ(plus(n,m))
(i) plus(n,0) = p11(n)
(ii) plus(n,m+1) = succ(p33(n,m,plus(n,m)))
= Comp[succ,p33](n,m,plus(n,m))
So plus: Pr[p11,Comp[succ,p3
3]]
(i) h(n,0) = f(n)(ii) h(n,m+1) = g(n,m,h(n,m))
illustrationillustration
(i) plus(n,0) = p11(n)
(ii) plus(n,m+1) = succ(p33(n,m,plus(n,m)))
= Comp[succ,p33](n,m,plus(n,m))
Classroom scenario:+ teacher writes k+1 tuple on the blackboard, in this case a
2-tuple <n,m>, e.g. <5,2>+ m≠0 so the calculation will include StudentA+ StudentB calculates the value for 1-tuple <n>p1
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))
illustrationillustration(i) plus(n,0) = p1
1(n)
(ii) plus(n,m+1) = succ(p33(n,m,plus(n,m)))
= Comp[succ,p33](n,m,plus(n,m))
Classroom scenario:+ StudentA then calculates the g-function, in this case
Comp[succ,p33](5,1,plus(5,1)) ……(i)
Expanding plus(5,1)
= succ(p33(5,0,plus(5,0))) = succ(p3
3(5,0,5)) plus(5,0) = p1
1(5)= succ(5)= 6 Replacing in (i)
Comp[succ,p33](5,1,6)
= succ(6)= 7
Other primitive recursive Other primitive recursive functionsfunctions
Comment: every primitive recursive function is total
Multiplication and Exponentiation are primitive recursive functions
Monus(n,m) = n – m if n m0 otherwise
Sg(n) = 1 if n = 00 otherwise
Partial Recursive FunctionsPartial Recursive Functions
Partial recursive Partial recursive functionsfunctions 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 functionsPartial recursive functionsTheorem: there exists a computable function that is total, but not
primitive recursiveProofLet f0,f1,f2,… be the enumeration of unary primitive recursive functions.
Consider f*f*(n) = fn(n) + 1◦ f* is unary and total◦ If f* is primitive recursive, it occurs in the enumeration (above)◦ Assume f* is fk for some k◦ Ask for the value of f*(k)
f*(k) = fk(k) Substituting n for k (above) this means f*(k) = fk(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 fn and add 1
◦ f* is Turing-computable
Number-theoretic Predicates Number-theoretic Predicates (recap)(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 operatorLeast 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
MinimizationMinimization New function-forming operation, Mn
suppose that f:Nk+1N with k 0 is given. We write Mn[f] for the function g:NkN defined as:
g(n) = m[Cf(n,m) = 0 and such that
for all j < m, f(n,j) is defined and ≠ 0
MinimizationMinimization
e.g. f(3,0) = 7f(3,1) = 4f(3,2) = 4f(3,3) = 2f(3,4) = 9f(3,5) = 0f(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
MinimizationMinimization
e.g. f(3,0) = 7f(3,1) is undefinedf(3,2) = 4f(3,3) = 2f(3,4) = 9f(3,5) = 0f(3,6) = 4…
m[f(3,m)= 0] = 5 but g(3) = Mn[f](3) is undefined
MinimizationMinimization
e.g. f(3,0) = 7f(3,1) = 4f(3,2) = 4f(3,3) = 2f(3,4) = 9f(3,5) = 5f(3,6) = 4…
g(3) = Mn[f](3) is undefined
ExerciseExercise
f(0,0) = 6 f(1,0) = 8 f(2,0) = 3 f(3,0) = 9 f(4,0) = 6f(0,1) = 4 f(1,1) = 8 f(2,1) = 1 f(3,1) = 6 f(4,1) = 6f(0,2) = 6 f(1,2) = 6 f(2,2) = 6 f(3,2) = 4 f(4,2) = 6f(0,3) = 0 f(1,3) = 6 f(2,3) is undefined f(3,3) = 6 f(4,3) = 6f(0,4) = 6 f(1,4) = 5 f(2,4) = 6 f(3,4) = 0 f(4,4) = 6f(0,5) = 8 f(1,5) = 0 f(2,5) = 0 f(3,5) = 6 f(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)
ExerciseExercise
f(0,0) = 6 f(1,0) = 8 f(2,0) = 3 f(3,0) = 9 f(4,0) = 6f(0,1) = 4 f(1,1) = 8 f(2,1) = 1 f(3,1) = 6 f(4,1) = 6f(0,2) = 6 f(1,2) = 6 f(2,2) = 6 f(3,2) = 4 f(4,2) = 6f(0,3) = 0 f(1,3) = 6 f(2,3) is undefined f(3,3) = 6 f(4,3) = 6f(0,4) = 6 f(1,4) = 5 f(2,4) = 6 f(3,4) = 0 f(4,4) = 6f(0,5) = 8 f(1,5) = 0 f(2,5) = 0 f(3,5) = 6 f(4,5) = 6
with f(4,m) = 6
for all m
Calculate g(0) = Mn[f](0) = 3g(1) = Mn[f](1) = 5g(2) = Mn[f](2) is undefinedg(3) = Mn[f](3) = 4g(4) = Mn[f](4) is undefined
Even if f(2,3) were defined,
Mn[f](n) = g(n) would still
be partial
PartialPartial
The exercise shows that applying minimization operator Mn to a total function may result in a partial function
Partial recursive functions Partial recursive functions defineddefined
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 World of number-theoretic functionsfunctions
The class of partial recursive The class of partial recursive functions = class of Turing-functions = class of Turing-
computable functionscomputable functions
TheoremsTheorems 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 functionsProof: initial functions
Successor function
0 1 21 : L B : 1
Figure 1.5.1
Proof: initial functionsProof: initial functions
Constant-k function ◦ Erases k groups of 1s off to the right,
writes a single 1 and halts◦ e.g. C0
0
B:10 1
Proof: initial functionsProof: initial functions Projection function. Erase all
sequences of 1s on the tape, except the one that is projected unto, e.g. p3
2
B:R0 1
1:BB:R
2 1:R
B:R3
1:BB:R
4
5B:L
B:L
61:L
1:L
7
B:R
Proof: CompProof: Comph = Comp[f,g1,…gm]f is an m-ary partial recursive
functiong1,…,gm are k-ary partial recursive
functionsWe have Turing Machines Mf,Mg,…
Mm
Mcomp will simulate the composition of Turing Machines Mf,Mg,…Mm
1 1 1 … 1 B 1 1 1 … 1 B … 1 1 1 … 1 B BInput tape
Argument n1 Argument n2Argument nk
1 1 1 … 1 B 1 1 1 … 1 B … 1 1 1 … 1 B BWorktape-1
Argument n1 Argument n2Argument nk
1 1 1 … 1 B 1 1 1 … 1 B … 1 1 1 … 1 B BWorktape-m
Argument n1 Argument n2Argument nk
B B …Output tape
Copy k arguments from input tape to m worktapes
…
1 1 1 … 1 B 1 1 1 … 1 B … 1 1 1 … 1 B BInput tape
Argument n1 Argument n2Argument nk
1 1 1 … 1 B …Worktape-1
g1(n1,n2,…,nk)
1 1 1 … 1 B ...Worktape-m
B B …Output tape
Mcomp simulates Mg,…Mm
on m worktapes
gm(n1,n2,…,nk)
…
1 1 1 … 1 B 1 1 1 … 1 B … 1 1 1 … 1 B BInput tape
Argument n1 Argument n2Argument nk
Worktape-1
g1(n1,n2,…,nk)
1 1 1 … 1 B ...Worktape-m
B B …Output tape
Mcomp copies the contents of m worktapes
unto worktape-1
gm(n1,n2,…,nk)
1 1 1 … 1 B 1 1 1 … 1 B … 1 1 1 … 1 B B
g2(n1,n2,…,nk) gm(n1,n2,…,nk)
…
1 1 1 … 1 B 1 1 1 … 1 B … 1 1 1 … 1 B BInput tape
Argument n1 Argument n2Argument nk
Worktape-1
g1(n1,n2,…,nk)
Output tape
Mcomp simulate Mf on worktape-1
1 1 1 … 1 B 1 1 1 … 1 B … 1 1 1 … 1 B B
g2(n1,n2,…,nk) gm(n1,n2,…,nk)
B B …
f(g1(n1,n2,…,nk), g2(n1,n2,…,nk),…, gm(n1,n2,…,nk))
1 1 1 … 1 B 1 1 1 … 1 B … 1 1 1 … 1 B BInput tape
Argument n1 Argument n2Argument nk
Worktape-1
Output tape
Mcomp copies the contents to the output tape
1 1 1 … 1 B …
f(g1(n1,n2,…,nk), g2(n1,n2,…,nk),…, gm(n1,n2,…,nk))
1 1 1 … 1 B …
Proof: Pr[f,g]Proof: Pr[f,g]f is a k-ary partial recursive
functiong is a k+2-ary partial recursive
functionBoth are Turing ComputableWe have Mf and Mg that compute
f and gMPr: 5 tape Turing Machine that
will simulate primitive recursion
Proof: Pr[f,g]Proof: Pr[f,g]
In case (i) (i.e. n1,…,nk,0), <n,0> are represented on input tape. MPr copies arguments n to worktape-1 and simulates the operation of Mf
on worktape-1. When it halts in a value-representing configuration, the value is copied onto the output tape
Proof: Pr[f,g]Proof: Pr[f,g]In case (ii) (i.e. n1,…,nk,m+1), <n,m+1> are
represented on the input tape. MPr copies arguments n to worktape-1 and simulates the operation of Mf on worktape-1. When it halts in a value-representing configuration, MPr 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(n0) = f(n)
1 1 1 … 1 B 1 1 1 … 1 B … 1 1 1 … 1 B 1 B 1 … 1 B …
Argument n1 Argument n2 Argument nk Argument m+1
1 1 1 … 1 B …
f(n1,…,nk) = h(n1,…,nk,0)
1 1 1 … 1 B 1 1 1 … 1 B … 1 1 1 … 1 B 1 B 1 … 1 B …
n1 n2 nk
f(n1,…,nk) = h(n1,…,nk,0)0
Copied from input tape Copied from worktape3
Copied from worktape1
1 B …
B B …
input
work1
work2
work3
output
After 1 iteration
Proof: Pr[f,g]Proof: Pr[f,g]
Mpr then simulates operation of Mg 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))
1 1 1 … 1 B 1 1 1 … 1 B … 1 1 1 … 1 B 1 B 1 … 1 B …
Argument n1 Argument n2 Argument nk Argument m+1
1 1 1 … 1 B …
h(n1,…,nk,1)
1 1 1 … 1 B 1 1 1 … 1 B … 1 1 1 … 1 B 1 1 B 1 … 1 B …
n1 n2 nk h(n1,…,nk,1)1
Copied from input tape Copied from worktape3
Copied from worktape1
1 1 B …
B B …
input
work1
work2
work3
output
After 2 iterations
Proof: Pr[f,g]Proof: Pr[f,g]Mpr then simulates operation of Mg
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)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) = p11(n) = n
(ii) plus(n,m+1) = g(n,m,h(n,m)) = succ(p33(n,m,plus(n,m)))
Case-study: plus(3,2)
Pr[f,g] for plus(n,m)Pr[f,g] for plus(n,m)
(i) plus(n,0) = f(n) = p11(n) = n
(ii) plus(n,m+1) = g(n,m,h(n,m)) = succ(p33(n,m,plus(n,m)))
Case-study: plus(3,2)The 2nd argument is not 0, so:
◦ MPr copies argument n to worktape-1 and simulates the operation of Mf on worktape-1 (f(n)=n=plus(n,0))
◦ MPr writes a single 1 on worktape-3 (indicating 1st 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
1 1 1 1 B 1 1 1 1 B
Argument n Argument m+1
1 1 1 1 B
f(n) = n
1 1 1 1 B 1 B 1 1 1 1 B
n f(n)=n0
1 B …
B B …
input
work1
work2
work3
output
After 1 iteration
Pr[f,g] for plus(n,m)Pr[f,g] for plus(n,m)
Mpr then simulates operation of Mg on worktape-2◦ Worktape-2 contains <3,0,3>, the 3 arguments for function g
1st argument: n (=3) 2nd argument: m (=0) 3rd argument: plus(3,0) =3
◦ Function g is defined as succ(p33(n,m,plus(n,m)))
◦ g(3,0,3) = succ(p33(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)
1 1 1 1 B 1 1 1 1 B
Argument n Argument m+1
1 1 1 1 1 B
g(3,0,3) = succ(3) = 4
1 1 1 1 B 1 1 B 1 1 1 1 1 B
n g(3,0,3) = succ(3) = 41
1 1 B …
B B …
input
work1
work2
work3
output
After 2 iterations
Pr[f,g] for plus(n,m)Pr[f,g] for plus(n,m)
Mpr then simulates operation of Mg on worktape-2◦ Worktape-2 contains <3,1,4>◦ g(3,1,4) = succ(p3
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)
1 1 1 1 B 1 1 1 1 B
Argument n Argument m+1
1 1 1 1 1 1 B
g(3,1,4) = succ(4) = 5
1 1 1 1 B 1 1 1 B 1 1 1 1 1 1 B
n 2
1 1 1 B …
B B …
input
work1
work2
work3
output
After 3 iterations
g(3,1,4) = succ(4) = 5
Pr[f,g] for plus(n,m)Pr[f,g] for plus(n,m)
Mpr then simulates operation of Mg on worktape-2◦ Worktape-2 contains <3,2,5>◦ g(3,2,5) = succ(p3
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)
1 1 1 1 B 1 1 1 1 B
Argument n Argument m+1
1 1 1 1 1 1 1 B
g(3,2,5) = succ(5) = 6
1 1 1 1 B 1 1 1 1 B 1 1 1 1 1 1 1 B
n 3
1 1 1 1 B …
B B …
input
work1
work2
work3
output
After 4 iterations
g(3,2,5) = succ(5) = 6
Pr[f,g] for plus(n,m)Pr[f,g] for plus(n,m)
Mpr then simulates operation of Mg on worktape-2◦ Worktape-2 contains <3,3,6>◦ g(3,3,6) = succ(p3
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)
1 1 1 1 B 1 1 1 1 B
Argument n Argument m+1
1 1 1 1 1 1 1 1 B
g(3,3,6) = succ(6) = 7
1 1 1 1 B 1 1 1 1 1 B 1 1 1 1 1 1 1 1 B
n 4
1 1 1 1 1 B …
B B …
input
work1
work2
work3
output
After 5 iterations
g(3,3,6) = succ(6) = 7
Pr[f,g] for plus(n,m)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]Proof: Mn[f]Suppose Mn[f] where f is a (k+1)-ary
partial recursive function. Let Mf be a single-tape Turing Machine that computes f.
MMn will compute h = Mn[f]◦Four-tape Turing machine◦Arguments n appear on input tape◦MMn will write a single 1 on worktape-1
(=0)◦Copies arguments n and the single 1
from worktape-1 onto worktape-2
1 1 1 … 1 B 1 1 1 … 1 B … 1 1 1 … 1 B BInput tape
Argument n1 Argument n2Argument nk
1 B …Worktape-1
Worktape-2
B B …Output tape
1 1 1 … 1 B 1 1 1 … 1 B … 1 1 1 … 1 B 1 B …
n1 n2nk
From worktape-1
MMn simulates Mf on worktape-2
Proof: Mn[f]Proof: Mn[f]
After execution of Mf on worktape-2, MMn 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
1 1 1 … 1 B 1 1 1 … 1 B … 1 1 1 … 1 B BInput tape
Argument n1 Argument n2Argument nk
1 B …Worktape-1
Worktape-2
B B …Output tape
1 1 B …
f(n,0)
In this example f(n,0) = 1, so 0 is not the least number operator
Proof: Mn[f]Proof: Mn[f]
If that is not the case MMn 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 Mf on worktape-2
This process is repeated until worktape-2’s value representing configuration equals to 0.
1 1 1 … 1 B 1 1 1 … 1 B … 1 1 1 … 1 B BInput tape
Argument n1 Argument n2Argument nk
1 1 B …Worktape-1
Worktape-2
B B …Output tape
1 1 1 … 1 B 1 1 1 … 1 B … 1 1 1 … 1 B 1 1 B …
n1 n2nk
From worktape-1
MMn simulates Mf on worktape-2
1 1 1 … 1 B 1 1 1 … 1 B … 1 1 1 … 1 B BInput tape
Argument n1 Argument n2Argument nk
Worktape-1
Worktape-2
Output tape
1 B …
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
1 1 B …
1 1 B …