# Not wanted on voyage

FROM VALUE PAGE:

## Equations

Equations for terms are alpha-conversion plus:

let P = M; P | = | M
let P = P; M | = | M
(D D') M | = | D (D' M)
D let P = M; M' | = | let P = (D M); M' | (bv D fv M' = Ø)
D (M M') | = | (D M) M' | (bv D fv M' = Ø)
D (M1,...,Mn) | = | (D M1,...,D Mn)

Equations for declarations are alpha-conversion plus:

let P = (D P) | = | D | (bv P = bv D)
let (P1,...,Pn) = (M1,...,Mn); | = | let P1 = M1;...; let Pn = Mn; | (bv Pi fv Mj = Ø)
(D; D'); D'' | = | D (D' D'')
D () | = | D
() D | = | D
D D' | = | D' D | (bv D fv D' = fv D bv D' = Ø)

We shall write ` M = M' : T in val' and ` D = D' : T in val' for the typed proof system given by the above axioms.

## Syntactic category

Let val be the category with:

- Objects are vectors of types.

- Morphisms from T to U are judgements of the form:

  x : T M : (U) in val

  viewed up to alpha-conversion and provable equality.

- Identity is:

  x : T (x) : (T) in val

- The composition of two morphisms:

  (x : T M : (U) in val) ; (y : U N : (V) in val)

  is given by let-binding:

  (x : T let (y : U) = M; N : (V) in val)

where x is the vector x1...xn, and T is the vector T1...Tn.

The category val has finite products, with (using alpha-conversion to avoid variable name clashes):

- Product on objects is concatenation of vectors.

- Product on morphisms:

  (x : T M : (T') in val) (y : U N : (U') in val)

  is given by pairing:

  xy : TU let (x' : T') = M; let (y' : U') = N; (x'y') : (T'U') in val

- Diagonal is given by duplicating variables:

  x : T (xx) : (TT) in val

- Symmetry is given by swapping variables:

  xy : TU (yx) : (UT) in val

- Terminal is given by:

  x : T () : () in val

## Graphical presentation

We shall now give a graphical presentation of a cartesian closed category, which allows us to draw data-flow diagrams for programs in val. These graphs are acyclic flow graphs, with edges labelled by base types and nodes labelled by constructors. These are described more formally in an appendix.

The symmetric monoidal structure is drawn:

Identity: |
| Composition: |
Tensor: |
Symmetry: |

The product structure is drawn:

Diagonal: | Terminal: |

We can now present the axioms of a category with finite products in graphical form. First, we present the symmetric monoidal axioms, all of which are graph isomorphisms.

Left unit: |  | = |
Right unit: |  | = |
Associativity: |  | = |
Functoriality of tensor wrt identity: |  | = |
Functoriality of tensor wrt composition: |  | = |
Symmetry is an iso: |  | = |
Symmetry is natural: |  | = |

As well as the symmetric monoidal category axioms, we have diagonal and terminal natural transformations, so the category has finite products. The coherence conditions are multigraph isomorphisms:

Symmetry respects diagonal 1: |  | = |
Symmetry respects diagonal 2: |  | = |
Terminal repsects diagonal: |  | = |

The naturality conditions for the product structure are not multigraph isomorphisms, but are bisimulations (as discussed in an appendix):

Diagonal is natural: |  | = |
Terminal is natural: |  | = |

## Equations

local rec x; let y:T = x; let x:T = M | = | let y:T = M | (x fv M)
(local rec x; D) D' | = | local rec x; (D D') | (x fv D')
D (local rec x; D') | = | local rec x (D; D') | (x fv D)
local rec x; local rec y; D | = | local rec y; local rec x; D

The recursive structure we have added allows us to find fixed points in val, on objects from proc. This is a familiar story to domain theorists, where it is common to find fixed points on (non-strict) Cpo morphisms on (pointed) Cpo objects.

To give a categorical account of recursive declarations, we borrow Hasegawa's presentation of recursive declarations, adapting Joyal, Street and Verity's traced monoidal structure. However, there is a crucial difference between our presentation and Hasegawa's: we are considering call-by-value semantics (such as the Cpo example above) where Hasegawa is considering call-by-name. The call-by-value category Cpo has smash product as its monoidal structure, so does not support a trace, whereas the call-by-name equivalent has non-strict product, and so does support a trace.

A trace on a symmetric monoidal category is given by a natural transformation:

TrX Y Z : C[X Z, Y Z] C[X, Y]

satisfying certain axioms. For example, Hasegawa shows that the category of pointed cpos with non-strict product has a trace given by fixed points.

As noted above, the category Cpo (of pointed cpos with smash product) does not have a trace, since the obvious fixed-point construction is the trivial one, since the fixed point of any strict map is the constant bottom map, and smash producting bottom with any other map yields bottom. Thus the attempt to duplicate Hasegawa's construction in the call-by-value case yields the constant bottm natural transformation, which fails to satisfy the trace axioms.

We need to generalize the trace construction to include cases such as Cpo, and fortunately there is an obvious such generalization. Given a symmetric monoidal category C with a full subcategory (not necessarily symmetric monoidal) TC

U : TC C

a partial trace is a natural transformation:

TrX Y A : C[X U A, Y U A] C[X, Y]

satisfying certain axioms (given in an appendix).

Adding local rec declarations gives the syntactic category val a partial trace (where TC is the full subcategory of traceable types) where the trace of

xz : TV M : (UV) in val

is given by a local rec declaration:

xz : TV local rec z; let (yz : UV) = M; (y) : (U) in val

This trace is partial because of the condition that T has to be traceable.

Last modified: Mon Sep 22 15:22:12 BST 1997