# How to Calculate with Nondeterministic Functions

## Abstract

While simple equational reasoning is adequate for the calculation of many algorithms from their functional specifications, it is not up to the task of dealing with others, particularly those specified as optimisation problems. One approach is to replace functions by relations, and equational reasoning by reasoning about relational inclusion. But such a wholesale approach means one has to adopt a new and sometimes subtle language to argue about the properties of relational expressions. A more modest proposal is to generalise our powers of specification by allowing certain nondeterministic, or multi-valued functions, and to reason about refinement instead. Such functions will not appear in any final code. Refinement calculi have been studied extensively over the years and our aim in this article is just to explore the issues in a simple setting and to justify the axioms of refinement using the semantics suggested by Morris and Bunkenburg.

## References

- 1.Bird, R.S., de Moor, O.: The Algebra of Programming. Prentice-Hall International Series in Computer Science, Hemel Hempstead (1997)Google Scholar
- 2.Harper, R., Honsell, F., Plotkin, G.: A framework for defining logics. J. Assoc. Comput. Mach.
**40**(1), 143–184 (1993)MathSciNetCrossRefGoogle Scholar - 3.Morris, J.M., Bunkenburg, A.: Specificational functions. ACM Trans. Program. Lang. Syst.
**21**(3), 677–701 (1999)CrossRefGoogle Scholar - 4.Morris, J.M., Bunkenburg, A.: Partiality and nondeterminacy in program proofs. Formal Aspects Comput.
**10**, 76–96 (1998)CrossRefGoogle Scholar - 5.Morris, J.M., Tyrrell, M.: Dually nondeterministic functions. ACM Trans. Program. Lang. Syst.
**30**(6) (2008). Article 34 CrossRefGoogle Scholar