Documentation

Std.Data.Option.Lemmas

theorem Option.mem_iff {α : Type u_1} {a : α} {b : Option α} :
a b b = some a
theorem Option.some_ne_none {α : Type u_1} (x : α) :
some x none
theorem Option.forall {α : Type u_1} {p : Option αProp} :
(∀ (x : Option α), p x) p none ∀ (x : α), p (some x)
theorem Option.exists {α : Type u_1} {p : Option αProp} :
(∃ (x : Option α), p x) p none ∃ (x : α), p (some x)
theorem Option.get_mem {α : Type u_1} {o : Option α} (h : Option.isSome o = true) :
theorem Option.get_of_mem {α : Type u_1} {a : α} {o : Option α} (h : Option.isSome o = true) :
a oOption.get o h = a
theorem Option.not_mem_none {α : Type u_1} (a : α) :
¬a none
@[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 : α) :
theorem Option.getD_eq_iff {α : Type u_1} {o : Option α} {a : α} {b : α} :
Option.getD o a = b o = some b o = none a = b
theorem Option.mem_unique {α : Type u_1} {o : Option α} {a : α} {b : α} (ha : a o) (hb : b o) :
a = b
theorem Option.ext {α : Type u_1} {o₁ : Option α} {o₂ : Option α} :
(∀ (a : α), a o₁ a o₂)o₁ = o₂
theorem Option.eq_none_iff_forall_not_mem :
∀ {α : Type u_1} {o : Option α}, o = none ∀ (a : α), ¬a o
@[simp]
theorem Option.isSome_none {α : Type u_1} :
@[simp]
theorem Option.isSome_some :
∀ {α : Type u_1} {a : α}, Option.isSome (some a) = true
theorem Option.isSome_iff_exists :
∀ {α : Type u_1} {x : Option α}, Option.isSome x = true ∃ (a : α), x = some a
@[simp]
theorem Option.isNone_none {α : Type u_1} :
@[simp]
theorem Option.isNone_some :
∀ {α : Type u_1} {a : α}, Option.isNone (some a) = false
@[simp]
theorem Option.not_isSome :
∀ {α : Type u_1} {a : Option α}, Option.isSome a = false Option.isNone a = true
theorem Option.eq_some_iff_get_eq :
∀ {α : Type u_1} {o : Option α} {a : α}, o = some a ∃ (h : Option.isSome o = true), Option.get o h = a
theorem Option.eq_some_of_isSome {α : Type u_1} {o : Option α} (h : Option.isSome o = true) :
o = some (Option.get o h)
theorem Option.not_isSome_iff_eq_none :
∀ {α : Type u_1} {o : Option α}, ¬Option.isSome o = true o = none
theorem Option.ne_none_iff_isSome :
∀ {α : Type u_1} {o : Option α}, o none Option.isSome o = true
theorem Option.ne_none_iff_exists :
∀ {α : Type u_1} {o : Option α}, o none ∃ (x : α), some x = o
theorem Option.ne_none_iff_exists' :
∀ {α : Type u_1} {o : Option α}, o none ∃ (x : α), o = some x
theorem Option.bex_ne_none {α : Type u_1} {p : Option αProp} :
(∃ (x : Option α), ∃ (x_1 : x none), p x) ∃ (x : α), p (some x)
theorem Option.ball_ne_none {α : Type u_1} {p : Option αProp} :
(∀ (x : Option α), x nonep x) ∀ (x : α), p (some x)
@[simp]
theorem Option.pure_def {α : Type u_1} :
pure = some
@[simp]
theorem Option.bind_eq_bind {α : Type u_1} {β : Type u_1} :
bind = Option.bind
@[simp]
theorem Option.bind_some {α : Type u_1} (x : Option α) :
Option.bind x some = x
@[simp]
theorem Option.bind_none {α : Type u_1} {β : Type u_2} (x : Option α) :
(Option.bind x fun (x : α) => none) = none
@[simp]
theorem Option.bind_eq_some :
∀ {α : Type u_1} {b : α} {α_1 : Type u_2} {x : Option α_1} {f : α_1Option α}, Option.bind x f = some b ∃ (a : α_1), x = some a f a = some b
@[simp]
theorem Option.bind_eq_none {α : Type u_1} {β : Type u_2} {o : Option α} {f : αOption β} :
Option.bind o f = none ∀ (a : α), o = some af a = none
theorem Option.bind_eq_none' {α : Type u_1} {β : Type u_2} {o : Option α} {f : αOption β} :
Option.bind o f = none ∀ (b : β) (a : α), a o¬b f a
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.join_eq_some :
∀ {α : Type u_1} {a : α} {x : Option (Option α)}, Option.join x = some a x = some (some a)
theorem Option.join_ne_none :
∀ {α : Type u_1} {x : Option (Option α)}, Option.join x none ∃ (z : α), x = some (some z)
theorem Option.join_ne_none' :
∀ {α : Type u_1} {x : Option (Option α)}, ¬Option.join x = none ∃ (z : α), x = some (some z)
theorem Option.join_eq_none :
∀ {α : Type u_1} {o : Option (Option α)}, Option.join o = none o = none o = some none
@[simp]
theorem Option.map_eq_map :
∀ {α α_1 : Type u_1} {f : αα_1}, Functor.map f = Option.map f
theorem Option.map_none :
∀ {α α_1 : Type u_1} {f : αα_1}, f <$> none = none
theorem Option.map_some :
∀ {α α_1 : Type u_1} {f : αα_1} {a : α}, f <$> some a = some (f a)
@[simp]
theorem Option.map_eq_some' :
∀ {α : Type u_1} {b : α} {α_1 : Type u_2} {x : Option α_1} {f : α_1α}, Option.map f x = some b ∃ (a : α_1), x = some a f a = b
theorem Option.map_eq_some :
∀ {α α_1 : Type u_1} {f : αα_1} {x : Option α} {b : α_1}, f <$> x = some b ∃ (a : α), x = some a f a = b
@[simp]
theorem Option.map_eq_none' :
∀ {α : Type u_1} {x : Option α} {α_1 : Type u_2} {f : αα_1}, Option.map f x = none x = none
theorem Option.map_eq_none :
∀ {α α_1 : Type u_1} {f : αα_1} {x : Option α}, f <$> x = none x = none
theorem Option.map_eq_bind {α : Type u_1} :
∀ {α_1 : Type u_2} {f : αα_1} {x : Option α}, Option.map f x = Option.bind x (some f)
theorem Option.map_congr {α : Type u_1} :
∀ {α_1 : Type u_2} {f g : αα_1} {x : Option α}, (∀ (a : α), a xf a = g a)Option.map f x = Option.map g x
@[simp]
theorem Option.map_id' {α : Type u_1} :
@[simp]
theorem Option.map_id'' {α : Type u_1} {x : Option α} :
Option.map (fun (a : α) => a) x = x
@[simp]
theorem Option.map_map {β : Type u_1} {γ : Type u_2} {α : Type u_3} (h : βγ) (g : αβ) (x : Option α) :
theorem Option.comp_map {β : Type u_1} {γ : Type u_2} {α : Type u_3} (h : βγ) (g : αβ) (x : Option α) :
@[simp]
theorem Option.map_comp_map {α : Type u_1} {β : Type u_2} {γ : Type u_3} (f : αβ) (g : βγ) :
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 : αβ} :
theorem Option.join_map_eq_map_join {α : Type u_1} {β : Type u_2} {f : αβ} {x : Option (Option α)} :
theorem Option.join_join {α : Type u_1} {x : Option (Option (Option α))} :
theorem Option.mem_of_mem_join {α : Type u_1} {a : α} {x : Option (Option α)} (h : a Option.join x) :
some a x
@[simp]
theorem Option.some_orElse {α : Type u_1} (a : α) (x : Option α) :
(HOrElse.hOrElse (some a) fun (x_1 : Unit) => x) = some a
@[simp]
theorem Option.none_orElse {α : Type u_1} (x : Option α) :
(HOrElse.hOrElse none fun (x_1 : Unit) => x) = x
@[simp]
theorem Option.orElse_none {α : Type u_1} (x : Option α) :
(HOrElse.hOrElse x fun (x : Unit) => none) = x
theorem Option.map_orElse {α : Type u_1} :
∀ {α_1 : Type u_2} {f : αα_1} {x y : Option α}, Option.map f (HOrElse.hOrElse x fun (x : Unit) => y) = HOrElse.hOrElse (Option.map f x) fun (x : Unit) => Option.map f y
@[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)
noncomputable def Option.choice (α : Type u_1) :

An arbitrary some a with a : α if α is nonempty, and otherwise none.

Equations
Instances For
    theorem Option.choice_eq {α : Type u_1} [Subsingleton α] (a : α) :
    @[simp]
    theorem Option.to_list_some {α : Type u_1} (a : α) :
    @[simp]
    theorem Option.to_list_none (α : Type u_1) :