File: Mathlib/Control/ULiftable.lean

full_name: ULiftable
code: /-- Given a universe polymorphic type family `M.{u} : Type u₁ → Type
u₂`, this class convert between instantiations, from
`M.{u} : Type u₁ → Type u₂` to `M.{v} : Type v₁ → Type v₂` and back.

`f` is an outParam, because `g` can almost always be inferred from the current monad.
At any rate, the lift should be unique, as the intent is to only lift the same constants with
different universe parameters. -/
class ULiftable (f : outParam (Type u₀ → Type u₁)) (g : Type v₀ → Type v₁) where
  congr {α β} : α ≃ β → f α ≃ g β
goal: Type (max (max (max (u₀ + 1) u₁) (v₀ + 1)) v₁)

full_name: ULiftable.congr
code: /-- Given a universe polymorphic type family `M.{u} : Type u₁ → Type
u₂`, this class convert between instantiations, from
`M.{u} : Type u₁ → Type u₂` to `M.{v} : Type v₁ → Type v₂` and back.

`f` is an outParam, because `g` can almost always be inferred from the current monad.
At any rate, the lift should be unique, as the intent is to only lift the same constants with
different universe parameters. -/
class ULiftable (f : outParam (Type u₀ → Type u₁)) (g : Type v₀ → Type v₁) where
  congr {α β} : α ≃ β → f α ≃ g β
goal: α ≃ β → f α ≃ g β

full_name: ULiftable.symm
code: /-- Not an instance as it is incompatible with `outParam`. In practice it seems not to be needed
anyway. -/
abbrev symm (f : Type u₀ → Type u₁) (g : Type v₀ → Type v₁) [ULiftable f g] : ULiftable g f 
goal: ULiftable g f

full_name: ULiftable.refl
code: instance refl (f : Type u₀ → Type u₁) [Functor f] [LawfulFunctor f] : ULiftable f f 
goal: ULiftable f f

full_name: ULiftable.up
code: /-- The most common practical use `ULiftable` (together with `down`), the function `up.{v}` takes
`x : M.{u} α` and lifts it to `M.{max u v} (ULift.{v} α)` -/
abbrev up {f : Type u₀ → Type u₁} {g : Type max u₀ v → Type v₁} [ULiftable f g] {α} :
    f α → g (ULift.{v} α) 
goal: f α → g (ULift.{v, u₀} α)

full_name: ULiftable.down
code: /-- The most common practical use of `ULiftable` (together with `up`), the function `down.{v}` takes
`x : M.{max u v} (ULift.{v} α)` and lowers it to `M.{u} α` -/
abbrev down {f : Type u₀ → Type u₁} {g : Type max u₀ v → Type v₁} [ULiftable f g] {α} :
    g (ULift.{v} α) → f α 
goal: g (ULift.{v, u₀} α) → f α

full_name: ULiftable.adaptUp
code: /-- convenient shortcut to avoid manipulating `ULift` -/
def adaptUp (F : Type v₀ → Type v₁) (G : Type max v₀ u₀ → Type u₁) [ULiftable F G] [Monad G] {α β}
    (x : F α) (f : α → G β) : G β 
goal: G β

full_name: ULiftable.adaptDown
code: /-- convenient shortcut to avoid manipulating `ULift` -/
def adaptDown {F : Type max u₀ v₀ → Type u₁} {G : Type v₀ → Type v₁} [L : ULiftable G F] [Monad F]
    {α β} (x : F α) (f : α → G β) : G β 
goal: G β

full_name: ULiftable.upMap
code: /-- map function that moves up universes -/
def upMap {F : Type u₀ → Type u₁} {G : Type max u₀ v₀ → Type v₁} [ULiftable F G] [Functor G]
    {α β} (f : α → β) (x : F α) : G β 
goal: G β

full_name: ULiftable.downMap
code: /-- map function that moves down universes -/
def downMap {F : Type max u₀ v₀ → Type u₁} {G : Type u₀ → Type v₁} [ULiftable G F]
    [Functor F] {α β} (f : α → β) (x : F α) : G β 
goal: G β

full_name: ULiftable.up_down
code: theorem up_down {f : Type u₀ → Type u₁} {g : Type max u₀ v₀ → Type v₁} [ULiftable f g] {α}
    (x : g (ULift.{v₀} α)) : up (down x : f α) = x 
goal: ULiftable.up (ULiftable.down x) = x

full_name: ULiftable.down_up
code: theorem down_up {f : Type u₀ → Type u₁} {g : Type max u₀ v₀ → Type v₁} [ULiftable f g] {α}
    (x : f α) : down (up x : g (ULift.{v₀} α)) = x 
goal: ULiftable.down (ULiftable.up x) = x

