The areas / V33. Data structures and computation
Mathlib.Control.ULift
24 declarations. Mathlib docs · Source
Monadic instances for ULift and PLift
In this file we define Monad and IsLawfulMonad instances on PLift and ULift.
def PLift.map E1 #
{α : Sort u} → {β : Sort v} → (α → β) → PLift α → PLift β
Functorial action.
theorem PLift.map_up E0 #
∀ {α : Sort u} {β : Sort v} (f : α → β) (a : α), PLift.map f { down := a } = { down := f a }
def PLift.pure E1 #
{α : Sort u} → α → PLift α
Embedding of pure values.
def PLift.seq E1 #
{α : Sort u} → {β : Sort v} → PLift (α → β) → (Unit → PLift α) → PLift β
Applicative sequencing.
theorem PLift.seq_up E0 #
∀ {α : Sort u} {β : Sort v} (f : α → β) (x : α), ({ down := f }.seq fun x_1 ↦ { down := x }) = { down := f x }
def PLift.bind E1 #
{α : Sort u} → {β : Sort v} → PLift α → (α → PLift β) → PLift β
Monadic bind.
theorem PLift.bind_up E0 #
∀ {α : Sort u} {β : Sort v} (a : α) (f : α → PLift β), { down := a }.bind f = f a
instance PLift.instMonad_mathlib E0 #
Monad PLift
instance PLift.instLawfulFunctor_mathlib E0 #
LawfulFunctor PLift
instance PLift.instLawfulApplicative_mathlib E0 #
LawfulApplicative PLift
instance PLift.instLawfulMonad_mathlib E0 #
LawfulMonad PLift
theorem PLift.rec.constant E0 #
∀ {α : Sort u} {β : Type v} (b : β), (PLift.rec fun x ↦ b) = fun x ↦ b
def ULift.map E1 #
{α : Type u} → {β : Type v} → (α → β) → ULift.{u', u} α → ULift.{v', v} β
Functorial action.
theorem ULift.map_up E0 #
∀ {α : Type u} {β : Type v} (f : α → β) (a : α), ULift.map f { down := a } = { down := f a }
def ULift.pure E1 #
{α : Type u} → α → ULift.{u_1, u} α
Embedding of pure values.
def ULift.seq E1 #
{α : Type u_1} → {β : Type u_2} → ULift.{u_3, max u_1 u_2} (α → β) → (Unit → ULift.{u_4, u_1} α) → ULift.{u, u_2} β
Applicative sequencing.
theorem ULift.seq_up E0 #
∀ {α : Type u} {β : Type v} (f : α → β) (x : α), ({ down := f }.seq fun x_1 ↦ { down := x }) = { down := f x }
def ULift.bind E1 #
{α : Type u} → {β : Type v} → ULift.{u_1, u} α → (α → ULift.{u_2, v} β) → ULift.{u_2, v} β
Monadic bind.
theorem ULift.bind_up E0 #
∀ {α : Type u} {β : Type v} (a : α) (f : α → ULift.{u_1, v} β), { down := a }.bind f = f a
instance ULift.instMonad_mathlib E0 #
Monad ULift.{u_2, u_1}
instance ULift.instLawfulFunctor_mathlib E0 #
LawfulFunctor ULift.{u_2, u_1}
instance ULift.instLawfulApplicative_mathlib E0 #
LawfulApplicative ULift.{u_2, u_1}
instance ULift.instLawfulMonad_mathlib E0 #
LawfulMonad ULift.{u_2, u_1}
theorem ULift.rec.constant E0 #
∀ {α : Type u} {β : Sort v} (b : β), (ULift.rec fun x ↦ b) = fun x ↦ b