0% found this document useful (0 votes)
3 views

Slide04 RecursiveFunction

computabiliy
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Slide04 RecursiveFunction

computabiliy
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 82

Basic Functions

Substitution
Recursion
Minimalisation

Recursive Function∗

Xiaofeng Gao

Department of Computer Science and Engineering


Shanghai Jiao Tong University, P.R.China

CS363-Computability Theory


Special thanks is given to Prof. Yuxi Fu for sharing his teaching materials.
CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 1/54
Basic Functions
Substitution
Recursion
Minimalisation

Outline
1 Basic Functions
Three Basic Functions
2 Substitution
Definition
Variable Sequences
3 Recursion
Definition
Examples
Corollary
4 Minimalisation
Bounded Minimalisation
Unbounded Minimalisation
A Famous Example

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 2/54


Basic Functions
Substitution
Three Basic Functions
Recursion
Minimalisation

Outline
1 Basic Functions
Three Basic Functions
2 Substitution
Definition
Variable Sequences
3 Recursion
Definition
Examples
Corollary
4 Minimalisation
Bounded Minimalisation
Unbounded Minimalisation
A Famous Example

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 3/54


Basic Functions
Substitution
Three Basic Functions
Recursion
Minimalisation

The Basic Functions

Lemma. The following basic functions are computable.


1 The zero function 0.
2 The successor function x + 1.
3 For each n ≥ 1 and 1 ≤ i ≤ n, the projection function Uin given
by Uin (x1 , . . . , xn ) = xi .

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 4/54


Basic Functions
Substitution
Three Basic Functions
Recursion
Minimalisation

Proof

These functions correspond to the arithmetic instructions for URM.


1 0: program Z(1);
2 x + 1: program S(1);
3 Uin : program T(i, 1).

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 5/54


Basic Functions
Substitution Definition
Recursion Variable Sequences
Minimalisation

Outline
1 Basic Functions
Three Basic Functions
2 Substitution
Definition
Variable Sequences
3 Recursion
Definition
Examples
Corollary
4 Minimalisation
Bounded Minimalisation
Unbounded Minimalisation
A Famous Example

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 6/54


Basic Functions
Substitution Definition
Recursion Variable Sequences
Minimalisation

Substitution Theorem

Suppose that f (y1 , . . . , yk ) and g1 (x), . . . , gk (x) are computable


functions, where x = x1 , . . . , xn . Then the function h(x) given by

h(x) ≃ f (g1 (x), . . . , gk (x))

is a computable function.

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 7/54


Basic Functions
Substitution Definition
Recursion Variable Sequences
Minimalisation

Substitution Theorem

Suppose that f (y1 , . . . , yk ) and g1 (x), . . . , gk (x) are computable


functions, where x = x1 , . . . , xn . Then the function h(x) given by

h(x) ≃ f (g1 (x), . . . , gk (x))

is a computable function.

Question: what is the domain of definition of h(x)?

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 7/54


Basic Functions
Substitution Definition
Recursion Variable Sequences
Minimalisation

Substitution Theorem

Suppose that f (y1 , . . . , yk ) and g1 (x), . . . , gk (x) are computable


functions, where x = x1 , . . . , xn . Then the function h(x) given by

h(x) ≃ f (g1 (x), . . . , gk (x))

is a computable function.

Question: what is the domain of definition of h(x)?

Note: h(x) is defined iff g1 (x), · · · , gk (x) are all defined and
(g1 (x), · · · , gk (x)) ∈ Dom(f ). Thus, if f and g1 , · · · , gk are all total
functions, then h is total.

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 7/54


Basic Functions
Substitution Definition
Recursion Variable Sequences
Minimalisation

Proof (Construction)

Let F, G1 , . . . , Gk be programs in standard form that compute


f , g1 , . . . , gk .

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 8/54


Basic Functions
Substitution Definition
Recursion Variable Sequences
Minimalisation

Proof (Construction)

Let F, G1 , . . . , Gk be programs in standard form that compute


f , g1 , . . . , gk .

Let m be max{n, k, ρ(F), ρ(G1 ), . . . , ρ(Gk )}.

Registers:
m+n m+n+1 m+n+k
[. . .]m
1 [x]m+1 [g1 (x)]m+n+1 . . . [gk (x)]m+n+k

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 8/54


