II. Recursive Function Yuxi Fu BASICS, Shanghai Jiao Tong University Hilbert’s Program The epochal address of David Hilbert (23Jan.1862-14Feb.1934) to the International Congress of Mathematicians (Paris, 1900): 1. Consistency of the Axioms of Arithmetic. This is the second among Hilbert’s 23 problems published in 1900 (ten were announced in the Paris Congress). 2. Entscheidungsproblem (decision problem) of first order logic. Yuxi Fu II. Recursive Function 1 / 49 Gödel’s Incompleteness Theorem Hilbert retired in 1930, and gave a special speech to the annual meeting of the Society of German Scientists and Physicians in his birth place, Königsberg. It was in this occasion he made his famous remark ”Wir müssen wissen. Wir werden wissen.” Kurt Gödel (28April.1906-14Jan.1978), a young man from Vienna and one year past his PhD, announced his Incompleteness Theorem in a roundtable discussion at the Conference on Epistemology held jointly with the Society meetings. (one day before Hilbert’s speech!) Yuxi Fu II. Recursive Function 2 / 49 History of Recursion Theory Gödel’s remarkable idea is the arithmetization of syntax. He used primitive recursive functions to do encoding. In 1931 Gödel was aware of the Ackermann function. By taking a suggestion from Herbrand, he developed in 1934 a formal system of Herbrand-Gödel recursive functions. Kleene (5Jan.1909-25Jan.1994) introduced in 1936 the µ-recursive functions, based on the system of the primitive recursive functions and an unbounded search operator. Yuxi Fu II. Recursive Function 3 / 49 Synopsis 1. Primitive Recursive Function 2. Ackermann Function 3. Recursive Function Yuxi Fu II. Recursive Function 4 / 49 1. Primitive Recursive Function Yuxi Fu II. Recursive Function 5 / 49 Recursion Theory offers a mathematical model for the study of effective calculability. Yuxi Fu I All effective objects can be encoded by natural numbers. I All effective procedures can be modeled by functions from numbers to numbers. II. Recursive Function 6 / 49 Initial Function def 1. The zero function 0 = λx1 . . . λxn .0. def 2. The successor function s(x) = λx.x+1. def 3. The projection function Uni (x1 , . . . , xn ) = λx1 . . . λxn .xi . Yuxi Fu II. Recursive Function 7 / 49 Composition Suppose f (y1 , . . . , yk ) is a k-ary function and g1 (e x ), . . . , gk (e x ) are n-ary functions, where e x abbreviates x1 , . . . , xn . The composition function h(e x ) is defined by h(e x ) = f (g1 (e x ), . . . , gk (e x )), Yuxi Fu II. Recursive Function 8 / 49 Recursion Suppose that f (e x ) is an n-ary function and g (e x , y , z) is an (n+2)-ary function. The recursion function h(e x ) is defined by h(e x , 0) = f (e x ), h(e x , y + 1) = g (e x , y , h(e x , y )). (1) (2) Clearly there is a unique function that satisfies (1) and (2). Yuxi Fu II. Recursive Function 9 / 49 Primitive Recursive Recursion The set of primitive recursive function is the least set generated from the initial functions, composition and recursion. Yuxi Fu II. Recursive Function 10 / 49 Dummy Parameter Proposition. Suppose that f (y1 , . . . , yk ) is a primitive recursive and that xi1 , . . . , xik is a sequence of k variables from x1 , . . . , xn (possibly with repetition). Then the function h given by h(x1 , . . . , xn ) = f (xi1 , . . . , xik ) is primitive recursive. Proof. x ), . . . , Unik (e x )). h(e x ) = f (Uni1 (e Yuxi Fu II. Recursive Function 11 / 49 Basic Arithmetic Function x + y: x + 0 = x, x + (y + 1) = (x + y ) + 1. xy : x0 = 0, x(y + 1) = xy + x. xy : x 0 = 1, x y +1 = x y x. Yuxi Fu II. Recursive Function 12 / 49 Basic Arithmetic Function x −̇1: 0−̇1 = 0, (x + 1)−̇1 = x. def x −̇y = x − y , if x ≥ y , : 0, otherwise. x −̇0 = x, x −̇(y + 1) = (x −̇y )−̇1. Yuxi Fu II. Recursive Function 13 / 49 Basic Arithmetic Function def sg(x) = 0, if x = 0, : 1, if x 6= 0. sg(0) = 0, sg(x + 1) = 1. def sg(x) = 1, if x = 0, : 0, if x 6= 0. sg(x) = 1−̇sg(x). Yuxi Fu II. Recursive Function 14 / 49 Basic Arithmetic Function |x − y | = (x −̇y ) + (y −̇x). x!: 0! = 1, (x + 1)! = x!(x + 1). min(x, y ) = x −̇(x −̇y ). max(x, y ) = x + (y −̇x). Yuxi Fu II. Recursive Function 15 / 49 Basic Arithmetic Function def rm(x, y ) = the remainder when y is devided by x: rm(x, y ) + 1 if rm(x, y ) + 1 < x, def rm(x, y + 1) = 0, otherwise. The recursive definition is given by rm(x, 0) = 0, rm(x, y + 1) = (rm(x, y ) + 1)sg(x −̇(rm(x, y ) + 1)). Yuxi Fu II. Recursive Function 16 / 49 Basic Arithmetic Function def qt(x, y ) = the quotient when y is devided by x: qt(x, y ) + 1, if rm(x, y ) + 1 = x, def qt(x, y + 1) = qt(x, y ), if rm(x, y ) + 1 6= x. The recursive definition is given by qt(x, 0) = 0, qt(x, y + 1), = qt(x, y ) + sg(x − (rm(x, y ) + 1)). Yuxi Fu II. Recursive Function 17 / 49 Basic Arithmetic Function def div(x, y ) = 1, if x divides y , : 0, otherwise. div(x, y ) = sg(rm(x, y )). Yuxi Fu II. Recursive Function 18 / 49 Bounded Sum and Bounded Product Bounded sum: X f (e x , y ) = 0, y <0 X y <z+1 Bounded product: Y f (e x, y) = X f (e x , y ) + f (e x , z). y <z f (e x , y ) = 1, y <0 Y y <z+1 Yuxi Fu f (e x, y) = ( Y f (e x , y )) · f (e x , z). y <z II. Recursive Function 19 / 49 Bounded Sum and Bounded Product By composition the following functions are also primitive recursive e ) is primitive recursive: if k(e x, w X f (e x , z) e) z<k(e x ,w and Y f (e x , z). e) z<k(e x ,w Yuxi Fu II. Recursive Function 20 / 49 Bounded Minimization Operator Bounded search: µz<y (f (e x , z) = 0) Yuxi Fu def = the least z < y , such that f (e x , z) = 0; y, if there is no such z. II. Recursive Function 21 / 49 Bounded Minimization Operator Bounded search: µz<y (f (e x , z) = 0) def = the least z < y , such that f (e x , z) = 0; y, if there is no such z. Proposition. If f (e x , z) is primitive recursive, then so is µz<y (f (e x , z) = 0). Proof. µz<y (f (e x , z) = 0) = Yuxi Fu P Q v <y ( x , u))). u<v +1 sg(f (e II. Recursive Function 21 / 49 Bounded Minimization Operator e ) are primitive recursive functions, then so is If f (e x , z) and k(e x, w the function e )(f (e µz<k(e x, w x , z) = 0). Yuxi Fu II. Recursive Function 22 / 49 Primitive Recursive Predicate Suppose M(x1 , . . . , xn ) is an n-ary predicate of natural numbers. The characteristic function cM (e x ), where e x = x1 , . . . , xn , is 1, if M(a1 , . . . , an ) holds, cM (a1 , . . . , an ) = 0, if otherwise. The predicate M(e x ) is primitive recursive if cM is primitive recursive. Yuxi Fu II. Recursive Function 23 / 49 Closure Property Proposition. The following statements are valid: I I If R(e x ) is a primitive recursive predicate, then so is ¬R(e x ). If R(e x ), S(e x ) are primitive recursive predicates, then the following predicates are primitive recursive: I I I R(e x ) ∧ S(e x ); R(e x ) ∨ S(e x ). If R(e x , y ) is a primitive recursive predicate, then the following predicates are primitive recursive: I I ∀z < y .R(e x , z); ∃z < y .R(e x , z). Proof. For example c∀z<y .R(ex ,z) (e x, y) = Yuxi Fu Q z<y cR (e x , z). II. Recursive Function 24 / 49 Definition by Case Suppose that f1 (e x ), . . . , fk (e x ) are primitive recursive functions, and M1 (e x ), . . . , Mk (e x ) are primitive recursive predicates, such that for every e x exactly one of M1 (e x ), . . . , Mk (e x ) holds. Then the function g (e x ) given by f1 (e x ), if M1 (e x ) holds, f2 (e x ), if M2 (e x ) holds, g (e x) = .. . fk (e x ), if Mk (e x ) holds. is primitive recursive. Proof. g (e x ) = cM1 (e x )f1 (e x ) + . . . + cMk (e x )fk (e x ). Yuxi Fu II. Recursive Function 25 / 49 More Arithmetic Function Proposition. The following functions are primitive recursive. (i) D(x) = the number of divisors of x; 1, if x is prime, (ii) Pr (x) = ; 0, if x is not prime. (iii) px = the x-th k, (iv) (x)y = 0, Yuxi Fu prime number; k is the exponent of py in the prime factorisation of x, for x, y > 0, . if x = 0 or y = 0. II. Recursive Function 26 / 49 More Arithmetic Function Proof. (i) D(x) = P y <x+1 div(y , x). (ii) Pr (x) = sg(|D(x) − 2|). (iii) px can be recursively defined as follows: p0 = 0, px+1 = µz < (2 + px !) 1−̇(z −̇px )Pr (z) = 0 . (iv) (x)y = µz<x(div(pz+1 y , x) = 0). Yuxi Fu II. Recursive Function 27 / 49 Encoding a Finite Sequence Suppose s = (a1 , a2 , . . . , an ) is a finite sequence of numbers. It can be coded by the following number b = pa11 +1 pa22 +1 . . . pann +1 . Then the length of s can be recovered from µz<b((b)z+1 = 0), and the i-th component can be recovered from (b)i −̇1. Yuxi Fu II. Recursive Function 28 / 49 Not all Computable Functions are Primitive Recursive Using the fact that all primitive recursive functions are total, a diagonalisation argument shows that non-primitive recursive computable functions must exist. The same diagonalisation argument applies to all finite axiomatizations of computable total function. Yuxi Fu II. Recursive Function 29 / 49 2. Ackermann Function Yuxi Fu II. Recursive Function 30 / 49 Ackermann Function The Ackermann function [1928] is defined as follows: ψ(0, y ) ' y + 1, ψ(x + 1, 0) ' ψ(x, 1), ψ(x + 1, y + 1) ' ψ(x, ψ(x + 1, y )). The equations clearly define a total function. Yuxi Fu II. Recursive Function 31 / 49 Ackermann Function is Monotone The Ackermann function is monotone: ψ(n, m) < ψ(n, m + 1), ψ(n, m) < ψ(n + 1, m). The Ackermann function grows faster on the first parameter: ψ(n, m + 1) ≤ ψ(n + 1, m) ψ(n, m) + C is dominated by ψ(J, m) for some large enough J: ψ(n, m) + ψ(n0 , m) < ψ(max(n, n0 ) + 4, m), ψ(n, m) + m < ψ(n + 4, m). Yuxi Fu II. Recursive Function 32 / 49 Ackermann Function Grows Fast Lemma. Let f (e x ) be a k-ary primitive recursive function. Then there exists some J such that for all n1 , . . . , nk we have that f (n1 , . . . , nk ) < ψ(J, k X nk ). i=1 Proof. The proof is by structural induction. (i) f is one of the initial functions. In this case take J to be 1. Yuxi Fu II. Recursive Function 33 / 49 Ackermann Function Grows Fast (ii) f is the composition function h(g1 (e x ), . . . , gm (e x )). Then f (e n) = h(g1 (e n), . . . , gm (e n)) < ψ(J0 , m X gi (e n)) < ψ(J0 , i=1 m X ψ(Ji , i=1 < ψ(J0 , ψ(J ∗ , k X k X nj )) < ψ(J ∗ , ψ(J ∗ + 1, j=1 = ψ(J ∗ + 1, k X nj )) j=1 nj + 1) ≤ ψ(J ∗ + 2, j=1 k X nj )) j=1 k X nj ). j=1 Now set J = J ∗ + 2. Yuxi Fu II. Recursive Function 34 / 49 Ackermann Function Grows Fast Suppose f is defined by the recursion: f (e x , 0) ' h(e x ), f (e x , y + 1) ' g (e x , y , f (e x , y )). Then h(e n) < ψ(Jh , P e n) and g (e n, m, p) < ψ(Jg , P e n + m + p). It is easy to prove f (n1 , . . . , nk , m) < ψ(J, k X nk + m) i=1 by induction on m. Yuxi Fu II. Recursive Function 35 / 49 Faster than any Primitive Recursive Function Now suppose ψ(x, y ) was primitive recursive. By composition ψ(x, x) would be primitive recursive. According to the Lemma ψ(n, n) < ψ(J, n) for some J and all n, which would lead to the contradiction ψ(J, J) < ψ(J, J). Yuxi Fu II. Recursive Function 36 / 49 Faster than any Primitive Recursive Function The Ackermann function grows faster than every primitive recursive function. Yuxi Fu II. Recursive Function 37 / 49 3. Recursive Function Yuxi Fu II. Recursive Function 38 / 49 Minimization Operator, or Search Operator Minimization function, or µ-function, or search function: the least y such that f (e x , y ) is defined for all z ≤ y , and µy (f (e x , y ) = 0) ' f (e x , y ) = 0, undefined if otherwise. Here ' is the computational equality. Yuxi Fu II. Recursive Function 39 / 49 Minimization Operator, or Search Operator Minimization function, or µ-function, or search function: the least y such that f (e x , y ) is defined for all z ≤ y , and µy (f (e x , y ) = 0) ' f (e x , y ) = 0, undefined if otherwise. Here ' is the computational equality. The recursion operation is a well-founded going-down procedure. The search operation is a possibly divergent going-up procedure. Yuxi Fu II. Recursive Function 39 / 49 Recursive Function The set of recursive functions is the least set generated from the initial functions, composition, recursion and minimization. Yuxi Fu II. Recursive Function 40 / 49 Decidable Predicate A predicate R(e x ) is decidable if its characteristic function 1, if R(e x ) is true, def cR (e x) = 0, otherwise. is a recursive function. Yuxi Fu II. Recursive Function 41 / 49 Decidable Predicate A predicate R(e x ) is decidable if its characteristic function 1, if R(e x ) is true, def cR (e x) = 0, otherwise. is a recursive function. The predicate R(e x ) is partially decidable if its partial characteristic function 1, if R(e x ) is true, def χR (e x) = ↑, otherwise. is a recursive function. Yuxi Fu II. Recursive Function 41 / 49 Closure Property Proposition. The following statements are valid: I I If R(e x ) is decidable, then so is ¬R(e x ). If R(e x ), S(e x ) are (partially) decidable, then the following predicates are (partially) decidable: I I I If R(e x , y ) is (partially) decidable, then the following predicates are (partially) decidable: I I Yuxi Fu R(e x ) ∧ S(e x ); R(e x ) ∨ S(e x ). ∀z < y .R(e x , y ); ∃z < y .R(e x , y ). II. Recursive Function 42 / 49 Definition by Cases Suppose f1 (e x ), . . . , fk (e x ) are recursive and M1 (e x ), . . . , Mk (e x ) are partially decidable. For every e x at most one of M1 (e x ), . . . , Mk (e x) holds. Then the function g (e x ) given by x ), if M1 (e x ) holds, f1 (e f2 (e x ), if M2 (e x ) holds, g (e x) ' .. . fk (e x ), if Mk (e x ) holds. is recursive. Yuxi Fu II. Recursive Function 43 / 49 Minimization via Decidable Predicate Suppose R(x, y ) is a partially decidable predicate. The function g (x) = µyR(e x, y) the least y such that R(e x , y ) holds, if there is such a y , = undefined, otherwise. is recursive. Proof. g (e x ) = µy (sg(χR (e x , y )) = 0). Yuxi Fu II. Recursive Function 44 / 49 Comment The µ-operator allows one to define partial functions. Yuxi Fu II. Recursive Function 45 / 49 Comment The µ-operator allows one to define partial functions. The diagonalisation argument does not apply to the set F of recursive functions. Yuxi Fu II. Recursive Function 45 / 49 Comment The µ-operator allows one to define partial functions. The diagonalisation argument does not apply to the set F of recursive functions. Using the µ-operator, one may define total functions that are not primitive recursive. Yuxi Fu II. Recursive Function 45 / 49 Minimization Operator is a Search Operator It is clear from the above proof why the minimization operator is sometimes called a search operator. Yuxi Fu II. Recursive Function 46 / 49 Definable Function A function is definable if there is a recursive function calculating it. Yuxi Fu II. Recursive Function 47 / 49 Ackermann Function is Recursive Proposition. The Ackermann function is recursive. Proof. A finite set S of triples is said to be suitable if the followings hold: (i) if (0, y , z) ∈ S then z = y + 1; (ii) if (x + 1, 0, z) ∈ S then (x, 1, z) ∈ S; (iii) if (x + 1, y + 1, z) ∈ S then ∃u.((x + 1, y , u)∈S ∧ (x, u, z)∈S). A triple (x, y , z) can be coded up by 2x 3y 5z . A set {u1 , . . . , uk } can be coded up by pu1 · · · puk . Let R(x, y , v ) be “v is a legal code and ∃z < v .(x, y , z)∈Sv ”. The Ackermann function ψ(x, y ) ' µz((x, y , z)∈SµvR(x,y ,v ) ). Yuxi Fu II. Recursive Function 48 / 49 Do recursive functions capture all computable functions? Yuxi Fu II. Recursive Function 49 / 49 Do recursive functions capture all computable functions? Gödel himself wasn’t very sure about it in 1934. Yuxi Fu II. Recursive Function 49 / 49
© Copyright 2024 Paperzz