Page 1

Semantics of a Sequential Language for Exact

Real-Number Computation

J. Raymundo Marcial-Romeroa,∗,1,

Mart´ ın H. Escard´ oa

aUniversity of Birmingham, Birmingham B15 2TT, England

Abstract

We study a programming language with a built-in ground type for real numbers. In order

for the language to be sufficiently expressive but still sequential, we consider a construction

proposed by Boehm and Cartwright. The non-deterministic nature of the construction sug-

gests the use of powerdomains in order to obtain a denotational semantics for the language.

We show that the construction cannot be modelled by the Plotkin or Smyth powerdomains,

but that the Hoare powerdomain gives a computationally adequate semantics. As is well

known, Hoare semantics can be used in order to establish partial correctness only. Since

computations on the reals are infinite, one cannot decompose total correctness into the

conjunction of partial correctness and termination as it is traditionally done. We instead in-

troduce a suitable operational notion of strong convergence and show that total correctness

can be proved by establishing partial correctness (using denotational methods) and strong

convergence (using operational methods). We illustrate the technique with a representative

example.

Key words: exact real-number computation, sequential computation, semantics,

non-determinism, PCF.

1Introduction

This is a contribution to the problem of sequential computation with real numbers,

where real numbers are taken in the sense of constructive mathematics [2]. It is fair

∗Corresponding author.

Email addresses: jrm@cs.bham.ac.uk(J. Raymundo Marcial-Romero),

mhe@cs.bham.ac.uk(Mart´ ın H. Escard´ o).

1Present address: Divisi´ on de Computaci´ on, UAEM, Ciudad Universitaria S/N, 50040,

Toluca, Estado de M´ exico, M´ exico

Preprint submitted to Elsevier Science 20 November 2006

Page 2

to say that the computability issues are well understood [35]. Here we focus on the

issue of designing programming languages with a built-in, abstract data type of real

numbers. Recent research, discussed below, has shown that it is notoriously diffi-

cult to obtain sufficiently expressive languages with sequential operational seman-

tics and corresponding denotational semantics which articulate the data-abstraction

requirement. Based on ideas arising from constructive mathematics, Boehm and

Cartwright [3], however, proposed a compelling operational solution to the prob-

lem. Yet, theirproposalfalls shortof providingafull solutionto thedata abstraction

problem, as it is not immediately clear what the corresponding denotational inter-

pretation would be. A partially successful attempt at solving this problem has been

developed by Potts [29] and Edalat, Potts and S¨ underhauf [6], as discussed below.

In light of the above, the purpose of this paper is two-fold: (1) to establish the

intrinsic difficulties of providing a denotational model of Boehm and Cartwright’s

operationalapproach,and (2)to showhowitispossibleto copewiththedifficulties.

Before elaborating on this research programme, we pause to discussprevious work.

Di Gianantonio [14], Escard´ o [11], and Potts et al. [28] have introduced various

extensions of the programming language PCF with a ground type for real num-

bers. Each of these authors interprets the real numbers type as a variation of the

interval domain introduced by Scott [30]. In the presence of a certain parallel con-

ditional [26], all computable first-order functions on the reals are definable in the

languages [14,8]. By further adding Plotkin’s parallel existential quantifier [26], all

computable functions of all orders become definable in the languages [14,7,10]. In

the absence of the parallel existential quantifier, the expressivity of the languages

at second-order types and beyond is not known. Partial results in this direction are

developed by Normann [24].

It is natural to ask whether the presence of such parallel constructs is an artifact of

the languages or whether they are needed for intrinsic reasons. Escard´ o, Hofmann

and Streicher [9] have shown that, in the interval domain models, the parallelism

is in fact unavoidable: weak parallel-or is definable from addition and other mani-

festly sequential unary functions, which indicates that addition, in these models, is

an intrinsically parallel operation. Moreover, Farjudian [12] has shown that if the

parallel conditional is removed from the language, only piecewise affine functions

on the reals are definable.

Essentially, the problem is as follows. Because computable functions on the reals

are continuous (see e.g. [35]), and because the real line is a connected space, any

computable boolean-valued function on the reals is constantly true or constantly

false unless it diverges for some inputs. Hence, definitions using the sequential

conditionalproduceeitherconstanttotalfunctionsorpartialfunctions.Ifoneallows

