Académique Documents
Professionnel Documents
Culture Documents
(d) There are elements R id and idR associated a vector [28] iff x = x 1. The second way is via
to every relation R B. R id behaves as a monotypes [2]: a relation a is a monotype iff a id.
right identity and idR as a left identity for The set of monotypes {a | a BR }, for a given R,
BR . is a complete Boolean lattice. We denote by a the
monotype complement of a.
(e) The Schroder rule P Q R P ^ R The domain and codomain of a relation R can be
Q R Q^ P holds whenever one characterized by the vectors R 1 and R^ 1, re-
of the three expressions is defined. spectively [15, 28]. They can also be characterized
(f) 1 R 1 = 1 iff R 6= 0 (Tarski rule). by the corresponding monotypes. In this paper, we
take the last approach. In what follows we formally
If R^ BR , then R is said to be homogeneous. If define these operators and give some of their prop-
all R A have the same type, the operations are all erties.
total and A itself is said to be homogeneous.
(3) Definition. The domain and codomain opera-
For simplicity, the universal, zero, and identity ele- tors of a relation R, denoted respectively by R< and
ments are all denoted by 1, 0, id, respectively. An- R> , are the monotypes defined by the equations
other operation that occurs in this article is the re-
(a) R< = id R 1,
flexive transitive closure R . It satisfies the well-
known laws (b) R> = id 1 R.
_
R = Ri and R = id R R = id R R, These operators can also be characterized by Galois
i0 connections(see [2, 2]). For each relation R and each
monotype a,
where R0 = id and Ri+1 = R Ri . From Definition
1, the usual rules of the calculus of relations can be R< a R a 1,
derived (see, e.g., [8, 10, 28]). R> a R 1 a.
The notion of Galois connections is very important
in what follows, there are many definitions of Galois The domain and codomain operators are linked by
connections [?]. We choose the following the equation R> = R^ < , as is easily checked.
one [2]. (4) Definition. Let R be a relation and a be a
(2) Definition. Let (S, S ) and (S 0 , S 0 ) be two monotype. The monotype right residual and mono-
preordered sets. A pair (f, g) of functions, where f : type left residual of a by R (called factors in [5]) are
S S 0 and g : S 0 S, forms a Galois connections defined respectively by
iff the following formula holds for all x S and y (a) a/R := ((1 a)/R)> ,
S0.
f (x) S 0 y x S g(y). (b) R\a := (R\(a 2 1))< .
The function f is called the lower adjoint and g
An alternative characterization of residuals can
the upper adjoint.
also be given by means of a Galois connection as
follows [1]:
2 Monotypes and Related Op- b a/R (b 2 R)> a,
b R\a (R b)< a.
erators
We have to use exhaustively the complement of
In the calculus of relations, there are two ways for the domain of a relation R, i.e the monotype a such
viewing sets as relations; each of them has its own that a = R< . To avoid the notation R< , we adopt
advantages. The first is via vectors: a relation x is the Notation
(b) A relation R is said to be progressively finite (7) Definition. We say that a relation Q refines a
[28] iff I(R) = id. relation R [23], denoted by Q v R, iff R< Q
R and R< Q< .
The description of I(R) by the formulation a/R = a
shows that I(R) exists, since (a | a id : a/R) is (8) Proposition. Let Q and R be relations, then
monotonic in the first argument and because the set
of monotypes is a complete lattice, it follows from the (a) The greatest lower (wrt v) of Q and R is,
fixed point theorem of Knaster and Tarski that this Q t R = Q< R< (Q R),
function has a least fixed point. Progressive finite- If Q< = R< then we have t and coincide
ness of a relation R is the same as well-foundedness i.e Q t R = Q R.
(b) If Q and R satisfy the condition Q< R< = (a) S(R) = I(P ) [(P Q)< /P ] P Q., with
(Q R)< , their least upper bound is Q u R = the restriction
Q R Q R R Q, otherwise, the least
upper bound does not exist. If Q< R< = 0 (b) P < Q< = 0
then we have u and coincide i.e Q u R =
Our goal is to show that the operational semantics
Q R.
a is equal to the denotational one which is given as
For the proofs see [9, 14]. the greatest fixed point of the semantic function Q
P 2 X in the demonic semilattice. In other words,
(9) Definition. The demonic composition of rela- we have to prove the next equation:
tions Q and R [5] is Q 2 R = (R< /Q) Q R. F
(a) S(R) = {X|X v Q P 2 X};
In what follows we present some properties of 2 .
(10) Theorem. by taking P := t 2 B and Q := t , one gets the
demonic semantics we have assigned to while loops
(a) (P 2 Q) 2 R = P 2 (Q 2 R), in previous papers [14, 35]. Other similar definitions
of while loops can be found in [19, 25, 29].
(b) R total Q 2 R = Q R,
Let us introduce the following abbreviations:
(c) Q function Q 2 R = Q R.
(12) Abbreviation. Let P , Q and X be relations
See [5, 6, 7, 14, 35]. subject to the restriction P < Q< = 0 (b) and x
Monotypes have very simple and convenient prop- a monotype. The Abbreviations wd , wa , w< , a and l
erties. Some of them are presented in the following are defined as follows:
proposition. wd (X) := Q P 2 X,
a := (P Q)< /P ,
(11) Proposition. Let a and b be monotypes. We wa (X) := Q P X,
have l := I(P ).
(a) a = a^ = a2 , w< (x) := Q< (P 2 x)< = Q (P 2 x)<
immediately sees why it is impossible to reach L by how the universal relationL arises as the greatest
joining anything to z (which is a point and hence is lower bound n0 S ^n 2 z of this set of points. Note
an immediate predecessor of ), since this can only that, whereas there is a unique solution to a, there
lead to z or to . are infinitelyF
many solutionsSto 4 (equivalently, to a),
Let us now go fully demonic and ask what is a for example nk S n (= nk S n ), for any k.
solution to ztS ^ 2 X v X. By the discussion above, For the upward approach, consider
this is equivalent to v X, which has a unique
solution, X = . This raises the question whether z ^ t X 2 S v X.
it is possible to find some fully demonic inequation Here also there are infinitely many solutions to this
similar to (a), whose solution is X = L. Because L is inequation; in particular, any vector v, including
in the middle of the demonic semilattice, there are in and L, is a solution to 4. Because (BL , v) is
fact two possibilities: either approach L from above only a join semilattice, it is not at all obvious that
or from below. the least fixed point of h(X) := z ^ t X 2 S ex-
For the approach from above, consider the inequa- ists. It does, however, since the following deriva-
tion tion shows that n0 z ^ 2 S n (=
F F
h n ^
(z ),
n0
0 ^ ^
X v z u S ^ 2 X. where h (z ) = z ) is a fixed point of h and hence
is obviously the least solution of 4: Because z ^
Using Theorem 10(c), we have z u S ^ 2 X = and S are mappings, property 10(c) implies that
z u S ^ X, since S ^ is deterministic (axiom a(b)). z ^ 2 S n = z ^ S n , for any n 0. But z ^ S n is
From a, z S ^ L; this implies z S ^ XL and also a mapping (it is the inverse of the point S ^n z)
S ^ X z, so that, by definition of u, and hence is total,Ffrom which, by Proposition 8(a)
^2 n ^ n
F
z u S ^ X = z S ^ X z S ^ XL z S ^ X = and equation a, z
S n0 ^n S = n0 z S =
^ n ^
S
z S ^ X. n0 z S = ( n0 S z) = L = L. This
This means that 4 reduces to means that L is the least upper bound of the set
of mappings {z ^ 2 S n |n 0}. Again, a look at
(a) X v z S ^ X. [31] gives some intuition to understand this result,
after recalling that mappings are minimal elements
By definition of refinement (7), this implies that
in (BL , v) (though not all mappings have the form
z S ^ XL XL; this is a variant of (a), thus
z ^ 2 S n ).
having XL = L as only solution. This means that
Thus, building L from below using the set of map-
any solution to 4 must be a total relation. But L
pings {z ^ 2 S n |n 0} is symmetric to building it
is total and in fact is the largest (by v) total rela-
from above using the set of points {S ^n 2 z|n 0}.
tion. It is also a solution toF4 (since by axiom a(d),
z S ^ L = L) so that L = {X|X v z u S ^ 2 X};
that is, L is the greatest fixed point in (BL , v) of 5 Conclusion
f (X) := z u S ^ 2 X. Now consider n0 S
^n 2
z,
^n
where S is a n-fold demonic composition defined We presented a theorem that can be also used to find
by S ^0 = I and S ^n+1 = S ^ 2 S ^n . By axiom the fixed points of functions of the form f (X) :=
a(b), S ^ is deterministic, so that, by 10(c) and asso- Q P 2 X (no restriction on the domains of P and
ciativity of demonic composition, conS n 2 z = S ^n z. Q). This theorem can be applied also to the program
Hence, verification and construction (as in the precedent ex-
It is easy to show that for any n 0, S ^n z is ample). Half of this theorem (the direction) is
a point (it is the n-th successor of zero) and that also proved by Sekerinski (the main iteration theo-
m 6= n S ^m z 6= S ^n z. Hence, in (BL , v), rem [29]) in a predicative programming set-up. Our
{S ^n z|n 0} (i.e. {S ^n 2 z|n 0}) is the set of theorem is more general because there is no restric-
immediate predecessors of ; looking at [31] shows tion on the domains of the relations P and Q.
The approach to demonic input-output relation [6] Berghammer, R.: Relational Specification of
presented here is not the only possible one. In Data Types and Programs. Technical report
[19, 20, 21], the infinite looping has been treated by 9109, Fakultat fur Informatik, Universitat der
adding to the state space a fictitious state to de- Bundeswehr Munchen, Germany, Sept. 1991.
note nontermination. In [8, 18, 22, 26], the demonic
input-output relation is given as a pair (relation,set). [7] Berghammer, R. and Schmidt, G.: Relational
The relation describes the input-output behavior of Specifications. In C. Rauszer, editor, Algebraic
the program, whereas the set component represents Logic, 28 of Banach Center Publications. Polish
the domain of guaranteed termination. Academy of Sciences, 1993.
We note that the preponderant formalism em-
ployed until now for the description of demonic [8] Berghammer, R. and Zierer, H.: Relational Al-
input-output relation is the wp-calculus. For more gebraic Semantics of Deterministic and Nonde-
details see [3, 4, 17]. terministic Programs. Theoretical Comput. Sci.,
43, 123147 (1986).
[15] Desharnais, J., Jaoua, A., Mili, F., Boudriga, [28] Schmidt, G. and Strohlein, T.: Relations and
N. and Mili, A.: A Relational Division Oper- Graphs. EATCS Monographs in Computer Sci-
ator: The Conjugate Kernel. Theoretical Com- ence. Springer-Verlag, Berlin, 1993.
put. Sci., 114, 247272 (1993).
[29] Sekerinski, E.: A Calculus for Predicative Pro-
[16] Dilworth, R. P.: Non-commutative Residuated gramming. In R. S. Bird, C. C. Morgan, and
Lattices. Trans. Amer. Math. Sci., 46, 426444 J. C. P. Woodcock, editors, Second Interna-
(1939). tional Conference on the Mathematics of Pro-
gram Construction, volume 669 of Lecture Notes
[17] E. W. Dijkstra. : A Discipline of Programming.
in Comput. Sci. Springer-Verlag, 1993.
Prentice-Hall, Englewood Cliffs, N.J., 1976.
[18] H. Doornbos. : A relational model of programs [30] Tarski, A.: On the calculus of relations. J.
without the restriction to Egli-Milner monotone Symb. Log. 6, 3, 1941, 7389.
constructs. IFIP Transactions, A-56:363382. [31] F. Tchier.: Semantiques relationnelles
North-Holland, 1994. demoniaques et verification de boucles non
[19] C. A. R. Hoare and J. He. : The weakest deterministes. Theses of doctorat, Departement
prespecification. Fundamenta Informaticae IX, de Mathematiques et de statistique, Universite
1986, Part I: 5184, 1986. Laval, Canada, 1996.
[20] C. A. R. Hoare and J. He. : The weakest [32] F. Tchier.: Demonic semantics by mono-
prespecification. Fundamenta Informaticae IX, types. International Arab conference on In-
1986, Part II: 217252, 1986. formation Technology (Acit2002),University of
Qatar, Qatar, 16-19 December 2002.
[21] C. A. R. Hoare and al. : Laws of programming.
Communications of the ACM, 30:672686, 1986. [33] F. Tchier.: Demonic relational semantics of
compound diagrams. In: Jules Desharnais,
[22] R. D. Maddux. : Relation-algebraic semantics. Marc Frappier and Wendy MacCaull, editors.
Theoretical Computer Science, 160:185, 1996. Relational Methods in computer Science: The
[23] Mili, A., Desharnais, J. and Mili, F.: Relational Quebec seminar, pages 117-140, Methods Pub-
Heuristics for the Design of Deterministic Pro- lishers 2002.
grams. Acta Inf., 24(3), 239276 (1987). [34] F. Tchier.: While loop d demonic relational
[24] Mills, H. D., Basili, V. R., Gannon, J. D. and semantics monotype/residual style. 2003 In-
Hamlet,R. G.: Principles of Computer Pro- ternational Conference on Software Engineer-
gramming. A Mathematical Approach. Allyn ing Research and Practice (SERP03), Las Ve-
and Bacon, Inc., 1987. gas, Nevada, USA, 23-26, June 2003.
[25] Nguyen, T. T.: A Relational Model of Demonic [35] F. Tchier.: Demonic Semantics: using mono-
Nondeterministic Programs. Int. J. Founda- types and residuals. IJMMS 2004:3 (2004) 135-
tions Comput. Sci., 2(2), 101131 (1991). 160. (International Journal of Mathematics and
Mathematical Sciences)
[26] D. L. Parnas. A Generalized Control Structure
and its Formal Definition. Communications of [36] M. Walicki and S. Medal.: Algebraic approches
the ACM, 26:572581, 1983 to nondeterminism: An overview. ACM compu-
tong Surveys,29(1), 1997, 30-81.
[27] Schmidt, G.: Programs as Partial Graphs I:
Flow Equivalence and Correctness. Theoretical [37] L.Xu, M. Takeichi and H. Iwasaki.: Rela-
Comput. Sci., 15, 125 (1981). tional semantics for locally nondeterministic