Basic Functions
Substitution Definition
Recursion Variable Sequences
Minimalisation

URM Program for Substitution

I1 : T(1, m + 1)
..
.
In : T(n, m + n)
In+1 : G1 [m + 1, . . . , m + n → m + n + 1]
..
.
In+k : Gk [m + 1, . . . , m + n → m + n + k]
In+k+1 : F[m + n + 1 . . . , m + n + k → 1]

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 9/54


Basic Functions
Substitution Definition
Recursion Variable Sequences
Minimalisation

Computable Function with Variable Sequences

Theorem. Suppose that f (y1 , . . . , yk ) is a computable function and


that xi1 , . . . , xik is a sequence of k of the variables x1 , . . . , xn (possibly
with repetitions). Then the function h given by

h(x1 , . . . , xn ) ≃ f (xi1 , . . . , xik )

is computable.

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 10/54


Basic Functions
Substitution Definition
Recursion Variable Sequences
Minimalisation

Computable Function with Variable Sequences

Theorem. Suppose that f (y1 , . . . , yk ) is a computable function and


that xi1 , . . . , xik is a sequence of k of the variables x1 , . . . , xn (possibly
with repetitions). Then the function h given by

h(x1 , . . . , xn ) ≃ f (xi1 , . . . , xik )

is computable.

Proof. h(x) ≃ f (Uin1 (x), . . . , Uink (x)).

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 10/54


Basic Functions
Substitution Definition
Recursion Variable Sequences
Minimalisation

Form New Functions

Rearrangement: h1 (x1 , x2 ) ≃ f (x2 , x1 );


Identification: h2 (x) ≃ f (x, x);
Adding Dummy Variables: h3 (x1 , x2 , x3 ) ≃ f (x2 , x3 ).

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 11/54


Basic Functions
Substitution Definition
Recursion Variable Sequences
Minimalisation

An Example

The function f (x1 , x2 , x3 ) = x1 + x2 + x3 is computable.

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 12/54


Basic Functions
Substitution Definition
Recursion Variable Sequences
Minimalisation

An Example

The function f (x1 , x2 , x3 ) = x1 + x2 + x3 is computable.

Proof. Since x + y is computable, by substituting x1 + x2 for x, and x3


for y in x + y we can claim that f is computable.

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 12/54


Basic Functions
Substitution Definition
Recursion Variable Sequences
Minimalisation

An Example

The function f (x1 , x2 , x3 ) = x1 + x2 + x3 is computable.

Proof. Since x + y is computable, by substituting x1 + x2 for x, and x3


for y in x + y we can claim that f is computable.

Note: When the functions g1 , · · · , gk substituted into f , it is not


necessarily involving all of the variables x1 , · · · , xn to guarantee the
computability of the new function.

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 12/54


Basic Functions
Definition
Substitution
Examples
Recursion
Corollary
Minimalisation

Outline
1 Basic Functions
Three Basic Functions
2 Substitution
Definition
Variable Sequences
3 Recursion
Definition
Examples
Corollary
4 Minimalisation
Bounded Minimalisation
Unbounded Minimalisation
A Famous Example

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 13/54


Basic Functions
Definition
Substitution
Examples
Recursion
Corollary
Minimalisation

Recursion Equations

Suppose that f (x) and g(x, y, z) are functions. The function obtained
from f (x) and g(x, y, z) by recursion is defined as follows:

h(x, 0) ≃ f (x),
h(x, y + 1) ≃ g(x, y, h(x, y)).

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 14/54


Basic Functions
Definition
Substitution
Examples
Recursion
Corollary
Minimalisation

Domain of h

h may not be total unless both f and g are total.

The domain of h satisfies:


(x, 0) ∈ Dom(h) iff x ∈ Dom(f );
(x, y + 1) ∈ Dom(h) iff (x, y) ∈ Dom(h)
and (x, y, h(x, y)) ∈ Dom(g).

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 15/54


Basic Functions
Definition
Substitution
Examples
Recursion
Corollary
Minimalisation

Uniqueness

Theorem. Let x = {x1 , · · · , xn },and suppose that f (x) and g(x, y, z)


are functions; then there is a unique function h(x, y) satisfying the
recursion equations

