To save content items to your account,
please confirm that you agree to abide by our usage policies.
If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account.
Find out more about saving content to .
To save content items to your Kindle, first ensure no-reply@cambridge.org
is added to your Approved Personal Document E-mail List under your Personal Document Settings
on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part
of your Kindle email address below.
Find out more about saving to your Kindle.
Note you can select to save to either the @free.kindle.com or @kindle.com variations.
‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi.
‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.
All the previous chapters are about techniques for unambiguously specifying hardware/software systems and transforming abstract specifications into efficient programs. One important motivation for presenting these techniques is the fact that it is often useful to have a distinction between the external view and the internal view of a system. The external view can take the form of a formal specification and it can be optimised with respect to abstractness, compactness and clarity. The internal view is a program which is devised with efficiency in mind. To have two descriptions corresponding to these two views can be considered as a separation of concerns: it helps to manage the complexity of large systems.
This approach introduces additional formal texts when compared with the older approaches dealing mostly with programs. As a consequence, care is needed to maintain the overview of all formal texts that arise when designing large systems.
This chapter presents two techniques developed in the context of COLD-K which serve for keeping this overview. These are certainly not the only useful techniques; they should be complemented with additional graphical techniques and classical software engineering techniques for configuration management, project management, etc. The first technique is to use simple pictures showing the modular structure of a formal specification. This is the topic of Section 11.2. The second technique is to add structure, putting specifications and implementations together in simple language constructs called components and designs. This is the topic of Section 11.3. Finally, Sections 11.4 and 11.5 present a number of applications as well as some concluding remarks.
This monograph promotes specification and programming on the basis of Horn logic with equality. As was pointed out in [Pad88a], this theoretical background equips us with a number of deductive methods for reasoning about specifications and designing correct programs. The term declarative programming stands for the combination of functional (or applicative) and relational (or logic) programming. This does not rule out the design of imperative programs with conditionals, loops and sequences of variable assignments, since all these features have functional or relational equivalents. In particular, variables become “output parameters” of functions. Hence the static view of declarative programming is not really a restriction. Only if correctness conditions concerned with liveness or synchronization are demanded, transition relations must be specified for fixing the dynamics of program execution (cf. Sect. 6.6).
Design specifications
With regard to the overall software design process, the methods considered here are tailored to design specifications, each consisting of a many-sorted signature SIG denoting data, functions and predicates to be specified and a set of Horn clauses over SIG, allowing more or less abstract presentations of declarative programs and the data structures they use and manipulate (cf. Sects. 1.1 and 1.2). Associated with a design specification DS is a requirement specification, the conjecture section of DS, which consists of correctness conditions on DS. In contrast to design axioms, Horn clauses are not always sufficient for specifying requirements. Hence we admit positive Gentzen clauses, which may involve disjunctions and existential quantifiers, in a requirement specification (cf. Sect. 1.4).
In Chapter 2 a number of techniques for setting up algebraic specifications were given. Now we want to do the same for state-based specifications. Recall that a state-based specification serves to describe a system whose model is a ‘class’. A class is a kind of state-machine where each state has an algebra associated with it. Because each such algebra can be viewed as a static world model, classes with their state transitions can be viewed to model dynamic systems. Special language constructs to specify these systems were introduced, such as procedures and the operators of dynamic logic. It is typical for these language constructs that they leave the sort of states implicit.
Therefore the techniques of Chapter 2 are mostly useful for describing the static aspects of states, whereas we need complementary guidelines for dealing with the dynamic aspects of a system. This is the main topic of this chapter. Key notions are that of precondition, postcondition and invariant.
In practice it turns out that there are certain patterns that occur quite often in state-based specifications, providing methodological guidelines for systematically setting up state-based specifications. In this chapter we shall do this, focusing on the axioms, and we adopt a classification distinguishing four distinct roles an axiom can play. These roles correspond to typical syntactic patterns. We shall refer to these by saying that there are four kinds of axioms:
properties of all states;
invariance properties;
properties of the initial state;
properties of state transitions including pre- and postcondition axioms and termination axioms.