Lecture Slides for MAT-60556 Part IX: Recursion theory Henri Hansen November 7, 2013 1
Recursion theory • Recursion theory mostly characterizes computabil- ity . • It is a study of functions that can be computed us- ing simple logical steps; We shall take just enough of recursion theory to be able to prove some limi- tative results of logic later on • Recursion theory is interesting in its own right, and this part will be helpful also if you later study the- oretical computer science 2
Preliminaries • We deal for this part only with functions on natural numbers, i.e. f : A �→ N , where A ⊆ N n for some n . A is called the domain of f • We treat all functions so that f ( x ) = ∞ means the situation where x would be undefined • A sequence of natural numbers ξ ∈ N N may also appear, and a functional is a mapping F : N N × N n �→ N . 3
Lambda notation • we use the lambda-notation for expressions as fol- lows: let r be an expression where x appears, then λxr denotes the function f ( x ) = r • For example λx ( x + 1) is an expression whose value is the function f ( x ) = x + 1 • The same can be done with functionals, when F ( ξ ; x ) = r , then [ λxr ]( ξ ) is equal to F ( ξ ; x ). 4
Least operator • Assume that the functional G is defined by the iden- tity G ( ξ ; x, y ) = r . Then the expression µyr defines a function F ( ξ ; x ) = µry • Consider the values of G ( ξ ; x, y ) when y = 0 , 1 , 2 , . . . There is at most one number b , when ξ and x are fixed, such that for every y < b , G ( ξ ; x, y ) is defined and greter than zero, and G ( ξ ; x, b ) = 0 • If such a b exists, then F ( ξ ; x ) = b , otherwise ∞ 5
Notation and terminology • Given a sequence ξ and a number i , we write ξ ( i ) for the i th number of the sequence. • We use x for a member of N n even when n = 1, and lets hope there is no confusion 6
Descriptions • A description is an expression that is formed ac- cording to one of seven different rules 1. Z is a 0-ary description, that defines the identity Z ( ξ ) = 0, i.e. it is functional with no arguments, which is identically zero 2. S is a unary description of a functional S ( ξ ; x ) = x + 1 (the increment) 3. A is a unary description of a functional A ( ξ ; x ) = ξ ( x ) (the x:th place in a sequence) 7
4. I n,i describes a n -ary functional I n,i ( ξ ; x ) = x i (the i:th projection) 5. C ( G, H 1 , . . . , H k ) is a description of functional F of arity n , when G is describes a k -ary functional and H i describe n -ary functionals. It is defined by F ( ξ, x ) = G ( ξ ; H 1 ( ξ ; x ) , . . . , H k ( ξ ; x )) 6. When F is P ( G, H ), where G describes a n -ary functional and H describes an n + 2-ary func- tional, then F describes an n + 1-ary functional F defined as: F ( ξ ; x, 0) = G ( ξ, x ) and F ( ξ ; x, y + 1) = H ( ξ ; x, y, F ( ξ ; x, y ))
We say that F is obtained from H and G by primitive recursion . 7. And if F is M ( G ) where G describes an n +1-ary functional, then F describes F ( ξ ; x ) = µyG ( ξ ; x, y ) • A functional is recursive iff it has a description.
Properties of recursive functionals • If F describes a functional where M does not ap- pear, we say that F describes a primitive recursive functional • If F describes a function, where neither A nor M appear, then the function F describes is a primitive recursive function • If φ is a fixed sequence, and F is any recursive func- tional, then the function described by λxF ( φ ; x ) is recursive relative to φ . 8
• Theorem: A recursive function is recursive relative to every sequence, and a function that is recursive relative to φ = λx ( x + 1) is recursive. • Theorem (optional) It is possible to construct a computer program based on a description, which means that recursive functions are computable
Examples of recursive functions • Description of F ( x, y ) = x + y is a P -description – F ( x, 0) = G ( x ), where G is the identity projec- tion, I 1 , 1 , i.e., x – F ( x, y + 1) = H ( x, y, F ( x, y )), which is described by S ( I 1 , 3 ), i.e., the successor of the third param- eter, i.e., F ( x, y ) + 1. • We often omit the projections and intermediate de- criptions; once we have a description for a some functions, any combination of them can be describes. For instanse the product λxy ( x · y ) : 9
– F ( x, 0) = 0 – F ( x, y + 1) = F ( x, y ) + x , for which we have a description. • Power function λxy ( x y ): – F ( x, 0) = 1 – F ( x, y + 1) = x · F ( x, y ) • x − y : First define F ( x ) = x − 1 by F (0) = ∞ and F ( x + 1) = x . Then x − y is G ( x, y ) such that G ( x, 0) = x and G ( x, y + 1) = F ( G ( x, y ))
• x/y (proper division): µz ( x − y · z ) • etc.
Examples of recursive functions with logic twist • x . − y = max( x − y, 0). 1. Define f using I 1 , 1 -description: f (0) = 0 and f ( x + 1) = x . x . 2. Define − by recursion from f : − 0 = 0 and x . − ( y + 1) = f ( x . − y ) • unary function ¬ x is defined λx (1 . − x ) • binary function x ∨ y is defined λxy ( x · y ) 10
• binary function x ∧ y is defined λxy ( ¬ ( ¬ x ∨ ¬ y )) • (with the interpretation 0 = true and any other number = false) • “Order relation” x < y is defined λxy (1 . − ( y . − x )) • x ≤ y is defined ¬ ( y < x ) • Equality x . = y is ( x ≤ y ) ∧ ( y ≤ x ) • We now turn to discussing the nature or . =
Equality of recursive functions • We defined . = as a composition of functionals, but this does not necessarily lead into it being a relation, i.e., it does not always return 0 or 1. • Think of the following composition F ( ξ ; x ) = ( G ( ξ ; x ) . = H ( ξ ; x )) • Then F is (primitive) recursive iff G and H are • However, if G ( φ ; z ) = ∞ or H ( φ ; z ) = ∞ (or both) for given φ and z , then F ( φ ; z ) = ∞ as well, so that F is not a relation 11
• We shall later see that equality of expressions is not a recursive function.
Church’s thesis • There are several definitions of what “computable” means • So far it has turned out that all of them are equiv- alent, i.e., reducible to one another • Turing machines, ideal computers, recursive func- tions, etc, can all be reduced to one another • Church thesis: “all algorithmic functions are recur- sive” 12
• The thesis is a matter of belief; it cannot be proven, because the notion of what “algorithmic” or “com- putable” means is not defined, but rather described intuitively.
Ideal computer • We can define a “computer” that closely follows the ideas of recursive functions • The “memory” of the computer consists of a se- quence of registers, R 0 , R 1 , . . . each of which con- tains a natural number. We denote K = R 0 , which is the “execution counter”. • The computer takes as an input a sequence φ and an n -tuple of numbers x , so that their values are assigned to R 1 , . . . , R n 13
• It has the commands Z i , S i , A i and J i,j,m : 1. Z i sets R i = 0 and K = K + 1 2. S i Sets R i = R i + 1 and K = K + 1 3. A i sets R i = φ ( R i ) and K = K + 1 4. J i,j,m , if R i = R j , sets K = m , and otherwise sets K = K + 1 • A computer program is a finite sequence of com- mands c , and it is run by first setting K = 0 and step-by-step execution of command c ( K ).
• It can be proven that if we interpret the program as ending when we run out of commands, i.e., when K > | c | , and the result of the computation as being the value of R 1 , then the set of functionals that the computer can compute is exactly the set of recursive functionals. • We give the numbering functions to indicate this
Some functions (all recursive!) • Summation, multiplication and generalized product, can easily be seen as recursive; the division (with quotient) q ( x, y ) • Bounded existential and universal quanification: Q ( ξ ; x, y ) = ∃ z ≤ y ( P ( ξ, x, z )), when P implements a “predi- cate”, is calculated by Π z<y P (( ξ ; x, z )) • Minimum is even primitive recursive: min z ≤ y P ( ξ ; x, z ) = � ( ∃ v ≤ z ( P ( ξ ; x, z ))) z ≤ y 14
• p x , the x th prime ( p 0 = 2, p 1 = 3, etc.), and ( z ) x , the exponent of the x th prime in the factorization of z , and lh ( z ) = x is the largest x so that ( z ) x > 0.
Numbering for computer programs • We now can give our ”computer program” a num- bering. Each command C gets a number # C 1. Z i gets 2 i 2. S i gets 3 i 3. A i gets 5 i 4. J i,j,m gets 7 i 11 j 13 m • Given a program B = C 0 , . . . , C h − 1 , we give p # C k � # B = k k<h 15
Recognizing a program • We define a unary relation Prog ( z ) = ( z > 0) ∧ ∀ x < lh ( z ) ∃ u < z ∃ v < z ∃ w < z (( z ) x = 2 u +1 ) ∨ (( z ) x = 3 u +1 ) ∨ (( z ) x = 5 u +1 ) ∨ (( z ) x = 7 u +1 11 v +1 13 w ) • Looks terrible, but clearly it is primitive recursive; Prog ( z ) holds iff there is some program such that # B = z • Given a number z , we write [ z ] = B when # B = z . When Prog ( z ) does not hold, we assume [ z ] is the empty program, i.e. does nothing 16
Recommend
More recommend