Consequence for native monadic specifications #
Reuse a native Std.Do.Triple with a stronger precondition and a weaker
postcondition. This is the consequence rule of the existing predicate
transformer, for any supported monad and postcondition shape. In particular,
Triple.and can first combine separate properties of the same computation;
Triple.mono then expresses their mathematical consequence without exposing
the computation's execution witnesses or unfolding its weakest precondition.
theorem
Std.Do.Triple.mono
{m : Type u → Type v}
{ps : PostShape}
[WP m ps]
{α : Type u}
{action : m α}
{pre pre' : Assertion ps}
{post post' : PostCond α ps}
(specification : ⦃pre⦄ action ⦃post⦄)
(precondition : pre' ⊢ₛ pre)
(postcondition : post.entails post')
:
Strengthen a native specification's precondition and weaken its postcondition, including every exceptional outcome in its postcondition shape. The action and its weakest-precondition interpretation are unchanged.