Hoare triples #
Hoare triples form the basis for compositional functional correctness proofs about monadic programs.
As usual, Triple pre x post epost holds iff the precondition pre entails the weakest
precondition wp x post epost of x : m α for the postcondition post and error
postcondition epost.
It is thus defined in terms of an instance WP m Pred EPred.
A Hoare triple for reasoning about monadic programs. A Hoare triple Triple pre x post epost
is a specification for x: if assertion pre holds before x, then postcondition post holds
after running x (and epost handles any errors).
- intro
{m : Type u → Type v}
{Pred EPred α : Type u}
[Monad m]
[Assertion Pred]
[Assertion EPred]
[WP m Pred EPred]
{pre : Pred}
{x : m α}
{post : α → Pred}
{epost : EPred}
(hwp : Lean.Order.PartialOrder.rel pre (wp x post epost))
: Triple pre x post epost
Construct a triple from a weakest precondition entailment.
Instances For
Hoare triple notation without exception postcondition (defaults to ⊥).
Instances For
Hoare triple notation with a binder for the return value.