day12 - Bounded Minimization 1 f(x = µ z(z ≤ x P(z if...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Bounded Minimization 1 f(x) = µ z (z ≤ x) [ P(z) ] if such a z, = x+1, otherwise where P(z) is primitive recursive. Can show f is primitive recursive by f(0) = 1-P(0) f(x+1) = f(x) if f(x) ≤ x = x+2-P(x+1) otherwise Dec 2, 10/4/11 © UCF (Charles E. 11 Bounded Minimization 2 f(x) = µ z (z < x) [ P(z) ] if such a z, = x, otherwise where P(z) is primitive recursive. Can show f is primitive recursive by f(0) = 0 f(x+1) = µ z (z ≤ x) [ P(z) ] Dec 2, 10/4/11 © UCF (Charles E. 22 Intermediate Arithmetic x // y: x//0 = 0 : silly, but want a value x//(y+1) = µ z (z<x) [ (z+1)*(y+1) > x] x | y: x is a divisor of y x|y = ((y//x) * x) == y Dec 2, 10/4/11 © UCF (Charles E. 33 Primality firstFactor(x): first non-zero, non-one factor of x. µ z (2 ≤ z ≤ x) [ z|x ] , firstfactor(x) = 0 if none isPrime(x): isPrime(x) = firstFactor(x) == x && (x>1) prime(i) = i-th prime: prime(0) = 2 prime(x+1) = µ z(prime(x)< z ≤prime(x)!+1) Dec 2, 10/4/11 © UCF (Charles E. 44 Exponents x^y: x^0 = 1 x^(y+1) = x * x^y exp(x,i): the exponent of pi in number x. exp(x,i) = µ z (z<x) [ ~(pi^(z+1) | x) ] Dec 2, 10/4/11 © UCF (Charles E. 55 Pairing Functions • • pair(x,y) = <x,y> = 2x (2y + 1) – 1 with inverses <z>1 = exp(z+1,0) <z>2 = ((( z + 1 ) // 2 <z>1 ) – 1 ) // 2 • These are very useful and can be extended to encode n-tuples <x,y,z> = <x, <y,z> > (note: stack analogy) Dec 2, 10/4/11 © UCF (Charles E. 66 Assignment # 3 Show that prfs are closed under mutual recursion. That is, assuming F1, F2 and G1 and G2 are pr, show that H1 and H2 are, where H1(0, x) = F1(x); H2(0, x) = F2(x) H1(y+1, x) = G1(y,x,H2(y,x)); H2(y+1, x) = G2(y,x,H1(y,x)) Hint: The pairing function is useful here. Due: September 17 Dec 2, 10/4/11 © UCF (Charles E. 77 ...
View Full Document

This note was uploaded on 10/03/2011 for the course COT 5310 taught by Professor Staff during the Spring '08 term at University of Central Florida.

Page1 / 7

day12 - Bounded Minimization 1 f(x = µ z(z ≤ x P(z if...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online