Bistable Biorders: A Sequential Domain Theory

We give a simple order-theoretic construction of a Cartesian closed category of sequential functions. It is based on bistable biorders, which are sets with a partial order -- the extensional order -- and a bistable coherence, which captures equivalence of program behaviour, up to permutation of top (error) and bottom (divergence). We show that monotone and bistable functions (which are required to preserve bistably bounded meets and joins) are strongly sequential, and use this fact to prove universality results for the bistable biorder semantics of the simply-typed lambda-calculus (with atomic constants), and an extension with arithmetic and recursion. We also construct a bistable model of SPCF, a higher-order functional programming language with non-local control. We use our universality result for the lambda-calculus to show that the semantics of SPCF is fully abstract. We then establish a direct correspondence between bistable functions and sequential algorithms by showing that sequential data structures give rise to bistable biorders, and that each bistable function between such biorders is computed by a sequential algorithm.


Introduction
Since its inception, domain theory has been a dominant paradigm in denotational semantics; it is a natural and mathematically rich theory with broad applicability across a wide range of phenomena.However, a limitation of domain theory has been its failure to capture the intensional aspects of computation.The observation of Plotkin [28], that the continuous functional model of PCF is not fully abstract, because it contains functions which are not sequential, is symptomatic, but the problem cuts deeper; in the presence of computational effects such as state or concurrency, intensional properties such as the order of computation become critical, and must be captured by some means in any sound model.
Thus, a longstanding problem in domain theory, and the subject of a significant amount of research [2,12,4,5], has been to find a simple characterization of higher-order sequential functions which is wholly extensional in character.Typically, what is sought is some form of mathematical structure, such that all set-theoretic functions which preserve this structure 1.1.Related Work.The notion of bistable biorder which is elaborated here was first presented (in a slightly different form) in [14], together with a (different) proof of full abstraction for a model of SPCF.Curien [9], Streicher [30] and Löw [32] have studied bistable functionals, and proved versions of some of the results described here (such as the correspondence between sequential algorithms and bistable functions in [9,32]).The use of definable retractions to prove definability and full abstraction for observably sequential languages originates with Longley [23,24].The concluding section of this paper gives references to more recent work on bidomain models of sequential languages.
1.2.Outline of the Paper.In Section 2, we describe the notion of bistable biorder and bistable function, and prove that it yields a Cartesian closed category.We prove that this contains a universal model of the simply-typed λ-calculus Λ ⊤ ⊥ over a single atomic type containing two constants (⊤ and ⊥), equivalent to the "minimal model" of Λ ⊤ ⊥ [26].In Section 3, we develop a notion of complete bistable biorder, or bistable bicpo, and show that we may define a CCC of bicpos and continuous and bistable functions.We give a semantics of SPCF in this category, and prove that it is fully abstract.In section 4 we describe a universal model of a λ-calculus extending Λ ⊤ ⊥ with arithmetic operations and recursion, which may be viewed as a target language for CPS interpretation of observably sequential languages such as SPCF.In Section 5, we investigate the correspondence between sequential algorithms on sequential data structures and bistable functions, showing that each of the latter gives rise to a bistable bicpo, and that each sequential algorithm on the "function-space" computes a bistable function.We then prove that every bistable function is computed in this way, and hence that there is a full embedding of the category of sequential data structures and sequential algorithms in the category of bistable bicpos and bistable and continuous functions.

