Option lemmas #
Lemmas about Option operations such as Option.elim and Option.getD.
Main results #
Option.elim_eq_if_isSome:o.elim no yes = if o.isSome then yes (o.getD d) else no.Option.getD_self_eq_iff:o.getD b = b ↔ ∀ b', o = some b' → b = b'.Option.getD_beq_self_eq_true_iff:(o.getD b == b) = true ↔ ∀ b', o = some b' → b = b'.
theorem Vector.ofFnM_option_replace {α : Type u_1} {β : Type u_2} {n : ℕ} (f : Fin n → Option α) (v : Fin n → β) :
(ofFnM fun (i : Fin n) => Option.map (fun (x : α) => v i) (f i)) = Option.map (fun (x : Vector α n) => ofFn v) (ofFnM f)
Replacing every accepted entry in an optional vector with a prescribed value retains failure and returns precisely the vector of prescribed values on success.