Definition
= the most general condition that, if true before , guarantees afterwards.
Core equivalence
is valid
Backward rules (compute inside-out)
| construct | rule |
|---|---|
| skip | |
| assignment | |
| sequence | |
| conditional | |
| while | needs user-given invariant ; check , , |
Live example (same one every time)
Program: x:=x+1; y:=x*2
Post:
Hence code ✓
Any other precondition stronger than also works; is the weakest.