Skip to main content

Nondeterministic Functional Programming with Sets

  • Conference paper
IV Higher Order Workshop, Banff 1990

Part of the book series: Workshops in Computing ((WORKSHOPS COMP.))

Abstract

Nondeterminism can be introduced into a functional language, along with a set of laws for reasoning about the behaviour of programs, without disturbing referential transparency. We show how to do this by adding a new type constructor for sets and a carefully selected family of operations on sets. Instead of specifying a nondeterministic choice explicitly with choose or amb, a programmer specifies the set of values which the program might compute. Operations on sets are restricted in order to maintain laws for reasoning about programs; in particular, no function can choose an element from a set. The implementation is specified via rewrite rules that transform a program in the nondeterministic language into an ordinary functional program augmented with amb (which is not directly accessible to the programmer). The denotational semantics for this language is based on the Hoare powerdomain, so it includes bottom as a possible result even when the implementation will definitely not produce bottom. Since the denotational semantics fails to capture all the properties of the implementation, we present an additional method for reasoning about the productivity of a program. Productivity can be used to place additional constraints on the implementation which are not expressible in the powerdomain semantics. All of these techniques are illustrated by defining a “processor farm” program and proving several of its properties.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. John Hughes and John O’Donnell, “Expressing and reasoning about non-deterministic functional programs,” Functional Programming, Glasgow 1989,Springer-Verlag (1990) 308–328.

    Google Scholar 

  2. G. Kahn and D. McQueen, “Coroutines and networks of parallel processes,” Information Processing 77, North-Holland, Amsterdam (1977).

    Google Scholar 

  3. John McCarthy, “A basis for a mathematical theory of computation,” Computer Programming and Formal Systems North-Holland (1963) 33–70.

    Google Scholar 

  4. B. A. Sijtsma, Verification and Derivation of Infinite-List Programs, PhD Thesis, University of Groningen (1988).

    Google Scholar 

  5. Philip L. Wadler, “Theorems for free,” 4’th International Conference on Functional Programming Languages and Computer Architecture, ACM (1989).

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 1991 British Computer Society

About this paper

Cite this paper

Hughes, J., O’Donnell, J. (1991). Nondeterministic Functional Programming with Sets. In: Birtwistle, G. (eds) IV Higher Order Workshop, Banff 1990. Workshops in Computing. Springer, London. https://doi.org/10.1007/978-1-4471-3182-3_2

Download citation

  • DOI: https://doi.org/10.1007/978-1-4471-3182-3_2

  • Publisher Name: Springer, London

  • Print ISBN: 978-3-540-19660-0

  • Online ISBN: 978-1-4471-3182-3

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics