A simple library of Monotonic Predicate Transformers
Require Export ImpureConfig.
Module MPP_Definitions.
A more fundamental notion than Monotonic Predicate Transformers: Monotonic Predicates of Predicate
Record MPP (
A:
Type):=
{
apply:> (
A ->
Prop) ->
Prop ;
apply_monotone (
P Q:
A ->
Prop):
apply P -> (
forall m,
P m ->
Q m) ->
apply Q
}.
Implicit Arguments apply [
A].
Bind Scope MPP_scope with MPP.
Delimit Scope MPP_scope with MPP.
Local Hint Resolve apply_monotone.
Refinement
Notation "
mp1 °|=
mp2" := (
forall P,
apply mp2 P ->
apply mp1 P) (
at level 120,
no associativity):
MPP_scope.
Program Definition ret {
A} (
a:
A):
MPP A
:= {|
apply :=
fun Q =>
Q a
|}.
Program Definition bind {
A B} (
mp1:
MPP A) (
mp2:
A ->
MPP B):
MPP B
:= {|
apply :=
fun Q =>
mp1 (
fun x => (
mp2 x)
Q)
|}.
Obligation 1.
eapply apply_monotone;
eauto.
simpl;
eauto.
Qed.