SlideShare a Scribd company logo
1 of 46
Primitive
Recursive
Functions
-Sampath Kumar S,
AP/CSE, SECE
11/21/2017
1
Preliminaries: partial and total functions
 The domain of a partial function on set A contains the subset of A.
 The domain of a total function on set A contains the entire set A.
 A partial function f is called partially computable if there
is some program that computes it. Another term for such
functions partial recursive.
 Similarly, a function f is called computable if it is both
total and partially computable. Another term for such
function is recursive.
2 11/21/2017
Composition
 Let f : A → B and g : B → C
 Composition of f and g can then be expressed as:
g ͦ f : A → C
(g ͦ f)(x) = g(f(x))
h(x) = g(f(x))
 NB: In general composition is not commutative:
( g ͦ f )(x) ≠ ( f ͦ g )(x)
3 11/21/2017
Composition
 Definition: Let g be a function containing k variables and
f1 ... fk be functions of n variables, so the composition of
g and f is defined as:
 h(0) = k Base step
h( x1, ... , xn) = g( f1(x1 ,..., xn), … , fk(x1 ,..., xn) ) Inductive step
 Example: h(x , y) = g( f1(x , y), f2(x , y), f3(x , y) )
 h is obtained from g and f1... fk by composition.
 If g and f1...fk are (partially) computable, then h is
(partially) computable. (Proof by construction)
4 11/21/2017
Recursion
 From programming experience we know that recursion
refers to a function calling upon itself within its own
definition.
 Definition: Let g be a function containing k variables
then h is obtained through recursion as follows:
h(x1 , … , xn) = g( … , h(x1 , … , xn) )
Example: x + y
f( x , 0 ) = x (1)
f(x , y+1 ) = f( x , y ) + 1 (2)
Input: f ( 3, 2 ) => f ( 3 , 1 ) + 1 => ( f ( 3 , 0 ) + 1 ) + 1 => ( 3 + 1 ) + 1 =>
5
5 11/21/2017
PRC: Initial functions
 Primitive Recursively Closed (PRC) class of functions.
 Initial functions:
 Example of a projection function: u2 ( x1 , x2 , x3 , x4 , x5 ) = x2
 Definition: A class of total functions C is called PRC² class if:
 The initial functions belong to C.
 Function obtained from functions belonging to C by
either composition or recursion belongs to C.
6
s(x) = x + 1
n(x) = 0
ui (x1 , … , xn) = xi
11/21/2017
PRC: primitive recursive functions
 There exists a class of computable functions
that is a PRC class.
 Definition: Function is considered primitive
recursive if it can be obtained from initial functions
and through finite number of composition and
recursion steps.
 Theorem: A function is primitive recursive iff it
belongs to the PRC class. (see proof in chapter 3)
 Corollary: Every primitive recursive function is
computable.
7 11/21/2017
Primitive recursive functions: sum
 We have already seen the addition function,