the boolean-valued functions to diverge at some inputs, then non-trivial predicates

are obtained, and this, together with the parallel conditional, allow us to define the

non-trivial total functions [11].

2

Page 3

This phenomenon had been anticipated by Boehm and Cartwright [3], who also

proposed a solution to the problem. In this paper we develop the proposed solution

and study its operational and denotational semantics. The idea is based on the fol-

lowing observations. In classical mathematics, the trichotomylaw “x < y, x = y or

x > y” holds for any pair of real numbers x and y, but, as is well known, it fails in

constructive(and in classical recursive) mathematics. However, the followingalter-

native cotransitivity law holds in constructive settings: for any two numbers a < b

and any number x, at least one of the relations a < x or x < b holds. Equivalently,

one has that (−∞,b) ∪ (a,∞) = R. Boehm and Cartwright’s idea is to consider a

language construct rtesta,b, for a < b rational, such that:

(1) rtesta,b(x) evaluates to true or to false for every real number x,

(2) rtesta,b(x) may evaluate to true iff x < b, and

(3) rtesta,b(x) may evaluate to false iff a < x.

It is important here that evaluation never diverges for a convergent input. If the real

number x happens to be in the interval (a,b), then the specification of rtesta,b(x)

allows it to evaluate to true or alternatively to false. The particular choice will de-

pend on the particular implementation of the real number x and of the construct

rtesta,b(cf. [20]), and is thus determined by the operational semantics.

As application of the construction, we givean example of a recursive definition of a

sequential program for addition, which is single-valued at total inputs, as required,

but multi-valued at partial inputs. Thus, by allowing the output to be multi-valued

at partial inputs, we are able to overcome the negative results of Escard´ o, Hofmann

and Streicher mentioned above.

We take the view that the denotational value of rtesta,b(x) lives in a suitable pow-

erdomain of the booleans. Thus (1) if a < x < b then the denotational value would

be the set {true,false}, (2) if a ?< x and x < b then it would be the set {true}, and

(3) if a < x and x ?< b then it would be the set {false}. Technically, one has to be

careful regarding which subsets of the powerset are allowed, but this is tackled later

in the body of the paper. One of our main results is that the Hoare powerdomain

gives a computationally adequate denotational semantics. We also show that the

Plotkin and Smyth powerdomains do not render the rtest construction continuous

and hence cannot be used as models. These and other examples of powerdomains

are discussed in the body of the paper.

As is well known, Hoare semantics can be used in order to establish partial correct-

ness only. Because computations on the reals are infinite, one cannot decompose

total correctness into the conjunction of partial correctness and termination, as is

usually done for discrete data types. Instead, we introduce a suitable operational

notion of strong convergence and show that total correctness can be proved by es-

tablishing partial correctness (using denotational methods) and strong convergence

(using operational methods). The technique is illustrated by a proof of total correct-

3

Page 4

ness of our sequential program for addition. Further applications are discussed in

the concluding section.

1.1Related work.

Potts [29] considers a redundant if operator (rif) for his programming language

LAR (an extension of PCF with linear fractional transformations), defined as

rif : ICK × ICF2× (ICK → t)2→ t

rif x < (I,J); then f else g =

f(x),

g(x),

if I ≪ x;

if J ≪ x.

where K ∈ ICR∞and F is a dense subset of K. He uses the Hoare powerdomain

to develop a denotational semantics for his language and prove computational ad-

equacy. Our work justifies this choice. Potts considers a deterministic one-step re-

duction relation, while we consider a non-deterministicrelation so as to have a pre-

cise match as possible with the denotational semantics in the case of multi-valued

terms.

Edalat, Potts and S¨ underhauf [6] had previously considered the denotational coun-

terpart of Boehm and Cartwright’s operational solution. However, they restrict at-

tentionto what can be referred to as single-valued,total computations.In particular,

their computational adequacy result for their denotational semantics is restricted to

this special case. Although it is indeed natural to regard this case as the relevant

one, we have already met compelling examples, such as the fundamental opera-

tion of addition, in which sequentiality cannot be achieved unless one allows, for

example, multi-valued outputs at partial inputs.

For their denotational semantics, they consider the Smyth powerdomain of a topo-

logical space of real numbers (which they refer to as the upper powerspace). Thus,

