Documentation

Mathlib.Data.Option.Defs

Extra definitions on Option #

This file defines more operations involving Option α. Lemmas about them are located in other files under Mathlib.Data.Option. Other basic operations on Option are defined in the core library.

def Option.traverse {F : Type u → Type v} [Applicative F] {α : Type u_1} {β : Type u} (f : αF β) :
Option αF (Option β)

Traverse an object of Option α with a function f : α → F β for an applicative F.

Equations
Instances For
    def Option.elim' {α : Type u_1} {β : Type u_2} (b : β) (f : αβ) :
    Option αβ

    An elimination principle for Option. It is a nondependent version of Option.rec.

    Equations
    Instances For
      @[simp]
      theorem Option.elim'_none {α : Type u_1} {β : Type u_2} (b : β) (f : αβ) :
      @[simp]
      theorem Option.elim'_some {α : Type u_1} {β : Type u_2} {a : α} (b : β) (f : αβ) :
      Option.elim' b f (some a) = f a
      @[simp]
      theorem Option.elim'_none_some {α : Type u_1} {β : Type u_2} (f : Option αβ) :
      theorem Option.elim'_eq_elim {α : Type u_3} {β : Type u_4} (b : β) (f : αβ) (a : Option α) :
      Option.elim' b f a = a.elim b f
      @[reducible, inline]
      abbrev Option.iget {α : Type u_1} [Inhabited α] :
      Option αα

      Inhabited get function. Returns a if the input is some a, otherwise returns default.

      Equations
      Instances For
        theorem Option.iget_some {α : Type u_1} [Inhabited α] {a : α} :
        (some a).iget = a
        instance Option.merge_isCommutative {α : Type u_1} (f : ααα) [Std.Commutative f] :
        instance Option.merge_isAssociative {α : Type u_1} (f : ααα) [Std.Associative f] :
        instance Option.merge_isIdempotent {α : Type u_1} (f : ααα) [Std.IdempotentOp f] :
        instance Option.merge_isId {α : Type u_1} (f : ααα) :
        @[deprecated Option.merge_isCommutative (since := "2025-04-04")]
        theorem Option.liftOrGet_isCommutative {α : Type u_1} (f : ααα) [Std.Commutative f] :

        Alias of Option.merge_isCommutative.

        @[deprecated Option.merge_isAssociative (since := "2025-04-04")]
        theorem Option.liftOrGet_isAssociative {α : Type u_1} (f : ααα) [Std.Associative f] :

        Alias of Option.merge_isAssociative.

        @[deprecated Option.merge_isIdempotent (since := "2025-04-04")]
        theorem Option.liftOrGet_isIdempotent {α : Type u_1} (f : ααα) [Std.IdempotentOp f] :

        Alias of Option.merge_isIdempotent.

        @[deprecated Option.merge_isId (since := "2025-04-04")]
        theorem Option.liftOrGet_isId {α : Type u_1} (f : ααα) :

        Alias of Option.merge_isId.