Skip to content
Snippets Groups Projects
Commit 0144c537 authored by Robbert Krebbers's avatar Robbert Krebbers
Browse files

Propers for monadic operations on option.

parent aad23129
No related branches found
No related tags found
No related merge requests found
...@@ -231,9 +231,15 @@ Proof. destruct mx; naive_solver. Qed. ...@@ -231,9 +231,15 @@ Proof. destruct mx; naive_solver. Qed.
Lemma bind_with_Some {A} (mx : option A) : mx ≫= Some = mx. Lemma bind_with_Some {A} (mx : option A) : mx ≫= Some = mx.
Proof. by destruct mx. Qed. Proof. by destruct mx. Qed.
Instance option_fmap_proper `{Equiv A, Equiv B} (f : A B) : Instance option_fmap_proper `{Equiv A, Equiv B} :
Proper (() ==> ()) f Proper (() ==> ()) (fmap (M:=option) f). Proper ((() ==> ()) ==> () ==> ()) (fmap (M:=option) (A:=A) (B:=B)).
Proof. destruct 2; constructor; auto. Qed. Proof. destruct 2; constructor; auto. Qed.
Instance option_mbind_proper `{Equiv A, Equiv B} :
Proper ((() ==> ()) ==> () ==> ()) (mbind (M:=option) (A:=A) (B:=B)).
Proof. destruct 2; simpl; try constructor; auto. Qed.
Instance option_mjoin_proper `{Equiv A} :
Proper (() ==> ()) (mjoin (M:=option) (A:=A)).
Proof. destruct 1 as [?? []|]; simpl; by constructor. Qed.
(** ** Inverses of constructors *) (** ** Inverses of constructors *)
(** We can do this in a fancy way using dependent types, but rewrite does (** We can do this in a fancy way using dependent types, but rewrite does
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment