Professional Documents
Culture Documents
Let f : A B and g : B C
h(x) = g(f(x))
NB: In
Base step
Inductive step
Example: x + y
(1)
f( x , 0 ) = x
f(x , y+1 ) = f( x , y ) + 1
(2)
Initial functions:
s(x) = x + 1
n(x) = 0
ui (x1 , , xn) = xi
NB: To prove that a function is primitive recursive you need show that it
can be obtained from the initial functions using only concatenation and
recursion.
8
h( x , 0 ) = 0
h( x , y + 1) = h( x , y ) + x
mult(succ(succ(0)),succ(succ(0)))
0! = 1
( x + 1 ) ! = x ! * s( x )
10
Power function
x0 = 1
x y+1 = x y * x
Predecessor
function
p (0) = 0
p(t+1)=t
pred(1) => 0 ;
pred(succ(x)) => x ;
11
x0=x
x ( t + 1) = p( x t )
|xy|=(xy)+(yx)
(x) = 1 x
if
x0
1
( x)
0 otherwise
dotsub(x,x) => 0 ;
dotsub(x,succ(y)) => pred(dotsub(x,y)) ;
What would be the output?
dotsub(succ(succ(succ(0))),succ(0))
x+y
f( x , 0 ) = x
f( x , y + 1 ) = f( x , y ) + 1
x*y
h( x , 0 ) = 0
h( x , y + 1 ) = h( x , y ) + x
x!
0! = 1
( x + 1 )! = x! * s(x)
x^y
x^0 = 1
x^( y + 1 ) = x^y * x
p(x)
p( 0 ) = 0
p( x + 1 ) = x
xy
x0=x
x ( t + 1) = p( x t )
if x y then x y = x y; else x y = 0
|xy|
(x)
|xy|=(xy)+(yx)
(x) = 1 x
13