Skip to content

Commit

Permalink
feat(data/option/basic): lemmas on map of none and congr (#5424)
Browse files Browse the repository at this point in the history
  • Loading branch information
pechersky committed Dec 21, 2020
1 parent 0ed425f commit 34d5750
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/data/option/basic.lean
Expand Up @@ -106,6 +106,18 @@ by cases x; simp
x.map f = some b ↔ ∃ a, x = some a ∧ f a = b :=
by cases x; simp

lemma map_eq_none {α β} {x : option α} {f : α → β} :
f <$> x = none ↔ x = none :=
by { cases x; simp only [map_none, map_some, eq_self_iff_true] }

@[simp] lemma map_eq_none' {x : option α} {f : α → β} :
x.map f = none ↔ x = none :=
by { cases x; simp only [map_none', map_some', eq_self_iff_true] }

lemma map_congr {f g : α → β} {x : option α} (h : ∀ a ∈ x, f a = g a) :
option.map f x = option.map g x :=
by { cases x; simp only [map_none', map_some', h, mem_def] }

@[simp] theorem map_id' : option.map (@id α) = id := map_id

@[simp] lemma map_map (h : β → γ) (g : α → β) (x : option α) :
Expand Down

0 comments on commit 34d5750

Please sign in to comment.