they consider possibly non-deterministic computations of total real numbers, re-

stricting their attention to those which happen to be deterministic. In the work re-

ported here, we insteadconsidernon-deterministiccomputationsof totaland partial

real numbers. In other words, instead of considering a powerdomain of a space of

real numbers, we consider a powerdomain of a domain of partial real numbers. Our

computational adequacy result holds for general computations, total or partial, and

whether deterministic or not. For our domain of partial real numbers, we consider

the interval domain proposed by Scott [30], but the present findings are expected to

apply to many possible notions of domain of partial real numbers.

Farjudian [13] has developed a programming language, which he called SHRAD,

which satisfies the three requirements mentioned at the beginning of the paper: se-

4

Page 5

quentiality, data abstraction and expressivity. In his work, he defines a sequential

language in which all computable first order functions are definable. However ex-

tensionalityistradedoffforsequentiality,inthesensethatallcomputablefirst order

functions are extensional over total real numbers but not over partial real numbers.

Hence functions such as the rounding functions, which are frequently used in prac-

tice, cannot be defined in SHRAD.

Di Gianantonio [15] also discusses the problem of sequential real-number compu-

tation in the presence of data abstraction, with some interesting negativeresults and

translations of parallel languages into sequential ones.

In order to characterize computable functions on the real numbers, Brattka [4] in-

troduces a class of relations that includes a contruction which is essentially the

same as Boehm and Cartwright’s multi-valued test discussed above. The main dif-

ference is that we articulate relations as functions with values on a powerdomain.

With this, we are able to capture higher-type computation. Moreover, as discussed

above, we take a powerdomain of the interval domain, not of the real line, and

hence we are able to distinguish partiality from multi-valuedness: an interval gives

a partially specified real number, and a set of intervals collects the possible (total

or partial) outputs of a non-deterministic computation.

1.2 Organization.

Section 2 presents a running example that motivates the technical development that

follows. Section 3 introduces some background. Section 4 studies the rtest con-

struction from the point of view of powerdomains. Section 5 develops a program-

ming language with the rtest construction and establishes computational adequacy

for the denotational semantics developed in Section 4. Section 6 applies this to de-

velop techniques for correctness proofs and gives sample applications. Section 7

summarizes the main results and discusses open problems and further work.

2 Running example

In order to motivate the use of the multi-valued construction discussed in the in-

troduction, we give an example showing how it can be used to avoid the parallel

constructions used in previous works on real-number computation. We take the

opportunity to introduce some basic concepts and constructions studied in the tech-

nical development that follows.

In the programming language considered in [11], the average operation

(− ⊕ −): [0,1] × [0,1] → [0,1]

5

Page 6

defined by

x ⊕ y = (x + y)/2

can be implemented as follows:

x ⊕ y= pif x < c

then pif y < c

then consL(tailL(x) ⊕ tailL(y))

else consC(tailL(x) ⊕ tailR(y))

else pif y < c

then consC(tailR(x) ⊕ tailL(y))

else consR(tailR(x) ⊕ tailR(y)).

Here

c = 1/2,L = [0,c],C = [1/4,3/4],R = [c,1],

the function consa: [0,1] → [0,1] is the unique increasing affine map with image

the interval a, i.e.,

consL(x) = x/2,

consC(x) = x/2 + 1/4,

consR(x) = x/2 + 1/2,

and the function taila: [0,1] → [0,1] is a left inverse, i.e.

taila(consa(x)) = x.

More precisely, the following left inverse is taken, where κais the length of a and

µais the left end-point of a:

taila(x) = max(0,min(κax + µa,1)).

Because equality on real numbers is undecidable, the relation x < c is undefined

(or diverges, or denotes ⊥) if x = c. In order to compensate for this, one uses a

parallel conditional such that

pif ⊥ then z else z = z.

The intuition behind the above program is the following. If both x and y are in the

interval L, then we know that x ⊕ y is in the interval L, if both x and y are in the

interval R, then we know that x ⊕ y is in the interval R, and so on. The boundary

cases are taken care of by the parallel conditional. For example, 1/2 is both in L

and R, and an unfolding of the program for x = y = 1/2 gives

6

Page 7

1/2 ⊕ 1/2 = pif ⊥

then pif ⊥

then consL(1 ⊕ 1)