h(x, 0) ≃ f (x),
h(x, y + 1) ≃ g(x, y, h(x, y)).

Note: When n = 0 (x do not appear), the recursion equations take the


form 
h(0) = a,
h(y + 1) ≃ g(y, h(y)).

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 16/54


Basic Functions
Definition
Substitution
Examples
Recursion
Corollary
Minimalisation

Computability Theorem

Theorem. h(x, y) is computable if f (x) and g(x, y, z) are computable.

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 17/54


Basic Functions
Definition
Substitution
Examples
Recursion
Corollary
Minimalisation

Proof
Registers:
m+n m+n+1 m+n+2 m+n+3
[. . .]m
1 [x]m+1 [y]m+n+1 [k]m+n+2 [h(x, k)]m+n+3 .

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 18/54


Basic Functions
Definition
Substitution
Examples
Recursion
Corollary
Minimalisation

Proof
Registers:
m+n m+n+1 m+n+2 m+n+3
[. . .]m
1 [x]m+1 [y]m+n+1 [k]m+n+2 [h(x, k)]m+n+3 .
Program:
T(1, m + 1)
..
.
T(n + 1, m + n + 1)
F[1, 2, . . . , n → m + n + 3]
Iq : J(n + m + 2, n + m + 1, p)
G[m + 1, . . . , m + n, m + n + 2, m + n + 3 → m + n + 3]
S(n + m + 2)
J(1, 1, q)
Ip : T(n + m + 3, 1)
CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 18/54
Basic Functions
Definition
Substitution
Examples
Recursion
Corollary
Minimalisation

Flow Diagram

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 19/54


Basic Functions
Definition
Substitution
Examples
Recursion
Corollary
Minimalisation

Addition

Let add: N2 → N, add(x, y) := x + y.

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 20/54


Basic Functions
Definition
Substitution
Examples
Recursion
Corollary
Minimalisation

Addition

Let add: N2 → N, add(x, y) := x + y.

add(x, 0) = x + 0 = x
add(x, y + 1) = x + (y + 1) = (x + y) + 1
= add(x, y) + 1
Therefore,
add(x, 0) = f (x)
add(x, y + 1) = g(x, y, add(x, y))
where
f : N → N, f (x) := x,
3
g : N → N, g(x, y, z) := z + 1.

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 20/54


Basic Functions
Definition
Substitution
Examples
Recursion
Corollary
Minimalisation

Multiplication

Let mult: N2 → N, mult(x, y) := x · y.

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 21/54


Basic Functions
Definition
Substitution
Examples
Recursion
Corollary
Minimalisation

Multiplication

Let mult: N2 → N, mult(x, y) := x · y.

mult(x, 0) = x · 0 = 0
mult(x, y + 1) = x · (y + 1) = x · y + x
= mult(x, y) + x
Therefore,
mult(x, 0) = f (x)
mult(x, y + 1) = g(x, y, mult(x, y))
where
f : N → N, f (x) := 0,
3
g : N → N, g(x, y, z) := z + x.

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 21/54


Basic Functions
Definition
Substitution
Examples
Recursion
Corollary
Minimalisation

Power Function

Let power: N2 → N, power(x, y) := xy

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 22/54


Basic Functions
Definition
Substitution
Examples
Recursion
Corollary
Minimalisation

Power Function

Let power: N2 → N, power(x, y) := xy

power(x, 0) = x0 ≃ 1
power(x, y + 1) = x(y+1) ≃ xy · x

Therefore,
power(x, 0) = f (x)
power(x, y + 1) = g(x, y, power(x))
where
f : N → N, f (x) := 1,
2
g : N → N, g(x, y, z) := z · x.

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 22/54


Basic Functions
Definition
Substitution
Examples
Recursion
Corollary
Minimalisation

Predecessor

x − 1 if x > 0,
Let pred: N → N, pred(x) := x−̇1 =
0 otherwise.

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 23/54


Basic Functions
Definition
Substitution
Examples
Recursion
Corollary
Minimalisation

Predecessor

x − 1 if x > 0,
Let pred: N → N, pred(x) := x−̇1 =
0 otherwise.

pred(0) = 0
pred(x + 1) = x

