NLA-lib Explorer

Option.exists_map_eq_some_of_exists

Library · theorem

If o is some a for an a satisfying Q, and f maps every value satisfying Q to one satisfying R, then o.map f is some b for a b satisfying R.

Option.exists_map_eq_some_of_exists.{u_1, u_2} {α : Type u_1} {β : Type u_2} {o : Option α}
  {f : α → β} {Q : α → Prop} {R : β → Prop} (h : ∃ a, o = some a ∧ Q a)
  (hQ : ∀ (a : α), Q a → R (f a)) : ∃ b, Option.map f o = some b ∧ R b

Full source on GitHub

Import NLAlib.ForMathlib.Data.Option.Basic.