Basics of program correctness
In a logic, write down (this is often called the specification)
- the effect of the computation that the program is required to perform (the postcondition Q)
- any constraints on the input environment to allow this computation (the precondition P)
Associate precise (logical) meaning to each construct in the programming language (this is done per-language, not per-program)
Reason (usually backwards) that the logical conditions are satisfied by the program S
A Hoare triple is a predicate {P}S{Q} that is true whenever P holds and the execution of S guarantees the Q holds