Bistable Biorders
Definition 2.1.A bistable biorder is a tuple (D, ≤ E , ), where (D, ≤ E ) is a partial order (the extensional order), and is an equivalence relation (bistable coherence) on D such that each -equivalence class is a distributive lattice with respect to ≤ E , and inclusion into D preserves meets and joins.
Bistable biorders were introduced in [14] as biordered sets (hence the name).In particular, we may define a bistable biorder to be a tuple D, ≤ E , ≤ B , where (D, ≤ E ) and (D, ≤ B ) are partial orders such that: Proposition 2.2.The definitions of bistable biorder are equivalent.
Proof.From the bistable order, we may define the bistable coherence relation: a b if a and b are bounded above in (D, ≤ B ).This is an equivalence relation, since if f, g ≤ B p and g, h ≤ B q, then g ≤ B p, q and hence p, q are bounded above and thus f h.
From the bistable coherence relation, we may define the bistable order x ≤ B y if x y and x ≤ E y.
We shall now construct a Cartesian closed category of bistable biorders and monotone and bistable functions.
We define a category BBO in which objects are bistable biorders and morphisms are monotone and bistable functions.
Proof.The product and co-product operations on bistable orders are defined directly (pointwise): The unit for the product is the one-point biorder, 1 and the unit for the co-product is the empty biorder.
We will now show that BBO is Cartesian closed by defining an exponential: a bistable biorder of functions, in which the extensional order is standard, and the bistable order is a symmetric version of the stable order.Definition 2.5.Given bistable biorders D, E, we define the function-space D ⇒ E to be the set of monotone and bistable functions from D to E, with Lemma 2.6.D ⇒ E is a bistable biorder.
Proof.If f g then f (a) ↑ ↓ g(a) for all a, and so we may define ≤ E meets and joins f ∧ g and f ∨ g pointwise: .
We now show that f ∧ g and f ∨ g are monotone and bistable functions -e.g. if , and for all y such that x y, f ( Finally, we need to prove that ↑ ↓ is transitive, for example, suppose f ↑ ↓ g and g ↑ ↓ h.Suppose x ↑ ↓ y.Then: Proof.We need to show that the natural bijection taking f : ), and its inverse, are well-defined on bistable biorders and bistable functions.This is similar to the proof for (stable) biorders and stable and monotone functions [3].
For example, to show that Λ(f ) preserves bistable coherence: Conversely, to show that if g : A bistable biorder D is pointed if (D, ≤ E ) has a least element ⊥ and a greatest element ⊤, such that ⊥ ⊤.A monotone bistable function f of pointed biorders is bistrict if it preserves the meet and join of the empty set -i.e.f (⊤) = ⊤ and f (⊥) = ⊥.We define the category BBO s of pointed bistable biorders and strict, monotone and bistable functions.Proof.The bilifting operation takes a bistable biorder A to a pointed bistable biorder by adding two new points, ⊤ and ⊥: A ⊤ ⊥ = (A × { * }) ∪ {⊥, ⊤}, where: 2.1.First-Order Sequentiality and Universality.A key step in proving universality for observably sequential languages is the observation that the monotone and bistable functions on pointed bistable biorders are bisequential (i.e.sequential with respect to both ⊥ and ⊤ elements).
Definition 2.9.Given pointed bistable biorders A 1 , . . ., A n , B, a function f : Lemma 2.10.Given pointed bistable biorders A 1 , . . ., A n , every strict, monotone and bistable function f : and so for some and so either ⊥[⊤] j = ⊤[⊥] i -in which case each A k is the one-point order -or else i = j as required, and hence i is unique -i.e.bisequential functions are strongly sequential.

Universality for Λ ⊤
⊥ .Let Λ ⊤ ⊥ be the simply-typed λ-calculus with products, over a single base type Σ containing the constants ⊤ and ⊥.The "minimal" model of this language (that is, the model inducing the maximal consistent theory containing β and η) was shown to be effectively presentable by Padovani [26] using an analysis of the syntax.By Cartesian closure of BBO, we obtain a model of Λ ⊤ ⊥ in which each type is interpreted as the corresponding bistable biorder.We will show that this is the minimal model.
For each type S of Λ ⊤ ⊥ , an element of the corresponding biorder is definable if it is the denotation of a closed term of type S. Universality holds at S if every element of S is definable.Universality at first-order function types is a consequence of sequentiality.

Lemma 2.11. The bistable model of Λ ⊤
⊥ is universal at all types of the form Σ n ⇒ Σ m .Proof.Suppose m = 1.If f is constant (⊤ or ⊥), then f is definable.Otherwise, f is strict, and hence for some i, f is i-strict -i.e.f = π i , and is therefore definable.If m > 1, we have f = f ; π i | i ≤ m , and f ; π i is definable for each i and so f is definable.
We will now prove that universality at higher-order types reduces to universality at first-order, using the notion of definable retraction.Definition 2.12.Given types S, T , a definable retraction from S to T (which we may write inj : S ¢ T : proj or just S ¢ T ) is a pair of terms: inj : S ⇒ T and proj : T ⇒ S which denote a retraction in BBO (i.e.[[inj]]; [[proj]] = id S ).

