Lecture 16: Sequential Algorithms

Lecture 16

  • Sequential ⟹ Stable
  • Cds M=(Ccells,Vvalues,EC×V = events, enabling relation, of the form c or (d,v)c)

Revisit the definition of MM

  • Good for straightforward cartesian closure: M=MM

  • Good for straightforward execution: Forest/programs

  • Good for straightforward composition: (function,comp.strat)

Recall that a proof is a sequence

cnvncn1c1v1c0

st

cn and (ci,vi)ci1i>0
  • Condition 1: an infinite proof
  • Condition 2 (Stability): if cnvncn1c1v1c0=c

    dmwmd1w1d0=c

    are two proofs of the same cell, then the longest common prefix is either or ends with a cell.

    (cf. picture)

If M is a cds, a configuration of M is a set xE st (determinism):

(c,v1),(c,v2)xv1=v2

On top of that:

(c,v)x, either c or (d,w)x;(d,w)c

Notations:

  • (c,v)x iff cF(x) (filled)
  • If cF(x) and (d,w)x and (d,w)ccA(x) (accessible)
  • cE(x)cA(x) or cF(x) (enabled)

(cf. picture)

The stability condition allows us to represent configurations as forests (the (d,w) is unique, in the determinism property).

Example: Σ={f2,g1,a0}. cf picture for f(g(Ω),a)

We write

D(M)={configurations of M},

Prop: for every cds M, D(M) satisfies:

x,y.xyxy is a configuration that is the glb of x and y

Proof: x,yzD(M)

  • cF(xy)cF(x) thus if (c,v1),(c,v2)F(xy), then v1=v2

  • if cF(xy), then there exists (d,w)xy by uniqueness (stability) such that (d,w)c


Let M,M be two cds and f:D(M)D(M) be Scott-continuous.

f is called sequential at x if

c,(cA(f(x)) and z>x;cF(f(z)))cA(x) st y>x;(cF(f(y))cF(y))

Th: Any sequential algorithm computes a sequential function

Prop: Any sequential function is stable.

 Sequential  Stable  Continuous 

Proof:

By contradiction, suppose that

f(xy)f(x)f(y)

3 different ways to define sequential algorithms (78)

  1. As configurations of MM=(C,V,E,)

    C=Dfin(M)×CV={valofccC}{outputvvV}E{(xc,outputv)(c,v)C×V}{(xc,valofc)cA(x)}c iff c(xc,outputv)xd iff c,vd(xc,valofc)(x{(c,v)})c iff (c,v)E

A dive into the corresponding category:

  • Objects: Cds
  • SeqAlg whose morphisms are given by

    SeqAlg(M,M)=D(MM)
D(MM)D(MM)D(M(M×M))

Look at the cells, they have the form:

xc.1xc.2 with xD(M)

Similarly, we have to check that

D((M×M)M)D(M(MM))

Cells in both of them: resp. of the form (x,x)c and x(xc) (recall that D(M×M)D(M)×D(M))

Categorical composition

Sequential algorithms as forests

Consider the quick left or:

Bool2cells: ?.1 and ?.2Boolcells: ?

cf. pictures

Formally, sequential algorithms as forests are defined via

  • a recursive syntax
  • typing rules
Forest: F=(T1,,Tn)Trees: T=requestcUU: T=valofc{isviUi}outputvF

We only accept forests that are well-typed:

(xDfin(M),rof the form qv where q is a proof of M)F(x,r)T(x,q)U

and:

(x,r)T1(x,r)Tn(x,r)F (x,rc)U(x,r)requestcUrc is a proof in M cA(x)(x{(c,v)},q)Ui(x,q)valofc(isviUi) q=rc(c,v)E(x,qM)F(x,q)outputvF

Alternatively, we can give a syntax in terms of branches (aka plays):

(requestc(valofcisv)outputv)+requestc(valofcisv)valofc

E.g.: requestcvalofc is allowed (corresponding to (c,valofc))

Composition

f:MMg:MMgf:MMx:1Mf:MMf(x):MM

where

1= empty set of cells

A generalized point x is of the form:

requestc1outputv1requestv2

i.e., in a way: xD(M)

cf. picture

Leave a comment