else consC(1 ⊕ 0)

else pif ⊥

then consC(0 ⊕ 1)

else consR(0 ⊕ 0).

All branches of the conditionals evaluate to 1/2, but in an infinite number of steps.

This can be seen as follows. A repeated unfolding of 1⊕1 gives the infinite expres-

sion consR(consR(consR(...))). Denotationally speaking, the program computes

the unique fixed point of consR, which is 1. Operationally speaking, the first un-

folding says that the result of the computation, whatever it is, lives in the interval

R, because, by definition, the image of consRis R; the second unfolding says that

the result is in the right half of the interval R, i.e. in the interval [3/4,1]; the third

unfolding tells us that the result is in the interval [7/8,1], and so on. Thus, the

operational semantics applied to 1 ⊕ 1 produces a shrinking sequence of intervals

converging to 1. The other cases are analogous.

Of course, a drawback of such a recursive definition is that, during evaluation, the

number of parallel processes grows exponentially in the number of unfoldings. In

order to overcome this, we switch back to the usual sequential conditional, and we

replace the partial less-than test by the multi-valued test discussed in the introduc-

tion:

Average(x,y)= if rtestl,r(x)

then if rtestl,r(y)

then consL(Average(tailL(x),tailL(y)))

else consC(Average(tailL(x),tailR(y)))

else if rtestl,r(y)

then consC(Average(tailR(x),tailL(y)))

else consR(Average(tailR(x),tailR(y))),

where c of the previous program splits into two points

l = 1/4,r = 3/4.

and this time we choose

L = [0,r],C = [1/8,7/8],R = [l,1].

The intuition behind this program is similar. What is interesting is that, despite the

use of the multi-valued construction rtest, the overall result of the computation

is single valued. In other words, different computation paths will give different

shrinking sequences of intervals, but all of them will shrink to the same number. A

7

Page 8

proof of this fact and of correctness of the program is provided in Section 6, using

the techniques developed below. For further examples see [22].

3Background

For domain-theoretic concepts, the reader is referred to [1,27], and for topological

concepts to [33,34] (see also [16]). Here we briefly summarize thenotions and facts

that are relevant to our purposes.

3.1Continuous Domains

Let P be a set with a preorder ⊑. For a subset X of P and an element x ∈ P we

write

↓X = {y ∈ P | y ⊑ x for some x in X},

↑X = {y ∈ P | x ⊑ y for some x in X},

↓x = ↓{x},↑x = ↑{x}.

We also say that X is a lower set iff X = ↓X, and that X is an upper set iff

X = ↑X.

Let x and y be elements of a directed complete partial order (dcpo) D. We say that

x is way-below or approximates y, denoted x ≪ y, if for every directed subset A of

D,y ⊑?Aimplies∃a ∈ Awithx ⊑ a. Wesaythatxiscompact ifitapproximates

{x ∈ D | x is compact}. We say that a subset B of a dcpo D is a basis for D, if for

every element x of D the set↓↓x ∩ B contains a directed subset with supremum x.

A dcpo is called a continuous domain or simply a domain if it has a basis. A dcpo

is called an algebraic domain if it has a basis of compact elements. An example

of an algebraic domain is the domain T⊥= {⊥,false,true} of booleans, ordered

by ⊥ ⊑ false,⊥ ⊑ true. A function f from a domain D to a domain E is Scott

continuos if it is monotone and f(?A) =?f(A) for all directed subset A of D. A

We say that a Scott closed set is finitely generated if it is the lower set of a finite

set. The following is easily established:

itself. We define↑↑x = {y ∈ D | x ≪ y},↓↓x = {y ∈ D | y ≪ x} and K(D) =

Scott closed subset of a domain D is a lower set closed under directed supremum.

Lemma 3.1 If D is a continuousdomain,C a finitelygeneratedScott closed subset

of D and f : D → D Scott continuous then

↓{f(x) | x ∈ C} = cl{f(x) | x ∈ C}.

where cl denotes topological (Scott) closure.

8

Page 9

3.2The Interval Domains R and I

The set R of non-empty compact subintervals of the Euclidean real line ordered by

reverse inclusion,

x ⊑ y iff x ⊇ y,

is a continuous domain, referred to as the interval domain. Here intervals are re-

garded as “partial numbers”, with the singleton intervals playing the role of “total