which can be rewritten in LRR as follows:
sum( x, succ(y) ) => succ( sum( x , y)) ;
sum( x , 0 ) => x ;
Example: sum(succ(0),succ(succ(succ(0)))) =>
succ(sum(succ(0),succ(succ(0)))) => succ(succ(sum(succ(0),succ(0)))) =>
succ(succ(succ(sum(succ(0),0) => succ(succ(succ(succ(0))) =>
succ(succ(succ(1))) => succ(succ(2)) => succ(3) => 4
8
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.
11/21/2017
Primitive recursive functions:
multiplication
h( x , 0 ) = 0
h( x , y + 1) = h( x , y ) + x
 In LRR this can be written as:
mult(x,0) => 0 ;
mult(x,succ(y)) => sum(mult(x,y),x) ;
 What would happen on the following input?
mult(succ(succ(0)),succ(succ(0)))
9 11/21/2017
Primitive recursive functions:
factorial
0! = 1
( x + 1 ) ! = x ! * s( x )
 LRR implementation would be as follows:
fact(0) => succ(null(0)) ;
fact(succ(x)) => mult(fact(x),succ(x)) ;
Output for the following? fact(succ(succ(null(0))))
10 11/21/2017
Primitive recursive functions:
power and predecessor
11
xx=x
=x
y+y
*
1
1
0
In LRR the power function can
be expressed as follows:
pow(x,0) => succ(null(0)) ;
pow(x,succ(y)) => mult(pow(x,y),x) ;
p (0) = 0
p ( t + 1 ) = t
Power function
Predecessor
function
In LRR the predecessor is as follows:
pred(1) => 0 ;
pred(succ(x)) => x ;
11/21/2017
Primitive recursive functions:
∸, | x – y | and α
x ∸ 0 = x
x ∸ ( t + 1) = p( x ∸ t )
12
| x – y | = ( x ∸ y ) + ( y ∸ x )
α(x) = 1 ∸ x
dotsub(x,x) => 0 ;
dotsub(x,succ(y)) => pred(dotsub(x,y)) ;
abs(x,y) => sum(dotsub(x,y),dotsub(y,x)) ;
α(x) => dotsub(1,x) ;
What would be the output?
 dotsub(succ(succ(succ(0))),succ(0))
Output for the following?
 a(succ(succ(0)))
 a(null(0))
0
0
1
)(





x
otherwise
if
x
11/21/2017
Primitive recursive functions
13
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
x ∸ y
if x ≥ y then x ∸ y = x – y; else x ∸ y = 0
x ∸ 0 = x
x ∸ ( t + 1) = p( x ∸ t )
| x – y | | x – y | = ( x ∸ y ) + ( y ∸ x )
α(x) α(x) = 1 ∸ x
11/21/2017
Bounded quantifiers
 Theorem: Let C be a PRC class. If f( t , x1 , … , xn)
belongs to C then so do the functions
g( y , x1 , ... , xn ) = f( t , x1 , …, xn )
g( y , x1 , ... , xn ) = f( t , x1 , …, xn )
14

y
t 0

y
t 0
11/21/2017
Bounded quantifiers
 Theorem: Let C be a PRC class. If f( t , x1 , … , xn)
belongs to C then so do the functions
g( y , x1 , ... , xn ) = f( t , x1 , …, xn )
g( y , x1 , ... , xn ) = f( t , x1 , …, xn )
 Theorem: If the predicate P( t, x1 , … , xn ) belongs
to some PRC class C, then so do the predicates:
( t)≤y P(t, x1, … , xn )
(∃t)≤y P(t, x1, … , xn )
15

y
t 0

y
t 0

11/21/2017
Primitive recursive predicates
16
x = y d( x , y ) = α( | x – y | )
x ≤ y α ( x ∸ y )
~P α( P )
P & Q P * Q
P v Q ~ ( ~P & ~Q )
y | x y | x = (∃t)≤x { y * t = x }
Prime(x) Prime(x) = x > 1 & ( t)≤x { t = 1 v t = x v ~( t | x ) }
Exercises for Chapter 3: page 62 Questions 3,4 and 5. Fibonacci function

11/21/2017
Bounded minimalization
17
Let P(t, x1, … ,xn) be in some PRC class C and we can define a function g as follows:
    n1,.
y
u=
u
=t
n1, x,xt,P=x,xt,g .....
0 0

11/21/2017
Bounded minimalization
18
Let P(t, x1, … ,xn) be in some PRC class C and we can define a function g as follows:
    n1,.
y
u=
u
=t
n1, x,xt,P=x,xt,g .....
0 0

P(t,x1,. .. ,xn )= 0 for t<t0
P(t0, x1,. .. ,xn )= 1,where
11/21/2017
Bounded minimalization
19
Let P(t, x1, … ,xn) be in some PRC class C and we can define a function g as follows:
    n1,.
y
u=
u
=t
n1, x,xt,P=x,xt,g .....
0 0

P(t,x1,. .. ,xn )= 0 for t<t0
P(t0, x1,. .. ,xn )= 1,where
 Function g also belongs to C as it is attained from composition of primitive
recursive functions.
11/21/2017
Bounded minimalization
20
Let P(t, x1, … ,xn) be in some PRC class C and we can define a function g as follows:
    n1,.
y
u=
u
=t
n1, x,xt,P=x,xt,g .....
0 0

P(t,x1,. .. ,xn )= 0 for t<t0
P(t0, x1,. .. ,xn )= 1,where
 Function g also belongs to C as it is attained from composition of primitive
recursive functions.
 t0 is the least value for for which the predicate P is true (1).
11/21/2017
Bounded minimalization
21
Let P(t, x1, … ,xn) be in some PRC class C and we can define a function g as follows:
    n1,.
y
u=
u
=t
n1, x,xt,P=x,xt,g .....
0 0

P(t,x1,. .. ,xn )= 0 for t<t0
P(t0, x1,. .. ,xn )= 1,where
 Function g also belongs to C as it is attained from composition of primitive
recursive functions.
 t0 is the least value for for which the predicate P is true (1).
  
   False=x,xt,Ptt
True=x,xt,Pt<t
n1,
n1,0


0...:
1...:
0 

11/21/2017
Bounded minimalization
22
Let P(t, x1, … ,xn) be in some PRC class C and we can define a function g as follows:
    n1,.
y
u=
u
=t
n1, x,xt,P=x,xt,g .....
0 0

P(t,x1,. .. ,xn )= 0 fort<t0
P (t0, x1,. .. ,xn)= 1,where
 Function g also belongs to C as it is attained from composition of primitive
recursive functions.
 t0 is the least value for for which the predicate P is true (1).
  
   False=x,xt,Ptt
True=x,xt,Pt<t
n1,
n1,0


0...:
1...:
0 

  
   0
0
0
0..
1..
tuif=x,xt,P
t<uif=x,xt,P
n1,.
u
=t
0n1,.
u
=t




11/21/2017
Bounded minimalization
23
Let P(t, x1, … ,xn) be in some PRC class C and we can define a function g as follows:
    n1,.
y
u=
u
=t
n1, x,xt,P=x,xt,g .....
0 0

P(t,x1,. .. ,xn )= 0 for t<t0
P(t0, x1,. .. ,xn )= 1,where
 Function g also belongs to C as it is attained from composition of primitive
recursive functions.
 t0 is the least value for for which the predicate P is true (1).
  
   False=x,xt,Ptt
True=x,xt,Pt<t
n1,
n1,0


0...:
1...:
0 

  
   0
0
0
0..
1..
tuif=x,xt,P
t<uif=x,xt,P
n1,.
u
=t
0n1,.
u
=t




g (y,x1,. .. ,xn)= ∑ 1= 1=t0 for u<t0
11/21/2017
Bounded minimalization
24
Let P(t, x1, … ,xn) be in some PRC class C and we can define a function g as follows:
    n1,.
y
u=
u
=t
n1, x,xt,P=x,xt,g .....
0 0

P(t,x1,. .. ,xn )= 0 for t<t0
P(t0, x1,. .. ,xn )= 1,where
 Function g also belongs to C as it is attained from composition of primitive
recursive functions.
 t0 is the least value for for which the predicate P is true (1).
  
   False=x,xt,Ptt
True=x,xt,Pt<t
n1,
n1,0


0...:
1...:
0 

  
   0
0
0
0..
1..
tuif=x,xt,P
t<uif=x,xt,P
n1,.
u
=t
0n1,.
u
=t




g (y,x1,. .. ,xn)= ∑ 1= 1=t0 for u<t0
 g( y , x1 , ... , xn ) produces the least value for which P is true. Finally the
definition for bounded minimalization can be given as:
       
  otherwise=x,xt,P
x,xt,Ptifx,xy,g=x,xt,P
n
nim
yt
nytnn
nim
yt
0..
......
1,.
1,.1,.1,.



11/21/2017
Bounded minimalization
25
Let P(t, x1, … ,xn) be in some PRC class C and we can define a function g as follows:
    n1,.
y
u=
u
=t
n1, x,xt,P=x,xt,g .....
0 0

P(t,x1,. .. ,xn )= 0 for t<t0
P(t0, x1,. .. ,xn )= 1,where
 Function g also belongs to C as it is attained from composition of primitive
recursive functions.
 t0 is the least value for for which the predicate P is true (1).
  
   False=x,xt,Ptt
True=x,xt,Pt<t
n1,
n1,0


0...:
1...:
0 

  
   0
0
0
0..
1..
tuif=x,xt,P
t<uif=x,xt,P
n1,.
u
=t
0n1,.
u
=t




g (y,x1,. .. ,xn)= ∑ 1= 1=t0 for u<t0
 g( y , x1 , ... , xn ) produces the least value for which P is true. Finally the
definition for bounded minimalization can be given as:
 Theorem: If P(t,x1, … ,xn) belongs to some PRC class C and there is function g
that does the bounded minimalization for P, then f belongs to C.
       
  otherwise=x,xt,P
x,xt,Ptifx,xy,g=x,xt,P
n
nim
yt
nytnn
nim
yt
0..
......
1,.
1,.1,.1,.



11/21/2017
Unbounded minimalization
 Definition: y is the least value for which predicate P is true if it
exists. If there is no value of y for which P is true, the
unbounded minimalization is undefined.
26
min
y
P(x1,... , xn , y)
11/21/2017
Unbounded minimalization
 Definition: y is the least value for which predicate P is true if it
exists. If there is no value of y for which P is true, the
unbounded minimalization is undefined.
 We can then define this as a non-total function in the
following way:
27
min
y
P(x1,... , xn , y)
x− y= min
z
[ y+ z= x]
11/21/2017
Unbounded minimalization
 Definition: y is the least value for which predicate P is true if it
exists. If there is no value of y for which P is true, the
unbounded minimalization is undefined.
 We can then define this as a non-total function in the
following way:
 Theorem: If P(x1, … , xn, y) is a computable predicate and if
then g is a partially computable function.
(Proof by construction)
28
min
y
P(x1,... , xn , y)
x− y= min
z
[ y+ z= x]
g(x1,. .., xn)= min
y
P(x1,. .. , xn , y)
11/21/2017
Additional primitive recursive
functions
 [ x / y ] , the whole part of the division i.e. [10/4]=2
 R(x,y) , remainder of the division of x by y.
 pn , nth prime number i.e p1=2 , p2=3 etc.
29
    yxyx=yx,R /*-
    x>y+t=yx nim
xt
*1/ 
p0= 0,
pn+ 1= min
t < pn!+ 1
[Prime(t)& t> pn]
11/21/2017
Pairing functions
30
 Let us consider the following primitive recursive function that provides a
coding for two numbers x and y.
  1-12y2>< +=yx, x
11/21/2017
Pairing functions
31
 Let us consider the following primitive recursive function that provides a
coding for two numbers x and y.
Example: <1,1> = 2 * ( 2 + 1 ) ∸ 1 = 6 ∸ 1 = 5
<1,2> = 2 * ( 2*2 + 1) ∸ 1 = 10 ∸ 1 = 9
  1-12y2>< +=yx, x
11/21/2017
Pairing functions
32
 Let us consider the following primitive recursive function that provides a
coding for two numbers x and y.
Example: <1,1> = 2 * ( 2 + 1 ) ∸ 1 = 6 ∸ 1 = 5
<1,2> = 2 * ( 2*2 + 1) ∸ 1 = 10 ∸ 1 = 9
   12y21:012y2 +=+>yx,<followsasrearrangecanweso,+thatNote xx

  1-12y2>< +=yx, x
11/21/2017
Pairing functions
33
 Let us consider the following primitive recursive function that provides a
coding for two numbers x and y.
Example: <1,1> = 2 * ( 2 + 1 ) ∸ 1 = 6 ∸ 1 = 5
<1,2> = 2 * ( 2*2 + 1) ∸ 1 = 10 ∸ 1 = 9
   12y21:012y2 +=+>yx,<followsasrearrangecanweso,+thatNote xx

 Define z to be as: < x , y > = z
Then for any z there is always a unique solution x and y.
  1-12y2>< +=yx, x
11/21/2017
Pairing functions
34
 Let us consider the following primitive recursive function that provides a
coding for two numbers x and y.
Example: <1,1> = 2 * ( 2 + 1 ) ∸ 1 = 6 ∸ 1 = 5
<1,2> = 2 * ( 2*2 + 1) ∸ 1 = 10 ∸ 1 = 9
   12y21:012y2 +=+>yx,<followsasrearrangecanweso,+thatNote xx

 Define z to be as: < x , y > = z
Then for any z there is always a unique solution x and y.
  1212y21 +zofdivisortheisthen,+=+zthatGiven xx
  x
+z=+Then 2/112y
  1-12y2>< +=yx, x
11/21/2017
Pairing functions
35
 Let us consider the following primitive recursive function that provides a
coding for two numbers x and y.
Example: <1,1> = 2 * ( 2 + 1 ) ∸ 1 = 6 ∸ 1 = 5
<1,2> = 2 * ( 2*2 + 1) ∸ 1 = 10 ∸ 1 = 9
   12y21:012y2 +=+>yx,<followsasrearrangecanweso,+thatNote xx

 Define z to be as: < x , y > = z
Then for any z there is always a unique solution x and y.
  1212y21 +zofdivisortheisthen,+=+zthatGiven xx
  x
+z=+Then 2/112y
 Thus we have the solutions for x and y which can then be defined using
the following functions:  
  zzr=y
zzl=x


  1-12y2>< +=yx, x
11/21/2017
Pairing functions
 More formally this can written as:
 Pairing Function Theorem: functions <x,y>, l(z), r(z) have
the following properties:
 are primitive recursive
 l(<x,y>) = x and r(<x,y>) = y
 < l(z) , r(z) > = z
 l(z) , r(z)≤ z
36
 
  zzr=y
zzl=x


     
     ]><[
]><[
yx,=zx=zr
yx,=zy=zl
z
nim
zy
z
nim
zx




11/21/2017
Gödel numbers
 Let (a1, … , an) be any sequence, then the Gödel
number is computed as follows:
37
[a1, ..., an]= ∏i= 1
n
pi
ai
11/21/2017
Gödel numbers
 Let (a1, … , an) be any sequence, then the Gödel
number is computed as follows:
 Example: Take a sequence (1,2,3,4), the Gödel
number will be computed as follows:
38
  4321
75321,2,3,4 =
[a1, ..., an]= ∏i= 1
n
pi
ai
11/21/2017
Gödel numbers
 Let (a1, … , an) be any sequence, then the Gödel
number is computed as follows:
 Example: Take a sequence (1,2,3,4), the Gödel
number will be computed as follows:
 Gödel numbering has a special uniqueness
property:
If [a1, … , an ] = [ b1, … , bn ] then
ai = bi , where i = 1, … , n
39
  4321
75321,2,3,4 =
[a1, ..., an]= ∏i= 1
n
pi
ai
11/21/2017
Gödel numbers
 Let (a1, … , an) be any sequence, then the Gödel
number is computed as follows:
 Example: Take a sequence (1,2,3,4), the Gödel
number will be computed as follows:
 Gödel numbering has a special uniqueness
property:
If [a1, … , an ] = [ b1, … , bn ] then
ai = bi , where i = 1, … , n
 Also notice: [ a1, … , an ] = [ a1, … , an, 0 ]
40
  4321
75321,2,3,4 =
[a1, ..., an]= ∏i= 1
n
pi
ai
11/21/2017
Gödel numbers
 Given that x = [a1, … , an ], we can now define two important
functions:
41
   
         00Lt
|~
1t
=xijjx=x
xp=a=x
jxi
nim
xi
i
nim
xtii
 


11/21/2017
Gödel numbers
 Given that x = [a1, … , an ], we can now define two important
functions:
 Example: Let x = [ 4 , 3 , 2 , 1 ], then (x)2 = 3 and (x)4=1 and (x)0 = 0
42
   
         00Lt
|~
1t
=xijjx=x
xp=a=x
jxi
nim
xi
i
nim
xtii
 


11/21/2017
Gödel numbers
 Given that x = [a1, … , an ], we can now define two important
functions:
 Example: Let x = [ 4 , 3 , 2 , 1 ], then (x)2 = 3 and (x)4=1 and (x)0 = 0
Lt(10) = will be the length of the sequence derived using Gödel
numbering
43
   
         00Lt
|~
1t
=xijjx=x
xp=a=x
jxi
nim
xi
i
nim
xtii
 


11/21/2017
Gödel numbers
 Given that x = [a1, … , an ], we can now define two important
functions:
 Example: Let x = [ 4 , 3 , 2 , 1 ], then (x)2 = 3 and (x)4=1 and (x)0 = 0
Lt(10) = will be the length of the sequence derived using Gödel
numbering
So: 10 = 2^1 * 3^0 * 5^1 = [ 1, 0, 1 ] => Lt(10) = 3
44
   
         00Lt
|~
1t
=xijjx=x
xp=a=x
jxi
nim
xi
i
nim
xtii
 


11/21/2017
Gödel numbers
 Given that x = [a1, … , an ], we can now define two important
functions:
 Example: Let x = [ 4 , 3 , 2 , 1 ], then (x)2 = 3 and (x)4=1 and (x)0 = 0
Lt(10) = will be the length of the sequence derived using Gödel
numbering
So: 10 = 2^1 * 3^0 * 5^1 = [ 1, 0, 1 ] => Lt(10) = 3
 Sequence Number Theorem:
45
  





 
otherwise
niifa
=a,a i
n
0
1
...1,
(1)
   
         00Lt
|~
1t
=xijjx=x
xp=a=x
jxi
nim
xi
i
nim
xtii
 


11/21/2017
Gödel numbers
 Given that x = [a1, … , an ], we can now define two important
functions:
 Example: Let x = [ 4 , 3 , 2 , 1 ], then (x)2 = 3 and (x)4=1 and (x)0 = 0
Lt(10) = will be the length of the sequence derived using Gödel
numbering
So: 10 = 2^1 * 3^0 * 5^1 = [ 1, 0, 1 ] => Lt(10) = 3
 Sequence Number Theorem:
46
  





 
otherwise
niifa
=a,a i
n
0
1
...1,
(1)
(2)       xnifx=x,x n Lt...1, 
   
         00Lt
|~
1t
=xijjx=x
xp=a=x
jxi
nim
xi
i
nim
xtii
 


11/21/2017

More Related Content

What's hot

Chomsky classification of Language
Chomsky classification of LanguageChomsky classification of Language
Chomsky classification of LanguageDipankar Boruah
 
Lecture 14 run time environment
Lecture 14 run time environmentLecture 14 run time environment
Lecture 14 run time environmentIffat Anjum
 
Introduction to oops concepts
Introduction to oops conceptsIntroduction to oops concepts
Introduction to oops conceptsNilesh Dalvi
 
Lecture 01 introduction to compiler
Lecture 01 introduction to compilerLecture 01 introduction to compiler
Lecture 01 introduction to compilerIffat Anjum
 
Types of grammer - TOC
Types of grammer - TOCTypes of grammer - TOC
Types of grammer - TOCAbhayDhupar
 
First Come First Serve & Shortest Job First-(FCFS & SJF)
First Come First Serve & Shortest Job First-(FCFS & SJF)First Come First Serve & Shortest Job First-(FCFS & SJF)
First Come First Serve & Shortest Job First-(FCFS & SJF)Adeel Rasheed
 
Chomsky & Greibach Normal Forms
Chomsky & Greibach Normal FormsChomsky & Greibach Normal Forms
Chomsky & Greibach Normal FormsRajendran
 
8 queens problem using back tracking
8 queens problem using back tracking8 queens problem using back tracking
8 queens problem using back trackingTech_MX
 
Master method theorem
Master method theoremMaster method theorem
Master method theoremRajendran
 

What's hot (20)

Chomsky classification of Language
Chomsky classification of LanguageChomsky classification of Language
Chomsky classification of Language
 
Top down parsing
Top down parsingTop down parsing
Top down parsing
 
A* Search Algorithm
A* Search AlgorithmA* Search Algorithm
A* Search Algorithm
 
NFA & DFA
NFA & DFANFA & DFA
NFA & DFA
 
Automata theory
Automata theoryAutomata theory
Automata theory
 
NFA to DFA
NFA to DFANFA to DFA
NFA to DFA
 
Lecture 14 run time environment
Lecture 14 run time environmentLecture 14 run time environment
Lecture 14 run time environment
 
Lecture: Automata
Lecture: AutomataLecture: Automata
Lecture: Automata
 
Introduction to oops concepts
Introduction to oops conceptsIntroduction to oops concepts
Introduction to oops concepts
 
Interface in java
Interface in javaInterface in java
Interface in java
 
Backtracking
BacktrackingBacktracking
Backtracking
 
Lecture 01 introduction to compiler
Lecture 01 introduction to compilerLecture 01 introduction to compiler
Lecture 01 introduction to compiler
 
Lexical analysis - Compiler Design
Lexical analysis - Compiler DesignLexical analysis - Compiler Design
Lexical analysis - Compiler Design
 
Features of java
Features of javaFeatures of java
Features of java
 
Phases of Compiler
Phases of CompilerPhases of Compiler
Phases of Compiler
 
Types of grammer - TOC
Types of grammer - TOCTypes of grammer - TOC
Types of grammer - TOC
 
First Come First Serve & Shortest Job First-(FCFS & SJF)
First Come First Serve & Shortest Job First-(FCFS & SJF)First Come First Serve & Shortest Job First-(FCFS & SJF)
First Come First Serve & Shortest Job First-(FCFS & SJF)
 
Chomsky & Greibach Normal Forms
Chomsky & Greibach Normal FormsChomsky & Greibach Normal Forms
Chomsky & Greibach Normal Forms
 
8 queens problem using back tracking
8 queens problem using back tracking8 queens problem using back tracking
8 queens problem using back tracking
 
Master method theorem
Master method theoremMaster method theorem
Master method theorem
 

Similar to 5.2 primitive recursive functions

An Approach For Solving Nonlinear Programming Problems
An Approach For Solving Nonlinear Programming ProblemsAn Approach For Solving Nonlinear Programming Problems
An Approach For Solving Nonlinear Programming ProblemsMary Montoya
 
Chapter 3 – Random Variables and Probability Distributions
Chapter 3 – Random Variables and Probability DistributionsChapter 3 – Random Variables and Probability Distributions
Chapter 3 – Random Variables and Probability DistributionsJasonTagapanGulla
 
Linear Machine Learning Models with L2 Regularization and Kernel Tricks
Linear Machine Learning Models with L2 Regularization and Kernel TricksLinear Machine Learning Models with L2 Regularization and Kernel Tricks
Linear Machine Learning Models with L2 Regularization and Kernel TricksFengtao Wu
 
2013 IEEE International Symposium on Information Theory
2013 IEEE International Symposium on Information Theory2013 IEEE International Symposium on Information Theory
2013 IEEE International Symposium on Information TheoryJoe Suzuki
 
(α ψ)- Construction with q- function for coupled fixed point
(α   ψ)-  Construction with q- function for coupled fixed point(α   ψ)-  Construction with q- function for coupled fixed point
(α ψ)- Construction with q- function for coupled fixed pointAlexander Decker
 
A numerical method to solve fractional Fredholm-Volterra integro-differential...
A numerical method to solve fractional Fredholm-Volterra integro-differential...A numerical method to solve fractional Fredholm-Volterra integro-differential...
A numerical method to solve fractional Fredholm-Volterra integro-differential...OctavianPostavaru
 
Higher Maths 121 Sets And Functions 1205778086374356 2
Higher Maths 121 Sets And Functions 1205778086374356 2Higher Maths 121 Sets And Functions 1205778086374356 2
Higher Maths 121 Sets And Functions 1205778086374356 2Niccole Taylor
 
Higher Maths 1.2.1 - Sets and Functions
Higher Maths 1.2.1 - Sets and FunctionsHigher Maths 1.2.1 - Sets and Functions
Higher Maths 1.2.1 - Sets and Functionstimschmitz
 
Real Time Code Generation for Nonlinear Model Predictive Control
Real Time Code Generation for Nonlinear Model Predictive ControlReal Time Code Generation for Nonlinear Model Predictive Control
Real Time Code Generation for Nonlinear Model Predictive ControlBehzad Samadi
 
1531 fourier series- integrals and trans
1531 fourier series- integrals and trans1531 fourier series- integrals and trans
1531 fourier series- integrals and transDr Fereidoun Dejahang
 
Convex Analysis and Duality (based on "Functional Analysis and Optimization" ...
Convex Analysis and Duality (based on "Functional Analysis and Optimization" ...Convex Analysis and Duality (based on "Functional Analysis and Optimization" ...
Convex Analysis and Duality (based on "Functional Analysis and Optimization" ...Katsuya Ito
 
Lp and ip programming cp 9
Lp and ip programming cp 9Lp and ip programming cp 9
Lp and ip programming cp 9M S Prasad
 
Hyperfunction method for numerical integration and Fredholm integral equation...
Hyperfunction method for numerical integration and Fredholm integral equation...Hyperfunction method for numerical integration and Fredholm integral equation...
Hyperfunction method for numerical integration and Fredholm integral equation...HidenoriOgata
 
Introduction to Artificial Neural Networks
Introduction to Artificial Neural NetworksIntroduction to Artificial Neural Networks
Introduction to Artificial Neural NetworksStratio
 

Similar to 5.2 primitive recursive functions (20)

An Approach For Solving Nonlinear Programming Problems
An Approach For Solving Nonlinear Programming ProblemsAn Approach For Solving Nonlinear Programming Problems
An Approach For Solving Nonlinear Programming Problems
 
ma112011id535
ma112011id535ma112011id535
ma112011id535
 
Chapter 3 – Random Variables and Probability Distributions
Chapter 3 – Random Variables and Probability DistributionsChapter 3 – Random Variables and Probability Distributions
Chapter 3 – Random Variables and Probability Distributions
 
Linear Machine Learning Models with L2 Regularization and Kernel Tricks
Linear Machine Learning Models with L2 Regularization and Kernel TricksLinear Machine Learning Models with L2 Regularization and Kernel Tricks
Linear Machine Learning Models with L2 Regularization and Kernel Tricks
 
2013 IEEE International Symposium on Information Theory
2013 IEEE International Symposium on Information Theory2013 IEEE International Symposium on Information Theory
2013 IEEE International Symposium on Information Theory
 
Ada boosting2
Ada boosting2Ada boosting2
Ada boosting2
 
(α ψ)- Construction with q- function for coupled fixed point
(α   ψ)-  Construction with q- function for coupled fixed point(α   ψ)-  Construction with q- function for coupled fixed point
(α ψ)- Construction with q- function for coupled fixed point
 
Dfa h11
Dfa h11Dfa h11
Dfa h11
 
A numerical method to solve fractional Fredholm-Volterra integro-differential...
A numerical method to solve fractional Fredholm-Volterra integro-differential...A numerical method to solve fractional Fredholm-Volterra integro-differential...
A numerical method to solve fractional Fredholm-Volterra integro-differential...
 
Higher Maths 121 Sets And Functions 1205778086374356 2
Higher Maths 121 Sets And Functions 1205778086374356 2Higher Maths 121 Sets And Functions 1205778086374356 2
Higher Maths 121 Sets And Functions 1205778086374356 2
 
Higher Maths 1.2.1 - Sets and Functions
Higher Maths 1.2.1 - Sets and FunctionsHigher Maths 1.2.1 - Sets and Functions
Higher Maths 1.2.1 - Sets and Functions
 
5.n nmodels i
5.n nmodels i5.n nmodels i
5.n nmodels i
 
Real Time Code Generation for Nonlinear Model Predictive Control
Real Time Code Generation for Nonlinear Model Predictive ControlReal Time Code Generation for Nonlinear Model Predictive Control
Real Time Code Generation for Nonlinear Model Predictive Control
 
Basic Calculus in R.
Basic Calculus in R. Basic Calculus in R.
Basic Calculus in R.
 
1531 fourier series- integrals and trans
1531 fourier series- integrals and trans1531 fourier series- integrals and trans
1531 fourier series- integrals and trans
 
Functions
FunctionsFunctions
Functions
 
Convex Analysis and Duality (based on "Functional Analysis and Optimization" ...
Convex Analysis and Duality (based on "Functional Analysis and Optimization" ...Convex Analysis and Duality (based on "Functional Analysis and Optimization" ...
Convex Analysis and Duality (based on "Functional Analysis and Optimization" ...
 
Lp and ip programming cp 9
Lp and ip programming cp 9Lp and ip programming cp 9
Lp and ip programming cp 9
 
Hyperfunction method for numerical integration and Fredholm integral equation...
Hyperfunction method for numerical integration and Fredholm integral equation...Hyperfunction method for numerical integration and Fredholm integral equation...
Hyperfunction method for numerical integration and Fredholm integral equation...
 
Introduction to Artificial Neural Networks
Introduction to Artificial Neural NetworksIntroduction to Artificial Neural Networks
Introduction to Artificial Neural Networks
 

More from Sampath Kumar S

4.7. chomskian hierarchy of languages
4.7. chomskian hierarchy of languages4.7. chomskian hierarchy of languages
4.7. chomskian hierarchy of languagesSampath Kumar S
 
4.3 techniques for turing machines construction
4.3 techniques for turing machines construction4.3 techniques for turing machines construction
4.3 techniques for turing machines constructionSampath Kumar S
 
4.2 variantsof turing machines (types of tm)
4.2 variantsof turing machines (types of tm)4.2 variantsof turing machines (types of tm)
4.2 variantsof turing machines (types of tm)Sampath Kumar S
 
3.6 &amp; 7. pumping lemma for cfl &amp; problems based on pl
3.6 &amp; 7. pumping lemma for cfl &amp; problems based on pl3.6 &amp; 7. pumping lemma for cfl &amp; problems based on pl
3.6 &amp; 7. pumping lemma for cfl &amp; problems based on plSampath Kumar S
 
3.5 equivalence of pushdown automata and cfl
3.5 equivalence of pushdown automata and cfl3.5 equivalence of pushdown automata and cfl
3.5 equivalence of pushdown automata and cflSampath Kumar S
 
3.1,2,3 pushdown automata definition, moves &amp; id
3.1,2,3 pushdown automata   definition, moves &amp; id3.1,2,3 pushdown automata   definition, moves &amp; id
3.1,2,3 pushdown automata definition, moves &amp; idSampath Kumar S
 
2.8 normal forms gnf &amp; problems
2.8 normal forms   gnf &amp; problems2.8 normal forms   gnf &amp; problems
2.8 normal forms gnf &amp; problemsSampath Kumar S
 
2.7 normal forms cnf & problems
2.7 normal forms  cnf & problems2.7 normal forms  cnf & problems
2.7 normal forms cnf & problemsSampath Kumar S
 
2.5 ambiguity in context free grammars
2.5 ambiguity in context free grammars2.5 ambiguity in context free grammars
2.5 ambiguity in context free grammarsSampath Kumar S
 
2.4 derivations and languages
2.4 derivations and languages2.4 derivations and languages
2.4 derivations and languagesSampath Kumar S
 
2.3 context free grammars and languages
2.3 context free grammars and languages2.3 context free grammars and languages
2.3 context free grammars and languagesSampath Kumar S
 
2.1 & 2.2 grammar introduction – types of grammar
2.1 & 2.2 grammar introduction – types of grammar2.1 & 2.2 grammar introduction – types of grammar
2.1 & 2.2 grammar introduction – types of grammarSampath Kumar S
 
1.10. pumping lemma for regular sets
1.10. pumping lemma for regular sets1.10. pumping lemma for regular sets
1.10. pumping lemma for regular setsSampath Kumar S
 
1.9. minimization of dfa
1.9. minimization of dfa1.9. minimization of dfa
1.9. minimization of dfaSampath Kumar S
 
1.8. equivalence of finite automaton and regular expressions
1.8. equivalence of finite automaton and regular expressions1.8. equivalence of finite automaton and regular expressions
1.8. equivalence of finite automaton and regular expressionsSampath Kumar S
 
1.7. eqivalence of nfa and dfa
1.7. eqivalence of nfa and dfa1.7. eqivalence of nfa and dfa
1.7. eqivalence of nfa and dfaSampath Kumar S
 
1.5 & 1.6 regular languages &amp; regular expression
1.5 & 1.6 regular languages &amp; regular expression1.5 & 1.6 regular languages &amp; regular expression
1.5 & 1.6 regular languages &amp; regular expressionSampath Kumar S
 

More from Sampath Kumar S (20)

4.7. chomskian hierarchy of languages
4.7. chomskian hierarchy of languages4.7. chomskian hierarchy of languages
4.7. chomskian hierarchy of languages
 
4.6 halting problem
4.6 halting problem4.6 halting problem
4.6 halting problem
 
4.3 techniques for turing machines construction
4.3 techniques for turing machines construction4.3 techniques for turing machines construction
4.3 techniques for turing machines construction
 
4.2 variantsof turing machines (types of tm)
4.2 variantsof turing machines (types of tm)4.2 variantsof turing machines (types of tm)
4.2 variantsof turing machines (types of tm)
 
4.1 turing machines
4.1 turing machines4.1 turing machines
4.1 turing machines
 
3.6 &amp; 7. pumping lemma for cfl &amp; problems based on pl
3.6 &amp; 7. pumping lemma for cfl &amp; problems based on pl3.6 &amp; 7. pumping lemma for cfl &amp; problems based on pl
3.6 &amp; 7. pumping lemma for cfl &amp; problems based on pl
 
3.5 equivalence of pushdown automata and cfl
3.5 equivalence of pushdown automata and cfl3.5 equivalence of pushdown automata and cfl
3.5 equivalence of pushdown automata and cfl
 
3.4 deterministic pda
3.4 deterministic pda3.4 deterministic pda
3.4 deterministic pda
 
3.1,2,3 pushdown automata definition, moves &amp; id
3.1,2,3 pushdown automata   definition, moves &amp; id3.1,2,3 pushdown automata   definition, moves &amp; id
3.1,2,3 pushdown automata definition, moves &amp; id
 
2.8 normal forms gnf &amp; problems
2.8 normal forms   gnf &amp; problems2.8 normal forms   gnf &amp; problems
2.8 normal forms gnf &amp; problems
 
2.7 normal forms cnf & problems
2.7 normal forms  cnf & problems2.7 normal forms  cnf & problems
2.7 normal forms cnf & problems
 
2.5 ambiguity in context free grammars
2.5 ambiguity in context free grammars2.5 ambiguity in context free grammars
2.5 ambiguity in context free grammars
 
2.4 derivations and languages
2.4 derivations and languages2.4 derivations and languages
2.4 derivations and languages
 
2.3 context free grammars and languages
2.3 context free grammars and languages2.3 context free grammars and languages
2.3 context free grammars and languages
 
2.1 & 2.2 grammar introduction – types of grammar
2.1 & 2.2 grammar introduction – types of grammar2.1 & 2.2 grammar introduction – types of grammar
2.1 & 2.2 grammar introduction – types of grammar
 
1.10. pumping lemma for regular sets
1.10. pumping lemma for regular sets1.10. pumping lemma for regular sets
1.10. pumping lemma for regular sets
 
1.9. minimization of dfa
1.9. minimization of dfa1.9. minimization of dfa
1.9. minimization of dfa
 
1.8. equivalence of finite automaton and regular expressions
1.8. equivalence of finite automaton and regular expressions1.8. equivalence of finite automaton and regular expressions
1.8. equivalence of finite automaton and regular expressions
 
1.7. eqivalence of nfa and dfa
1.7. eqivalence of nfa and dfa1.7. eqivalence of nfa and dfa
1.7. eqivalence of nfa and dfa
 
1.5 & 1.6 regular languages &amp; regular expression
1.5 & 1.6 regular languages &amp; regular expression1.5 & 1.6 regular languages &amp; regular expression
1.5 & 1.6 regular languages &amp; regular expression
 

Recently uploaded

Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxUnboundStockton
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
MICROBIOLOGY biochemical test detailed.pptx
MICROBIOLOGY biochemical test detailed.pptxMICROBIOLOGY biochemical test detailed.pptx
MICROBIOLOGY biochemical test detailed.pptxabhijeetpadhi001
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 

Recently uploaded (20)

Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docx
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
MICROBIOLOGY biochemical test detailed.pptx
MICROBIOLOGY biochemical test detailed.pptxMICROBIOLOGY biochemical test detailed.pptx
MICROBIOLOGY biochemical test detailed.pptx
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 

5.2 primitive recursive functions

  • 2. Preliminaries: partial and total functions  The domain of a partial function on set A contains the subset of A.  The domain of a total function on set A contains the entire set A.  A partial function f is called partially computable if there is some program that computes it. Another term for such functions partial recursive.  Similarly, a function f is called computable if it is both total and partially computable. Another term for such function is recursive. 2 11/21/2017
  • 3. Composition  Let f : A → B and g : B → C  Composition of f and g can then be expressed as: g ͦ f : A → C (g ͦ f)(x) = g(f(x)) h(x) = g(f(x))  NB: In general composition is not commutative: ( g ͦ f )(x) ≠ ( f ͦ g )(x) 3 11/21/2017
  • 4. Composition  Definition: Let g be a function containing k variables and f1 ... fk be functions of n variables, so the composition of g and f is defined as:  h(0) = k Base step h( x1, ... , xn) = g( f1(x1 ,..., xn), … , fk(x1 ,..., xn) ) Inductive step  Example: h(x , y) = g( f1(x , y), f2(x , y), f3(x , y) )  h is obtained from g and f1... fk by composition.  If g and f1...fk are (partially) computable, then h is (partially) computable. (Proof by construction) 4 11/21/2017
  • 5. Recursion  From programming experience we know that recursion refers to a function calling upon itself within its own definition.  Definition: Let g be a function containing k variables then h is obtained through recursion as follows: h(x1 , … , xn) = g( … , h(x1 , … , xn) ) Example: x + y f( x , 0 ) = x (1) f(x , y+1 ) = f( x , y ) + 1 (2) Input: f ( 3, 2 ) => f ( 3 , 1 ) + 1 => ( f ( 3 , 0 ) + 1 ) + 1 => ( 3 + 1 ) + 1 => 5 5 11/21/2017
  • 6. PRC: Initial functions  Primitive Recursively Closed (PRC) class of functions.  Initial functions:  Example of a projection function: u2 ( x1 , x2 , x3 , x4 , x5 ) = x2  Definition: A class of total functions C is called PRC² class if:  The initial functions belong to C.  Function obtained from functions belonging to C by either composition or recursion belongs to C. 6 s(x) = x + 1 n(x) = 0 ui (x1 , … , xn) = xi 11/21/2017
  • 7. PRC: primitive recursive functions  There exists a class of computable functions that is a PRC class.  Definition: Function is considered primitive recursive if it can be obtained from initial functions and through finite number of composition and recursion steps.  Theorem: A function is primitive recursive iff it belongs to the PRC class. (see proof in chapter 3)  Corollary: Every primitive recursive function is computable. 7 11/21/2017
  • 8. Primitive recursive functions: sum  We have already seen the addition function, which can be rewritten in LRR as follows: sum( x, succ(y) ) => succ( sum( x , y)) ; sum( x , 0 ) => x ; Example: sum(succ(0),succ(succ(succ(0)))) => succ(sum(succ(0),succ(succ(0)))) => succ(succ(sum(succ(0),succ(0)))) => succ(succ(succ(sum(succ(0),0) => succ(succ(succ(succ(0))) => succ(succ(succ(1))) => succ(succ(2)) => succ(3) => 4 8 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. 11/21/2017
  • 9. Primitive recursive functions: multiplication h( x , 0 ) = 0 h( x , y + 1) = h( x , y ) + x  In LRR this can be written as: mult(x,0) => 0 ; mult(x,succ(y)) => sum(mult(x,y),x) ;  What would happen on the following input? mult(succ(succ(0)),succ(succ(0))) 9 11/21/2017
  • 10. Primitive recursive functions: factorial 0! = 1 ( x + 1 ) ! = x ! * s( x )  LRR implementation would be as follows: fact(0) => succ(null(0)) ; fact(succ(x)) => mult(fact(x),succ(x)) ; Output for the following? fact(succ(succ(null(0)))) 10 11/21/2017
  • 11. Primitive recursive functions: power and predecessor 11 xx=x =x y+y * 1 1 0 In LRR the power function can be expressed as follows: pow(x,0) => succ(null(0)) ; pow(x,succ(y)) => mult(pow(x,y),x) ; p (0) = 0 p ( t + 1 ) = t Power function Predecessor function In LRR the predecessor is as follows: pred(1) => 0 ; pred(succ(x)) => x ; 11/21/2017
  • 12. Primitive recursive functions: ∸, | x – y | and α x ∸ 0 = x x ∸ ( t + 1) = p( x ∸ t ) 12 | x – y | = ( x ∸ y ) + ( y ∸ x ) α(x) = 1 ∸ x dotsub(x,x) => 0 ; dotsub(x,succ(y)) => pred(dotsub(x,y)) ; abs(x,y) => sum(dotsub(x,y),dotsub(y,x)) ; α(x) => dotsub(1,x) ; What would be the output?  dotsub(succ(succ(succ(0))),succ(0)) Output for the following?  a(succ(succ(0)))  a(null(0)) 0 0 1 )(      x otherwise if x 11/21/2017
  • 13. Primitive recursive functions 13 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 x ∸ y if x ≥ y then x ∸ y = x – y; else x ∸ y = 0 x ∸ 0 = x x ∸ ( t + 1) = p( x ∸ t ) | x – y | | x – y | = ( x ∸ y ) + ( y ∸ x ) α(x) α(x) = 1 ∸ x 11/21/2017
  • 14. Bounded quantifiers  Theorem: Let C be a PRC class. If f( t , x1 , … , xn) belongs to C then so do the functions g( y , x1 , ... , xn ) = f( t , x1 , …, xn ) g( y , x1 , ... , xn ) = f( t , x1 , …, xn ) 14  y t 0  y t 0 11/21/2017
  • 15. Bounded quantifiers  Theorem: Let C be a PRC class. If f( t , x1 , … , xn) belongs to C then so do the functions g( y , x1 , ... , xn ) = f( t , x1 , …, xn ) g( y , x1 , ... , xn ) = f( t , x1 , …, xn )  Theorem: If the predicate P( t, x1 , … , xn ) belongs to some PRC class C, then so do the predicates: ( t)≤y P(t, x1, … , xn ) (∃t)≤y P(t, x1, … , xn ) 15  y t 0  y t 0  11/21/2017
  • 16. Primitive recursive predicates 16 x = y d( x , y ) = α( | x – y | ) x ≤ y α ( x ∸ y ) ~P α( P ) P & Q P * Q P v Q ~ ( ~P & ~Q ) y | x y | x = (∃t)≤x { y * t = x } Prime(x) Prime(x) = x > 1 & ( t)≤x { t = 1 v t = x v ~( t | x ) } Exercises for Chapter 3: page 62 Questions 3,4 and 5. Fibonacci function  11/21/2017
  • 17. Bounded minimalization 17 Let P(t, x1, … ,xn) be in some PRC class C and we can define a function g as follows:     n1,. y u= u =t n1, x,xt,P=x,xt,g ..... 0 0  11/21/2017
  • 18. Bounded minimalization 18 Let P(t, x1, … ,xn) be in some PRC class C and we can define a function g as follows:     n1,. y u= u =t n1, x,xt,P=x,xt,g ..... 0 0  P(t,x1,. .. ,xn )= 0 for t<t0 P(t0, x1,. .. ,xn )= 1,where 11/21/2017
  • 19. Bounded minimalization 19 Let P(t, x1, … ,xn) be in some PRC class C and we can define a function g as follows:     n1,. y u= u =t n1, x,xt,P=x,xt,g ..... 0 0  P(t,x1,. .. ,xn )= 0 for t<t0 P(t0, x1,. .. ,xn )= 1,where  Function g also belongs to C as it is attained from composition of primitive recursive functions. 11/21/2017
  • 20. Bounded minimalization 20 Let P(t, x1, … ,xn) be in some PRC class C and we can define a function g as follows:     n1,. y u= u =t n1, x,xt,P=x,xt,g ..... 0 0  P(t,x1,. .. ,xn )= 0 for t<t0 P(t0, x1,. .. ,xn )= 1,where  Function g also belongs to C as it is attained from composition of primitive recursive functions.  t0 is the least value for for which the predicate P is true (1). 11/21/2017
  • 21. Bounded minimalization 21 Let P(t, x1, … ,xn) be in some PRC class C and we can define a function g as follows:     n1,. y u= u =t n1, x,xt,P=x,xt,g ..... 0 0  P(t,x1,. .. ,xn )= 0 for t<t0 P(t0, x1,. .. ,xn )= 1,where  Function g also belongs to C as it is attained from composition of primitive recursive functions.  t0 is the least value for for which the predicate P is true (1).       False=x,xt,Ptt True=x,xt,Pt<t n1, n1,0   0...: 1...: 0   11/21/2017
  • 22. Bounded minimalization 22 Let P(t, x1, … ,xn) be in some PRC class C and we can define a function g as follows:     n1,. y u= u =t n1, x,xt,P=x,xt,g ..... 0 0  P(t,x1,. .. ,xn )= 0 fort<t0 P (t0, x1,. .. ,xn)= 1,where  Function g also belongs to C as it is attained from composition of primitive recursive functions.  t0 is the least value for for which the predicate P is true (1).       False=x,xt,Ptt True=x,xt,Pt<t n1, n1,0   0...: 1...: 0         0 0 0 0.. 1.. tuif=x,xt,P t<uif=x,xt,P n1,. u =t 0n1,. u =t     11/21/2017
  • 23. Bounded minimalization 23 Let P(t, x1, … ,xn) be in some PRC class C and we can define a function g as follows:     n1,. y u= u =t n1, x,xt,P=x,xt,g ..... 0 0  P(t,x1,. .. ,xn )= 0 for t<t0 P(t0, x1,. .. ,xn )= 1,where  Function g also belongs to C as it is attained from composition of primitive recursive functions.  t0 is the least value for for which the predicate P is true (1).       False=x,xt,Ptt True=x,xt,Pt<t n1, n1,0   0...: 1...: 0         0 0 0 0.. 1.. tuif=x,xt,P t<uif=x,xt,P n1,. u =t 0n1,. u =t     g (y,x1,. .. ,xn)= ∑ 1= 1=t0 for u<t0 11/21/2017
  • 24. Bounded minimalization 24 Let P(t, x1, … ,xn) be in some PRC class C and we can define a function g as follows:     n1,. y u= u =t n1, x,xt,P=x,xt,g ..... 0 0  P(t,x1,. .. ,xn )= 0 for t<t0 P(t0, x1,. .. ,xn )= 1,where  Function g also belongs to C as it is attained from composition of primitive recursive functions.  t0 is the least value for for which the predicate P is true (1).       False=x,xt,Ptt True=x,xt,Pt<t n1, n1,0   0...: 1...: 0         0 0 0 0.. 1.. tuif=x,xt,P t<uif=x,xt,P n1,. u =t 0n1,. u =t     g (y,x1,. .. ,xn)= ∑ 1= 1=t0 for u<t0  g( y , x1 , ... , xn ) produces the least value for which P is true. Finally the definition for bounded minimalization can be given as:           otherwise=x,xt,P x,xt,Ptifx,xy,g=x,xt,P n nim yt nytnn nim yt 0.. ...... 1,. 1,.1,.1,.    11/21/2017
  • 25. Bounded minimalization 25 Let P(t, x1, … ,xn) be in some PRC class C and we can define a function g as follows:     n1,. y u= u =t n1, x,xt,P=x,xt,g ..... 0 0  P(t,x1,. .. ,xn )= 0 for t<t0 P(t0, x1,. .. ,xn )= 1,where  Function g also belongs to C as it is attained from composition of primitive recursive functions.  t0 is the least value for for which the predicate P is true (1).       False=x,xt,Ptt True=x,xt,Pt<t n1, n1,0   0...: 1...: 0         0 0 0 0.. 1.. tuif=x,xt,P t<uif=x,xt,P n1,. u =t 0n1,. u =t     g (y,x1,. .. ,xn)= ∑ 1= 1=t0 for u<t0  g( y , x1 , ... , xn ) produces the least value for which P is true. Finally the definition for bounded minimalization can be given as:  Theorem: If P(t,x1, … ,xn) belongs to some PRC class C and there is function g that does the bounded minimalization for P, then f belongs to C.           otherwise=x,xt,P x,xt,Ptifx,xy,g=x,xt,P n nim yt nytnn nim yt 0.. ...... 1,. 1,.1,.1,.    11/21/2017
  • 26. Unbounded minimalization  Definition: y is the least value for which predicate P is true if it exists. If there is no value of y for which P is true, the unbounded minimalization is undefined. 26 min y P(x1,... , xn , y) 11/21/2017
  • 27. Unbounded minimalization  Definition: y is the least value for which predicate P is true if it exists. If there is no value of y for which P is true, the unbounded minimalization is undefined.  We can then define this as a non-total function in the following way: 27 min y P(x1,... , xn , y) x− y= min z [ y+ z= x] 11/21/2017
  • 28. Unbounded minimalization  Definition: y is the least value for which predicate P is true if it exists. If there is no value of y for which P is true, the unbounded minimalization is undefined.  We can then define this as a non-total function in the following way:  Theorem: If P(x1, … , xn, y) is a computable predicate and if then g is a partially computable function. (Proof by construction) 28 min y P(x1,... , xn , y) x− y= min z [ y+ z= x] g(x1,. .., xn)= min y P(x1,. .. , xn , y) 11/21/2017
  • 29. Additional primitive recursive functions  [ x / y ] , the whole part of the division i.e. [10/4]=2  R(x,y) , remainder of the division of x by y.  pn , nth prime number i.e p1=2 , p2=3 etc. 29     yxyx=yx,R /*-     x>y+t=yx nim xt *1/  p0= 0, pn+ 1= min t < pn!+ 1 [Prime(t)& t> pn] 11/21/2017
  • 30. Pairing functions 30  Let us consider the following primitive recursive function that provides a coding for two numbers x and y.   1-12y2>< +=yx, x 11/21/2017
  • 31. Pairing functions 31  Let us consider the following primitive recursive function that provides a coding for two numbers x and y. Example: <1,1> = 2 * ( 2 + 1 ) ∸ 1 = 6 ∸ 1 = 5 <1,2> = 2 * ( 2*2 + 1) ∸ 1 = 10 ∸ 1 = 9   1-12y2>< +=yx, x 11/21/2017
  • 32. Pairing functions 32  Let us consider the following primitive recursive function that provides a coding for two numbers x and y. Example: <1,1> = 2 * ( 2 + 1 ) ∸ 1 = 6 ∸ 1 = 5 <1,2> = 2 * ( 2*2 + 1) ∸ 1 = 10 ∸ 1 = 9    12y21:012y2 +=+>yx,<followsasrearrangecanweso,+thatNote xx    1-12y2>< +=yx, x 11/21/2017
  • 33. Pairing functions 33  Let us consider the following primitive recursive function that provides a coding for two numbers x and y. Example: <1,1> = 2 * ( 2 + 1 ) ∸ 1 = 6 ∸ 1 = 5 <1,2> = 2 * ( 2*2 + 1) ∸ 1 = 10 ∸ 1 = 9    12y21:012y2 +=+>yx,<followsasrearrangecanweso,+thatNote xx   Define z to be as: < x , y > = z Then for any z there is always a unique solution x and y.   1-12y2>< +=yx, x 11/21/2017
  • 34. Pairing functions 34  Let us consider the following primitive recursive function that provides a coding for two numbers x and y. Example: <1,1> = 2 * ( 2 + 1 ) ∸ 1 = 6 ∸ 1 = 5 <1,2> = 2 * ( 2*2 + 1) ∸ 1 = 10 ∸ 1 = 9    12y21:012y2 +=+>yx,<followsasrearrangecanweso,+thatNote xx   Define z to be as: < x , y > = z Then for any z there is always a unique solution x and y.   1212y21 +zofdivisortheisthen,+=+zthatGiven xx   x +z=+Then 2/112y   1-12y2>< +=yx, x 11/21/2017
  • 35. Pairing functions 35  Let us consider the following primitive recursive function that provides a coding for two numbers x and y. Example: <1,1> = 2 * ( 2 + 1 ) ∸ 1 = 6 ∸ 1 = 5 <1,2> = 2 * ( 2*2 + 1) ∸ 1 = 10 ∸ 1 = 9    12y21:012y2 +=+>yx,<followsasrearrangecanweso,+thatNote xx   Define z to be as: < x , y > = z Then for any z there is always a unique solution x and y.   1212y21 +zofdivisortheisthen,+=+zthatGiven xx   x +z=+Then 2/112y  Thus we have the solutions for x and y which can then be defined using the following functions:     zzr=y zzl=x     1-12y2>< +=yx, x 11/21/2017
  • 36. Pairing functions  More formally this can written as:  Pairing Function Theorem: functions <x,y>, l(z), r(z) have the following properties:  are primitive recursive  l(<x,y>) = x and r(<x,y>) = y  < l(z) , r(z) > = z  l(z) , r(z)≤ z 36     zzr=y zzl=x              ]><[ ]><[ yx,=zx=zr yx,=zy=zl z nim zy z nim zx     11/21/2017
  • 37. Gödel numbers  Let (a1, … , an) be any sequence, then the Gödel number is computed as follows: 37 [a1, ..., an]= ∏i= 1 n pi ai 11/21/2017
  • 38. Gödel numbers  Let (a1, … , an) be any sequence, then the Gödel number is computed as follows:  Example: Take a sequence (1,2,3,4), the Gödel number will be computed as follows: 38   4321 75321,2,3,4 = [a1, ..., an]= ∏i= 1 n pi ai 11/21/2017
  • 39. Gödel numbers  Let (a1, … , an) be any sequence, then the Gödel number is computed as follows:  Example: Take a sequence (1,2,3,4), the Gödel number will be computed as follows:  Gödel numbering has a special uniqueness property: If [a1, … , an ] = [ b1, … , bn ] then ai = bi , where i = 1, … , n 39   4321 75321,2,3,4 = [a1, ..., an]= ∏i= 1 n pi ai 11/21/2017
  • 40. Gödel numbers  Let (a1, … , an) be any sequence, then the Gödel number is computed as follows:  Example: Take a sequence (1,2,3,4), the Gödel number will be computed as follows:  Gödel numbering has a special uniqueness property: If [a1, … , an ] = [ b1, … , bn ] then ai = bi , where i = 1, … , n  Also notice: [ a1, … , an ] = [ a1, … , an, 0 ] 40   4321 75321,2,3,4 = [a1, ..., an]= ∏i= 1 n pi ai 11/21/2017
  • 41. Gödel numbers  Given that x = [a1, … , an ], we can now define two important functions: 41              00Lt |~ 1t =xijjx=x xp=a=x jxi nim xi i nim xtii     11/21/2017
  • 42. Gödel numbers  Given that x = [a1, … , an ], we can now define two important functions:  Example: Let x = [ 4 , 3 , 2 , 1 ], then (x)2 = 3 and (x)4=1 and (x)0 = 0 42              00Lt |~ 1t =xijjx=x xp=a=x jxi nim xi i nim xtii     11/21/2017
  • 43. Gödel numbers  Given that x = [a1, … , an ], we can now define two important functions:  Example: Let x = [ 4 , 3 , 2 , 1 ], then (x)2 = 3 and (x)4=1 and (x)0 = 0 Lt(10) = will be the length of the sequence derived using Gödel numbering 43              00Lt |~ 1t =xijjx=x xp=a=x jxi nim xi i nim xtii     11/21/2017
  • 44. Gödel numbers  Given that x = [a1, … , an ], we can now define two important functions:  Example: Let x = [ 4 , 3 , 2 , 1 ], then (x)2 = 3 and (x)4=1 and (x)0 = 0 Lt(10) = will be the length of the sequence derived using Gödel numbering So: 10 = 2^1 * 3^0 * 5^1 = [ 1, 0, 1 ] => Lt(10) = 3 44              00Lt |~ 1t =xijjx=x xp=a=x jxi nim xi i nim xtii     11/21/2017
  • 45. Gödel numbers  Given that x = [a1, … , an ], we can now define two important functions:  Example: Let x = [ 4 , 3 , 2 , 1 ], then (x)2 = 3 and (x)4=1 and (x)0 = 0 Lt(10) = will be the length of the sequence derived using Gödel numbering So: 10 = 2^1 * 3^0 * 5^1 = [ 1, 0, 1 ] => Lt(10) = 3  Sequence Number Theorem: 45           otherwise niifa =a,a i n 0 1 ...1, (1)              00Lt |~ 1t =xijjx=x xp=a=x jxi nim xi i nim xtii     11/21/2017
  • 46. Gödel numbers  Given that x = [a1, … , an ], we can now define two important functions:  Example: Let x = [ 4 , 3 , 2 , 1 ], then (x)2 = 3 and (x)4=1 and (x)0 = 0 Lt(10) = will be the length of the sequence derived using Gödel numbering So: 10 = 2^1 * 3^0 * 5^1 = [ 1, 0, 1 ] => Lt(10) = 3  Sequence Number Theorem: 46           otherwise niifa =a,a i n 0 1 ...1, (1) (2)       xnifx=x,x n Lt...1,               00Lt |~ 1t =xijjx=x xp=a=x jxi nim xi i nim xtii     11/21/2017