Therefore,
pred(0) = f (x) = 0
pred(x + 1) = g(x, pred(x))
where
f : N → N, f (x) := 0,
2
g : N → N, g(x, y) := x.
CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 23/54
Basic Functions
Definition
Substitution
Examples
Recursion
Corollary
Minimalisation

Conditional Subtraction

def x − y, if x ≥ y,
Let sub: N2 → N, sub(x, y) := x−̇y =
0, otherwise.

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 24/54


Basic Functions
Definition
Substitution
Examples
Recursion
Corollary
Minimalisation

Conditional Subtraction

def x − y, if x ≥ y,
Let sub: N2 → N, sub(x, y) := x−̇y =
0, otherwise.

sub(x, 0) = x−̇0 ≃ x
sub(x, y + 1) = x−̇(y + 1) ≃ (x−̇y)−̇1.

Therefore,
sub(x, 0) = f (x)
sub(x, y + 1) = g(x, y, sub(x))
where
f : N → N, f (x) := x,
2
g : N → N, g(x, y, z) := z−̇1.
CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 24/54
Basic Functions
Definition
Substitution
Examples
Recursion
Corollary
Minimalisation

Sign

Let sg: N → N,

def 0, if x = 0,
sg(x) = :
1, if x 6= 0.

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 25/54


Basic Functions
Definition
Substitution
Examples
Recursion
Corollary
Minimalisation

Sign

Let sg: N → N,

def 0, if x = 0,
sg(x) = :
1, if x 6= 0.

sg(0) ≃ 0,
sg(x + 1) ≃ 1.


def 1, if x = 0,
sg(x) = :
0, if x 6= 0.

sg(x) ≃ 1−̇sg(x).

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 25/54


Basic Functions
Definition
Substitution
Examples
Recursion
Corollary
Minimalisation

Other Examples

Absolute Function (ABS): |x − y| ≃ (x−̇y) + (y−̇x).

Factorial: x!

0! ≃ 1,
(x + 1)! ≃ x!(x + 1).

Minimum: min(x, y) ≃ x−̇(x−̇y).

Maximum: max(x, y) ≃ x + (y−̇x).

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 26/54


Basic Functions
Definition
Substitution
Examples
Recursion
Corollary
Minimalisation

Remainder

def
rm(x, y) = the remainder when y is devided by x:

def rm(x, y) + 1, if rm(x, y) + 1 6= x,
rm(x, y + 1) =
0, if rm(x, y) + 1 = x.

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 27/54


Basic Functions
Definition
Substitution
Examples
Recursion
Corollary
Minimalisation

Remainder

def
rm(x, y) = the remainder when y is devided by x:

def rm(x, y) + 1, if rm(x, y) + 1 6= x,
rm(x, y + 1) =
0, if rm(x, y) + 1 = x.

The recursive definition is given by

rm(x, 0) = 0,
rm(x, y + 1) = (rm(x, y) + 1)sg(|x − (rm(x, y) + 1)|).

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 27/54


Basic Functions
Definition
Substitution
Examples
Recursion
Corollary
Minimalisation

Quotient

def
qt(x, y) = the quotient when y is devided by x:

def qt(x, y) + 1, if rm(x, y) + 1 = x,
qt(x, y + 1) =
qt(x, y), if rm(x, y) + 1 6= x.

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 28/54


Basic Functions
Definition
Substitution
Examples
Recursion
Corollary
Minimalisation

Quotient

def
qt(x, y) = the quotient when y is devided by x:

def qt(x, y) + 1, if rm(x, y) + 1 = x,
qt(x, y + 1) =
qt(x, y), if rm(x, y) + 1 6= x.

The recursive definition is given by

qt(x, 0) = 0,
qt(x, y + 1) = qt(x, y) + sg(|x − (rm(x, y) + 1)|).

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 28/54


Basic Functions
Definition
Substitution
Examples
Recursion
Corollary
Minimalisation

Conditional Division


def 1, if x|y,
div(x, y) = :
0, if x6 |y.

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 29/54


Basic Functions
Definition
Substitution
Examples
Recursion
Corollary
Minimalisation

Conditional Division


def 1, if x|y,
div(x, y) = : div(x, y) = sg(rm(x,y)).
0, if x6 |y.

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 29/54


