@[simp]
theorem
option.get_of_mem
{α : Type u_1}
{a : α}
{o : option α}
(h : ↥(o.is_some))
(a_1 : a ∈ o) :
option.get h = a
@[simp]
@[simp]
@[simp]
theorem
option.get_or_else_of_ne_none
{α : Type u_1}
{x : option α}
(hx : x ≠ none)
(y : α) :
some (x.get_or_else y) = x
theorem
option.map_injective
{α : Type u_1}
{β : Type u_2}
{f : α → β}
(Hf : function.injective f) :
option.map f
is injective if f
is injective.
@[simp]
@[simp]
theorem
option.map_some'
{α : Type u_1}
{β : Type u_2}
{a : α}
{f : α → β} :
option.map f (some a) = some (f a)
@[simp]
theorem
option.lift_or_get_choice
{α : Type u_1}
{f : α → α → α}
(h : ∀ (a b : α), f a b = a ∨ f a b = b)
(o₁ o₂ : option α) :
option.lift_or_get f o₁ o₂ = o₁ ∨ option.lift_or_get f o₁ o₂ = o₂
@[simp]
theorem
option.lift_or_get_none_left
{α : Type u_1}
{f : α → α → α}
{b : option α} :
option.lift_or_get f none b = b
@[simp]
theorem
option.lift_or_get_none_right
{α : Type u_1}
{f : α → α → α}
{a : option α} :
option.lift_or_get f a none = a
@[simp]
theorem
option.lift_or_get_some_some
{α : Type u_1}
{f : α → α → α}
{a b : α} :
option.lift_or_get f (some a) (some b) = ↑(f a b)
given an element of a : option α
, a default element b : β
and a function α → β
, apply this
function to a
if it comes from α
, and return b
otherwise.