Objectives
This section introduces the notion of
behavioral subtypes in a formal manner.
It discusses how realizations of abstract data
types are related to their abstract
counterparts,
and provides an example of proving the correctness
of the realization of an abstract type.
Also, it presents guidelines to determine
the correspondence between a subtype
and its supertype
including syntactic as well as
behavioral constraints,
while allowing for behavioral extensions
in the form of additional methods.
These guidelines may be used to establish
whether two types satisfy the
behavioral subtype relation.
Points to emphasize
- abstract data types --
representation function
- correspondence --
abstraction, renaming, extension
- behavioral subtypes -- correspondence
Hints
The notions introduced in this section closely correspond to the notion
of contracts as discussed in
sections [responsibilities]
and [contracts].
However, the assertion logic employed for
contracts \`{a} la Eiffel is more limited.
Questions
- How would you characterize
the relation between an abstract data type
and its realizations?
- Give an example of an abstract specification of a stack.
Define a realization and show that the realization
is correct with respect to its abstract
specification.
- Explain the notion of correspondence
for behavioral subtypes.
- Show that a stack is a behavioral
subtype of a bag by defining an appropriate
correspondence relation.
What proof obligations must be met?
Comments
In all modesty,
only the rudiments of a verification
method for object-oriented programming
have been sketched.
Further research is needed to arrive at
a fully developed proof system
that may be employed in practice.