Documentation

Std.Do.WP.Monad

Monad morphisms and weakest precondition interpretations #

A WP m ps is a WPMonad m ps if the interpretation WP.wp is also a monad morphism, that is, it preserves pure and bind.

class Std.Do.WPMonad (m : TypeType u) (ps : outParam PostShape) [Monad m] extends LawfulMonad m, Std.Do.WP m ps :
Type (max 1 u)

A WP that is also a monad morphism, preserving pure and bind. (They all are.)

Instances
    theorem Std.Do.WPMonad.wp_map {m : TypeType u} {ps : PostShape} {α β : Type} [Monad m] [WPMonad m ps] (f : αβ) (x : m α) :
    wp (f <$> x) = f <$> wp x
    theorem Std.Do.WPMonad.wp_seq {m : TypeType u} {ps : PostShape} {α β : Type} [Monad m] [WPMonad m ps] (f : m (αβ)) (x : m α) :
    wp (f <*> x) = wp f <*> wp x
    instance Std.Do.StateT.instWPMonad {m : TypeType u} {ps : PostShape} {σ : Type} [Monad m] [WPMonad m ps] :
    Equations
    instance Std.Do.ReaderT.instWPMonad {m : TypeType u} {ps : PostShape} {ρ : Type} [Monad m] [WPMonad m ps] :
    Equations
    instance Std.Do.ExceptT.instWPMonad {m : TypeType u} {ps : PostShape} {ε : Type} [Monad m] [WPMonad m ps] :
    Equations
    Equations
    Equations