numbers”. If we add a bottom element to R, then R becomes a bounded complete

continuous domain R⊥. For any interval x ∈ R, we write

x = inf x and x = sup x

so that x = [x,x]. Its length is defined by

κx= x − x.

A subset A ⊆ R has a least upper bound iff it has non-empty intersection, and in

this case

?A =

The way-below relation of R is given by

?A =

?

sup

a∈Aa, inf

a∈Aa

?

.

x ≪ y iff x < y and y < x.

A basis for R is given by the intervals with distinct rational (alternatively dyadic)

end-points.

The set I of all non-empty closed intervals contained in the unit interval [0,1]

is a bounded complete, countably based continuous domain, referred as the unit

interval domain. The bottom element of I is the interval [0,1].

3.3 Powerdomains

Powerdomains[25,31,32]areusuallyconstructedas idealcompletions[18]offinite

subsets of basis elements. For our purposes, it is more convenient to work with

their topological representations [27,1,19], which we now summarize. It is enough

for our purposes to restrict attention to ω-continuous dcpos, which we refer to as

domains in this subsection.

A subset A of a dcpo D is called Scott closed if it is closed in the Scott topology,

that is, if it is a lower set and is closed under the formation of suprema of directed

subsets. We use the notation cl(A) for the topological closure of A, i.e. the smallest

9

Page 10

Scott closed set containing A. A lense is a non-empty set that arises as the intersec-

tion of a Scott-closed set and a Scott compact upper subset.Here the notionof Scott

compact set is to be understood in the topological sense (every cover consisting of

Scottopen setshasafinitesubcover).On thesetoflensesofadcpoD,wedefinethe

topological Egli-Milner ordering, ⊑TEMby K ⊑TEML if L ⊆ ↑K and K ⊆ cl(L).

Notice that in a finite domain such as the flat domain of booleans, the lenses are

just order-convex sets, and that the topological Egli-Milner order coincides with

the usual order-theoretical one [16]. This is because in a finite domain the closed

sets are precisely the lower sets, and all sets are compact.

The Plotkin powerdomain PPD of a domain D consists of the lenses of D under

the Egli-Milner order, and the formal-union operation A ∪ B is given by actual

union A ∪ B followed by topological convex closure (intersection of all convex

closed sets containing it). There is a natural topological embedding η: D → PPD

given by x ?→ {x}.

The Smyth powerdomain PSD consists of the set of non-empty Scott-compact up-

per subsets ordered by reverse inclusion, with formal union given by actual union.

In this case, we have a natural topological embedding η: D → PSD given by

x ?→ ↑x

The Hoare powerdomain PHD consists of all non-empty Scott-closed subsets of

D ordered by inclusion. Because we use this to obtain a denotational model of our

language, we consider it in more detail. Least upper bounds are given by

?

i∈I

Ai= cl

?

i∈I

Ai.

The construction is the functor part of a monad, with action on continuous maps

given by

?f : PHD → PHE

A ?→ clf[A]

for any f : D → E. Its unit is given by

ηD: D → PHD

x ?→ ↓x,

which is also a topological embedding. Instead of considering multiplication, one

can equivalently consider the extension operator [21, Proposition 2.14], in this case

given by

¯f : PHD →

?→ cl?

for any continuous map f : D → PHE. Finally, formal unions are given by actual

PHE

A

a∈Afa

10

Page 11

unions as in the case of the Smyth powerdomain:

A ∪ B = A ∪ B.

4 Semantics of the Multi-valued Construction

In orderto makethedevelopmentoftheintroductionprecise, weassumethatweare

given a functorial powerdomain construction P, in a suitable category of domains,

with a natural embedding

ηD: D → PD

and a continuous formal-union operation

(− ∪ −): PD × PD → PD

for every domain D. Then the definition of the function rtesta,b: R → PT, where

a < b are real numbers, can be formulated as

rtesta,b(x) =

η(true),

η(true) ∪ η(false),

η(false),

if x ∈ (−∞,a],

if x ∈ (a,b),

if x ∈ [b,∞).

Because in our language there will be computations on the reals that diverge or

fail to fully specify a real number, we need to embed the real line into a domain

of total and partial real numbers. We choose to work with the domain R⊥, where

R is the interval domain introduced in Section 3. Similarly, as usual, we enlarge

