next up previous
Next: Hoare rules Up: The Hoare Calculus Previous: The Hoare Calculus

Specifications

The purpose of a program is to achieve a desired state transformation. A specification is a ``declarative'' description of such a transformation, that is it specifies the desired net effect of a transformation without concerning itself about how this effect is achieved using the available commands.

The classical method of C.A.R.Hoare ([5],[1])presents a specification as a pair (P,Q) of expressions in the predicate logic over the underlying data structure. The idea is that a command C satisfies the specification (P,Q), if for any state tex2html_wrap_inline1340 satisfying P the state achieved after executing C satisfies Q. However, the possibility that tex2html_wrap_inline1556 must be taken into account, so we distinguish between partial correctness

displaymath1538

and total correctness:

displaymath1539

Thus given a specification (P,Q), it may be considered the programmers job to solve it by finding a program X such that tex2html_wrap_inline1562 , or even tex2html_wrap_inline1564 is true.



H.Peter Gumm