Commit 19aae59a authored by Robbert Krebbers's avatar Robbert Krebbers
Browse files

Prove that `fmap` on `option` and `gmap` is monotone.

parent 19e85810
......@@ -1430,6 +1430,14 @@ Section option_prod.
Proof. intros ?%Some_pair_included. by rewrite -(Some_included_total b1). Qed.
End option_prod.
Lemma option_fmap_mono {A B : cmraT} (f : A B) ma mb :
Proper (() ==> ()) f
( a b, a b f a f b)
ma mb f <$> ma f <$> mb.
intros ??. rewrite !option_included; intros [->|(a&b&->&->&?)]; naive_solver.
Instance option_fmap_cmra_morphism {A B : cmraT} (f: A B) `{!CmraMorphism f} :
CmraMorphism (fmap f : option A option B).
......@@ -474,6 +474,14 @@ Proof.
apply (delete_local_update_cancelable m _ i (Some x));
[done|by rewrite lookup_singleton].
Lemma gmap_fmap_mono {B : ucmraT} (f : A B) m1 m2 :
Proper (() ==> ()) f
( x y, x y f x f y) m1 m2 fmap f m1 fmap f m2.
intros ??. rewrite !lookup_included=> Hm i.
rewrite !lookup_fmap. by apply option_fmap_mono.
End properties.
Section unital_properties.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment