Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 7 Recursive Functions. Initial Functions Zero function ζ(n) = 0. Successor σ(n) = n+1, for n ε N. Projection π i (n 1,…,n k ) = n i. k.

Similar presentations


Presentation on theme: "Lecture 7 Recursive Functions. Initial Functions Zero function ζ(n) = 0. Successor σ(n) = n+1, for n ε N. Projection π i (n 1,…,n k ) = n i. k."— Presentation transcript:

1 Lecture 7 Recursive Functions

2 Initial Functions Zero function ζ(n) = 0. Successor σ(n) = n+1, for n ε N. Projection π i (n 1,…,n k ) = n i. k

3 Composition Let m, k be two integers. Given functions g: N → N and h i : N → N for I = 1, 2, …, m, define f: N → by f(n 1,…,n k ) = g(h 1 (n 1,…,n k ),…,h m (n 1,…,n k ) f is called the composition of g and h 1, …, h m. f = g o (h 1,…,h m ) mk k

4 Primitive Recursion Let k > 0. Given g: N → N and h: N → N, (when k=0, g is a constant), define f : N → N by f(n 1,…n k,0) = g(n 1,…,n k ) f(n 1,…,n k,m+1) = h(n 1,…,n k,m,f(n 1,…n k,m) kk+2 k+1

5 Primitive Recursive Functions All initial functions are primitive recursive. If g and h 1, …, h m are primitive recursive, so is go(h 1, …, h k ). If g and h are primitive recursive, so is f obtained from g and h by primitive recursion. Nothing else is primitive recursive.

6 Add(m, n) = m+n Add(m,0) = π 1 (m) Add(m, n+1) = σ( π 3 (m,n, add(m, n))) 1 3

7 mult(m, n) = mn mult(m, 0) = ζ(m) Mult(m, n+1) = add(π 1 (m,n,mult(m,n)), π 3 (m, n, mult(m,n)) 13

8 minus(m,n)= m-n if m > n; 0 if m<n pred(m) = minus(m,1) pred(0) = ζ(0) pred(m+1) = m = π 1 (m, pred(m)) minus(m,0) = π 1 (m) minus(m, n+1) = pred(π 3 (m,n,minus(m, n)) 2 1 3

9 Pairing Function A function f: N → N is a pairing function if it satisfies the following conditions: (1) f is 1-to-1 and onto; (2) f is primitive recursive; (3) f(i, j) < f(i+1, j), f(i, j) < f(i, j+1). For example,

10 Two “inverse” functions i = g(f(i,j)) and j = h(f(i, j)) are also primitive recursive. 01 2 3 4 5 6 7 8 9 10 11 12 13 14

11 Bounded minimization Given g: N → N, define f by f(n 1, …, n k, m) = min {i | g(n 1, …, n k, i)=1} if there exists i < m such that g(n 1, …, n k, i) =1; = 0, otherwise. If g is primitive recursive, so is f. K+1

12 Unbounded minimization Given g: N → N, define f by f(n 1, …, n k ) = min {i | g(n 1, …, n k, i)=1} if there exists i such that g(n 1, …, n k, i) =1; = ↑, otherwise. f may not be primitive recursive, even if g is. K+1

13 Partial Recursive Functions All initial functions are partial recursive. If g is a total recursive function, then f obtained from g by unbounded minimization is partial recursive. If g and h 1,…, h k are partial recursive, so is g o (h 1,…,h k ). If g and h are partial recursive, so is f obtained from g and h by primitive recursion.

14 Over Σ* Zero function ζ(x) = ε. Successor σ a (x) = xa for a in Σ. Projection (no change) Composition (no change) Primitive recursion (need a change, m+1 is replaced by ma) Unbounded minimization (need to give a linear ordering of Σ*)

15 From Σ* to Γ* for Σ* c Γ* Zero function ζ(x) = ε. Successor σ a (x) = xa for a in Γ. N can be considered as a subset of {0, 1}* if we represent n by 1…1 n

16 Theorem A function is partial recursive iff it is Turing-computable.

17 Theorem The following are equivalent: A is r.e. A is Turing-acceptable. A is the range of a primitive recursive function. A is the domain of a partial recursive function.

18 Pairing function on Σ* Let π(i, j) be a pairing function on N. Let φ be a 1-to-1 onto mapping from N to Σ*. Let μ be a 1-to-1 onto mapping from Σ* to N. Then p(x, y) = φ(π(μ(x), μ(y)) is a pairing function on Σ*.


Download ppt "Lecture 7 Recursive Functions. Initial Functions Zero function ζ(n) = 0. Successor σ(n) = n+1, for n ε N. Projection π i (n 1,…,n k ) = n i. k."

Similar presentations


Ads by Google