This is an old revision of the document!
Generating Verification Conditions
Review: Hoare triples, wp, sp from previous lecture03.
We will first consider programs without loops.
Normal Form of Loop-Free Programs
We next look at proof rules for loops, assuming loop invariants are given.
We next look at a program semantics that has explicit error conditions, and that gives nice rules for weakest preconditions.
We next discuss a particular approach for generating verification conditions that admits simpler loop invariants.
Further reading
- Calculus of Computation Textbook, Chapter 5 (Program Correctness: Mechanics)
Annotations in Control-Flow Graphs
Loop Unrolling
Size of verification conditions
- one-point rule for equality
- introducing fresh names for branches
- general-purpose simplifications
- concolic testing idea
Asserts and errors for nice wp definition
assert(F) = irrecoverable error if is false, terminates execution.
wp computes conditions sufficient for errors not to happen.
Postconditions are just asserts at the end of the program.
How to build a system with relations where at the same time
wp(assert(F),Q) = (F & Q) wp(assume(F),Q) = (F --> Q)
Then
wp(assert(false); assume(false),Q) = false wp(assume(false); assume(false),Q) = true
so cannot have any more.
Sketch of how this can be done is in a homework from last year.