the domain T of booleans with a bottom element. Hence we have to work with an

extension R⊥→ PT⊥of the above function, which we denote by the same name:

R

?

R⊥

rtesta,b

− − − − → PT

?

rtesta,b

− − − − → PT⊥

For the moment, we do not insist on any particular extension. However, in order for

a powerdomain construction to qualify for a denotational model of the language,

the minimum requirement is that it makes the rtesta,bfunction continuous.

Lemma 4.1 If rtesta,b: R⊥ → PT⊥ is a continuous extension of the function

rtesta,b: R → PT, then the inequalities

η(true) ⊑ η(true) ∪ η(false),

η(false) ⊑ η(true) ∪ η(false)

11

Page 12

must hold in the powerdomain PT⊥

PROOF. Because the embedding R ֒→ R⊥is continuous when R is endowed

with its usual topology and R⊥with its Scott topology, so is its composition with

the function rtesta,b: R⊥ → PT⊥, which we denote by r: R → PT⊥. (This is

the diagonal of the above commutative square). In any dcpo, the relation d ⊑ e

holds if and only if every neighbourhood of d is a neighbourhood of e. Let V be a

neighbourhood of t := η(true). We have to show that n := η(true) ∪ η(false) ∈ V .

The set U := r−1(V ) is open in R by continuity of r : R → PT. Because r(a) =

t ∈ V , we have that a ∈ r−1(V ) = U. Hence, because U is open in R, there is

an open interval (u,v) with a ∈ (u,v) ⊆ U. Choose x such that a < x < v and

x < b, that is, such that x ∈ (a,b) ∩ (u,v) ⊆ U. By construction, r(x) = n. But

x ∈ r−1(V ), which shows that n ∈ V and hence that t ⊑ n, which amounts to the

first inequality. The second inequality is obtained in the same way.

2

Thus, any powerdomain not satisfying the above two inequalities does not qualify

for a model. In particular, this rules out the Plotkin and Smyth powerdomains. In

fact, for the Plotkin powerdomain one has that η(true) = {true} and η(false) =

{false}, and their formal union is {true,false} because this set is order-convex,

but the sets {true} and {true,false} are incomparable in the Egli-Milner order.

For the Smyth powerdomain, the same sets are obtained by the embedding, formal

union is given by actual union, and hence the inequalities do not hold because the

order is given by reverse inclusion. We omit routine proofs of the fact that e.g. the

mixed [17] and the sandwich [5] powerdomains also fail to satisfy the inequalities

and hence to make the rtesta,bconstruction continuous.

On the other hand, for the Hoare powerdomain, the inequalities do hold. In fact,

η(true) = {true,⊥} and η(false) = {false,⊥}, their formal union is their actual

union {true,false,⊥}, and the ordering is given by inclusion. Moreover:

Proposition 1 There is a continuous extension rtestH

tion rtesta,b: R → PT.

a,b: R⊥→ PHT⊥of the func-

PROOF. The functions f,g: R⊥→ PT⊥defined by

f(x) =

η(true),

⊥,

if x ⊆ (−∞,b),

otherwise,

g(x) =

η(false),

⊥,

if x ⊆ (a,∞),

otherwise,

12

Page 13

{true,false, }

{true, } {false, }

{ }

{true,false, }

{true, } {false, }

{ }

{false}

{true,false}

{true}

Smyth:

(Reverse Inclusion order)

{true,false, }

(Egli−Milner order)

{true,false}

{true} {false}

(Inclusion order)

Plotkin:

Hoare:

Fig. 1. Powerdomains of T⊥.

areeasilyseentobecontinuous,andtheyareconsistentbecauseη(true)andη(false)

are consistent elements. Hence their join

rtestH

a,b= f ⊔ g

is well-defined and continuous. An easy verification shows that this function has

the required extension property.

2

As we want to match our model with the operational semantics of the construction,

it would be desirable to distinguish between the elements {true} and {true,⊥} in

themodel.However,theHoare powerdomaindoes notdistinguishthem, and,on the

other hand, as we have just seen, other powerdomains do not give a continuous in-

terpretation of our construction. In order to overcome this problem when the Hoare

powerdomain is used as a denotational model, one usually decomposes proofs of

program correctness into partial correctness and termination. A related approach is

