Scott domains [dt-005W]
Compactness and Finiteness [dt-0040]
We begin by formalising the notion of an element in a cpo representing a finite amount of information.
DefinitionBoring and interesting sets [dt-003W]
There are two kinds of directed sets:
Following the above intuition, we might be tempted to say that the "infinite" elements of a cpo are those which are the lub of an interesting set, but this notion is too weak. Consider this cpo X:
DefinitionCompactness [dt-003U]
Let A be a cpo. Then x \in A is compact (a.k.a. finite) iff for all directed X \subseteq A: x \sqsubseteq \bigsqcup X \implies \exists y \in X.\ x \sqsubseteq y In English: A compact element will approximate some element of a directed set if it approximates the lub. We write \mathsf {K}(A) for the set of compact elements of A, i.e.: \mathsf {K}(A) = \{x \in A \mid x\ \text {is compact} \}
In the example cpo X above, all the elements except \infty and x would be compact. Thus, compactness better captures our notion of an element representing a finite amount of information. This understanding of compact elements is a generalisation of the notion of a finite element from the theory of algebraic lattices.
ExampleCompact elements [dt-003V]
- Every element in a finite cpo is compact. More generally, every element of a cpo of finite height (e.g. \mathbb {Z}_\bot ) is compact. This is because finite directed sets are always boring.
- Take the cpo \mathcal {P}(X) of subsets of X ordered by inclusion \subseteq , as seen in Exercise [dt-001G]. The compact elements of \mathcal {P}(X) are those of finite cardinality.
- Take the cpo \mathbb {N} \nrightarrow \mathbb {N} of partial functions on the natural numbers, ordered by inclusion of graphs. The compact elements of \mathbb {N} \nrightarrow \mathbb {N} are the functions which are defined only for finite domains.
ExampleCompact elements with infinitely many approximations [dt-003X]
Compact elements may still have an infinite number of approximations. Consider the cpo \mathbb {N} \cup \{ \infty , \infty + 1 \}, where we have tacked on an additional top element \infty + 1 to our normal cpo of natural numbers extended with infinity. Then, while \infty is not compact, \infty + 1 is compact — it is not the lub of an interesting directed set. If \infty + 1 is the lub of a set X then \infty + 1 must be in the set X. Nonetheless, there are an infinite number of approximations to \infty + 1, i.e., elements x such that x \sqsubseteq \infty + 1.
As an aside, requiring that our compact elements have a truly finite number of approximations is the basis for the theory of Berry domains and stable functions.
TheoremSubmonoids as a cpo [dt-003Y]
The submonoids of a monoid (X, \iota , \bullet ) form a cpo under \subseteq , where union gives the lub.
ExerciseBoth infinite and compact [dt-003Z]
Find a set in the cpo of submonoids of (\mathbb {N},0,+) that is both infinite and compact.
Solution.
Take E \triangleq \{ n \in \mathbb {N} \mid n\ \text {is even}\}. Let Y \subseteq \mathcal {P}(\mathbb {N}) be directed and E \subseteq \bigcup Y. Since 2 \in E there must exist y \in Y such that 2 \in Y. Since (y,0,+) is a monoid, every positive multiple of 2 is also in y, thus E \subseteq y and therefore E is compact.
Seeing as compact elements are also sometimes called finite, this is surprising as E is an infinite set. The reason it is nonetheless compact is that E is finitely generated — it is the smallest submonoid of (\mathbb {N},0,+) such that the finite set \{ 2 \} \subseteq E. In fact, the compact submonoids of (\mathbb {N},0,+) are precisely the finitely generated ones.
Algebraicity and ideals [dt-005X]
DefinitionAlgebraicity [dt-0041]
A cpo is algebraic iff every element is the lub of its compact approximations. That is, a cpo D is algebraic iff for all x \in D,
- \mathop {\downarrow }(x) = \{ y \in \mathsf {K}(D) \mid y \sqsubseteq x \} is directed;
- x = \bigsqcup \mathop {\downarrow }(x)
Aside: Plotkin provides an equivalent definition of \omega -algebraic cpos in which directed sets are replaced with \omega -chains throughout. Hutton claims this is less appealing, as the definition speaks of an \omega -chain of compact approximations, rather than the directed set of such.
Example\omega -algebraic cpos [dt-0042]
Many standard examples of cpos are \omega -algebraic cpos: finite cpos, subsets \mathcal {P}(X) of a set X, partial functions \mathbb {N} \nrightarrow \mathbb {N} and submonoids of a monoid. In general, any cpo of subalgebras (e.g. subgroups of a group, subrings of a ring etc.) is \omega -algebraic. This is the origin of the terminology.
CounterexampleNon-algebraic cpo [dt-0043]
In the cpo on the right (seen also in § [dt-0040]), the element x is not the lub of its compact approximations. The only compact element that approximates x is \bot , and the least upper bound of the set \{\bot \} is just \bot , not x. That is: \mathop {\downarrow }(x) = \{\bot \} but: x \neq \bigsqcup \{\bot \}
TheoremNothing suddenly invented at infinity [dt-0045]
Let D and E be algebraic cpos. Then a function f : D \rightarrow E is continuous iff, for all x \in D: f(x) = \bigsqcup \ \{ f(a) \mid a \in \mathop {\downarrow }(x) \} In other words, in an algebraic cpo, continuous functions are completely defined by their behaviour for compact arguments.
This makes precise our earlier slogan in Definition [dt-001J], that continuous functions don't suddenly behave differently for infinite (i.e. non-compact) elements.
Proof.
Exercise [dt-0044]
Let f : D \twoheadrightarrow E be a continuous function between algebraic cpos. Define: G_f = \{ (a,b) \in \mathsf {K}(D) \times \mathsf {K}(E) \mid b \sqsubseteq f(a) \} Then for all x \in D, prove that: f(x) = \bigsqcup \ \{ b \mid (a,b) \in G_f \land a \sqsubseteq x \}
Solution.
This is powerful. For example, the continuous function f : \mathcal {P}(\mathbb {N}) \twoheadrightarrow \mathcal {P}(\mathbb {N}) on an uncountable cpo \mathcal {P}(\mathbb {N}) is completely determined by the countable relation G_f.
DefinitionDown-closure [dt-0047]
Given a poset Y, a set X \subseteq Y is down-closed iff, for all x \in X, any y \sqsubseteq x is in X.
DefinitionIdeal [dt-0048]
A set is ideal iff it is both down-closed and directed.
DefinitionIdeal completion [dt-0046]
The ideal completion of a set A, written sometimes as \mathsf {Id}(A), is the set of all ideal subsets of A, i.e.: \mathsf {Id}(A) = \{ X \subseteq A \mid X\ \text {is ideal}\}
TheoremRepresentation theorem for algebraic cpos [dt-0049]
Every algebraic cpo D is isomorphic to the ideal completion of its compact elements, ordered by subset inclusion. That is, \mathsf {Id}(K(D)) is an algebraic cpo such that D \simeq \mathsf {Id}(K(D)) .
Getting closure [dt-005Y]
DefinitionBasis [dt-004A]
TheoremCompact basis for algebraic cpos [dt-004B]
If X is a basis for A, then A is algebraic and \mathsf {K}(A) = X.
Proof.
If a \in \mathsf {K}(A), then \bigsqcup M = a where M = \{ x \in X \mid x \sqsubseteq a \}, as X is a basis. Since a is compact, a \sqsubseteq b for some b \in M. But since a is the lub of M, b \sqsubseteq a as well. By antisymmetry a = b, hence a \in X. Thus \mathsf {K}(A) \subseteq X, so \mathsf {K}(A) = X and A is algebraic.
TheoremClosure of algebraic cpos under product [dt-004C]
If D and E are algebraic cpos, then so is their product construction D \times E.
Proof.
In the following proof, we show that \mathsf {K}(D) \times \mathsf {K}(E) is a basis for the product D \times E and thereby show via Theorem [dt-004B] that D \times E is algebraic if D and E are.
- \mathsf {K}(D) \times \mathsf {K}(E) \subseteq \mathsf {K}(D \times E): Let (x,y) \in \mathsf {K}(D) \times \mathsf {K}(E). To show that (x,y) is compact, let us assume that (x,y) \in \bigsqcup X where X \subseteq D \times E is directed. We must show that there exists some element e of X such that our (x,y) \sqsubseteq e. As (x,y) \in \bigsqcup X, by the definition of lub on products we can conclude that:
\begin {array}{lcl}
x & \sqsubseteq & \bigsqcup \pi _0[ X] \\
y & \sqsubseteq & \bigsqcup \pi _1[X]
\end {array}
Here we use the notation f[X] to indicate the image of a function on a set, i.e. \{ f(v) \mid v \in X \}.
Since x and y are both compact, there must exist x' \in \pi _0[ X] and y' \in \pi _1[ X] such that x \sqsubseteq x' and y \sqsubseteq y'. While it does not follow that (x', y') \in X, we know that there must exist a pair (a,b) \in X such that x' \sqsubseteq a and y' \sqsubseteq b as X is directed. Hence (a,b) can be our element e \in X that is approximated by (x,y), i.e. (x,y) \sqsubseteq (a,b). - \mathop {\downarrow }(x,y) is directed for all (x,y) \in D \times E: \begin {array}{lcl} \mathop {\downarrow }(x,y) &= & \{ (a,b) \in \mathsf {K}(D) \times \mathsf {K}(E) \mid (a,b) \sqsubseteq (x,y) \} \\ & = & \{ a \in \mathsf {K}(D) \mid a \sqsubseteq x \} \times \{ b \in \mathsf {K}(E) \mid b \sqsubseteq y \}\\ & = & \mathop {\downarrow }(x) \times \mathop {\downarrow }(y) \end {array} Because D and E are algebraic, \mathop {\downarrow }(x) and \mathop {\downarrow }(y) are directed. As directedness is closed under product, \mathop {\downarrow }(x,y) is directed too.
- (x,y) = \bigsqcup \mathop {\downarrow }(x,y) Starting from the right hand side: \begin {array}{lclr} \bigsqcup \mathop {\downarrow }(x,y) & = & \bigsqcup (\mathop {\downarrow }(x) \times \mathop {\downarrow }(y)) & \text {(part 2)}\\ & = & (\bigsqcup (\mathop {\downarrow }(x), \bigsqcup \mathop {\downarrow }(y))) & \text {(lub on products)}\\ & = & (x,y) & \text {($D$, $E$ are {algebraic})} \end {array}
Problem.
AsideScott's original solution: using complete lattices [dt-004D]
The lack of closure of algebraicity under the (continuous) function arrow, strict or non-strict, is not satisfying as it means that our semantic domains are not guaranteed to be algebraic even if they are composed from algebraic cpos. Instead, we must replace algebraic cpos with something stronger still.
Scott's original solution to this lack of closure was to use a complete lattice instead of cpos, i.e. requiring lubs for all subsets, not just directed ones. This solves the problem with \twoheadrightarrow but introduces new problems:
- Complete lattices need a top element \top , but adding a fictitious top (representing inconsistent information) to cpos like \mathbb {B}_\bot is strange.
- Extending the functions that capture our primitive semantic operations to complete lattices can spoil nice algebraic properties. Consider these two possible implementations of \mathsf {ite}, the function for the semantics of an \mathsf {if} expression: \mathsf {ite}(\top ,x,y) = x \sqcup y\quad \quad \quad \quad \quad \mathsf {ite}(\top ,x,y) = \top Either of these solutions results in the failure of useful and expected laws for \mathsf {if} expressions. For example, the left definition above results in the failure of the common equation to eliminate unreachable cases: \mathsf {ite}(b, \mathsf {ite}(b,x,y),z) = \mathsf {ite}(b,x,z) And the second definition above results in the failure of this equation that removes redundant checks: \mathsf {ite}(b,x,x) = x
- The powerdomain construction does not generalise to complete lattices, so semantics for non-deterministic programs are difficult in this setting.
DefinitionConsistent completeness [dt-004E]
A poset A is consistent complete (or bounded complete) iff \bigsqcup X exists for all consistent X \subseteq A. That is, any set with an upper bound (a consistent set) has a least upper bound.
ExampleConsistent completeness vs directed completeness [dt-004F]
DefinitionScott domain [dt-004G]

A cpo D is a Scott domain iff:
- D is \omega -algebraic,
- D is consistent complete,
Remark [dt-004H]
The second requirement in Definition [dt-004G] can, in light of the first, be expressed equivalently as: x \sqcup y exists for all consistent x,y \in D. This is useful when needing to show that a given cpo is a Scott domain.
TheoremClosure of Scott domains [dt-004I]
Scott domains are closed under all our cpo constructions, including sums +, products \times , continuous functions \twoheadrightarrow , smash sums \oplus , smash products \otimes and strict functions \mathbin {\circ \hspace{-0.4em}\twoheadrightarrow }.
Thesis.
Our semantic domains are Scott domains.