Академический Документы
Профессиональный Документы
Культура Документы
An Introduction
Robert Cartwright
Rebecca Parsons
Rice University
This monograph is an unauthorized revision of Lectures On A Mathematical Theory
of Computation by Dana Scott [3]. Scotts monograph uses a formulation of domains
called neighborhood systems in which nite elements are selected subsets of a master
set of objects called tokens. Since tokens have little intuitive signicance, Scott has
discarded neighborhood systems in favor of an equivalent formulation of domains called
information systems [4]. Unfortunately, he has not rewritten his monograph to reect
this change.
We have rewritten Scotts monograph in terms of nitary bases (see Cartwright [2])
instead of information systems. A nitary basis is an information system that is closed
under least upper bounds on nite consistent subsets. This convention ensures that
every nite answer is represented by a single basis object instead of a set of objects.
1 The Rudiments of Domain Theory
Motivation
Programs perform computations by repeatedly applying primitive operations to data values. The
set of primitive operations and data values depends on the particular programming language.
Nearly all languages support a rich collection of data values including atomic objects, such as
booleans, integers, characters, and oating point numbers, and composite objects, such as arrays,
records, sequences, tuples, and innite streams. More advanced languages also support functions
and procedures as data values. To dene the meaning of programs in a given language, we must rst
dene the building blocksthe primitive data values and operationsfrom which computations in
the language are constructed.
Domain theory is a comprehensive mathematical framework for dening the data values and
primitive operations of a programming language. A critical feature of domain theory (and expressive
programming languages like Scheme and ML) is the fact that program operations are also data
values; both operations and values are elements of computational domains.
In a language implementation, every data value and operation is represented by a nite cong-
uration of symbols (e.g., a bitstring). But the choice of data representations should not aect the
observable behavior of programs. Otherwise, a programmer cannot reason about the behavior of
programs independent of their implementations.
To achieve this goal, we must abandon nite representations for some data values. The abstract
meaning of a procedure, for example, is typically dened as a function from an innite domain to an
innite codomain. Although the graph of this function is recursively enumerable, it does not have
an eective nite canonical representation; otherwise we could decide the equality of recursively
enumerable sets by generating their canonical descriptions and comparing them.
Data values that do not have nite canonical representations are called innite data values.
Some common examples are functions over an innite domain, innite streams, and innite trees.
To describe an innite data value, we must use an innite sequence of progressively better nite
approximations. Each nite approximation obviously has a canonical representation.
We can interpret each nite approximation as a proposition asserting that a certain property is
true of the approximated value. By stating enough dierent properties (a countably innite number
in general), every higher order data value can be uniquely identied.
Higher order data domains also contain ordinary nite values. There are two kinds of nite
values.
First, the nite elements used to approximate innite values are legitimate data values them-
selves. Even though these approximating elements are only partially dened, they can be
produced as the nal results fo computations. For example, a tree of the form cons(, ),
where and are arbitrary values, is a data value in its own right, because a computation
yielding cons(, ) may subsequently diverge without producing any information about the
values and .
Second, higher order domains may contain maximal nite elements that do not approximate
any other values. These maximal values correspond to conventional nite data objects. For
example, in the domain of potentially innite binary trees of integers, the leaf consisting of
the integer 42 does not approximate any element other than itself.
In summary, a framework for dening data values and operations must accommodate innite
elements, partially dened elements, and nite maximal elements. In addition, the framework
1
should support the construction of more complex values from simpler values, and it should support a
notion of computation on these objects. This paper describes a frameworkcalled domain theory
satisfying all of these properties.
Notation
The following notation is used throughout the paper:
means logical implication
means if and only if, used in mathematical formulas
i means if and only if, used in text
_ means approximation ordering
N means the natural numbers
Basic Denitions
To support the idea of describing data values by generating better and better approximations, we
need to specify an ordering relation among the nite approximations to data values. The following
denitions describe the structure of the sets of nite approximations corresponding to domains;
these sets of nite approximations are called nitary bases.
Denition 1.1: [Partial Order] A partial order B is a pair B, _) consisting of (i) a set B
called the universe and (ii) a binary relation _ on the set B called the approximation ordering that
is
reexive: x B[x _ x],
antisymmetric: x, y B[x _ y] and [y _ x] implies x = y, and
transitive: x, y, z B[x _ y] and [y _ z] implies x _ z.
Denition 1.2: [Upper bounds, Lower bounds, Consistency] Let S be a subset of a partial
order B. An element b B is an upper bound of S i s S s _ b. An element b B is a lower
bound of S i s S b _ s. S is consistent (sometimes called bounded) i S has an upper bound.
An upper bound b of S is the least upper bound of S (denoted
S) i b approximates all upper
bounds of S. A lower bound b of S is the greatest lower bound of S (denoted S) i every lower
bound of S approximates b.
Remark 1.3: Upper bounds are much more important in domain theory than lower bounds.
Denition 1.4: [Directed Subset] A subset S of a partial order B is directed i every nite
subset of S has an upper bound in S. A directed subset of B is progressive i it does not contain
a maximum element. A directed subset of B is a chain i it is totally ordered: a, b Ba _ b or
b _ a.
Claim 1.5: The empty set is directed.
Denition 1.6: [Complete Partial Order] A complete partial order, abbreviated cpo, is a
partial order B, _) such that every directed subset has a least upper bound in B.
2
Claim 1.7: A cpo has a least element.
Denition 1.8: [Finitary Basis] A nitary basis B is a partial order B, _) such that B is
countable and every nite consistent subset S B has a least upper bound in B.
We call the elements of a nitary basis B propositions because they can be interpreted as
logical assertions about domain elements. In propositional logic, the least upper bound of a set of
propositions is the conjunction of all the propositions in the set. Since the empty set, , is a nite
consistent subset of B, it has a least upper bound, which is denoted
B
. The proposition holds
for all domain elements; hence it does not give any information about an element.
Example 1.9: Let B = , 0, 1, 00, 01, 10, 11 where 0 describes strings that start with 0 and
are indeterminate past that point; 00 describes the string that consisting of two consecutive 0s.
The other propositions are dened similarly. Let _ denote the obvious approximation (implication)
relation between propositions. Thus, 0 _ 00 and 0 _ 01. In pictorial form, the partial order
B, _) looks like:
00
01
10
11
d d
r
r
B, _) is clearly a partial order. To show that B, _) is a nitary basis, we must show that B
is countable and that all nite consistent subsets of B have least upper bounds.
Since B is nite, it is obviously countable. It is easy to conrm that every nite consistent
subset has a least upper bound by inspection. In fact, the least upper bound of any consistent
subset S of B is simply the greatest element of S.
1
Thus, B, _) is a nitary basis. P
Example 1.10: Let B = (n, m) [ n, m N, n m where the proposition (n, m) represents
an integer x such that n x m. in this example is the proposition (0, ). Let _ be dened
as
(n, m) _ (j, k) n j and m k
For example, (1, 10) _ (2, 6) but (2, 6) and (7, 12) are incomparable, as are (2, 6) and (4, 8).
It is easy to conrm that B is countable and that B, _) is a partial order. A subset S of B is
consistent if there is an integer for which the proposition in S is true. Thus, (2, 6) and (4, 8) are
consistent since either 4, 5, or 6 could be represented by these propositions. The least upper bound
of these elements is (4, 6). In general, for a consistent subset S = (n
i
, m
i
) [ i I of B, the least
upper bound of S is dened as
S = (max n
i
[ i I, min m
i
[ i I) .
Therefore, B, _) is a nitary basis. P
Given a nitary basis B, the corresponding domain T
B
is constructed by forming all consistent
subsets of B that are closed under implication (where a _ b corresponds to b a and a . b
corresponds to ab). More precisely, a consistent subset S B is an element of the corresponding
domain T
B
i
1
This is a special property of B. It is not true of nitary bases in general.
3
s S b B b _ s b S
r, s S r . s S
In T
B
, there is a unique element 1
p
corresponding to each proposition p B: 1
p
= b B [ b _ p.
In addition, T
B
contains elements (closed subsets of B) corresponding to the limits of all
progressive directed subsets of B. This construction completes the nitary basis B by adding
limit elements for all progressive directed subsets of B.
In T
B
, every element d is represented by the set of all the propositions in the nitary basis B
that describe d. These sets are called ideals.
Denition 1.11: [Ideal] For nitary basis B, a subset 1 of B is an ideal over B i
1 is downward closed: e 1 (b B b _ e b 1)
1 is closed under least upper bounds on nite subsets (conjunction).
We construct domains as partially ordered sets of ideals.
Denition 1.12: [Constructed Domain] Let B be a nitary basis. The domain T
B
determined
by B is the partial order D, _
D
) where D is the set of all ideals 1 over B and _
D
is the subset
relation. We will frequently write T instead of T
B
.
The proof of the following two claims are easy; they are left to the reader.
Claim 1.13: The least upper bound of two ideals 1
1
and 1
2
, if it exists, is found by closing 1
1
1
2
to form an ideal over B.
Claim 1.14: The domain T determined by a nitary basis B is a complete partial order.
Each proposition b in a nitary basis B determines an ideal consisting of the set of propositions
implied by b. An ideal of this form called a principal ideal of B.
Denition 1.15: [Principal Ideals] For nitary basis B = B, _), the principal ideal determined
by b B, is the ideal 1
b
such that
1
b
= b
B [ b
_ b .
We will use the notation 1
b
to denote the principal ideal determined by b throughout the monograph.
Since there is a natural one-to-one correspondence between the propositions of a nitary basis
B and the principal ideals over B, the following theorem obviously holds.
Theorem 1.16: The principal ideals over a nitary basis B form a nitary basis under the subset
ordering.
Within the domain T determined by a nitary basis B, the principal ideals are characterized
by an important topological property called niteness.
Denition 1.17: [Finite Elements] An element e of a cpo T = D, _) is nite
2
i for every
directed subset S of D, e =
.
The next theorem identies the relationship between an ideal and all the principal ideals that
approximate it.
Theorem 1.19: Let T be the domain determined by a nitary basis B. For any 1 T, 1 =
T
0
[ 1
_ 1 .
Proof See Exercise 9. P
The approximation ordering in a partial order allows us to dierentiate partial elements from
total elements.
Denition 1.20: [Partial and Total Elements] Let B be a partial order. An element b B
is partial i there exists an element b
B such that b ,= b
and b _ b
. An element b B is total
i for all b
B, b _ b
implies b = b
.
Example 1.21: The domain determined by the nitary basis dened in Example 1.9 consists
only of elements for each proposition in the basis. The four total elements are the principal ideals
for the propositions 00, 01, 10, and 11. In general, a nite basis determines a domain with this
property. P
Example 1.22: The domain determined by the basis dened in Example 1.10 contains total
elements for each of the natural numbers. These elements are the principal ideals for propositions
of the form (n, n). In this case as well, there are no ideals formed that are not principal. P
Example 1.23: Let = 0, 1 and
forms a nitary basis under the prex ordering on strings. is the least element
in the
is isomorphic to T.
Proof Since the nite elements of T are precisely the principal ideals, it is easy to see that B
is
isomorphic to B. Hence, B
S = S .
2. if S is directed, then
S T and
S =
S .
Proof The conditions for ideals specied in Denition 1.11 must be satised for these properties
to hold. The intersection case is trivial. The union case requires the stated restriction since ideals
require closure under lubs. P
For the remainder of this monograph, we will ignore the distinction between principal ideals
and the corresponding elements of the nitary basis whenever it is convenient.
Exercises
1. Let
B = s
n
[ s
n
= m N [ m n, n N
What is the approximation ordering for B? Verify that B is a nitary basis. What are the
total elements of the domain determined by B. Draw a partial picture demonstrating the
approximation ordering in the basis.
2. Example 1.9 can be generalized to allow strings of any nite length. Give the nitary basis
for this general case. What is the approximation ordering? What does the domain look like?
What are the total elements in the domain? Draw a partial picture of the approximation
ordering.
3. Let B be all nite subsets of N with the subset relation as the approximation relation. Verify
that this is a nitary basis. What is the domain determined by B. What are the total
elements? Draw a partial picture of the domain.
6
4. Construct two non-isomorphic innite domains in which all elements are nite but there are
no innite chains of elements (x
n
)
n=0
with x
n
_ x
n+1
but x
n
,= x
n+1
for all n).
5. Let B be the set of all non-empty open intervals on the real line with rational endpoints plus
a bottom element. What would a reasonable approximation ordering be? Verify that B is
a nitary basis. For any real number t, show that
x B [ t x
is an ideal element. Is it a total element? What are the total elements? (Hint: When t is
rational consider all intervals with t as a right-hand end point.)
6. Let D be a nitary basis for domain T. Dene a new basis, D
= X [ X D where
X = Y D[ X _ Y . Show that D
are isomorphic.
7. Let B, _) be a nitary basis where
B = X
0
, X
1
, . . . , X
n
, . . ..
Suppose that consistency of nite sequences of elements is decidable. Let
Y
0
= X
0
Y
n+1
=
X
n+1
if X
n+1
is consistent with Y
0
, Y
1
, . . . , Y
n
Y
n
otherwise .
Show that Y
0
, . . . , Y
n
, . . . is a total element in the domain determined by B. (Hint: Show
that Y
0
, . . . , Y
n1
is consistent for all n.) Show that all ideals can be determined by such
sequences.
8. Devise a nitary basis B with more than two elements such that every pair of elements in B
is consistent, but B is not consistent.
9. Prove Theorem 1.19.
2 Operations on Data
Since program operations perform computations incrementally on data values that correspond to
sets of approximations (ideals), they obey some critical topological constraints. For any approxima-
tion x
to the input value x, a program operation f must produce the output f(x
). Since program
output cannot be withdrawn, every program operation f is a monotonic function: x
1
_ x
2
implies
f(x
1
) _ (x
2
).
We can decribe this process in more detail by examining the structure of computations. Recall
that every value in a domain D can be interpreted as a set of nite elements in D that is closed
under implication. When an operation f is applied to the input value x, f gathers information
about x by asking the program computing x to generate a countable chain of nite elements C
where
1
c
[ c C = x. For the sake of simplicity, we can force the chain C describing the input
value x to be innite: if C is nite, we can convert it to an equivalent innite chain by repeating
the last element. Then we can view f as a function on innite streams that repeatedly reads the
next element in an innite chain C and writes the next element element in an innite chain C
where
1
c
[ c
S) =
F(a) F(a
).
These closure properties ensure that the relation F uniquely identies a continuous function f on
D. Relations satisfying these closure properties are called approximable mappings.
The following set of denitions restates the preceding descriptions in more rigorous form.
Denition 2.1: [Approximable Mapping] Let / and B be the domains determined by nitary
bases A and B, respectively. An approximable mapping F AB is a binary relation over AB
such that
1.
A
F
B
2. If a F b and a F b
then a F (b . b
)
3. If a F b and b
_
B
b, then a F b
4. If a F b and a _
A
a
, then a
F b
The partial order of approximable mappings F A B under the subset relation is denoted by
the expression Map(A, B).
Conditions 1, 2, and 3 force the image of an input ideal to be an ideal. Condition 4 states that the
function on ideals associated with F is monotonic.
Denition 2.2: [Continuous Function] Let / and B be the domains determined by nitary
bases A and B, respectively. A function f : / B is continuous i for any ideal 1 in /,
f(1) =
f(1
a
) [ a 1. The partial ordering _
B
from B determines a partial ordering _ on
continuous functions:
f _ g x / f(x) _
A
g(x) .
The partial order consisting of the continuous functions from / to B under the pointwise ordering
is denoted by the expression Fun(A, B).
8
It is easy to show that continuous functions satisfy a stronger condition than the denition
given above.
Theorem 2.3: If a function f : / B is continuous, then for every directed subset S of /,
f(
S) =
f(1) [ 1 S.
Proof By Theorem 1.27,
S is simply
S. Since f is continuous, f(
S) =
f(1
a
) [ 1
S a 1. Similarly, for every 1 /, f(1) =
f(1
a
) [ a 1. Hence,
f(1) [ 1 S =
f(1
a
) [ a 1 [ 1 S =
f(1
a
) [ 1 S a 1. P
Every approximable mapping F over the nitary bases AB determines a continuous function
f : / B. Similarly, every continuous function f : / B determines a an approximable mapping
F over the nitary bases AB.
Denition 2.4: [Image of Approximable Mapping] For approximable mapping
F AB
the image of d / under F (denoted apply(F, d)) is the ideal b B [ a A, a d, a F b .
The function f : / B determined by F is dened by the equation:
f(d) = apply(F, d) .
Remark 2.5: It is easy to conrm that apply(F, d) is an element of B and that the function f
is continuous. Given any ideal d /, apply(F, d) is the subset of B consisting of all the elements
related by F to nite elements in d. The set apply(F, d) is an ideal in B since (i) the set b B[a F b
is downward closed for all a A, and (ii) a F b a F b
implies a F (b . b
). The continuity of f is
an immediate consequence of the denition of f and the denition of continuity.
The following theorem establishes that the partial order of approximable mappings over AB
is isomorphic to the partial order of continuous functions in / B.
Theorem 2.6: Let A and B be nitary bases. The partial order Map(A, B) consisting of the set
of approximable mappings over A and B is isomorphic to the partial order /
c
B of continuous
functions mapping / into B. The isomorphism is produced by the function F : Map(A, B)
(/
c
B) dened by
F(F) = f
where f is the function dened by the equation
f(d) = apply(F, d)
for all d /.
Proof The theorem is an immediate consequence of the following lemma. P
Lemma 2.7:
1. For any approximable mappings F, G AB
(a) a A, b B a F b 1
b
_ F(F)(1
a
).
(b) F G a A F(F)(a) _ F(G)(a)
9
2. The function F : Map(A, B) (/
c
B) is one-to-one and onto.
Proof (lemma)
1. Part (a) is the immediate consequence of the denition of f (b f(1
a
) a F b) and the
fact that f(1
a
) is downward closed. Part (b) follows directly from Part (a): F G a
/ b [ a F b b [ a Gb. But the latter holds i a A (f(a) g(a) f(a) _ g(a)).
2. Assume F is not one-to-one. Then there are distinct approximable mappings F and G such
that F(F) = F(G). Since F(F) = F(G),
a A, b B (1
b
_ F(F)(1
a
) 1
b
_ F(G)(1
a
)) .
By Part 1 of the lemma,
a A, b B (a F b 1
b
_ F(F)(1
a
) 1
b
_ F(G)(1
a
) a Gb) .
We can prove that F is onto as follows. Let f be an arbitary continuous function in / B.
Dene the relation F AB by the rule
a F b 1
b
_ f(1
a
) .
It is easy to verify that F is an approximable mapping. By Part 1 of the lemma,
a F b 1
b
_ F(F)(1
a
) .
Hence
1
b
_ f(1
a
) 1
b
_ F(F)(1
a
) ,
implying that f and F(F) agree on nite inputs. Since f and F(F) are continuous, they are equal.
P
The following examples of show how approximable mappings and continuous functions are
related.
Example 2.8: Let B be the domain of innite strings from the previous section and let T be
the truth value domain with two total elements, true and false where
T
denotes that there is
insucient information to determine the outcome. Let p : B T be the function dened by the
equation:
p(x) =
true if x = 0
n
1y where n is even
false if x = 0
n
1y where n is odd
T
otherwise
The function p determines whether or not there are an even number of 0s before the rst 1 in
the string. If there is no one in the string, the result is
T
. It is easy to show that p is continuous.
The corresponding binary relation P is dened by the rule:
a P b b _
T
T
0
2n
1 _
B
a b _
T
true 0
2n+1
1 _
B
a b _
T
false
The reader should verify that P is an approximable mapping and that p is the continuous
function determined by P. P
10
Example 2.9: Given the domain B from the previous example, let g : B B be the function
dened by the equation:
g(x) =
0
n+1
y if x = 0
n
1
k
0y
D
otherwise
The function g eliminates the rst substring of the form 1
k
(k > 0) from the input string x.
If x = 1
, then g(x) =
D
. The reader should conrm that g is continuous and determine the approximable mapping G
corresponding to g. P
Approximable mappings and continuous functions can be composed and manipulated just like
any other relations and functions. In particular, the composition operators for approximable map-
pings and continuous functions behave as expected. In fact, both the approximable mappings and
the continuous functions form a category.
Theorem 2.10: The approximable mappings form a category over nitary bases where the identity
mapping for nitary basis B, I
B
BB, is dened for a, b B as
a I
B
b b _ a
and the composition G F B
1
B
3
of approximable mappings F B
1
B
2
and G B
2
B
3
is dened for a B
1
and c B
3
by the rule:
a (G F) c b B
2
a F b b Gc .
To show that this structure is a category, we must establish the following properties:
1. the identity mappings are approximable mappings,
2. the identity mappings composed with an approximable mapping denes the original mapping,
3. the mappings formed by composition are approximable mappings, and
4. function composition is associative.
Proof Let F T
1
T
2
and G T
2
T
3
be approximable mappings. Let I
1
, I
2
be identity
mappings for B
1
and B
2
respectively.
1. The verication that the identity mappings satisfy the requirements for approximable map-
pings is straightforward and left to the reader.
2. To show F I
1
and I
2
F are approximable mappings, we prove the following equivalence:
F I
1
= I
2
F = F
For a B
1
and b B
2
,
a (F I
1
) b c T
1
(c _ a c F b) .
By the denition of approximable mappings, this property holds i a F b, implying that F
and F I
1
are the same relation. The proof of the other half of the equivalence is similar.
11
3. We must show that the relation G F is approximable given that the relations F and G
are approximable. To prove the rst condition, we observe that
1
F
2
and
2
G
3
by
assumption, implying that
1
(G F)
3
. Proving the second condition requires a bit more
work. If a (G F) c and a (G F) c
and b
Gc
for some b
) and since b
_ (b .b
) Gc
. Therefore, (b . b
) G(c . c
, c
F b and b Gc
and thus a
(G F) c
a 1
b
_ f(1
a
)
The right-hand side of this equation, call it e, is an idealfor a proof of this, see Exercise 2.10.
Since f is an onto function, there must be some d T such that f(d) = e. Since a
a, 1
a
_ a
holds. Thus, f(1
a
) _ f(a). Since this holds for all a
a, f(1
a
) _ f(d) by the denition of f(d)
so 1
a
_ d. Thus, a
1
b
[ b f(1
a
)
Since p _ q implies 1
p
_ 1
q
, z is also an ideal (see Exercise 2.10 again). Since 1
b
_ 1
a
holds for
each 1
b
, z _ 1
a
must also hold. Also, since each 1
b
_ z, 1
b
= f(1
b
) _ f(z). Therefore, b f(z).
Since b is an arbitrary element in f(1
a
), f(1
a
) _ f(z) must hold and thus 1
a
_ z. Therefore,
1
a
= z and a z. But then a 1
c
for some c f(1
a
) by the denition of z. Thus, 1
a
_ 1
c
and
f(1
a
) _ 1
c
. Since c was chosen such that 1
c
_ f(1
a
), 1
c
_ 1
a
and therefore 1
c
= f(1
a
) and f(1
a
)
is nite. The same argument holds for the inverse of f; therefore, the isomorphism preserves the
niteness of elements. P
Exercises
Exercise 2.13: Show also that partial order of monotonic functions mapping T
0
to c
0
(using the
pointwise ordering) is isomorphic to the partial order of approximable mappings over f : DE.
Exercise 2.14: Prove that, if F D E is an approximable mapping, then the corresponding
function f : T c satises the following equation:
f(x) =
e [ d x dFe
for all x T.
Exercise 2.15: Prove the following claim: if F, G DE are approximable mappings, then there
exists H DE such that H = F G = F G.
Exercise 2.16: Let I, ) be a non-empty partial order that is directed and let D, _) be a nitary
basis. Suppose that a : I T is dened such that i j a(i) _ a(j) for all i, j I. Show that
a(i) [ i I
13
is an ideal in T. This says that the domain is closed under directed unions. Prove also that for
f : D E an approximable mapping, then for any directed union,
f(
a(i) [ i I) =
f(a(i)) [ i I
This says that approximable mappings preserve directed unions. If an elementwise function pre-
serves directed unions, must it come from an approximable mapping? (Hint: see Exercise 2.8).
Exercise 2.17: Let I, ) be a directed partial order with f
i
: D E as a family of approximable
mappings indexed by i I. We assume i j f
i
(x) _ f
j
(x) for all i, j I and all x T. Show
that there is an approximable mapping g : D E where
g(x) =
f
i
(x) [ i I
for all x T.
Exercise 2.18: Let f : T c be an isomorphism between domains. Let : D E be the
one-to-one correspondence from Theorem 2.6 where
f(1
a
) = 1
(a)
for a D. Show that the approximable mapping determined by f is the relationship (x) _ b.
Show also that if a and a
) = (a) . (a
_
D
d
[d, e] P
1
e
_
E
e
where d and d
D, [d, e] P
0
d
_ d.
3. For [d, e] DE and e
E, [d, e] P
1
e
_ d.
4. For approximable mapping H A(DE), H = (P
0
H), (P
1
H)).
5. For a / and [d, e] DE, [a, [d, e]] F, G) [a, d] F [a, e] G.
Proof The proof is left as an exercise to the reader. P
The projection mappings and paired mappings on nitary mappings obviously correspond to
continuous functions on the corresponding domains. We will denote the continous functions cor-
responding to P
0
and P
1
by the symbols p
1
and p
2
. Similarly, we will denote the function corre-
sponding to the paired mapping F, G) by the expression f, g).
It should be clear that the denition of projection mappings and paired mappings can be
generalized to products of more than two domains. This generalization enables us to treat a multi-
ary continous function (or approximable mapping) as a special form of a unary continuous function
(or approximable mapping) since multi-ary inputs can be treated as single objects in a product
domain. Moreover, it is easy to show that a relation R (A
1
. . . A
n
) B of arity n + 1 (as
in Exercise 2.18) is an approximable mapping i every restriction of R to a single input argument
(by xing the other input arguments) is an approximable mapping.
Theorem 3.5: A relation F (AB) C is an approximable mapping i for every a A and
every b B, the derived relations
F
a,
= [y, z] [ [[a, y], z] F
F
,b
= [x, z] [ [[x, b], z] F
are approximable mappings.
Proof Before we prove the theorem, we need to introduce the class of constant relations K
e
DE
for arbitrary nitary bases D and E and show that they are approximable mappings.
Lemma 3.6: For each e E, let the constant relation K
e
DE be dened by the equation
K
e
= [d, e
] [ d D, e
_ e .
In other words,
d K
e
e
_ e .
For e E, the constant relation K
e
DE is approximable.
16
Proof (lemma) The proof of this lemma is left to the reader. P(lemma)
To prove the if direction of the theorem , we observe that we can construct the relations F
a,
and F
,b
for all a A and b B by by composing and pairing primitive approximable mappings.
In particular, F
a,
is the relation
F K
a
, I
B
)
where I
B
denotes the identity relation on B. Similary, F
,b
is the relation
F I
A
, K
b
)
where I
A
denotes the identity relation on A.
To prove the only-if direction, we assume that for all a A and b B, the relations F
a,
and
F
,b
are approximable. We must show that the four closure properties for approximable mappings
hold for F.
1. Since F
A
,
is approximable, [
B
,
C
] F
A
,
, which implies [[
A
,
B
],
C
] F.
2. If [[x, y], z] F and [[x, y], z
] F, then [y, z] F
x,
and [y, z
] F
x,
. Since F
x,
is
approximable, [y, z . z
] F
x,
, implying [[x, y], z . z
] F.
3. If [[x, y], z] F and z
_ z, then [y, z] F
x,
. Since F
x,
is approximable, [y, z
] F
x,
,
implying [[x, y], z
] F.
4. If [[x, y], z] F and [x, y] _ [x
, y
], then [y, z] F
x,
, x _ x
, and y _ y
. Since F
x,
is
approximable, [y
, z] F
x,
, implying [x, y
, z] F
,y
, implying [[x
, y
], z] F.
P
The same result can be restated in terms of continous functions.
Theorem 3.7: A function of two arguments, f : /B ( is continuous i for every a / and
every b B, the unary functions
x f[a, x] and y f[y, b]
are continuous.
Proof Immediate from the previous theorem and the fact that the domain of approximable
mappings over (AB) C is isomorphic to the domain of continuous functions over (/B) (.
P
The composition of functions as dened in Theorem 2.10 can be generalized to functions of
several arguments. But we need some new syntactic machinery to describe more general forms of
function composition.
Denition 3.8: [Cartesian types] Let S be a set of symbols used to denote primitive types.
The set S
of Cartesian types over S consists of the set of expressions denoting all nite non-empty
Cartesian products over primitive types in S:
S
::= S [ S S [ . . . .
A signature is a pair S, O) consisting of a set S of type names s
1
, . . . , s
m
used to denote
domains and a set O of function symbols o
i
i
[ 1 i m,
i
S
,
i
S used to denote
rst order functions over the domains S. Let V be a countably innite set of symbols (variables)
v
i
[ S, i N distinct from the symbols in . The typed expressions over (denoted c())
is the set typed terms determined by the following inductive denition:
17
1. v
i
V is a term of type ,
2. for M
1
1
, . . . , M
n
n
c() and o
(
1
...n)
0
O then
o
(
1
...n)
0
(M
1
1
, . . . , M
n
n
)
0
is a term of type
0
.
We will restrict our attention to terms where every instance of a variable v
i
has the same type .
To simplify notation, we will drop the type superscripts from terms whenever they can easily be
inferred from context.
Denition 3.9: [Finitary algebra] A nitary algebra with signature is a function A mapping
each primitive type S to a nitary basis A[[]],
each operation type
1
. . .
n
S
i
i
O to an approximable mapping A[[o
i
]] (A[[
i
]] A[[
i
]]).
Recall that A[[
i
]] is a product basis.
Denition 3.10: [Closed term] A term M c is closed i it contains no variables in V .
The nitary algebra A implicitly assigns a meaning to every closed term M in c(). This
extension is inductively dened by the equation:
A[[o[M
1
, . . . , M
n
]]] = A[[o]][A[[M
1
]], . . . , A[[M
n
]]] = b
0
[ [b
1
, . . . , b
n
] A[[
i
]] [b
1
, . . . , b
n
]A[[o]]b
0
.
We can extend A to terms M with free variables by implicitly abstracting over all of the free
variables in M.
Denition 3.11: [Meaning of terms] Let M be a term in c and let l = x
1
1
, . . . x
n
n
be a list
of distinct variables in V containing all the free variables of M. Let A be a nitary algebra with
signature and for each tuple [d
1
, . . . , d
n
] A[[
1
]] . . . A[[
n
]], let A
{x
1
:=d
1
,...,xn:=dn}
denote the
algebra A extended by dening
A[[x
i
]] = d
i
for 1 i n. The meaning of M with respect to l, denoted A[[x
1
1
, . . . , x
n
n
M]], is the relation
F
M
(A[[
1
]] A[[
n
]]) A[[
0
]] dened by the equation:
F
M
[d
1
, . . . , d
n
] = A
{x
1
:=d
1
,...,x
1
:=dn}
[[M]]
The relation denoted by A[[x
1
1
, . . . , x
n
n
M]] is often called a substitution. The following
theorem shows that the relation A[[x
1
1
, . . . , x
n
n
M]] is approximable.
Theorem 3.12: (Closure of continuous functions under substitution) Let M be a term in c and
let l = x
1
1
, . . . x
n
n
be a list of distinct variables in V containing all the free variables of M. Let A
be a nitary algebra with signature . Then the relation F
M
denoted by the expression
x
1
1
, . . . , x
n
n
M
is approximable.
18
Proof The proof proceeds by induction on the structure of M. The base cases are easy. If M is
a variable x
i
, the relation F
M
is simply the projection mapping P
i
. If M is a constant c of type ,
then F
M
is the contant relation K
c
of arity n. The induction step is also straightforward. Let M
have the form g[M
1
1
, . . . , M
m
m
]. By the induction hypothesis,
x
1
1
, . . . , x
n
n
M
i
i
denotes an approximable mapping F
M
i
(A[[
1
]] A[[
n
]]) A[[
i
]]. But F
M
is simply the compo-
sition of the approximable mapping A[[g]] with the mapping F
M
1
, . . . F
Mm
). Theorem 2.10 tells us
that the composition must be approximable. P
The preceding generalization of composition obviously carries over to continuous functions. The
details are left to the reader.
The next domain constructor, the function-space constructor, allows approximable mappings
(or equivalently continuous functions) to be regarded as objects. In this framework, standard oper-
ations on approximable mappings such as application and composition are approximable mappings.
Indeed, the denitions of ideals and of approximable mappings are quite similar. The space of ap-
proximable mappings is built by looking at the actions of mappings on nite sets, and then using
progressively larger nite sets to construct the mappings in the limit. To this end, the notion of a
nite step mapping is required.
Denition 3.13: [Finite Step Mapping] Let A and B be nitary bases. An approximable
mapping F AB is a nite step mapping i there exists nite set S AB and F is the least
approximable mapping such that S F.
It is easy to show that for every consistent nite set S AB, a least mapping F always exists.
F is simply the closure of S under the four conditions that an approximable mapping must satisfy.
The least approximable mapping respecting the empty set is the relation a,
B
) [ a A. The
space of approximable mappings is built from these nite step mappings.
Denition 3.14: [Partial Order of Finite Step Mappings] For nitary bases A and B the
mapping basis is the partial order A B consisting of
the universe of all nite step mappings, and
the approximation ordering
F _ G a A F(a) _
B
G(a) .
The following theorem establishes that the constructor maps nitary bases into nitary bases.
Theorem 3.15: Let A and B be nitary bases. Then, the mapping basis A B is a nitary
basis.
Proof Since the elements are nite subsets of a countable set, the basis must be countable. It
is easy to conrm that A B is a partial order; this task is left to the reader. We must show
that every nite consistent subset of A B has a least upper bound in A B. Let be a nite
consistent subset of the universe of A B. Each element of is a set of ordered pairs a, b) that
meets the approximable mapping closure conditions. Since is consistent, it has an upper bound
A B. Let U =
. Clearly, U
F T .
It is easy to conrm that the relation on the right hand side of the preceding equation is approx-
imable mapping: if it violated any of the closure properties so would a nite approximation in T.
We must prove that the function h is one-to-one and onto. To prove the former, we note that each
pair of distinct ideals has a witness a, b) that belongs to a set in one ideal but not in any set in
the other. Hence, the images of the two ideals are distinct. The function h is onto because every
approximable mapping is the image of the set of nite step maps that approximate it. P
The preceding theorem can be restated in terms of continuous functions.
Corollary 3.21: (to Theorem 3.20) The domain of ideals determined by the nitary basis
(/
c
B)
0
is isomorphic to the partial order of continuous functions /
c
B. Hence, /
c
B is a
domain.
Now that we have dened the approximable map and continous function domain constructions,
we can show that operators on maps and functions introduced in Section 2 are continuous functions.
20
Theorem 3.22: Given nitary bases, A and B, there is an approximable mapping
Apply : ((A B) A) B
such that for all F : A B and a A,
Apply[F, a] = F a .
Recall that for any approximable mapping G CD and any element c C
Gc = d [ c Gd .
Proof For F (A B), a A and b B, dene the Apply relation as follows:
[F, a] Apply b a F b .
It is easy to verify that Apply is an approximable mapping; this step is left to the reader. From
the denition of Apply, we deduce
Apply[F, a] = b [ [F, a] Apply b = b [ a F b = F a .
P
This theorem can be restated in terms of continuous functions.
Corollary 3.23: Given domains, / and B, there is an continuous function
apply : ((/
c
B) /)
c
B
such that for all f : /
c
B and a /,
apply[f, a] = f a .
Proof of corollary. Let apply : ((/
c
B) /)
c
B be the continuous function (on functions
rather than relations!) corresponding to Apply. From the denition of apply and Theorem 2.6 which
relates approximable mappings on nitary bases to continous functions over the corresponding
domains, we know that
apply[f, 1
A
] = b B[ F
(A B) ; a 1
A
F
F [F
, a] Apply b
where F denotes the approximable mapping corresponding to f. Since f is the continuous function
corresponding to F,
f 1
A
= b B[ a 1
A
a F b
So, by the denition of the Apply relation, apply[f, 1
A
] f 1
A
. For every b f 1
A
, there exists
a 1
A
such that a F b. Let F
b. By denition,
F
= h.
In addition, the function
curry : (/B () (/ (B ())
dened by the equation
curry g 1
A
1
B
= curry
g
1
A
1
B
is continous.
Proof Let g be any continuous function in the domain (/B) (. Recall that
curry
g
a = (y g[a, y]) .
Using this denition and the denition of operations in the rst equation, we can deduce
apply curry
g
p
0
, p
1
)[a, b] = apply[curry
g
p
0
, p
1
)[a, b]]
= apply[(curry
g
p
0
)[a, b], p
1
[a, b]]
= apply[curry
g
p
0
[a, b], b]
= apply[curry
g
a, b]
= curry
g
a b
= g[a, b] .
22
Hence, the rst equation holds.
The second equation follows almost immediately from the rst. Dene g
: (/ B)
c
( by
the equation
g
[a, b] = h a b .
The function g
[a, y])
= (y h a y)
= h a .
Since h = curry
g
, the rst equation implies that
apply h p
0
, p
1
) = apply curry
g
p
0
, p
1
)
= g
.
Hence,
curry
apply
h p
0
, p
1
) = curry
g
= h.
These two equations show that (/B)
c
( is isomorphic to (/
c
(B () under the curry
operation. In addition, the denition of curry shows that
curry g _ curry g
g _ g
.
Hence, curry is an isomorphism. Moreover, curry must be continuous. P
The same theorem can be restated in terms of approximable mappings.
Corollary 3.27: The relation Curry
G
satises the following two equations:
Apply Curry
G
0
,
1
) = G
Curry
ApplyG
0
,
1
= G.
In addition, the relation
Curry : (AB) C) (A (B C))
dened by the equation
Curry(G) = [a, F] [ a A, F (B C), [b, c] F [a, b] Gc
is approximable.
Exercises
Exercise 3.28: We assume that there is a countable basis. Thus, the basis elements could without
loss of generality be dened in terms of 0, 1
such that
AB = [0a, 1b] [ a A, b B
Give the appropriate denition for the elements in the domain. Also show that there exists an
approximable mapping diag : D DD where diag x = [x, x] for all x T.
23
Exercise 3.29: Establish some standard isomorphisms:
1. AB BA
2. A(BC) (AB) C
3. A A
, B B
AB A
n=0
1
n
0B
Thus, B
2. if b B and d D
, then 0X 1Y D
.
Show that, with the superset relation as the approximation ordering, D
D D
.
Exercise 3.31: Using the product construction as a guide, generate a denition for the separated
sum system A + B. Show that there are mappings in
A
: A A + B, in
B
: B A + B,
out
A
: A + B A, and out
B
: A + B B such that out
A
in
A
= I
A
where I
A
is the identity
function on A. State any necessary assumptions to ensure this function equation is true.
Exercise 3.32: For approximable mappings f : A A
and g : B B
and f +g : A+B A
+B
such that
(f g)[a, b] = [f a, g b]
and thus
f g = f p
0
, g p
1
)
Show also that
out
A
(f +g) in
A
= f
and
out
B
(f +g) in
B
= g
Is f +g uniquely determined by the last two equations?
Exercise 3.33: Prove that the composition operator is an approximable mapping. That is, show
that comp : (B C) (A B) (A C) is an approximable mapping where for f : A B
and g : B C, comp[g, f] = g f. Show this using the approach used in showing the result for
apply and curry. That is, dene the relation and then build the function from apply, curry, using
and paired functions. (Hint: Fill in mappings according to the following sequence of domains).
(A B) A B
(B C) ((A B) A) (B C) B
((B C) (A B)) A (B C) B
((B C) (A B)) A C
(B C) (A B) (A C).
This map shows only one possible solution.
24
Exercise 3.34: Show that for every domain T there is an approximable mapping
cond : TDD D
called the conditional operator such that
1. cond[true, a, b] = a
2. cond[false, a, b] = b
3. cond[
T
, a, b] =
D
and T =
T
, true, false such that
T
_ true,
T
_ false, but true and false are incomparable.
(Hint: Dene a cond relation).
4 Fixed Points and Recursion
Functions can now be constructed by composing basic functions. However, we wish to be able to
dene functions recursively as well. The technique of recursive denition will also be useful for
dening domains. Recursion can be thought of as (possibly innite) interated composition. The
primary result is the following Fixed Point Theorem.
Theorem 4.1: For any approximable mapping f : D D on any domain, there exists a least
element x T such that
f(x) = x.
Proof Let f
n
stand for the function f composed with itself n times. Thus,
f
0
= I
D
and
f
n+1
= f f
n
Dene
x = d D[ n N.f
n
d.
To show that x T, we must show it to be an ideal. f is an approximable mapping, so x since
f . For d x and d
_ d, d
x.
Closure under lubs is direct since f must include lubs to be approximable.
To see that f(x) = x, note that for any d x, if d f d
, then d
n=0
f
n
()
for all f : D D.
Proof The nal equation can be simplied to
fix(f) = d D[ n N.f
n
d
which is the equation used in the previous theorem to dene the xed point. Using the formula
from Exercise 2.8 on the above denition for fix yields the following equation to be shown:
fix(f) =
fix(1
F
) [ F (D D).F f
where 1
F
denotes the ideal for F in D D.
From its denition, fix is monotonic since, if f _ g, then fix(f) _ fix(g) since f
n
_ g
n
. Since
F f, 1
F
_ f and since fix is monotonic, fix(1
F
) _ fix(f).
Let x fix(f). Thus, there is a nite sequence of elements such that f x
1
f . . . f x
f x.
Dene F as the basis element encompassing the step functions required for this sequence. Clearly,
F f. In addition, this same sequence exists in fix(1
F
) since we constructed F to contain it, and
thus, x fix(1
F
) and fix(f) _ fix(1
F
). The equality is therefore established.
The rst equality is direct from the Fixed Point Theorem since the same denition is used.
Assume f(x) _ x for some x T. Since x, x ,= . Since f is an approximable mapping, for
x
x and x
, _
F
) where
F
= [
and the approximation order is the superset relation. The reader should satisfy himself that F
and F are isomorphic and that the elements are the partial functions. The total elements are the
total functions over the natural numbers.
The domains T and (^ ^) are not isomorphic. However, the following mapping val :
F N N can be dened as follows:
( , n) val m (n, m)
and
( , N) val N
Dene also as the ideal for m ^,
m = m, N
It is easy to show then that for T and n ^ we have
val(, n) =
(n) if (n) ,=
= otherwise
Thus,
curry(val) : F (N N)
is a one-to-one function on elements. (The problem is that (N N) has more elements than F
does as the reader should verify for himself).
Now, what about mappings f : F F? Consider the function
f()(n) = 0 if n = 0
= (n 1) +n 1 for n > 0
If is a total function, f() is a total function. If (k) is undened, then f()(k +1) is undened.
The function f is approximable since it is completely determined by its actions on partial functions.
That is
f() =
f() [ .
The Fixed Point Theorem denes a least xed point for any approximable mapping. Let = f().
Now, (0) = 0 and
(n + 1) = f()(n + 1)
= (n) +n
By induction, (n) =
n
i=0
i and therefore, is a total function. Thus, f has a unique xed point.
27
Now, in looking at (N N), we have
0 ^ (The symbols n and n will no longer be
distinguished, but the usage should be clear from context.). Now dene the two mappings,
succ, pred : N N as approximable mappings such that
n succ m p N.n _ p, m _ p + 1
n pred m p + 1 N.n _ p + 1, m _ p
In more familiar terms, the same functions are dened as
succ(n) = n + 1
pred(n) = n 1 if n > 0
= if n = 0
The mapping zero : N T is also dened such that
zero(n) = true if n = 0
= false if n > 0
where T is the domain of truth value dened in an earlier section. The structured domain
N, 0, succ, pred, zero) is called The Domain of the Integers in the present context. The function
element dened as the xed point of the mapping f can now be dened directly as a mapping
: N N as follows:
(n) = cond(zero(n), 0, (pred(n)) +pred(n))
where the function + must be suitably dened. Recall that cond was dened earlier as part of the
structure of the domain T . This equation is called a functional equation; the next section will give
another notation, the calculus for writing such equations. P
Example 4.4: The domain B dened in Example ?? contained only innite elements as total
elements. A related domain, ( dened in Exercise 2.20, can be regarded as a generalization on
^. To demonstrate this, the structured domain corresponding to the domain of integers must be
presented. The total elements in ( are denoted while the partial elements are denoted for
any 0, 1.
The empty sequence assumes the role of the number 0 in ^. Two approximable mappings can
serve as the successor function: x 0x denoted succ
0
and x 1x denoted succ
1
. The predecessor
function is lled by the tail mapping dened as follows:
tail(0x) = x,
tail(1x) = x and
tail() = .
The zero predicate is dened using the empty mapping dened as follows:
empty(0x) = false,
empty(1x) = false and
empty() = true.
To distinguish the other types of elements in (, the following mappings are also dened:
zero(0x) = true,
zero(1x) = false and
zero() = false.
one(0x) = false,
one(1x) = true and
one() = false.
28
The reader should verify the conditions for an approximable mapping are met by these functions.
An element of ( can be dened using a xed point equation. For example, the total element
representing an innite sequence of alternating zeroes and ones is dened by the xed point of the
equation
a = 01a.
This same element is dened with the equation
a = 0101a.
Is the element dened as
b = 010b
the same as the previous two? Approximable mappings in ( ( can also be dened using
equations. For example, the mapping
d() = ,
d(0x) = 00d(x) and
d(1x) = 11d(x)
can be characterized with the functional equation
d(x) = cond(empty(x), , cond(zero(x), succ
0
(succ
0
(d(tail(x)))), succ
1
(succ
1
(d(tail(x))))))
The concatenation function of Exercise 2.20 over ( ( ( can be dened with the functional
equation
C(x, y) = cond(empty(x), y, cond(zero(x), succ
0
(C(tail(x), y)), succ
1
(C(tail(x), y))))
The reader should verify that this denition is consistent with the properties required in the exercise.
These denitions all use recursion. They rely on the object being dened for a base case (
for example) or on earlier values (tail(x) for example). These equations characterize the object
being dened, but unless a theorem is proved to show that a solution to the equation exists, the
denition is meaningless. However, the Fixed Point Theorem for domains was established earlier
in this section. Thus, solutions exist to these equations provided that the variables in the equation
range over domains and any other functions appearing in the equation are known to be continuous
(that is approximable).
To illustrate one use of the Fixed Point Theorem as well as show the use of recursion in a more
familiar setting, we will show that all second order models of Peanos axioms are isomorphic. Recall
that
Denition 4.5: [Model for Peanos Axiom] A structured set N, 0, succ) for 0 N and
succ : N N is a model for Peanos axioms if all the following conditions are satised:
1. n N.0 ,= succ(n)
2. n, m N.succ(n) = succ(m) n = m
3. x N.0 x succ(x) x x = N
where succ(x) = succ(n) [ n x. The nal clause is usually referred to as the principle of
mathematical induction.
29
Theorem 4.6: All second order models of Peanos axioms are isomorphic.
Proof Let N, 0, +) and M, , #) be models for Peanos axioms. Let N M be the cartesian
product of the two sets and let T(N M) be the powerset of N M. Recall from Exercise ??
that the powerset can be viewed as a domain with the subset relation as the approximation order.
Dene the following mapping:
u (0, ) (+(n), #(m)) [ (n, m) u
The reader should verify that this mapping is approximable. Since it is indeed approximable, a
xed point exists for the function. Let r be the least xed point:
r = (0, ) (+(n), #(m)) [ (n, m) r
But r denes a binary relation which establishes the isomorphism. To see that r is an isomorphism,
the one-to-one and onto features must be established. By construction,
1. 0 r and
2. n r m +(n) r #(m).
Now, the sets (0, ) and (+(n), #(m))[ (n, m) r are disjoint by the rst axiom. Therefore,
0 corresponds to only one element in m. Let x N be the set of all elements of N that correspond
to only one element in m. Clearly, 0 x. Now, for some y x let z M be the element in M that
y uniquely corresponds to (that is y r z). But this means that +(y) r#(z) by the construction of
the relation. If there exists w M such that +(y) r w and since (+(y), w) ,= (0, ), the xed point
equation implies that (+(y) = +(n
0
)) and (w = #(m
0
)) for some (n
0
, m
0
) r. But then by the
second axiom, y = n
0
and since y x, z = m
0
. Thus, #(z) is the unique element corresponding to
+(y). The third axiom can now be applied, and thus every element in N corresponds to a unique
element in M. The roles of N and M can be reversed in this proof. Therefore, it can also be shown
that every element of M corresponds to a unique element in N. Thus, r is a one-to-one and onto
correspondence. P
Exercises
Exercise 4.7: In Theorem 4.2, an equation was given to nd the least xed point of a function
f : T T. Suppose that for a T, a _ f(a). Will the xed point x = f(x) be such that a _ x?
(Hint: How do we know that
n=0
f
n
(a) T?)
Exercise 4.8: Let f : T T and S T satisfy
1. S
2. x S f(x) S
3. [n.x
n
S x
n
_ x
n+1
]
n=0
x
n
S
Conclude that fix(f) S. This is sometimes called the principle of xed point induction. Apply
this method to the set
S = x T [ a(x) = b(x)
where a, b : T T are approximable, a() = b(), and f a = a f and f b = b f.
30
Exercise 4.9: Show that there is an approximable operator
: ((T T) T) ((T T) T)
such that for : (T T) T and f : T T,
()(f) = f((f))
Prove also that fix : (T T) T is the least xed point of .
Exercise 4.10: Given a domain T and an element a T, construct the domain T
a
where
T
a
= x T [ x _ a
Show that if f : T T is approximable, then f can be restricted to another approximable map
f
: T
fix(f)
T
fix(f)
where x T
fix(f)
.f
have in
T
fix(f)
?
Exercise 4.11: The mapping x can be viewed as assigning a xed point operator to any domain
T. Show that x can be uniquely characterized by the following conditions on an assignment
T YF
D
:
1. F
D
: (T T) T
2. F
D
(f) = f(F
D
(f)) for all f : T T
3. when f
0
: T
0
T
0
and f
1
: T
1
T
1
are given and h : T
0
T
1
is such that h() = and
h f
0
= f
1
h, then
h(F
D
0
(f
0
)) = F
D
1
(f
1
).
Hint: Apply Exercise 4.7 to show x satises the conditions. For the other direction, apply
Exercise 4.10.
Exercise 4.12: Must an approximable function have a maximum xed point? Give an example
of an approximable function that has many xed points.
Exercise 4.13: Must a monotone function f : T(A) T(A) have a maximum xed point? (Recall
T(A) is the powerset of the set A).
Exercise 4.14: Verify the assertions made in the rst example of this section.
Exercise 4.15: Verify the assertions made in the second example, in particular those in the
discussion of Peanos Axioms. Show that the predicate function one : ( T could be dened
using a xed point equation from the other functions in the structure.
Exercise 4.16: Prove that
fix(f g) = f(fix(g f))
for approximable functions f, g : T T.
Exercise 4.17: Show that the less-than-or-equal-to relation l N N is uniquely determined by
l = (n, n) [ n N (n, succ(m) [ (n, m) l
for the structure called the Domain of Integers.
31
Exercise 4.18: Let N
be a structured set satisfying only the rst two of the axioms referred to
as Peanos. Must there be a subset S N
)).
Exercise 4.19: Let f : T T be an approximable map. Let a
n
: T T be a sequence of
approximable maps such that
1. a
0
(x) = for all x T
2. a
n
_ a
n+1
for all n N
3.
n=0
a
n
= I
D
in T T
4. a
n+1
f = a
n+1
f a
n
for all n N
Show that f has a unique xed point. (Hint: Show that if x = f(x) then a
n
(x) _ a
n
(fix(f)) for
all n N. Show this by induction on n.)
5 Typed -Calculus
As shown in the previous section, functions can be characterized by recursion equations which
combine previously dened functions with the function being dened. The expression of these
functions is simplied in this section by introducing a notation for specifying a function without
having to give the function a name. The notation used is that of the typed -Calculus; a function
is dened using a -abstraction.
An informal characterization of the -calculus suces for this section; more formal descriptions
are available elsewhere in the literature [1]. Thus, examples are used to introduce the notation.
An innite number of variables, x,y,z,. . . of various types are required. While a variable has
a certain type, type subscripts will not be used due to the notational complexity. A distinction
must also be made between type symbols and domains. The domain / B does not uniquely
determine the component domains / and B even though these domains are uniquely determined
by the symbol for the domain. The domain is the meaning that we attribute to the symbol.
In addition to variables, constants are also present. For example, the symbol 0 is used to
represent the zero element from the domain ^. Another constant, present in each domain by
virtue of Theorem 4.2, is fix
D
, the least xed point operator for domain T of type (T T) T.
The constants and variables are the atomic (non-compound) terms. Types can be associated with
all atomic terms.
There are several constructions for compound terms. First, given , . . . , , a list of terms, the
ordered tuple
, . . . , )
is a compound term. If the types of , . . . , are /, . . . , B, the type of the tuple is /. . . B since
the tuple is to be an element of this domain. The tuple notation for combining functions given
earlier should be disregarded here.
The next construction is function application. If the term has type / B and the term
has the type /, then the compound term
()
32
has type B. Function application denotes the value of a function at a given input. The nota-
tion (
0
, . . . ,
n
) abbreviates (
0
, . . . ,
n
)). Functions applied to tuples allows us to represent
applications of multi-variate functions.
The -abstraction is used to dene functions. Let x
0
, . . . , x
n
be a list of distinct variables of
type T
0
, . . . , T
n
. Let be a term of some type T
n+1
. can be thought of as a function of n + 1
variables with type (T
0
. . . T
n
) T
n+1
. The name for this function is written
x
0
, . . . , x
n
.
This expression denotes the entire function. To look at some familiar functions in the new notation,
consider
x, y.x
This notation is read lambda ex wye (pause) ex. If the types of x and y are / and B respectively,
the function has type (/B) /. This function is the rst projection function p
0
. This function
and the second projection function can be dened by the following equations:
p
0
= x, y.x
p
1
= x, y.y
Recalling the function tuple notation introduced in an earlier section, the following equation holds:
f, g) = w.f(w), g(w))
which denes a function of type T
1
(T
2
T
3
).
Other familiar functions are dened by the following equations:
eval = f, x.f(x)
curry = = gxy.g(x, y)
The curry example shows that this notation can be iterated. A distinction is thus made between
the terms x, y.x and xy.x which have the types T
0
T
1
T
0
and T
0
T
1
T
0
respectively.
Thus, the following equation also holds:
curry(x, y.) = xy.
which relates the multi-variate form to the iterated or curried form. Another true equation is
fix = x(Ff.f(F(f)))
where fix has type (T T) T and x has type
((((T T) T) ((T T) T)) ((T T) T))
This is the content of Exercise 4.9.
This notation can now be used to dene functions using recursion equations. For example, the
function in Example 4.3 can be characterized by the following equation:
= fix(fn.cond(zero(n), 0, f(pred(n)) +pred(n))
which states that is the least recursively dened function f whose value at n is cond(. . .). The
variable f occurs in the body of the cond expression, but this is just the point of a recursive
33
denition. f is dened in terms of its value on smaller input values. The use of the xed point
operator makes the denition explicit by forcing there to be a unique solution to the equation.
In an abstraction x, y, z., the variables x,y, and z are said to be bound in the term . Any
other variables in are said to be free variables in unless they are bound elsewhere in . Bound
variables are simply placeholders for values; the particular variable name chosen is irrelevant. Thus,
the equation
x. = y.[y/x]
is true provided y is not free in . The notation [y/x] species the substitution of y for x everywhere
x occurs in . The notation [/x] for the substitution of the term for the variable x is also
legitimate.
To show that these equations with terms are indeed meaningful, the following theorem relating
terms and approximable mappings must be proved.
Theorem 5.1: Every typed term denes an approximable function of its free variables.
Proof Induction on the length of the term and its structure will be used in this proof.
Variables Direct since x x is an approximable function.
Constants Direct since x k is an approximable function for constant k.
Tuples Let =
0
, . . . ,
n
). Since the
i
terms are less complex, they are approximable functions
of their free variables by the induction hypothesis. Using Theorem 3.4 (generalized to the
multi-variate case) then, which takes tuples as values also denes an approximable function.
Application Let =
0
(
1
). We assume that the types of the terms are appropriately matched.
The
i
terms dene approximable functions again by the induction hypothesis. Recalling
the earlier equations, the value of is the same as the value of eval(
0
,
1
). Since eval is
approximable, Theorem 3.7 shows that the term denes an approximable function.
Abstraction Let = x.. By the induction hypothesis, denes a function of its free variables.
Let those free variables be of types T
0
, . . . , T
n
where T
n
is the type of x. Then denes an
approximable function
g : T
0
. . . T
n
T
where T
)
yields an approximable function, but this is just the function dened by . The reader can
generalize this proof for multiple bound variables in .
P
Given this, the equation = states that the two terms dene the same approximable function
of their free variables. As an example,
x. = y.[y/x]
provided y is not free in since the generation of the approximable function did not depend on the
name x but only on its location in . Other equations such as these are given in the exercises. The
most basic rule is shown below.
34
Theorem 5.2: For appropriately typed terms, the following equation is true:
(x
0
, . . . , x
1
.)(
0
, . . . ,
n1
) = [
0
/x
0
, . . . ,
n1
/x
n1
]
Proof The proof is given for n = 1 and proceeds again by induction on the length of the term
and the structure of the term.
Variables This means (x.x)() = must be true which it is.
Constants This requires (x.k)() = k must be true which it is for any constant k.
Tuples Let =
0
,
1
). This requires that
(x.
0
,
1
))() =
0
[/x],
1
[/x])
must be true. This equation holds since the left-hand side can be transformed using the
following true equation:
(x.
0
,
1
))() = (x.
0
)(), (x.
1
)())
Then the inductive hypothesis is applied to the
i
terms.
Applications Let =
0
(
1
). Then, the result requires that the equation
(x.
0
(
1
))() =
0
[/x](
1
[/x])
hold true. To see that this is true, examine the approximable functions for the left-hand side
of the equation.
0
V , x t
0
1
V , x t
1
V s
so
(x.
0
(
1
))()
V [(x t
0
(t
1
))(s)]
=
V , x [(x t
0
)(s)]([(x t
1
)(s)])
From this last term, we use the induction hypothesis. To see why the last step holds, start
with the set representing the left-hand side and using the aprroximable mappings for the
terms:
(x.
0
(
1
))()
V [(x t
0
(t
1
))(s)]
= b [ a.a s a [x t
0
(t
1
)] b
= b [ a.a s a (x, u) [ v x t
1
) v (x t
0
) u b
= b [ a.a s v (x t
1
)(a) v (x t
0
)(a) b
= b [ a, c.a s a (x t
1
) v a (x t
0
) c v c b
= b [ v [(x t
1
)(s)] c (x t
0
)(s) v c b
= b [ v [(x t
1
)(s)] v [(x t
0
)(s)] b
= [(x t
0
)(s)]([(x t
1
)(s)])
Abstractions Let = y.
0
. The required equation is
(x.y.
0
)() = y.
0
[/x]
35
provided that y is not free in . The following true equation applies here:
(x.y.)() = y.((x.)())
To see that this equation holds, let g be a function of n + 2 free variables dened by . By
Theorem 5.1, the term x.y. denes the function curry(curry(g)) of n variables. Call this
function h. Thus,
h(v)()(y) = g(v, , y)
where v is the list of the other free variables. Using a combinator inv which inverts the order
of the last two arguments,
h(v)()(y) = curry(inv(g))(v, y)()
But, curry(inv(g)) is the function dened by x.. Thus, we have shown that
(x.y.)()(y) = (x.)()
is a true equation. If y is not free in and (y) = is true, then = y. must also be true.
P
If
(x, y) is the same as . This species that x and y are not free
in . This notation is used in the proof of the following theorem.
Theorem 5.3: The least xed point of
x, y.(x, y), (x, y))
is the pair with coordinates fix(x.(x, fix(y.(x, y)))) and fix(y.(fix(x.(x, y)), y)).
Proof We are thus assuming that x and y are not free in and . The purpose here is to nd
the least solution to the pair of equations:
x = (x, y) and y = (x, y)
This generalizes the xed point equation to two variables. More variables could be included using
the same method. Let
y
= fix(x.(x, y))
Then,
x
= (x
, y
)
and
y
= (fix(x.(x, y
), y
))
= (x
, y
).
This shows that the pair x
, y
and y
0
_ y
, y
_ y
0
must hold as well so y
0
= y
. Thus,
x
T, tail : T
and push : T T
n=0
. (Hint:
Try a recursive denition, such as
diag(x) = push(x, diag(x))
but be sure to prove that all terms of diag(x) are x.) Also introduce by an appropriate recursive
denition a combinator map : (T T)
T T
n=0
, x) = f
n
(x))
n=0
Exercise 5.10: For any domain T introduce, as a least xed point, a combinator
while : (T T ) (T T) (T T)
by the recursion equation
while(p, f)(x) = cond(p(x), while(p, f)(f(x)), x)
Prove that
while(p, while(p, f)) = while(p, f)
Show how while could be used to obtain the least number operator,, mentioned in the proof of
Theorem 5.5. Generalize this idea to dene a combinator
find : T
(T T ) T
which means nd the rst term in the sequence (if any) which satises the given predicate.
Exercise 5.11: Prove the existence of a one-one function num : N N N such that
num(0, 0) = 0
num(n, m+ 1) = num(n + 1, m)
num(n + 1, 0) = num(0, n) + 1
Draw a descriptive picture (an innite matrix) for the function. Find a closed form for the values
if possible. Use the function to prove the isomorphism between T(N),T(NN), and T(N) T(N).
Exercise 5.12: Show that there are approximable mappings
graph : (T(N) T(N)) T(N)
and
fun : T(N) (T(N) T(N))
where fun graph = f.f and graph fun _ x.x. (Hint: Using the notation [n
0
, . . . , n
k
] =
num(n
0
, [n
1
, . . . , n
k
]), two such combinators can be given by the formulas
fun(u)(x) = m[ n
0
, . . . , n
k1
x.[n
0
+ 1, . . . , n
k1
+ 1, 0, m] u
graph(f) = [n
0
+ 1, . . . , n
k1
+ 1, 0, m] [ m f(n
0
, . . . , n
k1
)
where k is a variable - meaning all nite sequences are to be considered.)
40
6 Introduction to Domain Equations
As stressed in the introduction, the notion of computation with potentially innite elements is
an integral part of domain theory. The previous sections have dened the notion of functions
over domains, as well as a notation for expressing these functions. In addition, the notion of
computation through series of approximations has been addressed. This computation is possible
since the functions dened have been approximable and thus continuous. This section addresses the
construction of more complex domains with innite elements. The next section looks specically
at the notion of computability with respect to these innite elements. The last section looks at
another approach to domain construction.
New domains have been constructed from existing ones using domain constructors such as the
product construction (), the function space construction () and the sum construction (+) of
Exercise 3.31. These constructors can be iterated similar to the way that function application was
iterated to form recursive function denitions. In this way, domains can be characterized using
recursion equations, called domain equations.
A domain equation represents an isomorphism between the domain as a whole and the combina-
tion of domains that comprise it. These recursive domains are frequently termed reexive domains
since, as in the following example, the domain contains a copy of itself in its structure.
Example 6.1: Consider the following domain equation:
T = /+ (T T )
where / is a previously dened domain. This domain can be thought of as containing atomic
elements from / or pairs of elements of T . What do the elements of this domain look like? In
particular, what are the nite elements of this domain? How is the domain constructed? What is
an appropriate approximation ordering for the domain? What do lubs in this domain look like?
What is the appropriate notion of consistency? Does this domain even exist? Is there a unique
solution to this equation? Each of these questions is examined below.
The domain equation tells us that an element of the domain is either an element from / or
is a pair of smaller elements from T . One method of constructing a sum domain is using pairs
where some distinguished element denotes what type an element is. Thus, for some a /, the
pair , a) might represent the element in T for the given element a. For some s, t T , the pair
s, t), ) might then represent the element in T for the pair s, t. Thus, is the distinguished
element, and the location of in the pair species the type of the element. The nite elements
are either elements in T representing the (nite) elements of / or the pair elements from T whose
components are also nite elements in T .
The question then arises about innite elements. Are there innite elements in this domain?
Consider the following xed point equation for some element for a /:
x = a, x), ).
The xed point of this equation is the innite product of the element a. Does this element t the
denition for T ? From the informal description of the elements of T given so far, x does qualify as
a member of T .
Now that some intuition has been developed about this domain, a formal construction is re-
quired. Let A, _
A
) be the nitary basis used to generate the domain /. Let be an object such
that / A. Dene the bottom element of the nitary basis T as
T
= , ). Next, all the
elements of / must be included so dene an element in T for each a A as , a). Finally, pair
41
elements for all elements in T must exist in T to complete the construction. The set T can be
dened inductively as the least set such that:
1.
T
T
2. , a) T whenever a A
3.
T
, s), ) T whenever s T
4. t,
T
), ) T whenever t T
The set can also be characterized by the following xed point equation:
T =
T
, a) [ a A
T
, s), ) [ s T t,
T
), ) [ t T.
A solution must exist for this equation by the xed point theorem.
Now that the basis elements have been dened, we must show how to nd lubs. We will again
use an inductive denition.
1. , ) . t = t for all t T
2. For a, b A, , a) . , b) = , a . b) if a . b exists in A
3. s, t), ) . s
, t
), ) = s . s
, t . t
), ) if s . s
and t . t
exist in T.
4. The lub , a) . s, t), ) does not exist.
Next, the notion of consistency needs to be explored. From the denition of lubs given above,
the following sets are consistent:
1. The empty set is consistent.
2. Everything is consistent with the bottom element.
3. A set of elements all from the basis A is consistent in T if the set of elements is consistent in
A.
4. A set of product elements in T is consistent if the left component elements are consistent and
the right component elements are consistent.
These conditions derive from the sum and product nature of the domain.
The approximation ordering in the basis has the following inductive denition:
1.
T
_
T
s for all s T
2. y _
T
u .
T
whenever y _
T
u
3. , a) _
T
, b) whenever a _
A
b
4. s, t), ) _
T
u, v), ) whenever s _
T
u and t _
T
v
The next step is to verify that T is indeed a nitary basis. The basis is still countable. The
approximation is clearly a partial order. The existence of lubs of nite bounded subsets must be
veried. The denition of consistency gives us the requirements for a bounded subset. Each of the
conditions for consistency are examined inductively since the denitions are all inductive:
42
1. The lub of the empty set is the bottom element
T
.
2. The lub of a set containing the bottom element is the lub of the set without the bottom
element which must exist by the induction hypothesis.
3. The lub of a set of elements all from the A is the element in T for the lub in A. This element
must exist since A is a nitary basis and all elements from A have corresponding elements
in T.
4. The lub of a set of product elements is the pair of the lub of the left components and the lub
of the right components. These exist by the induction hypothesis.
Thus, a nitary basis has been created; the domain is formed as always from the basis. The solution
to the domain equation has been found since any element in the domain T is either an element
representing an element in / or is the product of two other elements in T . Similarly, any element
found on the left-hand side must also be in the domain T by the construction. Thus, the domain
T is identical to the domain /+ (T T ).
To look at the question concerning the existence and uniqueness of the solution to this domain
equation, recall the xed point theorem. This theorem states that a xed point set exists for any
approximable mapping over a domain. In the nal section, the concept of a universal domain is
introduced. A universal domain is a domain which contains all other domains as sub-domains.
These sub-domains are, roughly speaking, the image of approximable functions over the universal
domain. The domain equation for T can be viewed as an approximable mapping over the universal
domain. As such, the xed point theorem states that a least xed point set for the function does
exist and is unique. Sub-domains are dened formally below.
Looking again at the informal discussion concerning the elements of the domain T , the innite
element proposed does t into the formal denition for elements of T . This element is an innite
tree with all left sub-trees containing only the element a. For this innite element to be computable,
it must be the lub of some ascending chain of nite approximations to it. The element x can, in
fact, be dened by the following ascending sequence of nite trees:
x
0
=
x
n+1
= a, x
n
), )
x =
n=0
x
n
Thus, using domain equations, a domain has been dened recursively. This domain includes
innite as well as nite elements and allows computation on the innite elements to proceed using
the nite approximations, as with the more conventionally dened domains presented earlier.
The nal topic of this section is the notion of a sub-domain. Informally, a sub-domain is
a structured part of a larger domain. Earlier, a domain was described as a sub-domain of the
universal domain. Thus, the sub-domain starts with a subset of the elements of the larger domain
while retaining the approximation ordering, consistency relation and lub relation, suitably restricted
to the subset elements.
Denition 6.2: [Sub-Domain] A domain 1, _
R
) is a sub-domain of a domain T, _
D
), denoted
1T i
1. 1 T - The elements of 1 are a subset of the elements of T.
2.
R
=
D
- The bottom elements are the same.
43
3. For x, y 1, x _
R
y x _
D
y - The approximation ordering for 1 is the approximation
ordering for T restricted to elements in 1.
4. For x, y, z 1, x .
R
y = z i x .
D
y = z - The lub relation for 1 is the lub relation for T
restricted to elements in 1.
5. 1 is a domain.
Equivalently, a sub-domain can be thought of as the image of an approximable function which
approximates the identity function (also termed a projection). The notion of a sub-domain is used
in the nal section in the discussions about the universal domain. This mapping between the
domains can be formalized as follows:
Theorem 6.3: If T c, then there exists a projection pair of approximable mappings i : T c
and j : c T where j i = I
D
and i j _ I
E
where i and j are determined by the following
equations:
i(x) = y E[ z x.z _ y
j(y) = x D[ x y
for all x T and y c.
The proof is left as an exercise.
By the denition of a sub-domain, it should be clear that
T
0
c T
1
c (T
0
T
1
T
0
T
1
)
Using this observation, the sub-domains of a domain can be ordered. Indeed, the following theorem
is a consequence of this ordering.
Theorem 6.4: For a given domain T, the set of sub-domains T
0
[ T
0
T form a domain.
The proof proceeds using the ordering relation dened as an approximation ordering and is left as
an exercise.
Finally, a converse of Theorem 6.3 can also be established:
Theorem 6.5: For two domains T and c, if there exists a projection pair i : T c and j : c T
with j i = I
D
and i j _ I
E
, then T
c where T T
.
Proof We want to show that i maps nite elements to nite elements and that T
is the image of
T in c.
For some x D with 1
x
as the principal ideal of x, we can write
i(1
x
) = .1
y
[ y i(1
x
)
Applying j to both sides we get
1
x
= j i(1
x
) = .j(1
y
) [ y i(1
x
)
since j i = I
D
and j is continuous by assumption. But, since x 1
x
, x j(1
y
) for some y i(1
x
).
This means that
1
x
j(1
y
)
and thus
i(1
x
) i j(1
y
) 1
y
44
Since 1
y
i(1
x
) must hold by the construction, i(1
x
) = 1
y
. This proves that nite elements are
mapped to nite elements.
Next, consider the value for i(
D
). Since
D
_
D
j(
E
), i(
D
) _
E
. Thus i(
D
) =
E
.
Thus, T is isomorphic to the image of i in c. We still must show that T
. Let y
, z
and y
. z
= x
. z
= x
i(1
x
). We already know that x j(1
x
) so i(1
x
) _ 1
x
. Thus,
i(1
x
) = 1
x
and thus, x
. P
Exercises
Exercise 6.6: Show that there must exist domains satisfying
/ = /+ (/B) and
B = /+B
Decide what the elements will look like and dene / and B using simultaneous xed points.
Exercise 6.7: Prove Theorem 6.4
Exercise 6.8: Prove Theorem 6.3
Exercise 6.9: Show that if / and B are nite systems, that
T c T T c
where T T
and T
c is denoted T
c.
7 Computability in Eectively Given Domains
In the previous sections, we gave considerable emphasis to the notion of computation using in-
creasingly accurate approximations of the input and output. This section denes this notion of
computability more formally. In Section 5, we found that partial functions over the natural num-
bers were expressible in the -notation. This relationship characterizes computation for a particular
domain. To describe computation over domains in general, a broader denition is required.
The way a domain is presented impacts the way computations are performed over it. Indeed,
the theorems of recursive function theory rely in part on the normal presentation of the natural
numbers. A presentation for a domain is an enumeration of the elements of the domain. The
standard presentation of the natural numbers is simply the numbers in ascending order beginning
with 0. There are many permutations of the natural numbers, each of which can be considered
a presentation. Computation with these non-standard presentations may be impossible; that is a
computable function on the standard presentation may be non-computable over a non-standard
45
presentation. Therefore, an eective presentation for a domain is dened as a presentation which
makes the required information computable.
Information about elements in a domain can be characterized completely by looking at the
nite elements and their relationships. Thus a presentation must enumerate the nite elements
and allow the consistency and lub relationships on these elements to be computed to allow this
style of computation.
The consistency relation and the lub relation depend on each other. For example, if a set of
elements is consistent, a lub must exist for the set. Given that a set is consistent, the lub can be
found in nite time by just enumerating the elements and checking to see if this element is the lub.
However, if the set is inconsistent, the enumeration will not reveal this fact. Thus, the consistency
relation must be assumed to be recursive in an eective presentation. Exercise 7.10 provides a
description of presentations that should clarify the assumptions made. Formally, a presentation is
dened as follows:
Denition 7.1: [Eective Presentation] The presentation of a nitary basis D is a function
: N D such that (0) =
D
and the range of is the set of nite elements of D. The denition
holds for a domain T as well.
A presentation is eective i
1. The consistency relation (k.
i
_
k
j
_
k
) for elements
i
and
j
is recursive
4
over i
and j.
2. The lub relation (
k
=
i
.
j
) is recursive over i, j, and k.
This denition supports our intuition about domains; we have stated that the important in-
formation about a domain is the set of nite elements, the ordering and consistency relationships
between the elements and the lub relation. Thus, an eective presentation provides, in a suitable
(that is computable) form, the basic information about the structure and elements of a domain. A
presentation can also be viewed as an enumeration of the elements of the domain with the position
of an element in the enumeration given by the index corresponding to the integer input for that
element in the presentation function with the 0 element representing . This perspective is used
in the majority of the proofs.
Now that the presentation of a domain has been formalized, the notion of computability can be
formally dened. Thus,
Denition 7.2: [Computable Mappings] Given two domains, T and c with eective presen-
tations
1
and
2
respectively, an approximable mapping f : D E is computable i the relation
x
n
f y
m
is recursively enumerable in n and m.
By considering the domain T to be a single element domain, the above denition applies not
only to computable functions but also to computable elements. For d T where d is the only
element in the domain, the element
e = f(d) c
denes an element in c. The denition states that e is a computable i the set
m N [ y
m
_ e
4
Recursive in this context means that the relation is decidable.
46
is a recursively enumerable set of integers. Clearly if the set of elements approximating another
is nite, the set is recursive. The notion of a recursively enumerable set simply requires that
all elements approximating the element in question be listed eventually. The computation then
proceeds by accepting an enumeration representing the input element and enumerating the elements
that approximate the desired output element.
Now that the notions of computability and eective presentations have been formalized, the
methods of constructing domains and functions will be addressed.
The proof of the next theorem is trivial and is left to the reader.
Theorem 7.3: The identity map on an eectively given domain is computable. The composition
of computable mappings on eectively given domains are also computable.
The following corollary is a consequence of this theorem:
Corollary 7.4: For computable function f : T c and a computable element x T, the element
f(x) c is computable.
In addition, the standard domain constructors maintain eective presentations.
Theorem 7.5: For domains T
0
and T
1
with eective presentations, the domains
T
0
+T
1
and T
0
T
1
are also eectively given. In addition, the projection functions are all computable. Finally, if f and
g are computable maps, then so are f +g and f g.
Proof Let X
i
[ i N be the enumeration of T
0
and Y
i
[ i N be the enumeration of T
1
.
Another method of sum construction is to use two distinguishing elements in the rst position to
specify the element type. Thus, a sum domain can be dened as follows:
T
0
+T
1
= (
0
,
1
) (0, x) [ x T
0
(1, y) [ y T
1
x.x
a x
y _ x
for all x c.
Proof Assume that (2) holds. We want to show that a is a nitary projection. By the closure
properties on ideals, we know that for all x c,
x
x y _ x
y x
Thus, a(x) x must hold. In addition, the following trivially holds:
x
x x
a x
a(x)
thus a(x) a(a(x)) holds for all x c. This shows that a is indeed a projection. Let D = x
E[xax. It is easy to show that DE and that a is determined from D as required in Theorem 8.2.
Thus, the xed point set of a is isomorphic to a domain from the previous proofs. Thus, (2) (1).
For the converse, assume that a is a nitary projection. Let T be isomorphic to the xed point
set of a. This means there is a projection pair i and j such that j i = I
D
and i j = a and a I
E
.
From Theorem 6.5 then we have that T T
and T
c. We want to identify T
as follows:
T
= x c [ x a x
From the proof of Theorem 6.5, the basis elements of D
a(1
x
) = 1
x
x a x
Since a is a projection, 1
x
must also be a xed point. Since i(j(1
x
)) = 1
x
implies that j(1
x
) is a
nite element of T, x T
holds.
Finally, using a = i j in the formula in Theorem 6.3, the formula in (2) is obtained, proving
the converse. P
This characterization of projections provides a new and interesting combinator.
52
Theorem 8.6: For any domain c, dene sub : (c c) (c c) using the relation
x sub(f) z y E.y f y y _ x z _ y
for all x, z E and all f : E E. Then the range of sub is exactly the set of nitary projections
on c. In addition, sub is a nitary projection on c c. If c is eectively given, then sub is
computable.
Proof Clearly, sub(f) is approximable. It is obvious from the denition that f sub(f) preserves
lubs and thus is approximable as well. Thus,
y f y y _ x z _ y x f z
obviously holds. Thus, sub(f) f holds. Also
y f y y sub(f) y
thus, sub(f) sub(sub(f)) holds as well. Thus, sub is a projection on c c. The denition of
the relation shows that it is computable when c is eectively given.
Since sub is a projection, its range is the same as its xed point set. If sub(a) = a, it is easy
to see that clause (2) of Theorem 8.5 holds and conversely. Thus, the range of sub is the nitary
projections.
To see that sub is a nitary projection, we use Theorem 6.4 and Theorem 8.2 to say that
the xed point set of sub is in a one-to-one inclusion preserving correspondence with the domain
D [ D c. P
With these results and the universal domain to be dened next, the theory of sub-domains is
translated into the -calculus notation using the sub combinator. The universal domain is dened
by rst dening a domain which has the desired structure but has a top element. The top element
is then removed to give the universal domain.
Denition 8.7: [Universal Domain] As in the section on domain equations, an inductive de-
nition for a domain 1 is given as follows:
1. , V
2. u, v) V whenever u, v V
Thus, we are starting with two objects, a bottom element and a top element, and making two
avors of copies of these objects. Intuitively, we end up with nite binary trees with either the top
or the bottom element as the leaves. To simplify the denitions below, the pairs should be reduced
such that:
1. All occurrences of , ) are replaced by and
2. All occurrences of , ) are replaced by .
These rewrite rules are easily shown to be nite Church-Rosser.
5
As an example of the reduction
the pair
, , )), , )), , ), , )))
reduces to
, , )), , ))
. The approximation ordering is dened as follows:
5
The nitary basis should be dened as the equivalence classes induced by the reduction. The presentation is
simplied by considering only reduced trees.
53
1. _ v for all v V
2. v _ for all v V.
3. u, v) _ u
, v
) i u _ u
and v _ v
Since the top element is approximated by everything, all nite sets of trees are consistent. The
lub for a pair of trees is dened as follows:
1. u . = for u V
2. . u = for u V
3. u . = u for u V
4. . u = u for u V
5. u, v) . u
, v
) = u . u
, v . v
) for u, v V
The proof that this forms a nitary basis follows the same guidelines as the proofs in Section 6.
In addition, it should be clear that the presentation is eective.
To form the universal domain, the top element is simply removed. Thus, the system U =
V is the basis used to form the universal domain. The proof that this is still a nitary
basis with an eective presentation is also straightforward and left to the exercises. Note that
inconsistent sets can now exist since there is no top element. A set is inconsistent i its lub is .
We shall now prove the claims made for the universal domain.
Theorem 8.8: The domain | is universal in the sense that for every domain T, T |. If T
is eectively given, then the projection pair for the embedding is computable. In fact, there is a
correspondence between the eectively presented domains and the computable nitary projections
of |.
Proof Recall that D must be countable to be a nitary basis. Thus, we can assume that the basis
has an enumeration
D = X
n
[ n N
where X
0
= . The eective and general cases are considered together in the proof; comments
about computability are included for the eective case as required. Thus, if T is eectively given,
the enumeration above is assumed to be computable.
To prove that the domain can be embedded in |, the embedding will be shown. To start, for
each nite element d
i
in the basis, dene two sets, d
+
i
and d
i
as follows:
d
+
i
= d D[ d
i
_ d
d
i
= D d
+
i
The d
+
i
set contains all the elements that d
i
approximates, while the d
i
set contains all the other
elements, partitioning D into two disjoint sets. Sets for dierent elements can be intersected to
form ner partitions of D. For k > 0, let R +,
k
, let R
i
be the ith symbol in the string R,
and dene a region D
R
as
D
R
=
k
i=1
d
R
i
i
54
a
b c
d
d
i
sets are as follows:
d
+
1
= a, b
d
1
= c,
d
+
2
= c
d
2
= a, b,
d
+
3
= a
d
3
= b, c,
The regions are as follows:
D
+
= a, b D
+++
=
D
= , c D
++
=
D
++
= D
++
= a
D
+
= a, b D
+
= b
D
+
= c D
++
=
D
= D
+
= c
D
+
=
D
=
The regions generated by each successive element encode the relationships induced by the ap-
proximation ordering between the new element and all elements previously added. The reader is
encouraged to try this example with other enumerations of this basis and compare the results.
The embedding of the elements proceeds by building a tree based on the regions corresponding
to the element. The regions are used to nd locations in the tree and to determine whether a or a
6
This example is taken from Cartwright and Demers [2].
55
element is placed in the location. These trees preserve the relationships specied by the regions
and thus, the tree embedding is isomorphic to the domain in question. Once the tree is built, the
reduction rules are applied until a non-reducible tree is reached. This tree is the representative
element in the universal domain, and the set of these trees form the sub-space.
The function to determine the location in the tree for a given domain,
Loc
D
: +,
l, r
takes strings used to generate regions and outputs a path in a tree where l stands for left sub-tree
and r stands for right sub-tree. This path is computed using the following inductive denition:
Loc
D
() = .
Loc
D
(R+) = Loc
D
(R)l if D
R+
,= and D
R
,= .
= Loc
D
(R) otherwise.
Loc
D
(R) = Loc
D
(R)r if D
R+
,= and D
R
,= .
= Loc
D
(R) otherwise.
The set of locations for each non-empty region is the set of paths to all leaves of some nite
binary tree. An induction argument is used to show the following properties of Loc
D
that ensure
this:
1. If R S for R, S +,
, then Loc
D
(R) Loc
D
(S).
2. Let S = Loc
D
(R) [ R +,
k
D
R
,= for k > 0 be a set of location paths for a given k.
For any p l, r
, j
, i
, and j
as well. Dene
a +b = cond which, i
+
in
0
a out
0
, i
+
in
1
b out
1
) j
+
a b = i
x
a proj
0
, b proj
1
) j
x
a b = i
(f.b f a) j
for all a, b : | |.
From earlier theorems, we know that these combinators are all computable over an eectively
presented domain. The next theorem characterizes the eect these combinators have on projection
functions.
Theorem 8.10: If a, b : | | are projections, then so are a +b, a b, and a b. If a and b are
nitary, then so are the compound projections.
Proof Since a and b are retractions, a = a a and b = b b. Then for a b using the denition of
,
(a b) (a b) = i
x
a proj
0
, b proj
1
) a proj
0
, b proj
1
) j
x
= i
x
a a proj
0
, b b proj
1
) j
x
= a b
Thus, a b is a retraction. The other cases follow similarly.
57
Since a and b are projections, a, b I
U
(denoted simply I for the remainder of the proof). Using
the denition for + along with the above relation and the denition of projection pairs, we can see
that
a +b I + I = i
+
j
+
I
Thus, a +b is a projection. The other cases follow similarly.
To show that the projections are nitary, we must show that the xed point sets are isomorphic
to a domain. Since a and b are assumed nitary, their xed point sets are isomorphic to
D
a
= x U[ x a x
D
b
= y U[ y b y
We wish to show that T
a
T
b
T
ab
. By the denition of the constructor, the xed point
set of a b over | is the same as the xed point set of f.b f a on | |. (Hint: i
and j
set up the isomorphism.) So, the xed points for f : | | are of the form:
f = b f a
We can think of a as a function in | T
a
and dene the other half of the projection pair as
i
a
: T
a
| where i
a
a = a and a i
a
= i
a
. Dene a function i
b
for the projection pair for b
similarly. For some g : T
a
T
b
let
f = i
b
g a
Substituting this denition for f yields
b f a = b i
b
g a a = i
b
g a = f
by the denition of i
b
and since a is a retraction by assumption. Conversely, for a function f such
that i
b
g a = f, let
g = b f i
a
Substituting again,
i
b
g a = i
b
g f i
a
a = b f a = f
Thus, there is an order preserving isomorphism between g : T
a
T
b
and the functions f = bf a.
The proofs of the isomorphisms for the other constructs are similar. P
Thus, the sub-domain relationship with the universal domain has been stated in terms of nitary
projections over the universal domain. In addition, all the domain constructors have been shown
to be computable combinators on the domain of these nitary projections. Recalling that all
computable maps have computable xed points, the standard xed point method can be used to
solve domain equations of all kinds if they can be dened on projections.
Returning to the -calculus for a moment, all objects in the -calculus are considered functions.
Since | | is a part of |, every object in the -calculus is also an object of |. Transposing
some of the familiar notation, where the old notation appears on the left, the new combinators are
dened as follows:
which(z) = which(j
+
(z))
in
i
(x) = i
+
(in
i
(x)) where i = 0, 1
out
i
(x) = out
i
(j
+
(x)) where i = 0, 1
x, y) = i
x
(x, y))
proj
i
= proj
i
(j
x
(z)) where i = 0, 1
u(x) = j
(u)(x)
x. = i
(x.)
58
Thus, all functions, all constants, all combinators, and all constructs are elements of |. Indeed,
everything is an element of |. Elements in | play multiple roles by representing dierent objects
under dierent projections. While this notion may be dicult to get used to, there are many
advantages, both notational and conceptual.
Exercises
Exercise 8.11: A retraction a : T T is a closure operator i I
D
a as relations. On a domain
like T(N), give some examples of closure operators. (Hint: Close up the integers under addition.
Is this continuous on T(N)?) Prove in general that for any closure a : T T, the xed point set
of a is always a nitary domain. (Hint: Show that the xed point set is closed as required for a
domain.) What are the nite elements of the xed point set?
Exercise 8.12: Give a direct proof that the domain X [ X T is eectively presented if T
is. (Hint: The nite elements of the domain correspond exactly to the nite domains X T.) In
the case of T = |, show that the computable elements of the domain correspond exactly to the
eectively presented domains (up to eective isomorphism).
Exercise 8.13: For nitary projections a : c c, write
T
a
= x c [ x a x
Show that for any two such projections a and b, that
a b T
a
T
b
Exercise 8.14: Find another universal domain that is not isomorphic to |.
Exercise 8.15: Prove the remains cases in Theorem 8.10.
Exercise 8.16: Suppose S and T are two binary constructors on domains that can be made into
computable operators on projections over the universal domain. Show that we can nd a pair of
eectively presented domains such that
D S(D, E) and E T(D, E).
Exercise 8.17: Using the translations shown after the proof of Theorem 8.10, show how the whole
typed--calculus can be translated into |. (Hint: for f : T
a
B, write f = b f a for nitary
projections a and b. For x
Da
., write x.b(
[a(x)/x]) where