Lecture Slides for MAT-60556 Part IX: Recursion theory Henri Hansen - - PowerPoint PPT Presentation

lecture slides for mat 60556 part ix recursion theory
SMART_READER_LITE
LIVE PREVIEW

Lecture Slides for MAT-60556 Part IX: Recursion theory Henri Hansen - - PowerPoint PPT Presentation

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


slide-1
SLIDE 1

Lecture Slides for MAT-60556 Part IX: Recursion theory

Henri Hansen November 7, 2013

1

slide-2
SLIDE 2

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

  • f 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-

  • retical computer science

2

slide-3
SLIDE 3

Preliminaries

  • We deal for this part only with functions on natural

numbers, i.e. f : A → N, where A ⊆ Nn 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 ξ ∈ NN may also

appear, and a functional is a mapping F : NN × Nn → N.

3

slide-4
SLIDE 4

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

slide-5
SLIDE 5

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

slide-6
SLIDE 6

Notation and terminology

  • Given a sequence ξ and a number i, we write ξ(i)

for the ith number of the sequence.

  • We use x for a member of Nn even when n = 1,

and lets hope there is no confusion

6

slide-7
SLIDE 7

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

slide-8
SLIDE 8
  • 4. In,i describes a n-ary functional In,i(ξ; x) = xi

(the i:th projection)

  • 5. C(G, H1, . . . , Hk) is a description of functional F
  • f arity n, when G is describes a k-ary functional

and Hi describe n-ary functionals. It is defined by F(ξ, x) = G(ξ; H1(ξ; x), . . . , Hk(ξ; 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))

slide-9
SLIDE 9

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.
slide-10
SLIDE 10

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

slide-11
SLIDE 11
  • 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

slide-12
SLIDE 12

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, I1,1, i.e., x – F(x, y + 1) = H(x, y, F(x, y)), which is described by S(I1,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

slide-13
SLIDE 13

– F(x, 0) = 0 – F(x, y + 1) = F(x, y) + x, for which we have a description.

  • Power function λxy(xy):

– 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))

slide-14
SLIDE 14
  • x/y (proper division): µz(x − y · z)
  • etc.
slide-15
SLIDE 15

Examples of recursive functions with logic twist

  • x .

− y = max(x − y, 0).

  • 1. Define f using I1,1-description:

f(0) = 0 and f(x + 1) = x

  • 2. Define

. − by recursion from f: x . − 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

slide-16
SLIDE 16
  • 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 .

=

slide-17
SLIDE 17

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

slide-18
SLIDE 18
  • We shall later see that equality of expressions is not

a recursive function.

slide-19
SLIDE 19

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

slide-20
SLIDE 20
  • 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.

slide-21
SLIDE 21

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, R0, R1, . . . each of which con- tains a natural number. We denote K = R0, 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 R1, . . . , Rn

13

slide-22
SLIDE 22
  • It has the commands Zi, Si, Ai and Ji,j,m:
  • 1. Zi sets Ri = 0 and K = K + 1
  • 2. Si Sets Ri = Ri + 1 and K = K + 1
  • 3. Ai sets Ri = φ(Ri) and K = K + 1
  • 4. Ji,j,m, if Ri = Rj, 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).

slide-23
SLIDE 23
  • 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 R1, 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
slide-24
SLIDE 24

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<yP((ξ; x, z))

  • Minimum is even primitive recursive: minz≤y P(ξ; x, z) =
  • z≤y

(∃v ≤ z(P(ξ; x, z)))

14

slide-25
SLIDE 25
  • px, the xth prime (p0 = 2, p1 = 3, etc.), and (z)x,

the exponent of the xth prime in the factorization

  • f z, and lh(z) = x is the largest x so that (z)x > 0.
slide-26
SLIDE 26

Numbering for computer programs

  • We now can give our ”computer program” a num-
  • bering. Each command C gets a number #C
  • 1. Zi gets 2i
  • 2. Si gets 3i
  • 3. Ai gets 5i
  • 4. Ji,j,m gets 7i11j13m
  • Given a program B = C0, . . . , Ch−1, we give

#B =

  • k<h

p#Ck

k

15

slide-27
SLIDE 27