Basic Functions
Definition
Substitution
Examples
Recursion
Corollary
Minimalisation

Definition by Cases

Suppose that f1 (x), . . . , fk (x) are computable functions, and


M1 (x), . . . , Mk (x) are decidable predicates, such that for every x
exactly one of M1 (x), . . . , Mk (x) holds. Then the function g(x) given
by


 f1 (x), if M1 (x) holds,
f2 (x), if M2 (x) holds,


g(x) ≃ ..


 .
fk (x), if Mk (x) holds.

is computable.

Proof. g(x) ≃ cM1 (x)f1 (x) + . . . + cMk (x)fk (x).

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 30/54


Basic Functions
Definition
Substitution
Examples
Recursion
Corollary
Minimalisation

Algebra of decidability

Suppose that M(x) and Q(x) are decidable predicates; then the
following are also decidable.
1 not M(x)
2 M(x) and Q(x)
3 M(x) or Q(x)

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 31/54


Basic Functions
Definition
Substitution
Examples
Recursion
Corollary
Minimalisation

Algebra of decidability

Suppose that M(x) and Q(x) are decidable predicates; then the
following are also decidable.
1 not M(x)
2 M(x) and Q(x)
3 M(x) or Q(x)
Proof:
1 1−̇cM (x)
2 cM (x) · cQ (x)
3 max(cM (x), cQ (x))

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 31/54


Basic Functions
Bounded Minimalisation
Substitution
Unbounded Minimalisation
Recursion
A Famous Example
Minimalisation

Outline
1 Basic Functions
Three Basic Functions
2 Substitution
Definition
Variable Sequences
3 Recursion
Definition
Examples
Corollary
4 Minimalisation
Bounded Minimalisation
Unbounded Minimalisation
A Famous Example

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 32/54


Basic Functions
Bounded Minimalisation
Substitution
Unbounded Minimalisation
Recursion
A Famous Example
Minimalisation

Bounded Sum and Bounded Product


Bounded sum:
X
f (x, z) ≃ 0,
z<0
X X
f (x, z) ≃ f (x, z) + f (x, y)
z<y+1 z<y

Bounded product:
Y
f (x, z) ≃ 1,
z<0
Y Y
f (x, z) ≃ ( f (x, z)) · f (x, y)
z<y+1 z<y

They are computable if f (x, z) is total and computable.


CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 33/54
Basic Functions
Bounded Minimalisation
Substitution
Unbounded Minimalisation
Recursion
A Famous Example
Minimalisation

Bounded Sum and Bounded Product

By substitution the following functions are also computable


X
f (x, z)
z<k(x,w)

and Y
f (x, z)
z<k(x,w)

if k(x, w) is total and computable.

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 34/54


Basic Functions
Bounded Minimalisation
Substitution
Unbounded Minimalisation
Recursion
A Famous Example
Minimalisation

Bounded Minimization Operator, or µ-Operator

µz < y(· · · ): the least z less than y such that · · ·


def the least z < y, such that f (x, z) = 0;
µz<y(f (x, z) = 0) =
y if there is no such z.

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 35/54


Basic Functions
Bounded Minimalisation
Substitution
Unbounded Minimalisation
Recursion
A Famous Example
Minimalisation

µ-Operator

Theorem.

If f (x, z) is total and computable, then so is µz<y (f (x, z) = 0).

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 36/54


Basic Functions
Bounded Minimalisation
Substitution
Unbounded Minimalisation
Recursion
A Famous Example
Minimalisation

Proof

Q
Consider h(x, v) = sg(f (x, u)) (Computable).
u≤v

Given x, y, suppose z0 = µz < y(f ((x), y) = 0). Easy to see,

if v < z0 , then h((x), v) = 1;

if z0 ≤ v < y, then h((x), v) = 0;


P
Thus z0 = h((x), v).
v<y
P Q
So µz<y(f (x, z) = 0) ≃ ( sg(f (x, u))) is computable.
v<y u≤v

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 37/54


Basic Functions
Bounded Minimalisation
Substitution
Unbounded Minimalisation
Recursion
A Famous Example
Minimalisation

Bounded Minimization Operator, or µ-Operator

Corollary: If f (x, z) and k(x, w) are total and computable functions,


then so is the function

