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

12.1. DIRECT SUM

95

12.1Direct sum

The problem with sum types arises from the impossibility of de ning the interpretation by means of the direct sum:

jA Bj = jAj + jBj = f1g jAj [ f2g jBj

(1; ) _

(1; 0) (mod

A B

)

if _

0

(mod

A

)

^

 

 

^

 

 

 

(2; ) _

(2; 0) (mod

A B

)

if _

0

(mod

B

)

^

 

 

^

 

 

 

 

with incoherence otherwise.

Domain-theoretically, this amounts to taking the disjoint union with the ? element identi ed, so it is sometimes called an amalgamated sum.

If we de ne the (stable) functions Inj 1

from A to A B and Inj 2

from B to

A B by

 

 

 

 

 

 

 

 

 

 

Inj 1(a) = f1g a

 

Inj 2(b) = f2g b

 

 

object of the coherence space

A B

can be written nj 1(a) for some a

2 A

every 2

b

 

b

 

 

 

I

 

or Inj (

) for some1

2 B.

This expression is unique, except in the case of the

 

 

2

?. This non-uniqueness of the decomposition makes

empty set: ? = Inj

? = Inj

 

it impossible to de ne a function casewise

 

 

 

 

 

H(Inj 1(a)) = F (a)

 

H(Inj 2(b)) = G(b)

 

 

from two stable functions F from A to C and G from B to C. Indeed this fails for the argument ?, since F (?) has no reason to be equal to G(?).

12.2Lifted sum

A rst solution is given by adding two tags 1 and 2 to jA Bj to form A q B: 1 is coherent with the (1; ) but not with the (2; ) and likewise 2 with the (2; ) but not with the (1; ).

We can then de ne:

 

q1(a) = f1g [ Inj 1(a)

q2(b) = f2g [ Inj 2(b)

96

CHAPTER 12. COHERENCE SEMANTICS OF THE SUM

Now, from F and G, the casewise de nition is possible:

H(q1(a)) = F (a)

H(q2(b)) = G(b)

H(c) = ? if c \ f1; 2g = ?

In other words, in order to know whether 2 H(c), we look inside c for a tag 1 or 2, then if we nd one (say 1), we write c = q1(a) and ask whether 2 G(a).

This solution interprets the standard conversion schemes:

x: u y: v ( 1r)

u[r=x]

x: u y: v ( 2s)

v[s=y]

However the interpretation H of the term x: ( 1x) y: ( 2y) z, which is de ned by

H(q1(a)) = q1(a)

H(q2(b)) = q2(b)

H(c) = ? if c \ f1; 2g = ?

does not always satisfy H(c) = c. In fact this equation is satis ed only for c of the form q1(a), q2(b) or ?.

On the other hand, the commuting conversions do hold: let t 7!E t be an elimination of the form 1t, or 2t, or t w, or "U t, or x0: u0 y0: v0 t. We want

to

check that E ( x: u y: v t) and x: (E u) y: (E v) t have the same interpretation.

In

the case where (semantically) t is q1a,

the two expressions give [[E u]](a).

In

the case where c \ f1; 2g = ?, we get on

the one hand E(?) where E is

the

stable function corresponding to E, and on the other ?; but it is easy to see that E(?) = ? (E is strict) in all the cases in question.

Having said this, the presence of an equation (however minor) which is not interpreted means we must reject the semantics. Even if we are unsure how to use it, the equation

x: ( 1x) y: ( 2y) t = t

plays a part in the implicit symmetries of the disjunction. Once again, we are not looking for a model at any price, but for a convincing one. For that, even the secondary connectors (such as _) and the marginal equations are precious, because they show up some points of discord between syntax and semantics. By trying to analyse this discord, one can hope to nd some properties hidden in the syntax.

12.2. LIFTED SUM

97

12.2.1dI-domains

There is a simple solution, but it requires the abandonment of coherence spaces: let us simply say that in A q B, we only consider such objects as q1a, q2b and ?. As a result of what has gone before, everything will work properly, but the structure so obtained is no longer a coherence space: indeed, if 2 jAj, then q1 = f1; (1; )g appears in A q B, but not its subset f(1; )g.

In fact, we see that it is necessary to add to the idea of coherence a partial order relation, here 1 < (1; ), 2 < (2; ). We are interested in coherent subsets of the space which are downwards-closed: if 0 < 2 a, then 0 2 a. According to [Winskel], the tokens should be regarded as \events", where coherence speci es when two events may co-exist and the partial order 0 < says that if the eventis present then the event 0 must also be present. This is called an event structure; [CGW86] characterises the resulting spaces, which are exactly [Berry]'s original dI-domains.

As an example, one can re-de ne the lazy natural numbers, Int+, which we met in section 9.3.2. Clearly we want p+ < q and p+ < q+ for p < q; one may then show that the points of the corresponding dI-domain Int< are just the pe, p, ? and 1f. The three spaces satisfy the domain equations

Int ' Sgl Int Int+ ' Sgl (Sgl N Int+) Int< ' Emp q Int<

where Sgl is the coherence space with just one token (section 12.6). This may be used as an alternative way of de ning inductive data types.

The damage caused by this interpretation is limited, because one can require that for all 2 jAj, the set of 0 < be nite, which ensures that the down-closure of a nite set is always nite, and so we are saved from one of our objections to Scott domains.

Semantically, there is nothing else to quarrel with about this interpretation, which accounts for all reasonable constructions. But on the other hand, it forces us to leave the class of coherence spaces, and uses an order relation which compromises the conceptual simplicity of the system.

This leads us to look for something else, which does preserve this class. The price will be a more complicated interpretation of the sum (although we are basically only interested in the sum as a test for our semantic ideas) but we shall be rewarded with a novel idea: linearity.

The interpretation we shall give is manifestly not associative. It is interesting to remark that Winskel's interpretation is not either: indeed, if A; B; C are coherence spaces considered as event structures (with a trivial order relation) then (A q B) q C and A q (B q C) are not the same:

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