Hoare triples for a conjunctive weakest precondition #
Two specifications for one program x combine into a single specification when wp x is
conjunctive. Triple.and conjoins the two specifications. Triple.mp reads the second
specification as an implication and discharges its antecedent with the first. Triple.observe
runs a program obs for the sole purpose of learning a fact, then carries the fact into a
specification for a second program prog.
Conjunction of two Hoare triple specifications for a program x. This theorem decomposes proofs:
prove unrelated facts about x separately, then combine them here.
Modus ponens for two Hoare triple specifications of a program x. This theorem separates proofs.
Let h₁ establish a basic postcondition post₁ for x, and let h₂ establish the advanced
postcondition post₂ under the assumption post₁. Then mp h₁ h₂ establishes post₂ for x.
Observe a fact about the state by running the program obs, then carry the fact into the proof
for the program prog. A specification for prog follows from the specification h for obs
with postcondition post, together with the specification hgoal deriving the goal
wp prog post' epost' from post. The premise hp restricts obs to observation: an assertion
that holds after a successful run of obs already holds before it.