µz<k(x, w) (f (x, z) = 0).

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 38/54


Basic Functions
Bounded Minimalisation
Substitution
Unbounded Minimalisation
Recursion
A Famous Example
Minimalisation

Bounded Minimization Operator, or µ-Operator

Corollary: If f (x, z) and k(x, w) are total and computable functions,


then so is the function

µz<k(x, w) (f (x, z) = 0).

Proof. By substitution of k(x, w) for y in the computable function


µz<y (f (x, z) = 0).

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 38/54


Basic Functions
Bounded Minimalisation
Substitution
Unbounded Minimalisation
Recursion
A Famous Example
Minimalisation

Suppose that R(x, y) is a decidable predicates. Then the following


statements are valid:
1 the function f (x, y) ≃ µz<y R(x, y) is computable;
2 the following predicates are decidable:
a) M1 (x, y) ≡ ∀z < yR(x, z);
b) M2 (x, y) ≡ ∃z < yR(x, z).

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 39/54


Basic Functions
Bounded Minimalisation
Substitution
Unbounded Minimalisation
Recursion
A Famous Example
Minimalisation

Suppose that R(x, y) is a decidable predicates. Then the following


statements are valid:
1 the function f (x, y) ≃ µz<y R(x, y) is computable;
2 the following predicates are decidable:
a) M1 (x, y) ≡ ∀z < yR(x, z);
b) M2 (x, y) ≡ ∃z < yR(x, z).

Proof.
1 f (x, y) = µz < y(sg(CR (x, z)) = 0).
Q
2 a) cM1 (x, y) = cR (x, z).
z<y
b) M2 (x, y) ≡ not (∀z < y(not R(x, z)))

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 39/54


Basic Functions
Bounded Minimalisation
Substitution
Unbounded Minimalisation
Recursion
A Famous Example
Minimalisation

Theorem. The following functions are computable.


(a) D(x) = the number of divisors of x;

1, if x is prime,
(b) Pr(x) = ;
0, if x is not prime.
(c) px = the x-th prime number;

 k, k is the exponent of py in the prime
(d) (x)y = factorisation of x, for x, y > 0, .
0, if x = 0 or y = 0.

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 40/54


Basic Functions
Bounded Minimalisation
Substitution
Unbounded Minimalisation
Recursion
A Famous Example
Minimalisation

Proof.
P
(a) D(x) ≃ y≤x div(y, x).

(b) Pr(x) ≃ sg(|D(x) − 2|).

(c) px can be recursively defined as follows:

p0 ≃ 0,
px+1 ≃ µz ≤ (px ! + 1)(z > px and z is prime).

(d) (x)y ≃ µz<x(pz+1


y 6 |x).

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 41/54


Basic Functions
Bounded Minimalisation
Substitution
Unbounded Minimalisation
Recursion
A Famous Example
Minimalisation

Prime Coding

Suppose s = (a1 , a2 , . . . , an ) is a finite sequence of numbers. It can be


coded by the number

b = p1a1 +1 p2a2 +1 . . . pann +1 .

Then the length of s can be recovered from

µz<b((b)z+1 = 0),

and the i-th component can be recovered from

(b)i −̇1.

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 42/54


Basic Functions
Bounded Minimalisation
Substitution
Unbounded Minimalisation
Recursion
A Famous Example
Minimalisation

Unbounded Minimization

µ-function:


 the least y such that
(i) f (x, y) is defined for all z ≤ y, and

µy(f (x, y) = 0) ≃

 (ii) f (x, y) = 0,
undefined if otherwise.

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 43/54


Basic Functions
Bounded Minimalisation
Substitution
Unbounded Minimalisation
Recursion
A Famous Example
Minimalisation

Theorem

If f (x, y) is computable, so is µy(f (x, y) = 0).

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 44/54


Basic Functions
Bounded Minimalisation
Substitution
Unbounded Minimalisation
Recursion
A Famous Example
Minimalisation

Proof
Let F be a program in standard form that computes f (x, y). Let m be
max{n + 1, ρ(F)}.
m+n m+n+1 m+n+2
Registers:[. . .]m
1 [x]m+1 [k]m+n+1 [0]m+n+2 .

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 45/54


Basic Functions
Bounded Minimalisation
Substitution
Unbounded Minimalisation
Recursion
A Famous Example
Minimalisation