considered in Section 6.

From now on, we denote rtestH

cations, we are only interested in the situation 0 < a < b < 1 and the restriction

of this function to the domain I of closed subintervals of the interval [0,1], again

written rtesta,b: I → PT⊥.

a,b: R⊥→ PHT⊥simply by rtesta,b. In our appli-

4.0.0.1

main goal of this paper, we briefly digress to discuss a natural variation rtest′

Remark on the boundary cases of rtest.

Before proceeding to the

a,b:

13

Page 14

R → PT of the rtesta,bconstruction, defined by

rtest′

a,b(x) =

η(true),

η(true) ∪ η(false),

η(false),

if x ∈ (−∞,a),

if x ∈ [a,b],

if x ∈ (b,∞).

With a proofsimilarto that of Lemma4.1, we conclude that if rtest′

then

a,bis continuous

η(true) ∪ η(false) ⊑ η(true)

η(true) ∪ η(false) ⊑ η(false).

This rules out the Plotkin and Hoare powerdomains, but not the Smyth powerdo-

main. However, it is not clear what the operational counterpart of this function

would be. The function rtesta,bis operationally computable because, for any argu-

ment x given intensionally as a shrinking sequence of intervals, the computational

rules systematicallyestablishone of thesemidecidableconditionsa < x and x < b.

However, the conditions a ≤ x and x ≤ b are not semi-decidable, and hence it is

not immediately apparent what a computationally adequate operational semantics

for rtest′would be. But it is interesting, as pointed out by one of the referees, that

thecotransitivitylawgivenintheintroductionasaconstructivejustificationofrtest

can be equivalently formulated as “a ≤ x or x ≤ b whenever a < b”. In any case,

it is not clear to us, at the time of writing, whether or how this reformulation of the

cotransitivity law would lead to a computational mechanism for rtest′.

5 A Programming Language for Sequential Real-Number Computation

We introduce the language LRT for the rtest construction, which amounts to the

language considered by Escard´ o [11] with the parallel conditional removed and a

constantfor rtesta,badded. Weremark that thisis acall-by-namelanguage. Because

real-number computations are infinite, and there are no canonical forms for partial

real-numbercomputations,itisnotclearwhatacall-by-valueoperationalsemantics

ought to be. We leave this as an open problem.

5.1Syntax

The language LRT is an extension of PCF with a ground type for real numbers and

suitable primitive functions for real-number computation. Its raw syntax is given

by

14

Page 15

x ∈ V ariable,

t::=nat | bool | I | t → t,

P ::=x | n | true | false | (+1)(P) | (−1)(P) |

(= 0)(P) | ifP thenP elseP | consa(P) |

taila(P) | rtesta,b(P) | λx : t.P | PP | YP,

where the subscripts of the constructs cons, tail are rational intervals and those

of rtest are rational numbers. (We apologize for using the letters a and b to denote

numbers and intervals in different contexts.) Terms of ground type I are intended

to compute real numbers in the unit interval.

It is convenient for our purposes to first define the denotational and then the opera-

tional semantics.

5.2Denotational Semantics.

The ground types bool,nat and I are interpreted as the Hoare powerdomainof the

domains of booleans, natural numbers and intervals, respectively. Function types

are interpreted as function spaces in the category of dcpos:

?bool? = PHT⊥,?nat? = PHN⊥,?I? = PHI,

?σ → τ? = ?σ? → ?τ?.

This reflects the fact that we are considering a call-by-name language.

The interpretation of constants in LRT is defined as follows:

?true? = η(true),?false? = η(false),?n? = η(n),

?(+1)? =?

(+1),?(−1)? =?

(−1),?(= 0)? =?

(= 0),

?consa? = ?

consa,?taila? =?

?Y?(F) =

taila,

?

?rtesta,b? = rtesta,b,

n≥0

Fn(⊥),

?if?(B,X,Y ) =

X,

Y,

X ∪ Y,

⊥,

if B = η(true),

if B = η(false),

if B = η(true) ∪ η(false),

if B = ⊥.

Herethesymbolsη,?,

are defined in Section 2, and the function rtesta,bis defined in Section 4.

aredefinedasinSection3.3,thefunctions(+1),(−1),(= 0)

are the standard interpretations in the Scott model of PCF, the functions consa,taila

15