Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Logic and CS / Girard. Proofs and Types.pdf
Скачиваний:
38
Добавлен:
10.08.2013
Размер:
947.15 Кб
Скачать

120

CHAPTER 15. REPRESENTATION THEOREM

15.1Representable functions

15.1.1Numerals

Proposition Any closed normal term t of type Int = X: X!(X!X)!X is a numeral n for some n 2 N.

Proof The notion of head normal form (section 3.4) is applicable to system F, and from it we deduce that t must be of the form

X: xX : yX!X : v

where v is of type X, and so cannot be an abstraction. We prove by induction that v is of the form

y (y (y : : : (y x) : : :))

| {z } n occurrences

where n is an integer.

Suppose that v is w u or w U, where w 6= y. Since v is normal, w must be of the form w0 u0 or w0 U0. But the types of x and y are simpler than that of w0, so w0 is an abstraction and w is a redex: contradiction. So v is x, in which case our

result holds with n = 0, or v is y v0

and we apply the induction hypothesis to v0

of type X.

 

Remark If we had taken the variant X: (X!X)!(X!X) we would have obtained almost the same result, but in addition there is a variant for 1:

X: yX!X : y

This phenomenon is one of the little imperfections of the syntax. Similar features arise with inductive data types, i.e. the closed normal forms of type T are \almost" the terms obtained by combining the functions fi, but in general only \almost".

Having said this, the recursion scheme for inductive types, de ned (morally) in terms of the fi, shows that (in a sense to be made precise) the terms constructed from the fi are \dense" among the others. To return to our pet subject, the syntax seems to be too rigid and much too arti cial to allow a satisfactory study of such di culties. Undoubtedly they cannot be resolved otherwise than by means of an operational semantics which would allow us to identify (or distinguish between) algorithms beyond what can be done with normalisation, which is only an approximation to that semantics.

15.1. REPRESENTABLE FUNCTIONS

121

15.1.2Total recursive functions

Let us return to the original question, which was to characterise the functions which are representable in F. We have seen that such functions are recursive, i.e. calculable.

Proposition There is a total recursive function which is not representable in F.

Proof The function which we shall take is the normalisation operation. We represent terms in a formal language as a string of symbols from a xed nite alphabet and hence as an integer. Then this function takes one term (represented by an integer) and yields another. This function is universal (in the sense of Turing) with respect to the functions representable in F, and so cannot itself be represented in F.

More precisely:

N(n) = m if n codes the term t, m codes u and u is the normal form of t.

N(n) = 0 if n does not code any term of F.

On the other hand we have the functions:

A(m; n)

= p if m; n; p are the codes of t; u; v such that v = t u, with

A(m; n)

= 0 otherwise.

](n) = m if m codes n.

[(m) = n if m is the code of the numeral n, with [(m) = 0 otherwise. Now consider:

D(n) = [(N(A(n; ](n)))) + 1

This is certainly a total recursive function, but it cannot be represented in F. Indeed, suppose that t of type Int!Int represents D and let n be the

code of t. Then A(n; ](n)) is the

code

of t

 

 

, and N(A(n; ](n))) that

of

its

n

 

 

 

 

 

 

normal form. But by de nition of t, t

 

 

 

D(n), so N(A(n; ](n))) = ](D(n)) and

n

[(N(A(n; ](n)))) = D(n) whence D(n) = D(n) + 1: contradiction.

 

 

For any reasonable coding, A,

] and

 

[ are obviously representable

in

F,

so N itself is not representable in F.

 

 

 

 

 

 

 

 

 

 

This result is of course a variant of a very famous result in Recursion Theory (due to Turing), namely that the set of total recursive functions cannot be enumerated by a single total recursive function. In particular it applies to all sorts of calculi, typed or untyped, which satisfy the normalisation theorem.

122

CHAPTER 15. REPRESENTATION THEOREM

15.1.3Provably total functions

A recursive function f which is total from N to N is called provably total in a system of arithmetic A if A proves the formula which expresses \for all n, the program e, with input n, terminates and returns an integer" for some algorithm e representing f. The precise formulation depends on how we write programs formally in A. For example, with the Kleene notation:

A proves 8n: 9m: T1(e; n; m)

where T1(e; n; m) means that the program e terminates with output m if given input n. This may itself be expressed as 9m0: P (n; m; m0) where P is a primitive recursive predicate and m0 is the \transcript" of the computation. The two quanti ers 9m: 9m0: can be replaced by a single one 9p: using some (primitive recursive) coding of pairs. We prefer to be no more speci c about this precise formulation, but we notice that termination is expressed by a 02 formula1.

In 7.4, we saw that the functions representable in T are provably total in Peano arithmetic PA, and the converse is also true. Here we have:

Proposition The functions representable in F are provably total in second order Peano arithmetic PA2.

Proof An object f of type Int!Int gives rise to an algorithm which, given an integer n, returns jfj(n); we have described how to do this already. Now we want to show that this program terminates. We make use of the strong normalisation theorem, and by examining the mathematical principles employed in the proof we obtain the result.

What matters is essentially the reducibility of f alone (together with that of the numerals, which is immediate). We only use nitely many reducibilities, which saves us from the fact that (as in T) reducibility is not globally de nable. The reducibility predicates are de nable by second order quanti cation over sets of (terms coded as) integers. The mathematical principles we have used are:

induction on the reducibility predicates for the types involved in f,

the comprehension scheme and second order quanti cation, which allow us to de ne a reducibility candidate from a parametrised reducibility.

But PA2 is precisely the system of arithmetic with induction, comprehension and

second order quanti cation.

 

1See footnote page 57.

Соседние файлы в папке Logic and CS