On Guarded Commands with Fair Choice * Emil Sekerinski McMaster University, Hamilton, Ontario L8S 4L7, Canada, emil@mcmaster.ca Abstract. For the purpose of program development, fairness is typi- cally formalized by verification rules or, alternatively, through refinement rules. In this paper we give an account of (weak) fairness in an algebraic style, extending recently proposed algebraic accounts of iterations and loops using the predicate transformer model of statements. 1 Introduction The nondeterministic choice known from Dijkstra’s guarded commands allows an arbitrary selection to be made each time it is encountered, giving implemen- tations maximal freedom. Alternatively, we can assume that a certain degree of fairness is exercised for repeated choices, a useful assumption for modeling concurrent systems. For the purpose of program development, fairness has been formalized by verification rules, for example in [9,8]. More recently, fairness has been formally treated through refinement rules [5, 14]. The goal of this paper is to give an account of fairness in an algebraic style. Doing so, we follow and extend the algebraic accounts of various forms of iter- ations and of loops in particular [4], which has been used to derive transforma- tion rules for program development techniques like data refinement, atomicity refinement, reordering, and others. Our contribution is to define (weak) fairness algebraically and to derive elementary refinement and verification rules, using predicate transformers as the model of statements. The next section introduces the basic statements in the predicate transformer model and extends the discussion to various forms of iteration statements de- fined by fixed points. Section 3 introduced fair choice and gives basic theorems supporting the definition. Section 4 gives the fundamental loop theorem for loops with a fair choice. We conclude with some remarks in Section 5. 2 Statements We assume the reader is familiar with the principles of weakest precondition semantics and program refinement [2, 10, 11]. Here we briefly review the funda- mentals of statements defined by predicate transformers, following the treatment of [3], using typed, higher-order logic. The iteration statements are based on [1, 7] and in particular on [4]. * Appeared in R. Backhouse and J. Oliveira (Eds.) Proceedings of the 5th Interna- tional Conference on the Mathematics of Program Construction, MPC 2000, Ponte de Lima, Portugal, July 2000, Lecture Notes in Computer Science 1837, c Springer- Verlag, 2000.