theorem
Option.get_mem
{α : Type u_1}
{o : Option α}
(h : Option.isSome o = true)
:
Option.get o h ∈ o
theorem
Option.get_of_mem
{α : Type u_1}
{a : α}
{o : Option α}
(h : Option.isSome o = true)
:
a ∈ o → Option.get o h = a
@[simp]
theorem
Option.some_get
{α : Type u_1}
{x : Option α}
(h : Option.isSome x = true)
:
some (Option.get x h) = x
@[simp]
theorem
Option.get_some
{α : Type u_1}
(x : α)
(h : Option.isSome (some x) = true)
:
Option.get (some x) h = x
theorem
Option.getD_of_ne_none
{α : Type u_1}
{x : Option α}
(hx : x ≠ none)
(y : α)
:
some (Option.getD x y) = x
@[simp]
theorem
Option.not_isSome :
∀ {α : Type u_1} {a : Option α}, Option.isSome a = false ↔ Option.isNone a = true
theorem
Option.eq_some_of_isSome
{α : Type u_1}
{o : Option α}
(h : Option.isSome o = true)
:
o = some (Option.get o h)
theorem
Option.bind_comm
{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
{f : α → β → Option γ}
(a : Option α)
(b : Option β)
:
(Option.bind a fun x => Option.bind b (f x)) = Option.bind b fun y => Option.bind a fun x => f x y
theorem
Option.bind_assoc
{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
(x : Option α)
(f : α → Option β)
(g : β → Option γ)
:
Option.bind (Option.bind x f) g = Option.bind x fun y => Option.bind (f y) g
theorem
Option.bind_id_eq_join
{α : Type u_1}
{x : Option (Option α)}
:
Option.bind x id = Option.join x
@[simp]
@[simp]
theorem
Option.map_eq_bind
{α : Type u_1}
:
∀ {α : Type u_2} {f : α → α} {x : Option α}, Option.map f x = Option.bind x (some ∘ f)
theorem
Option.map_congr
{α : Type u_1}
:
∀ {α : Type u_2} {f g : α → α} {x : Option α}, (∀ (a : α), a ∈ x → f a = g a) → Option.map f x = Option.map g x
@[simp]
theorem
Option.map_map
{β : Type u_1}
{γ : Type u_2}
{α : Type u_3}
(h : β → γ)
(g : α → β)
(x : Option α)
:
Option.map h (Option.map g x) = Option.map (h ∘ g) x
theorem
Option.comp_map
{β : Type u_1}
{γ : Type u_2}
{α : Type u_3}
(h : β → γ)
(g : α → β)
(x : Option α)
:
Option.map (h ∘ g) x = Option.map h (Option.map g x)
@[simp]
theorem
Option.map_comp_map
{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
(f : α → β)
(g : β → γ)
:
Option.map g ∘ Option.map f = Option.map (g ∘ f)
theorem
Option.mem_map_of_mem
{α : Type u_1}
{β : Type u_2}
{a : α}
{x : Option α}
(g : α → β)
(h : a ∈ x)
:
g a ∈ Option.map g x
theorem
Option.bind_map_comm
{α : Type u_1}
{β : Type u_2}
{x : Option (Option α)}
{f : α → β}
:
Option.bind x (Option.map f) = Option.bind (Option.map (Option.map f) x) id
theorem
Option.join_map_eq_map_join
{α : Type u_1}
{β : Type u_2}
{f : α → β}
{x : Option (Option α)}
:
Option.join (Option.map (Option.map f) x) = Option.map f (Option.join x)
theorem
Option.join_join
{α : Type u_1}
{x : Option (Option (Option α))}
:
Option.join (Option.join x) = Option.join (Option.map Option.join x)
theorem
Option.mem_of_mem_join
{α : Type u_1}
{a : α}
{x : Option (Option α)}
(h : a ∈ Option.join x)
:
@[simp]
theorem
Option.some_orElse
{α : Type u_1}
(a : α)
(x : Option α)
:
(HOrElse.hOrElse (some a) fun x => x) = some a
@[simp]
@[simp]
@[simp]
theorem
Option.guard_eq_some :
∀ {α : Type u_1} {p : α → Prop} {a b : α} [inst : DecidablePred p], Option.guard p a = some b ↔ a = b ∧ p a
theorem
Option.liftOrGet_eq_or_eq
{α : Type u_1}
{f : α → α → α}
(h : ∀ (a b : α), f a b = a ∨ f a b = b)
(o₁ : Option α)
(o₂ : Option α)
:
Option.liftOrGet f o₁ o₂ = o₁ ∨ Option.liftOrGet f o₁ o₂ = o₂
@[simp]
theorem
Option.liftOrGet_none_left
{α : Type u_1}
{f : α → α → α}
{b : Option α}
:
Option.liftOrGet f none b = b
@[simp]
theorem
Option.liftOrGet_none_right
{α : Type u_1}
{f : α → α → α}
{a : Option α}
:
Option.liftOrGet f a none = a
@[simp]
theorem
Option.liftOrGet_some_some
{α : Type u_1}
{f : α → α → α}
{a : α}
{b : α}
:
Option.liftOrGet f (some a) (some b) = some (f a b)
theorem
Option.elim_none
{β : Sort u_1}
{α : Type u_2}
(x : β)
(f : α → β)
:
Option.elim none x f = x
theorem
Option.elim_some
{β : Sort u_1}
{α : Type u_2}
(x : β)
(f : α → β)
(a : α)
:
Option.elim (some a) x f = f a
@[simp]
theorem
Option.getD_map
{α : Type u_1}
{β : Type u_2}
(f : α → β)
(x : α)
(o : Option α)
:
Option.getD (Option.map f o) (f x) = f (Option.getD o x)
An arbitrary some a
with a : α
if α
is nonempty, and otherwise none
.
Equations
- Option.choice α = if h : Nonempty α then some (Classical.choice h) else none
Instances For
theorem
Option.choice_isSome_iff_nonempty
{α : Type u_1}
:
Option.isSome (Option.choice α) = true ↔ Nonempty α