Behavioral constraints -- signature versus assertions
-
int f(int x) {
require( 9 <= x && x <= 11 );
...
promise( 3 <= result && result <= 5);
return result;
}
slide: Types and behavioral constraints
For example, we may express the requirement imposed
by typing a variable as an element of an integer
subrange also by stating that the variable is an integer
variable that respects the bounds of the subrange.
Similarly, we can express the typing constraints
on the domain and range of a function by
means of pre- and post-conditions asserting these
constraints.
See slide [10-constraints].
More generally, we may characterize the behavior
of a function type by means of pre- and post-conditions
and the behavior of an object type by means
of pre- and post-conditions for its methods
and an invariant clause expressing the
invariant properties of its state and behavior.
Recall that
this is precisely what is captured in our
notion of contract, as discussed in section [contracts].
With regard to the second question,
to verify behavioral properties (expressed as assertions)
we need an assertion logic in the style of Hoare.
Such a logic will be discussed in the next section.
In addition, we need a way in which to verify that
(an instance of) a subtype respects
the behavioral properties of its supertype.
In section [correspondence]
we will give precise guidelines for a programmer
to check the behavioral correspondence between two types.
[]
readme
course
preface
1
2
3
4
5
6
7
8
9
10
11
12
appendix
lectures
resources
eliens@cs.vu.nl

draft version 0.1 (15/7/2001)