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

7.3. EXPRESSIVE POWER: EXAMPLES

49

7.3Expressive power: examples

7.3.1Booleans

The typical example is given by the logical connectors:

neg(u) = D F T u

disj(u; v) = D T v u

conj(u; v) = D v F u

For example, disj(T; x)

T and disj(F; x)

x; but on the other hand, faced with

the expression disj(x; T), we do not know

what to do.

 

Question Is it possible to de ne another disjunction which is symmetrical?

We shall see in 9.3.1, by semantic methods, that there is no term G of type

Bool; Bool ! Bool such that:

G hT; xi T

G hx; Ti T

G hF; Fi F

7.3.2Integers

First we must represent the integers: the choice of n = Sn O to represent the integer n is obvious.

The classical functions are de ned by simple recurrence relations. Let us give the example of the addition: we have to work from the de ning equations we already know:

x + O = x

x + S y = S (x + y)

Consider t[x; y] = R x ( zInt: z0 Int: S z) y:

t[x; O] x

t[x; S y] ( zInt: z0 Int: S z) (t[x; y]) y S t[x; y]

This shows that one can take t[x; y] as a de nition of x + y.

Among easy exercises in this style, one can amuse oneself by de ning multiplication, exponential, predecessor etc.

Predicates on integers can also be de ned, for example

null(O) = T null(S x) = F

gives

def Bool 0 Int

null(x) = R T ( z : z : F) x

which allows us to turn a characteristic function (type Int) into a predicate (type

Bool).

50

CHAPTER 7. GODEL'S SYSTEM T

None of these examples makes serious use of higher types. However, as the types used in the recursion increase, more and more functions become expressible. For example, if f is of type Int! Int, one can de ne it(f) of type Int! Int by

it(f) x = R

 

( zInt: z0 Int: f z) x

(it(f)

 

is fn

 

 

1

1)

n

As an object of type (Int! Int)!(Int! Int), the function it, is:

xInt!Int: it(x)

It is easy to see that by nite iteration of some reasonable function f0, we can exceed every primitive recursive function. The function which, given n, returns itn f0 (Ackermann's function), grows more quickly than all the primitive recursive functions.

This kind of function is easily de nable in T, provided we use a recursion on a complex type, such as Int! Int: take R f0 ( xInt!Int: zInt: it(x)) y, which normalises for y = O to f0, and for n to itn f0.

To nish, let us remark that the second argument of v in R u v t is frequently unused. One would prefer an iterator It instead of the recursor R, applying to u of type T , v of type T !T , and t of type Int, with the rule:

It u v (S t) v (It u v t)

The one-step predecessor satisfying the equations pred(O) = O, pred(S x) = x cannot be constructed using the iterator: R is essential. In fact, if one has only the iterator one can de ne the same functions but a certain number of equations with variables disappear. So the predecessor will still be de nable, but will satisfy pred(S t) t only when t is of the form n, in other words by values. This is a little annoying (in particular for F, where we shall no longer have anything but the iterator), for it shows that to calculate pred(n), the program makes n steps, which is manifestly excessive. We do not know how to type the predecessor, except in systems like T, where the solution is visibly ad hoc.

As an exercise, de ne R from It and pairing (by values only). We shall use this in system F (see 11.5.1).

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