Framing at the wp layer #
WP.Frames op x F P states that the program x commutes op F · into the postcondition of
wp x in every state that satisfies the guard P, with the exception channel framed by the
FrameOp-derived companion.
The guard P matters when the footprint of x depends on the state.
For example, a write to the memory region [s.p, s.p + s.n) frames F s := s.mem a = v under the
guard P s := a < s.p ∨ s.p + s.n ≤ a.
A WP built as the Lean.Order.PredTrans.frameClosure of a base wp frames every resource under
every guard.
The monadic counterpart, which builds a WPMonad from the frame closure of a base interpretation,
is in Std.WP.Monad.Frame.
The program x frames the resource F under the guard P: in a state that satisfies P,
op F · commutes into the postcondition of wp x and the companion opE F · into the exception
postcondition.
- op_wp_le_wp_op (Q : Value → Pred) (E : EPosts) : Lean.Order.PartialOrder.rel (Lean.Order.meet P (op F (wp x Q E))) (wp x (fun (a : Value) => op F (Q a)) (opE F E))
Under
P,op Fand its companion commute into the postcondition pair ofwp x.
Instances For
Reinterpret a WP so its weakest precondition is the frameClosure of the base
wp over a family of supremum-preserving resource operators op r and the FrameOp-derived
exception-channel companion.
Equations
- Std.WP.WP.withFrameClosure op base = { trans := fun (x : Prog) => Lean.Order.PredTrans.frameClosure op (Std.WP.WP.trans x), trans_monotone := ⋯ }