Example -- $IntSet \not<= FatSet$
- FatSet -- insert, select, size
- IntSet -- insert, delete, select, size
History property -- not satisfied by $IntSet$
slide: History properties -- example
With respect to its signature, IntSet merely extends
FatSet with a delete method and hence
could be regarded as a subtype of FatSet.
However, consider the history property stated above,
which says that for any (FatSet) s, when an
integer x is an element of s in state
then x will also be an element of s
in any state that comes after .
This property holds since instances of FatSet
do not have a method delete by which elements
can be removed.
Now if we take this property into account,
IntSet may not be regarded as a subtype
of FatSet, since instances of IntSet may grow
and shrink and hence do not respect the
FatSet history property.
This observation raises two questions.
Firstly, how can we characterize the behavior
of an object or function and, more importantly,
how can we extend our notion of types to
include a behavioral description?
And secondly, assuming that we have the means to
characterize the behavior of a function or object
type, how can we verify that a subtype respects
the behavioral constraints imposed by the supertype?
The answer to the first question is suggested
by the observation that we may also express the constraints
imposed by the signature by means of logical formulae
that state the constraints as assertions which must
be satisfied.