Alternating states for dual nondeterminism in imperative programming

The refinement calculus of Back, Morgan, Morris, and others is based on monotone predicate transformers (weakest preconditions) where conjunctions stand for demonic choices between commands and disjunctions for angelic choices. Arbitrary monotone predicate transformers cannot be modelled by relational semantics but can be modelled by so-called multirelations. Results of Morris indicate, however, that the natural domain for the combination of demonic and angelic choice is the free distributive completion (FDC) of the state space. The present paper provides a new axiomatization and more explicit construction of the FDC of an arbitrary ordered set. The FDC concept is self-dual, but the construction is not. We therefore determine the duality function from the FDC to the dual of the FDC of the dual ordered set. The elements of the FDC are classified according to their conjunctivity and disjunctivity. The theory is applied to imperative programming with operators for sequential composition and demonic and angelic choice. The theory based on the FDC is shown to be equivalent to a weakest precondition theory for up-closed predicates. If the order is discrete (i.e., the equality relation), the FDC turns out to be the domain of the choice semantics of Back and von Wright, whereas up-closed multirelations are functions towards this domain.

[1]  Ingrid Rewitzky,et al.  Binary Multirelations , 2003, Theory and Applications of Relational Structures as Knowledge Instruments.

[2]  Peter Naur Proof of Algorithms by General Snapshots , 1966 .

[3]  W. P. Roever Dijkstra's Predicate Transformer, Non-Determinism, Recursion and Termination , 1976, MFCS.

[4]  Ralph-Johan Back,et al.  A Lattice-theoretical Basis for a Specification Language , 1989, MPC.

[5]  Robert W. Floyd,et al.  Assigning Meanings to Programs , 1993 .

[6]  Carroll Morgan,et al.  Programming from specifications , 1990, Prentice Hall International Series in computer science.

[7]  H. J. Boom A Weaker Precondition for Loops , 1982, TOPL.

[8]  Willem P. de Roever,et al.  A Calculus for Recursive Program Schemes , 1972, ICALP.

[9]  W. R. Tunnicliffe The free completely distributive lattice over a poset , 1985 .

[10]  Carroll Morgan,et al.  Data refinement by calculation , 1990, Acta Informatica.

[11]  Robin Milner,et al.  On Observing Nondeterminism and Concurrency , 1980, ICALP.

[12]  Michael Barr,et al.  Category theory for computing science , 1995, Prentice Hall International Series in Computer Science.

[13]  Joseph M. Morris Augmenting Types with Unbounded Demonic and Angelic Nondeterminacy , 2004, MPC.

[14]  C. A. R. Hoare,et al.  Communicating sequential processes , 1978, CACM.

[15]  Ralph-Johan Back,et al.  Refinement Calculus: A Systematic Introduction , 1998 .

[16]  Maurice Nivat,et al.  Non Deterministic Recursive Program Schemes , 1977, FCT.

[17]  Joseph M. Morris,et al.  Dual unbounded nondeterminacy, recursion, and fixpoints , 2007, Acta Informatica.

[18]  Dana S. Scott,et al.  Finite Automata and Their Decision Problems , 1959, IBM J. Res. Dev..

[19]  Wim H. Hesselink,et al.  Interpretations of Recursion under Unbounded Nondeterminacy , 1988, Theor. Comput. Sci..

[20]  Wim H. Hesselink Predicate Transformers for Recursive Procedures with Local Variables , 1999, Formal Aspects of Computing.

[21]  W. H. J. Feijen,et al.  Beauty Is Our Business: A Birthday Salute to Edsger W.Dijkstra , 1990 .

[22]  Clare E. Martin,et al.  Modelling Nondeterminism , 2004, International Conference on Mathematics of Program Construction.

[23]  Wim H. Hesselink,et al.  A mathematical approach to nondeterminism in data types , 1988, TOPL.

[24]  Manfred Broy,et al.  Semantics of Nondeterministic and Noncontinuous Constructs , 1978, Program Construction.

[25]  Joseph M. Morris,et al.  Terms with unbounded demonic and angelic nondeterminacy , 2007, Sci. Comput. Program..

[26]  Edsger W. Dijkstra,et al.  Guarded commands, nondeterminacy and formal derivation of programs , 1975, Commun. ACM.

[27]  Krzysztof R. Apt,et al.  Countable nondeterminism and random assignment , 1986, JACM.

[28]  Wim H. Hesselink,et al.  Modalities of nondeterminacy , 1990 .

[29]  David Michael Ritchie Park,et al.  On the Semantics of Fair Parallelism , 1979, Abstract Software Specifications.

[30]  K. Mani Chandy,et al.  Parallel program design - a foundation , 1988 .

[31]  Edsger W. Dijkstra,et al.  A Discipline of Programming , 1976 .

[32]  A. M. Turing,et al.  Checking a large routine , 1989 .

[33]  Edsger W. Dijkstra,et al.  Co-operating sequential processes , 1968 .

[34]  J. W. de Bakker,et al.  Mathematical theory of program correctness , 1980, Prentice-Hall international series in computer science.

[35]  Rutger M. Dijkstra DUALITY: A simple formalism for the analysis of UNITY , 2005, Formal Aspects of Computing.

[36]  Stephen A. Cook,et al.  The complexity of theorem-proving procedures , 1971, STOC.

[37]  W. Marsden I and J , 2012 .

[38]  Wim H. Hesselink,et al.  LR-Parsing Derived , 1992, Sci. Comput. Program..

[39]  Edsger W. Dijkstra,et al.  Predicate Calculus and Program Semantics , 1989, Texts and Monographs in Computer Science.