Concurrency with oracles
While there has been research into deterministic concurrency (e.g. Eleni Spiliopoulou's work with the Bristol Haskell system as described in his thesis Concurrent and Distributed Functional Systems), models of concurrency are generally nondeterministic. For programming languages like Haskell which have the goal of being referentially transparent, the nondeterminism associated with concrrency presents a challenge - the usual techniques for supporting it used by most other (imperative) languages cannot not be simply transferred verbatim.
But neither can nondeterminism be just ignored - to quote F. Warren Burton from Nondeterminism with Referential Transparency in Functional Programming Languages:
Nondeterminism is useful in real-time applications where the behaviour of a program should depend on the order in which external events occur. For example, it might be desirable to merge the elements of two lists in the order in which the elements become available. This type of nondeterminism appears to be necessary if functional programs are to be used for real-time computing.
Other example include:
- which out of two computations will finish first;
- which input event will arrive first;
- whether a computation will finish before an input event arrives.
For concurrent programs, nondeterminism is inescapable - events like storage, network or other external failures can occur without warning. The languages used for writing such programs must have some way to allow these programs to cope with such degradation gracefully while continuing to carry out their desinated tasks, albeit at reduced capacity.
How oracles can help
By presenting them to programs via a (thoretically) infinite structured value such as a tree, oracles allow for the controlled use of nondeterminism while maintaining referential transparency - wherever the program requires an nondeterminic result, an oracle is then used for this purpose throught the use of operations from the interface for the corresponding abstract data type. Once an oracle has been used, it can't be reused - referential transparency demands that the outcome of applying the oracle remains constant.
Examples of use
K. V. S. Prasad uses oracles directly in A Calculus of Broadcasting Systems; Peter Dybjer, Herbert Sander and Mieke Massink use the concept for reasoning about various models of concurrency and their possible applications.
- A Functional Programming Approach to the Specification and Verification of Concurrent Systems, Peter Dybjer and Herbert Sander.
- Functional Techniques in Concurrency, Mieke Massink.
- A Calculus of Broadcasting Systems, K. V. S. Prasad.