Proof
Let F be a program in standard form that computes f (x, y). Let m be
max{n + 1, ρ(F)}.
m+n m+n+1 m+n+2
Registers:[. . .]m
1 [x]m+1 [k]m+n+1 [0]m+n+2 .
Program:
T(1, m + 1)
..
.
T(n, m + n)
Ip : F[m + 1, m + 2, . . . , m + n + 1 → 1]
J(1, m + n + 2, q)
S(m + n + 1)
J(1, 1, p)
Iq : T(m + n + 1, 1)
CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 45/54
Basic Functions
Bounded Minimalisation
Substitution
Unbounded Minimalisation
Recursion
A Famous Example
Minimalisation

Flow Diagram

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 46/54


Basic Functions
Bounded Minimalisation
Substitution
Unbounded Minimalisation
Recursion
A Famous Example
Minimalisation

Corollary

Suppose that R(x, y) is a decidable predicate; then the function

g(x) = µyR(x, y)

the least y such that R(x, y) holds, if there is such a y,
=
undefined, otherwise.

is computable.

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 47/54


Basic Functions
Bounded Minimalisation
Substitution
Unbounded Minimalisation
Recursion
A Famous Example
Minimalisation

Corollary

Suppose that R(x, y) is a decidable predicate; then the function

g(x) = µyR(x, y)

the least y such that R(x, y) holds, if there is such a y,
=
undefined, otherwise.

is computable.

Proof. g(x) = µy(sg(cR (x, y)) = 0).

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 47/54


Basic Functions
Bounded Minimalisation
Substitution
Unbounded Minimalisation
Recursion
A Famous Example
Minimalisation

Discussion

The µ-operator allows one to define partial functions.

E.g., given f (x, y) = |x − y2 |, g(x) ≃ µy(f (x, y) = 0),

we have g is the non-total function


 √
x, if x is a perfect square
g(x) =
undefined, otherwise.

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 48/54


Basic Functions
Bounded Minimalisation
Substitution
Unbounded Minimalisation
Recursion
A Famous Example
Minimalisation

Remark

Using the µ-operator, one may define total functions that are not
primitive recursive.

Remark: The set of primitive recursive functions are those definable


from the basic functions using substitution and recursion.

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 49/54


Basic Functions
Bounded Minimalisation
Substitution
Unbounded Minimalisation
Recursion
A Famous Example
Minimalisation

Ackermann Function

The Ackermann function is defined as follows:

ψ(0, y) ≃ y + 1,
ψ(x + 1, 0) ≃ ψ(x, 1),
ψ(x + 1, y + 1) ≃ ψ(x, ψ(x + 1, y)).

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 50/54


Basic Functions
Bounded Minimalisation
Substitution
Unbounded Minimalisation
Recursion
A Famous Example
Minimalisation

Ackermann Function

Fact. The Ackermann function is computable.

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 51/54


Basic Functions
Bounded Minimalisation
Substitution
Unbounded Minimalisation
Recursion
A Famous Example
Minimalisation

Ackermann Function

Fact. The Ackermann function is computable.

Definition. A finite set S of triples is said to be suitable if the


followings hold:
(i) if (0, y, z) ∈ S then z = y + 1;
(ii) if (x + 1, 0, z) ∈ S then (x, 1, z) ∈ S;
(iii) if (x + 1, y + 1, z) ∈ S then ∃u.((x + 1, y, u)∈S) ∧ ((x, u, z)∈S).
Three conditions correspond to the three clauses in the definition of ψ.

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 51/54


Basic Functions
Bounded Minimalisation
Substitution
Unbounded Minimalisation
Recursion
A Famous Example
Minimalisation

Ackermann Function

Fact. The Ackermann function is computable.

Definition. A finite set S of triples is said to be suitable if the


followings hold:
(i) if (0, y, z) ∈ S then z = y + 1;
(ii) if (x + 1, 0, z) ∈ S then (x, 1, z) ∈ S;
(iii) if (x + 1, y + 1, z) ∈ S then ∃u.((x + 1, y, u)∈S) ∧ ((x, u, z)∈S).
Three conditions correspond to the three clauses in the definition of ψ.
The definition of a suitable set S ensures the following property:
If (x, y, z) ∈ S, then
(i) z = ψ(x, y);
(ii) S contains all the earlier triple (x1 , y1 , ψ(x1 , y1 )) that are needed to
calculate ψ(x, y).

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 51/54


Basic Functions
Bounded Minimalisation
Substitution
Unbounded Minimalisation
Recursion
A Famous Example
Minimalisation

Computability Proof

Moreover, for any particular pair of numbers (m, n) there is a suitable


set S such that (m, n, ψ(m, n)) ∈ S. For instance, let S be the set of
triples (x, y, ψ(x, y)) that are used in the calculations of ψ(m, n).

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 52/54


Basic Functions
Bounded Minimalisation
Substitution
Unbounded Minimalisation
Recursion
A Famous Example
Minimalisation

Computability Proof

Moreover, for any particular pair of numbers (m, n) there is a suitable


set S such that (m, n, ψ(m, n)) ∈ S. For instance, let S be the set of
triples (x, y, ψ(x, y)) that are used in the calculations of ψ(m, n).

Note a triple (x, y, z) can be coded up by single positive number


2x 3y 5z . A finite set {u1 , . . . , uk } can be coded up by pu1 · · · puk .

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 52/54


Basic Functions
Bounded Minimalisation
Substitution
Unbounded Minimalisation
Recursion
A Famous Example
Minimalisation

Computability Proof

Moreover, for any particular pair of numbers (m, n) there is a suitable


set S such that (m, n, ψ(m, n)) ∈ S. For instance, let S be the set of
triples (x, y, ψ(x, y)) that are used in the calculations of ψ(m, n).

Note a triple (x, y, z) can be coded up by single positive number


2x 3y 5z . A finite set {u1 , . . . , uk } can be coded up by pu1 · · · puk .

Hence a finite set of triples can be coded by a single number v. Let Sv


denote the set of triples coded by the number v. then

(x, y, z) ∈ Sv ⇔ p2x 3y 5z divides v.

So ‘(x, y, z) ∈ Sv ’ is a decidable predicate of x, y, z, and v; and if it


holds, then x, y, z < v.

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 52/54


Basic Functions
Bounded Minimalisation
Substitution
Unbounded Minimalisation
Recursion
A Famous Example
Minimalisation

Computability Proof (Cont.)

Let R(x, y, v) be “v is a legal code and ∃z < v((x, y, z)∈Sv )”.

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 53/54


Basic Functions
Bounded Minimalisation
Substitution
Unbounded Minimalisation
Recursion
A Famous Example
Minimalisation

Computability Proof (Cont.)

Let R(x, y, v) be “v is a legal code and ∃z < v((x, y, z)∈Sv )”.

R(x, y, v) is decidable using the techniques and functions of earlier


sections.

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 53/54


Basic Functions
Bounded Minimalisation
Substitution
Unbounded Minimalisation
Recursion
A Famous Example
Minimalisation

Computability Proof (Cont.)

Let R(x, y, v) be “v is a legal code and ∃z < v((x, y, z)∈Sv )”.

R(x, y, v) is decidable using the techniques and functions of earlier


sections.

Thus the function f (x, y) = µvR(x, y, v) is a computable function that


searches for the code of a suitable set containing (x, y, z) for some z.

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 53/54


Basic Functions
Bounded Minimalisation
Substitution
Unbounded Minimalisation
Recursion
A Famous Example
Minimalisation

Computability Proof (Cont.)

Let R(x, y, v) be “v is a legal code and ∃z < v((x, y, z)∈Sv )”.

R(x, y, v) is decidable using the techniques and functions of earlier


sections.

Thus the function f (x, y) = µvR(x, y, v) is a computable function that


searches for the code of a suitable set containing (x, y, z) for some z.

As a result, the Ackermann function ψ(x, y) = µz((x, y, z)∈Sf (x,y) ) is


computable.

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 53/54


Basic Functions
Bounded Minimalisation
Substitution
Unbounded Minimalisation
Recursion
A Famous Example
Minimalisation

Ackermann Function

The Ackermann function is not primitive recursive.


It grows faster than all the primitive recursive functions.

CSC363-Computability Theory@SJTU Xiaofeng Gao Recursive Function 54/54

You might also like