Recognizing a program

  • We define a unary relation Prog(z) =

(z > 0) ∧ ∀x < lh(z)∃u < z∃v < z∃w < z ((z)x = 2u+1) ∨ ((z)x = 3u+1) ∨ ((z)x = 5u+1) ∨ ((z)x = 7u+111v+113w)

  • 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

slide-28
SLIDE 28

Executing the program

  • The “state” of our computer can be given as a

number u, which is encoded so that (u)i = Ri.

  • Let us define the following functions:
  • 1. k(u) = (u)0
  • 2. i(u, z, x) = ((z)k(u))x
  • 3. f(u, z, x) = q(u, p

(u)i(u,z,x) i(u,z,x)

)

  • 4. k′(u, z) =

  

i(u, z, 5) if (u)i(u,z,3) = (u)i(u,z,4) k(u) + 1

  • therwise

17

slide-29
SLIDE 29
  • Then, we can define the “next step” function(nal).

We write i(x) instead of i(u, z, x) for brevity. Nex(ξ; u, z) =

                                          

2 · f(u, z, 0) if(u > 0) ∧ (k(u) < lh(z)) ∧ (i(0) > 0) 2 · pi(1) · u if(u > 0) ∧ (k(u) < lh(z)) ∧ (i(1) > 0) 2 · pξ((u)i(2))

i(2)