full_name: instULiftableId
code: instance instULiftableId : ULiftable Id Id 
goal: ULiftable Id Id

full_name: StateT.uliftable'
code: /-- for specific state types, this function helps to create a uliftable instance -/
def StateT.uliftable' {m : Type u₀ → Type v₀} {m' : Type u₁ → Type v₁} [ULiftable m m']
    (F : s ≃ s') : ULiftable (StateT s m) (StateT s' m') 
goal: ULiftable (StateT s m) (StateT s' m')

full_name: instULiftableStateTULift
code: instance {m m'} [ULiftable m m'] : ULiftable (StateT s m) (StateT (ULift s) m') 
goal: ULiftable (StateT s m) (StateT (ULift.{u_6, u₀} s) m')

full_name: StateT.instULiftableULiftULift
code: instance StateT.instULiftableULiftULift {m m'} [ULiftable m m'] :
    ULiftable (StateT (ULift.{max v₀ u₀} s) m) (StateT (ULift.{max v₁ u₀} s) m') 
goal: ULiftable (StateT (ULift.{max v₀ u₀, u₀} s) m) (StateT (ULift.{max v₁ u₀, u₀} s) m')

full_name: ReaderT.uliftable'
code: /-- for specific reader monads, this function helps to create a uliftable instance -/
def ReaderT.uliftable' {m m'} [ULiftable m m'] (F : s ≃ s') :
    ULiftable (ReaderT s m) (ReaderT s' m') 
goal: ULiftable (ReaderT s m) (ReaderT s' m')

full_name: instULiftableReaderTULift
code: instance {m m'} [ULiftable m m'] : ULiftable (ReaderT s m) (ReaderT (ULift s) m') 
goal: ULiftable (ReaderT s m) (ReaderT (ULift.{u_6, u₀} s) m')

full_name: ReaderT.instULiftableULiftULift
code: instance ReaderT.instULiftableULiftULift {m m'} [ULiftable m m'] :
    ULiftable (ReaderT (ULift.{max v₀ u₀} s) m) (ReaderT (ULift.{max v₁ u₀} s) m') 
goal: ULiftable (ReaderT (ULift.{max v₀ u₀, u₀} s) m) (ReaderT (ULift.{max v₁ u₀, u₀} s) m')

full_name: ContT.uliftable'
code: /-- for specific continuation passing monads, this function helps to create a uliftable instance -/
def ContT.uliftable' {m m'} [ULiftable m m'] (F : r ≃ r') :
    ULiftable (ContT r m) (ContT r' m') 
goal: ULiftable (ContT r m) (ContT r' m')

full_name: instULiftableContTULift
code: instance {s m m'} [ULiftable m m'] : ULiftable (ContT s m) (ContT (ULift s) m') 
goal: ULiftable (ContT s m) (ContT (ULift.{u_7, u_5} s) m')

full_name: ContT.instULiftableULiftULift
code: instance ContT.instULiftableULiftULift {m m'} [ULiftable m m'] :
    ULiftable (ContT (ULift.{max v₀ u₀} s) m) (ContT (ULift.{max v₁ u₀} s) m') 
goal: ULiftable (ContT (ULift.{max v₀ u₀, u₀} s) m) (ContT (ULift.{max v₁ u₀, u₀} s) m')

full_name: WriterT.uliftable'
code: /-- for specific writer monads, this function helps to create a uliftable instance -/
def WriterT.uliftable' {m m'} [ULiftable m m'] (F : w ≃ w') :
    ULiftable (WriterT w m) (WriterT w' m') 
goal: ULiftable (WriterT w m) (WriterT w' m')

full_name: instULiftableWriterTULift
code: instance {m m'} [ULiftable m m'] : ULiftable (WriterT s m) (WriterT (ULift s) m') 
goal: ULiftable (WriterT s m) (WriterT (ULift.{u_6, u₀} s) m')

full_name: WriterT.instULiftableULiftULift
code: instance WriterT.instULiftableULiftULift {m m'} [ULiftable m m'] :
    ULiftable (WriterT (ULift.{max v₀ u₀} s) m) (WriterT (ULift.{max v₁ u₀} s) m') 
goal: ULiftable (WriterT (ULift.{max v₀ u₀, u₀} s) m) (WriterT (ULift.{max v₁ u₀, u₀} s) m')

full_name: Except.instULiftable
code: instance Except.instULiftable {ε : Type u₀} : ULiftable (Except.{u₀,v₁} ε) (Except.{u₀,v₂} ε) 
goal: ULiftable (Except ε) (Except ε)

full_name: Option.instULiftable
code: instance Option.instULiftable : ULiftable Option.{u₀} Option.{u₁} 
goal: ULiftable Option Option