So we can prove universality for Λ ⊤
⊥ by showing that every Λ ⊤ ⊥ type is a definable retract of a first order type.To do so, we require a few simple facts about definable retractions.Lemma 2.14.If inj T : T 1 ¢ T 2 : proj T , and inj S : Proof.We have, for example, λf x.inj T (f (proj S x) : The key to reducing the order of the function-space is the fact that for any n, by Lemma 2.15 and strictness of f , and similarly if f (e) = ⊥, then (g f )(e) = ⊥.Hence g(f ) = f as required.
Proof.Consider the terms Proof.By induction on m.For the base case (m = 1), we have (Σ n ⇒ Σ) ⇒ Σ ¢ (Σ ⇒ Σ)×Σ n by Lemma 2.17, and since Σ ⇒ Σ¢Σ n +1 ⇒ Σ, and Proof. is by induction on type structure.For the induction cases: By applying Lemma 2.13 to Lemmas 2.11 and 2.19 we have established:

J. LAIRD
Our proof also yields a solution to a related problem: to give a simple axiomatization of the theory of the minimal model.Definition 2.22.Let the theory = ⊤ ⊥ over the terms of Λ ⊤ ⊥ be the compatible, symmetric and transitive closure of βηπ-equivalence extended with the axioms f : For each type T , we have a definable retraction inj T : Proof.This is by induction on T , following the definition of proj T and inj T , since to prove that they define a retraction in BBO, we used only standard properties of all CCCs (i.e.βηπ-equivalence) together with ( . Hence for each j ≤ m(T ), the terms λx.π j ((inj M ) x) and λx.π j ((inj N ) x) have the same head-normal form (i.e.λx.⊤, λx.⊥ or λx.π i x for some 1

Bistable bicpos
We shall now extend our notion of bistable biorder with notions of completeness and continuity.Definition 3.1.Given ≤ E -directed sets X, Y , we say that X ↑ ↓ Y if for all x ∈ X and y ∈ Y there exists x ′ ∈ X and y Let BBC be the category of bistable bicpos and continuous and bistable functions.
Proof.We show that for any directed set F of functions from A to B, a bistable and continuous least upper bound can be defined pointwise -( F )(a) = F (a), where To show preservation of glbs, we note that {f (a The bistable bicpos are also closed under the lifting and coproduct operations.
3.1.SPCF.We have defined a cpo-enriched Cartesian closed category of sequential functionals, in which we may interpret PCF.We will now show that we have a fully abstract semantics of SPCF [6] -PCF with a non-local control operatorcatch -and an "error", ⊤.Thus we may connect our bistable semantics of Λ ⊤ ⊥ to the "original" observably sequential language, SPCF.In doing so, we establish indirectly the correspondence between observably sequential functionals and bistable functionals, since both yield fully abstract imodels of SPCF.In the case of the bistable model, our proof of universality for Λ ⊤ ⊥ gives an easy proof of full abstraction, since every SPCF type-object is a limit for a chain of Λ ⊤ ⊥ types.
The types of SPCF are given by the following grammar: Terms are obtained by extending the simply-typed λ-calculus with pairing and projection and the following constants: Divergence and Error: ⊤, ⊥ : Σ, Numerals: 0 : nat, succ, pred : nat ⇒ nat, Conditionals: The control operator catch is a basic form of Cartwright and Felleisen's catch [6]; it sends i-strict functions (ith-projection) to i.Despite its simplicity, it can be used to derive (call-by-name versions of) control operators such as Felleisen's idealized call-with-currentcontinuation operator C : ((nat ⇒ Σ) ⇒ Σ) ⇒ nat [10]: We may give a simple operational semantics for SPCF programsclosed terms of type Σ -using evaluation contexts, Definition 3.3.Evaluation contexts of SPCF are given by the following grammar: The "small-step" operational semantics of SPCF programs is given in Table 1.The rule for catch makes its connection with control operators such as callcc apparent; the current continuation (represented as a tuple of evaluation contexts filled with the possible values for catch M ) is passed as an argument to M .For a program M we write M ⇓ if M ։ ⊤.We adopt a standard definition of observational approximation and equivalence: Table 1: "Small-step" operational semantics for SPCF programs.
given terms M, N :

3.2.
The bistable model of SPCF.The ground type nat is interpreted as N ⊤ ⊥ , where N is the set of natural numbers with the trivial extensional and bistable orderings.We interpret catch n as the strict bistable function from Σ n ⇒ Σ to N ⊤ ⊥ which sends the ith projection to the value i.The interpretation of the remainder of the language (i.e.PCF) is standard, since BBC is a cpo-enriched Cartesian closed category.
Adequacy is proved using a Tait-style computability predicate argument as for PCF [28].
We prove full abstraction by reduction to universality for Λ ⊤ ⊥ .The key to doing this is the observation that for each i, the type Σ i ⇒ Σ is a definable retract of nat.
For each n ≥ 1 we have projection maps from N ⊤ ⊥ to Σ n ⇒ Σ sending i < n to the i + 1th projection, and i ≥ n to ⊥.These are definable as n-ary case statements case n , where case 1 = λx.λy.((IF0 x) x, ⊥ ), and case n+1 = λx.λy.(IF0 x) π 1 y, (case n (pred x)) (π 2 y) Lemma 3.5.For each SPCF type S there is a sequence of Λ ⊤ ⊥ types {S i : i ∈ ω} with SPCF-definable retractions: Proof.We define Σ i = Σ, nat i = Σ i ⇒ Σ (and so inj i = catch i and proj i = case i ), (S × T ) i = S i × T i , and (S ⇒ T ) i = S i ⇒ T i .Theorem 3.6.For all terms M, N , M N if and only if Proof.Inequational soundness follows from soundness and adequacy: if

Universality for a CPS Target Language
We have given a direct interpretation of SPCF in the category of bistable bicpos and bistable and continuous functions, but this is in fact equivalent to a CPS (continuationpassing-style) interpretation (in the style of Streicher and Reus [31]).This may be described as a translation into a target language, Λ ⊤ ⊥ (ω), which is an extension of Λ ⊤ ⊥ with arithmetic and recursion (and which may also be used as a target calculus for CPS translation of call-by-value variants of SPCF).By proving universality for this calculus we show that it precisely captures the observably sequential functions over the given type-structure.
Types of Λ ⊤ ⊥ (ω) are generated from two ground types: a data type of natural number values and the program (or "response") type Σ. Programs of function type may take either data or programs as arguments, but must return a program -i.e.nat may not occur on the right of an arrow.Thus the types of our language are: where P = N (we refer to non-N types as pointed).

SPCF and Λ ⊤
⊥ (ω).We may embed SPCF in Λ ⊤ ⊥ (ω) via a fragment of the call-by-name CPS interpretation, by representing the type N as (N ⇒ Σ) ⇒ Σ.The constants of SPCF may thus be expressed in Λ ⊤ ⊥ (ω) as macros: In fact, this yields an interpretation of SPCF in the category of bistable bicpos which is equivalent to the direct one, because the objects N ⊤ ⊥ and (N ⇒ Σ) ⇒ Σ are isomorphic.To show this, we extend our sequentiality result for bistable functions to those which take an argument of the form N ⇒ D. Noting that N ⇒ D ∼ = Π i∈N D, if D and E are pointed, we say that a function f : Lemma 4.1.If A is pointed then every strict, continuous and bistable function f : (N ⇒ A) ⇒ Σ is i-strict for some i.
Proof.Given i ∈ N, a ∈ A, and e ∈ N ⇒ A, let e[a] i ∈ N ⇒ A denote the function defined: for all i, j, and so by continuity and bistability, f Hence the strict function from So every SPCF type-object is isomorphic to the corresponding Λ ⊤ ⊥ (ω) type-object.Moreoever, it is straightforward to show that the interpretation of SPCF constants factors through this isomorphism and hence: Proposition 4.3.The direct and indirect interpretations of SPCF are equivalent.
Note that we may express h[a] i in Λ ⊤ ⊥ (ω) as λx.IF0 x = i then a else (h x).To prove that this defines a retraction, we require a bound on the number of times the fixpoint must be unwound to compute inj(f ) for finitary f ∈ U ⇒ Σ. Definition 4.7.A function f : U → Σ is i-dependent if there exist g, h ∈ U such that g(j) = h(j) for all j = i and f (g) = f (k).We shall say that f has finite support if the set of i ∈ N such that f is i-dependent is finite.Proof.For each g ∈ U , define g i ∈ U by g i (x) = g(x) if x ≤ i and g(x) = ⊥, otherwise.Then f i : U → Σ, defined f i (g) = f (g i ) is continuous and bistable, and k-dependent only for k ≤ i.By continuity, {f i | i ∈ N} = f .Lemma 4.9.If f has finitary support then inj(proj(f )) = f .Proof.By induction on the size of the set of n ∈ N such that f is n-dependent.If f is not n-dependent for any n then it is constant, and so inj(proj(f )) = f by strictness of inj, proj.
Suppose f is i-strict (hence i-dependent).Unfolding the fixpoint gives inj(f ) = λx.λy.f λa.λb.Hence proj(inj(f Observe that λk.f k[v] i is n-dependent on strictly fewer n than f , since it is not idependent but if it is n-dependent for some n = i then so is f .Hence by hypothesis proj(inj Proof.For each i, proj(inj(f i )) = f i by Lemma 4.9, and so proj(inj(f It is now straightforward to prove universality of U .
Proposition 4.11.For each pointed type T there is a definable retraction from T to U U ⇒ U ¢ U .
Proof.By induction on the structure of T .For the induction step, suppose T = R ⇒ S, then: Lemma 4.12.The bistable semantics of Then f is definable as the term: ). Hence by Lemma 2.13 we have shown the following.

4.3.
Extending the Bistable Semantics.We may us bicpos to give (fully abstract) interpretations of functional programming languages with a variety of features of, including recursive types, call-by-value functions, and different control primitives.In general, these models follow the same lines as those based on cpos and continuous functions.Sum Types: We may interpret sum types using either the coproduct, the "bilifted coproduct", A ⊕ B = (A + B) ⊤ ⊥ , or a "bi-coalesced" sum identifying the ⊤ and ⊥ elements of its components.Using the bilifted co-product, for example, we may construct a fully abstract model of SPCF extended with sums [14].It is straightforward to reduce full abstraction for this semantics to the case of the language without sums by using a definable retraction A ⊕ B ¢ nat × A × B. (The injection from A ⊕ B to nat × A × B sends in l (e) to 0, e, ⊥ and in r (e) to 1, ⊥, e , and the projection from nat × A × B to A ⊕ B sends 0, d, e to in l (d), n + 1, d, e to in r (e).)Recursive Types: We may interpret general recursive types using bistable variants of the standard techniques for determining colimits of ω-chains of cpos [29,27].For example, we may give an observably sequential version of Plotkin's FPC [11] by adding recursive types to SPCF.We may prove full abstraction for the resulting semantics by showing that every type is the limit of a chain of SPCF types, as shown for unary FPC in [15].Call-by-value: Our constructions generalize naturally to a call-by-value setting using standard techniques; for example, the strong monad ( ) ⊤ ⊥ meets the requirements for a model of Moggi's computational metalanguage [25].
Hence we can interpret a call-by-value version of SPCF with catch.A proof of full abstraction for this model using definable retractions is given in [20].Alternatively, we may interpret call-by-value SPCF with control (i.e.callcc) at all types by CPS interpretation.Continuation-passing style interpretation: We have given a simple interpretation of SPCF inside Λ ⊤ ⊥ (ω): this corresponds to a special case of the call-by-name CPS interpretation of Streicher and Reus [31], in which (closed) terms M : T are interpreted as elements of In general (in call-by-value, or call-by-name with sum types), continuation-passing style interpretations will not be equivalent to those based on the lifting monad (the latter is equivalent to a linear CPS monad [17]).CPS interpretation yields models with "higher-order" control (callcc at all types), whilst lifting yields models with "first-order control" (catch or callcc at ground type only).

Bistable functions and Sequential Algorithms
As we have already observed, sequential algorithms also provide a description of the fully abstract model of SPCF [7], and thus correspond to bistable functions.We shall now make this correspondence explicit, by showing that the set of sequential data algorithms on a sequential data structure forms a bistable bicpo, and that all bistable functions between such spaces of strategies are observably sequential, in that they are computed by a sequential algorithm on the corresponding function-space SDS.(Similar results have been described by Curien [9] and Streicher [30].) As observed in [21,8], sequential algorithms on sequential data structures may be represented as strategies on a game (of the basic form described in [1]).We adopt this presentation, capturing interactions which result in an error (⊤) as odd-length traces.
A sequential data structure game A is specified by a triple (M A , λ A , P A ), where M A is a set of moves with a labelling function λ A : M A → {P, O} which partitions M A into sets of Player and Opponent moves.
A is the set of plays of A, where M ⊛ A is the set of sequences over A which are finite, alternating (i.e.P-moves are immediately preceded by O-moves and vice-versa), and contain at most one occurrence of each move and at least as many Opponent as Player moves.Key examples are the "empty game" ∅, ∅, {ε} , and the game with one (Opponent) move o = {o}, o, O , {ε, o} .
Sequential algorithms, or Player strategies on A, are represented as sets of plays, using odd-length sequences to represent divergences.We write s ⊑ E t for the partial order on sequences defined "s is an even-length prefix of t or s = t".Definition 5.1.A sequential algorithm over a game A is a non-empty subset of P A , subject to the conditions: (So the only odd-length sequences in σ are of maximal length.)We shall write strat(A) for the set of strategies over A. Given a strategy σ, we shall write E(σ) for its set of even-length sequences (which is a strategy).So, for instance, there are two strategies over o, {ε} and {ε, o}.We shall now define an extensional order and bistable coherence making strat(A) a bistable bicpo.Definition 5.2.We first define the extensional order on plays: s ≤ E t if s is even-length and s ⊑ t, or t is odd-length and t ⊑ s.This is a partial order -to show antisymmetry, note that if s ≤ E t and t ≤ E s then s and t are either both even or both odd, and hence s = t.Thus we may define a partial order on strategies: σ ≤ E τ if ∀s ∈ σ.∃t ∈ τ.s ≤ E t.We establish that this is a partial order by proving antisymmetry.
Proof.We prove that s ∈ σ if and only if s ∈ τ by induction on length.For the induction case suppose sab ∈ E(σ).Then s ∈ σ and so s ∈ τ , and there exists t ∈ τ such that sab ≤ E t.If sab ⊑ t then sab ∈ τ .Otherwise t is odd-length and t ⊑ sab.Then there exists t ′ ∈ σ such that t ≤ E t ′ and so t ′ ⊑ t ⊑ sab.But this contradicts determinacy of σ.
So in strat(o), for instance, we have {ε} ≤ E {ε, o}.More generally, for each game there is a ≤ E -least element ⊥ -the empty strategy -and a ≤ E -greatest element ⊤, which contains every play consisting of at most one move.Definition 5.4.Two strategies are bistably coherent if they have the same non-divergent traces -i.e.σ τ if E(σ) = E(τ ).
It is straightforward to see that σ ∪ τ is a least upper bound, since σ, τ ⊆ σ ∪ τ , and if σ, τ ≤ E ρ, then for all s ∈ σ ∪ τ , either s ∈ σ or s ∈ τ and we have r ∈ ρ such that s ≤ E r.
We now prove completeness.For a directed set of strategies S ⊆ strat(A), we define This is a well-defined strategy: if s, t ∈ S then there exists τ ∈ S such that σ(s), σ(t) ≤ E τ and so s, t ∈ τ and are therefore even-branching.
S is an upper bound for S: We prove by induction on sequence length that if s ∈ σ ∈ S then there exists t ∈ S such that s ≤ E t. Suppose there exists τ ∈ S with σ ≤ E τ such that s ∈ τ .Then there exists s ′ ∈ τ with s ≤ E s ′ , and s ′ must be a (proper) prefix of s so by hypothesis, there exists t ∈ S with s ≤ E s ′ ≤ E t.
S is a least upper bound: If σ ≤ E τ for all σ ∈ S, then if s ∈ S then s ∈ σ(s) ≤ E τ , and so there exists t ∈ τ with s ≤ E t.
The proof that preserves bistable glbs is similar.
We shall say that a biorder arising as strat(A) for some sequential data structure is an SDS-biorder.5.1.Bistable Functions and observably sequential functions.We shall now show that bistable functions between spaces of sequential algorithms correspond to sequential algorithms on the corresponding "function-space" sequential data structure.We follow Lamarche [21] and Curien [8] in decomposing this into an affine function space A ⊸ B, and a !operator.
Definition 5.6.The affine function-space A ⊸ B is formed as follows.
We define the application of a strategy σ : A ⇒ B to a strategy σ : B by combining the promotion and affine application operations: We define an observably sequential function between sequential data structures A and B to be a function f : strat(A) → strat(B) which is "realized" by a sequential algorithm σ f : A ⇒ B -i.e.f (τ ) = σ f • τ .By Lemmas 5.7 and 5.9, we have shown the following.
We shall now show that every strategy on A ⇒ B corresponds to a continuous and bistable function from strat(A) to strat(B).To do so, we observe that bistable functions are stable with respect to the inclusion order -i.e.continuous with respect to ⊆, and conditionally multiplicative Proposition 5.11.Every bistable and continuous function of SDS-biorders is stable.
, where s ′ a is the maximal prefix of s such that s ′ ∈ σ ∩ τ ) and similarly τ ≤ E τ ′ .Moreover σ ′ τ ′ and σ ′ ∩ τ ′ = σ ∩ τ , and so Hence f is also monotone with respect to ⊆, and moreover continuous because every ⊆-directed set is ≤ E -directed.
Thus each continuous and bistable function f : strat(A) → strat(B) has a trace: tr We define a sequential algorithm σ f : A ⇒ B for computing f by "sequentializing" this trace: Lemma 5.12.σ f is a well-defined strategy on A ⇒ B.
Proof.σ f is even-prefix-closed by definition.To prove that it is even-branching, suppose sab, sac ∈ σ f .We show that b = c.
But by definition of σ f , (|sab↾!A| E , sab↾B) ∈ tr(f ), which is a contradiction.We show that if s ∈ σ f is odd-length, then there is no extension of s in σ f by the same argument.
We may now show how to sequentialize each element of tr(f ).Lemma 5.16.Let f : strat(A) → strat(B) be a continuous bistable function.Then for any (τ, t) ∈ tr(f ), there exists a sequence τ t ∈ σ f such that |τ t↾!A| E = τ and τ t↾B = t.
Proof.By induction on the total lengths of the sequences in τ ∪ {t}.
Thus we have shown that every bistable and continuous function f : strat(A) → strat(B) is observably sequential (and hence given an alternaative proof that observably sequential functions may be composed).
Proposition 5.17.The SDS-biorders and observably sequential functions form a full subcategory of BBC.

Further Directions
Research into bidomain models of sequential programming languages is ongoing, and includes the following themes: Elimination of nesting in SPCF: In [16,20] we use the full abstract bicpo model of SPCF to show that nested and recursive function calls in SPCF may be eliminated: every SPCF term is observationally equivalent to one typable in an affine typing system which does not permit nesting.The proof is based on the universality of the type of first-oder functions: we show that all retractions into this type may be defined in our affine system.Since every first-order function is definable without nesting, we show that every SPCF-definable element of the model is definable in affine SPCF.Locally Boolean Domains: We have shown that the category of sequential algorithms and sequential data structures can be fully embedded in the category of bistable bicpos and bistable and continuous functions.This leaves open the question of how the correspondence works in the opposite direction; what is the image of the embedding, and given an object in that image, can we construct the corresponding sequential data structures?Furthermore, is there a "linear decomposition" of bistable bidomains into a model of linear logic, which corresponds to that for sequential algorithms [21,8]?In [17] we answer these qestions by describing a notion of "locally boolean" domain -a partial order (the extensional order) with an involutive negation, which can be used to give simple definitions of the stable and bistable orders.Our fundamental representation result for these domains is that they can all be generated (up to isomorphism) by taking products and co-products, lifting, and limits of ω-chains.Hence, in particular, locally boolean domains may be viewed as games in which one player chooses indices in the product, and the other in the lifted sum.Semantics of imperative effects: Locally boolean domains form a model of linear type theory equivalent to the simple games and strategies (or affine sequential algorithms) model described by Lamarche [21,8].A more general "linear decomposion" of bistable functions is still under investigation.A next step is to extend our semantics beyond functional languages with control to include imperative features, nondeterminism and concurrency, inspired by games models of functional-imperative languages such as Idealized Algol.The key to constructing such models is the identification of categorical structures shared by games and bistable models, and used to capture subtle intensional properties of such languages [13].This in turn may lead to higher-order principles for reasoning about them.
In another direction, we may obtain a semantics of fresh name generation in a category of "FM-biorders" -bistable biorders acted upon by the topological group of natural number automorphisms.This fits with a a natural CPS interpretation of fresh name generation given by Shinwell and Pitts to give a sequential model of a "CPS-nu-calculus".Other Bidomain Models: Bistable bidomains share many properties with Bérry's original (stable) bidomains [2].This captures a different but related notion of nondeterministic observable sequentiality, as shown by may-nand-must full abstraction results for a version of Λ ⊤ ⊥ (ω) with countable non-determinism [19] (as well as fully abstract models of languages such as the lazy λ-calculus [18]).This poses the question of whether there is a general notion of bidomain embracing both stable and bistable instances, and other phenomena such as probabilistic non-determinism.
• a and b are are bounded above in ≤ B if and only if they are bounded below in ≤ B .• If a and b are bounded above in ≤ B then there are elements a ∧ b, a ∨ b ∈ D which are (respectively) the greatest lower bound and least upper bound of a and b with respect to both orders.• If {a, b, c} is bounded above in ≤ B , then a ∨ (b ∧ c) = (a ∨ b) ∧ (a ∨ c) (and so a ∧ (b ∨ c) = (a ∨ b) ∧ (a ∨ c).

Proposition 2 . 8 .
The inclusion of BBO s into BBO has a left adjoint.

Lemma 2 . 13 .
If universality holds at type T , and inj : S ¢ T : proj, then universality holds at type S. Proof.Given an element e ∈ S, we have a term M : T such that [[M ]] = e; inj and thus [[proj M ]] = e; inj; proj = e.

Theorem 2 . 20 .
The bistable model of Λ ⊤ ⊥ is universal at all types.Corollary 2.21.The bistable model is minimal.Proof.It is straightfoward to use universality to show that if [[M ]] = [[N ]], then there is an (applicative) context such that C[M ] = βηπ ⊤ and C[N ] = βηπ ⊥, or vice-versa.Hence any compatible theory containing βηπ as well as M = N also contains ⊥ = ⊤.

Lemma 4 . 8 .
Every f : U ⇒ Σ is the least upper bound of a chain of functions with finite support.
by Lemma 4.5 as required.Proposition 4.10.(inj, proj) form a definable retraction from U ⇒ Σ to U .

•
If b and c are both moves in B then sab↾B, sac↾C ∈ f (|sa↾!A| E ) and so b = c.• If b is a move in !A and c is a move in B (or vice-versa), then b is an odd-length sequence on A and so |sab↾!A| E = |sa| E ∪ {b} |sa↾!A| E = |sac↾!A| E .Hence f (|sab↾!A| E ) f (|sac↾ !A| E ) and so sac↾B = (sa↾B)c ∈ f (|sab↾!A| E ) since it is even-length.But this contradicts the assumption that the (odd-length) sab↾B = sa↾B ∈ f (|sab↾!A| E ). • If b and c are both (Opponent) moves in A, then if b