How can I write a partial recursive function "maximum(x,y,z)"?

92 Views Asked by At

It is quite easy to write a partial recursive function "max(x,y)":

1.substraction1: substraction(x) = if x=0 then 0 else x - 1

@R(z1,i21)

2.substraction2: substraction(x,y) = if x < y then 0 else x - y

@R(i11,@S(substraction1,[i33]))

3.addition: x + y

@R(i11,@S(a1,[i33]))

4.maximum: maximum(x,y) = max(x,y)

@S(addition,[substraction2,i22])

where a(x) = x + 1;

z(x) = 0;

inm(x1,...xn) = xm , where 1 ≤ m ≤ n

But how can I compare and do it for x, y and z to get max(x,y,z) ?

Thank you

1

There are 1 best solutions below

0
On BEST ANSWER

I'm not sure what the unusual notation in your question means, but, if you're allowed to compose functions (as you are in most of the definitions of partial recursiveness), then you can just say $$ \max(x,y,z)=\max(\max(x,y),z). $$ If, on the other hand, composition isn't available, then you should say what is available.