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

11.3. REPRESENTATION OF SIMPLE TYPES

83

11.3Representation of simple types

A large part of the interest in F is in the possibility of de ning commonly used types in it; we shall devote the rest of the chapter to this.

11.3.1Booleans

We de ne Bool (not the one of system T) as X: X!X!X with

def

def

T = X: xX : yX : x

F = X: xX : yX : y

and if u; v; t are of respective types U; U; Bool we de ne D u v t of type U by

def

D u v t = t U u v

Let us calculate D u v T and D u v F:

D u v T = ( X: xX : yX : x) U u v ( xU : yU : x) u v

( yU : u) v u

D u v F = ( X: xX : yX : y) U u v ( xU : yU : y) u v

( yU : yU ) v v

11.3.2Product of types

def

We de ne U V = X: (U!V !X)!X with

 

u; v

 

def

h

i

= X: xU!V !X : x u v

 

 

The projections are de ned as follows:

def

def

1t = t U ( xU : yV : x)

2t = t V ( xU : yV : y)

84

CHAPTER 11. SYSTEM F

Let us calculate 1hu; vi and 2hu; vi:

1hu; vi = ( X: xU!V !X : x u v) U ( xU : yV : x) ( xU!V !U : x u v) ( xU : yV : x)

( xU : yV : x) u v ( yV : u) v

u

2hu; vi = ( X: xU!V !X : x u v) V ( xU : yV : yV ) ( xU!V !V : x u v) ( xU : yV : y)

( xU : yV : y) u v ( yV : y) v

v

Note

that h 1t; 2ti

t does not hold, even if we allow xU : t x

t and

X: t X

t.

 

 

11.3.3Empty type

def def

We can de ne Emp = X: X with "U t = t U.

11.3.4 Sum type

 

def

If U; V are types, we can de ne U + V = X: (U!X)!(V !X)!X.

If u; v are of types U; V we de ne 1u and 2v of type U + V by

def

def

1u = X: xU!X : yV !X : x u

2v = X: xU!X : yV !X : y v

If u; v; t are of respective types U; U; R + S, we de ne x: u y: v t of type U by

def U V

x: u y: v t = t U ( x : u) ( y : v)

Let us calculate x: u y: v ( 1r):

x: u y: v ( 1r) = ( X: xR!X : yS!X : x r) U ( xR: u) ( yS: v) ( xR!U : yS!U : x r) ( xR: u) ( yS: v) ( yS!U : ( xR: u) r) ( yS: v)

( xR: u) r u[r=x]

and similarly x: u y: v ( 2s) v[s=y].

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