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

Add lemma `option_fmap_equiv_inj`.

parent e91acf76
No related branches found
No related tags found
1 merge request!276Misc setoids lemmas and tweaks for maps and option
...@@ -179,6 +179,9 @@ Global Instance option_guard: MGuard option := λ P dec A f, ...@@ -179,6 +179,9 @@ Global Instance option_guard: MGuard option := λ P dec A f,
Global Instance option_fmap_inj {A B} (f : A B) : Global Instance option_fmap_inj {A B} (f : A B) :
Inj (=) (=) f Inj (=@{option A}) (=@{option B}) (fmap f). Inj (=) (=) f Inj (=@{option A}) (=@{option B}) (fmap f).
Proof. intros ? [x1|] [x2|] [=]; naive_solver. Qed. Proof. intros ? [x1|] [x2|] [=]; naive_solver. Qed.
Global Instance option_fmap_equiv_inj `{Equiv A, Equiv B} (f : A B) :
Inj () () f Inj (≡@{option A}) (≡@{option B}) (fmap f).
Proof. intros ? [x1|] [x2|]; inversion 1; subst; constructor; by apply (inj _). Qed.
Lemma fmap_is_Some {A B} (f : A B) mx : is_Some (f <$> mx) is_Some mx. Lemma fmap_is_Some {A B} (f : A B) mx : is_Some (f <$> mx) is_Some mx.
Proof. unfold is_Some; destruct mx; naive_solver. Qed. Proof. unfold is_Some; destruct mx; naive_solver. Qed.
......
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