· f(u, z, 2) if(u > 0) ∧ (k(u) < lh(z)) ∧ (i(2) > 0) 2k′(u,z) · q(u, 2k(u) if(u > 0) ∧ (k(u) < lh(z)) ∧ (i(3) > 0) u

  • therwise
  • Nex(ξ; u, z) is a primitive recursice function(al) as

before

slide-30
SLIDE 30
  • The execution of the computer program B is is car-

ried out by setting z = #B, u to encode the in- put x = x1, . . . , xn and then setting s0 = u and si = Nex(ξ; si−1, z). If (si)0 ≥ lh(z), the program has halted.

  • Hence: the execution can also be defined in a (prim-

itive) recursive manner!

  • Let h = mint(st)0 ≥ lh(z), and we can call the num-

ber Πt≤hpst

t

the computation code of (ξ; z, x)

  • We can replace the sequence ξ with a number v

such that ξ(i) = (v)i, if we know a “long enough”

slide-31
SLIDE 31

stretch of ξ. In such a case we define the func- tion Nex∗(v, u, z) just like Nex, except ξ((u)i(2)) is replace by (v)(u)i(2)

slide-32
SLIDE 32

Properties of computation

  • Given x = (x1, . . . , xn), Let us define a n + 3-ary

relation T ∗

n and an n + 2 are relation Tn as follows

  • 1. T ∗

n(v, z, x, y) = ((y)0 = px1 1 · · · pxn n ∧

∀t < lh(y) . − 1((y)t+1 = Nex∗(v, (y)t, z)) ∧ ∀t < lh(y) . − 1(((y)t)0 < lh(z)) ∧ (((y)lh(y) . − 1)0 ≥ lh(z))

  • 2. Tn(ξ; z, x, y) = T ∗(v, z, x, y)
  • Theorem:

T ∗

n and Tn are primitive recursive, i.e.,

we can always detect whether a given computation code is valid

18

slide-33
SLIDE 33
  • Definition, let U(y) = ((y)lh(y) .

−1)1

  • Theorem: [z](ξ; x) = U(µyT(ξ; z, x, y))

– This follows in a mechanical way from the defini- tions: µyT(ξ; z, x, y) is precicely the computation code for (ξ; z, x) and U() gives the “return value” (R1) after the last computation step

  • Corollary: For any given computer program B, the

associated function is recursive and we can always find a description for it.

slide-34
SLIDE 34

Fundamental Theorems

  • Normal form theorem:

For every n-ary recursive functional F, we can find a number such that F(ξ; x) = U(µyT(ξ; e, x, y))

  • The great power of this is that B(ξ; x, z) = [z](ξ; x)

is a recursive functional, and therefore, B(ξ; x, z) is universal: It can be used to calculate all functions that the computer can calculate

  • Also, the converse holds, as we have seen:

The computer can compute all recursive functional!

19

slide-35
SLIDE 35
  • The self application problem: Calculate µx([x](x) =

∞); this is recursively unsolvable! – Examine the function g(x) = [x](x) for all such x that [x](x) = ∞, and 0 otherwise. It satifies the identity [x](x) = g(x) + 0 ∗ [x](x) – If g is recursive, then so is λx[g(x)+1], and there is a number e such that [e](x) = g(x) + 1. – Then g(e) + 1 = g(e) + 0 ∗ [e](e), so that g(e) = ∞, and either g cannot be total or it cannot be recursive – If we had a recursive µx([x](x) = ∞), we could define a total g recursively, so that this function cannot be recursive.

slide-36
SLIDE 36
  • Then the halting problem for λz, x([z](x) = ∞) is

also recursively unsolvable, because you could use it to solve λx([x](x) = ∞) recursively.

  • The vanishing problem is the decision problem for

the relation λz, x([z](x) = 0) is also recursively un- solvable

slide-37
SLIDE 37

Recursively enumerable sets

  • We focus on functions for this part; by relation we

mean a first-order relation (on numbers).

  • An n- dimensional set will mean a subset of Nn.

These sets and relations have a one-to-one mapping

  • A relation defines a set; we say that the set is re-

cursive if the corresponding relation is recursive

  • We introduce quantification in order to define new

sets: an n+1-ary relation P can be used to define a

20

slide-38
SLIDE 38

n-ary relation R by R(x) = ∃yP(x, y) (and similarly for ∀x). These operations are not recursive.

  • Definition: A relation is recursively enumerable (r.e.)

iff it is obtained by existential quantification of a re- cursive relation.

  • Lemma: The following operations on r.e. relations

give r.e. relations

  • 1. Composition with total, recursive function
  • 2. existential quantification
  • 3. conjunction
slide-39
SLIDE 39
  • 4. disjunction
  • 5. bounded quantification

(proof left ans exerccise!)

  • Theorem: Let A be the graph of an n-ary function
  • f. Then A is r.e. iff f is recursive

– if e is such that [e](x) = f(x), we have (x, u) ∈ A iff ∃y(T, e, x, y) ∧ U(y) = u, and by definition A is r.e. – if A is r.e., then we can write (x, u) ∈ A ⇔ ∃yR(x, u, y) for some recursive R.

slide-40
SLIDE 40
  • A relation is recursive iff both the relation and its

negation are r.e. – if R is recursive, then so is ¬R, and recursive implies r.e. – If R(x) = ∃yP(x, y) and ¬R(x) = ∃yQ(x, y), then R(x) = P(x, µy(P(x, y)∨Q(x, y))) which is recur- sive.

  • For every n- dimensional set A the following are

equivalent:

  • 1. A is r.e.
  • 2. A is the domain of some n-ary recursive function
slide-41
SLIDE 41
  • 3. A is enumerated by an n-tuple of recursive unary

functions

  • 1 ⇒ 2 follows from the fact that the set is defined

by x ∈ A iff ∃yR(x, y) where R is recursive, so that f(x) = λx(µyR(x, y)), and the domain of f will be A.

  • 2 ⇒ 3 follows by letting f(x) = U(µy(T(e, x, y)));

such e exists because f is recursive, and hence x ∈ A is the same as ∃yT(e, x, y). Let t be the encoding

  • f the n + 1-tuple (y, x), and define fi(t) = ti when

T(e, x, y) holds and ∞ otherwise. f is clearly recur- sive.

slide-42
SLIDE 42
  • 3 ⇒ 1 is rather simple.
slide-43
SLIDE 43

Diophantine relations

  • A n-ary relation E is said to be elementary iff there

is some polynomial of n variables such that E(x) ⇔ p(x) = 0

  • Elementary relations are closed under disjunctions

and conjunctions

  • A relation P is diophantine iff there exists an ele-

mentary relation E such that P(x) ⇔ ∃yE(x, y) (x is an n-tuple and y an m-tuple here)

21

slide-44
SLIDE 44
  • Diophantine relations are closed under disjunction,

conjunction and existential quantification

  • Theorem:

A relation is recursively enumerable if and only if it is diophantine!