Assignment Rule
The basis of all correctness proofs is provided by the Assignment Rule, which states that the following Hoare tripple is (totally) correct:
Here is some value, easily computed from the current state variables, either using library functions, or maybe is a variable or a constant. is a state variable name, and
is the predicate with replaced by where-ever it occurs.
This rule is sound (i.e. does give correct tripples) because if the output to is to satisfy it is enough that satisfies the same condition had to satisfy according to .
It is also complete (i.e. the precondition is as weak (= general) as possible), so
is the weakest possible precondition given the piece of code and postcondition
.
Subsections
David Goodwin
2008-09-20