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.
- some: ∀ {α : Type u_1} {β : Type u_2} {r : α → β → Prop} {a : α} {b : β}, r a b → Option.rel r (some a) (some b)
- none: ∀ {α : Type u_1} {β : Type u_2} {r : α → β → Prop}, Option.rel r none none
Lifts a relation α → β → Prop to a relation Option α → Option β → Prop by just adding
none ~ none.
Instances For
Traverse an object of Option α with a function f : α → F β for an applicative F.
Equations
- Option.traverse f x = match x with | none => pure none | some x => some <$> f x
Instances For
If you maybe have a monadic computation in a [Monad m] which produces a term of type α,
then there is a naturally associated way to always perform a computation in m which maybe
produces a result.
Equations
- Option.maybe x = match x with | none => pure none | some fn => some <$> fn
Instances For
Equations
- Option.getDM' x y = do let __do_lift ← x Option.getDM __do_lift y
Instances For
An elimination principle for Option. It is a nondependent version of Option.rec.
Equations
- Option.elim' b f x = match x with | some a => f a | none => b
Instances For
o = none is decidable even if the wrapped type does not have decidable equality.
This is not an instance because it is not definitionally equal to Option.decidableEq.
Try to use o.isNone or o.isSome instead.
Equations
- Option.decidableEqNone = decidable_of_decidable_of_iff (_ : Option.isNone o = true ↔ o = none)
Instances For
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Inhabited get function. Returns a if the input is some a, otherwise returns default.
Equations
- Option.iget x = match x with | some x => x | none => default
Instances For
Convert undef to none to make an LOption into an Option.
Equations
- Lean.LOption.toOption x = match x with | Lean.LOption.some a => some a | x => none