mathlib documentation

control.​monad.​cont

control.​monad.​cont

structure monad_cont.​label  :
Type w → (Type u → Type v) → Type u → Type (max v w)
  • apply : α → m β

def monad_cont.​goto {α : Type u_1} {β : Type u} {m : Type u → Type v} :
monad_cont.label α m β → α → m β

Equations
@[class]
structure monad_cont  :
(Type u → Type v) → Type (max (u+1) v)

Instances
@[class]
structure is_lawful_monad_cont (m : Type u → Type v) [monad m] [monad_cont m] :
Type

Instances
def cont_t  :
Type u → (Type u → Type v) → Type w → Type (max w v)

Equations
  • cont_t r m α = ((α → m r) → m r)
def cont  :
Type u → Type w → Type (max w u)

Equations
def cont_t.​run {r : Type u} {m : Type u → Type v} {α : Type w} :
cont_t r m α → (α → m r) → m r

Equations
def cont_t.​map {r : Type u} {m : Type u → Type v} {α : Type w} :
(m r → m r) → cont_t r m α → cont_t r m α

Equations
theorem cont_t.​run_cont_t_map_cont_t {r : Type u} {m : Type u → Type v} {α : Type w} (f : m r → m r) (x : cont_t r m α) :
(cont_t.map f x).run = f ∘ x.run

def cont_t.​with_cont_t {r : Type u} {m : Type u → Type v} {α β : Type w} :
((β → m r) → α → m r) → cont_t r m α → cont_t r m β

Equations
theorem cont_t.​run_with_cont_t {r : Type u} {m : Type u → Type v} {α β : Type w} (f : (β → m r) → α → m r) (x : cont_t r m α) :

@[ext]
theorem cont_t.​ext {r : Type u} {m : Type u → Type v} {α : Type w} {x y : cont_t r m α} :
(∀ (f : α → m r), x.run f = y.run f) → x = y

@[instance]
def cont_t.​monad {r : Type u} {m : Type u → Type v} :

Equations
@[instance]
def cont_t.​is_lawful_monad {r : Type u} {m : Type u → Type v} :

Equations
def cont_t.​monad_lift {r : Type u} {m : Type u → Type v} [monad m] {α : Type u} :
m α → cont_t r m α

Equations
@[instance]
def cont_t.​has_monad_lift {r : Type u} {m : Type u → Type v} [monad m] :

Equations
theorem cont_t.​monad_lift_bind {r : Type u} {m : Type u → Type v} [monad m] [is_lawful_monad m] {α β : Type u} (x : m α) (f : α → m β) :

@[instance]
def cont_t.​monad_cont {r : Type u} {m : Type u → Type v} :

Equations
@[instance]
def cont_t.​is_lawful_monad_cont {r : Type u} {m : Type u → Type v} :

Equations
@[instance]
def cont_t.​monad_except {r : Type u} {m : Type u → Type v} (ε : out_param (Type u_1)) [monad_except ε m] :

Equations
@[instance]
def cont_t.​monad_run {r : Type u} {m : Type u → Type v} :
monad_run (λ (α : Type u), (α → m r) → ulift (m r)) (cont_t r m)

Equations
def except_t.​mk_label {m : Type u → Type v} [monad m] {α β ε : Type u} :
monad_cont.label (except ε α) m β → monad_cont.label α (except_t ε m) β

Equations
theorem except_t.​goto_mk_label {m : Type u → Type v} [monad m] {α β ε : Type u} (x : monad_cont.label (except ε α) m β) (i : α) :

def except_t.​call_cc {m : Type u → Type v} [monad m] {ε : Type u} [monad_cont m] {α β : Type u} :
(monad_cont.label α (except_t ε m) β → except_t ε m α) → except_t ε m α

Equations
@[instance]
def except_t.​monad_cont {m : Type u → Type v} [monad m] {ε : Type u} [monad_cont m] :

Equations
def option_t.​mk_label {m : Type u → Type v} [monad m] {α β : Type u} :

Equations
theorem option_t.​goto_mk_label {m : Type u → Type v} [monad m] {α β : Type u} (x : monad_cont.label (option α) m β) (i : α) :

def option_t.​call_cc {m : Type u → Type v} [monad m] [monad_cont m] {α β : Type u} :
(monad_cont.label α (option_t m) β → option_t m α) → option_t m α

Equations
@[instance]
def option_t.​monad_cont {m : Type u → Type v} [monad m] [monad_cont m] :

Equations
def writer_t.​mk_label {m : Type u → Type v} [monad m] {α : Type u_1} {β ω : Type u} [has_one ω] :
monad_cont.label (α × ω) m β → monad_cont.label α (writer_t ω m) β

Equations
theorem writer_t.​goto_mk_label {m : Type u → Type v} [monad m] {α : Type u_1} {β ω : Type u} [has_one ω] (x : monad_cont.label (α × ω) m β) (i : α) :

def writer_t.​call_cc {m : Type u → Type v} [monad m] [monad_cont m] {α β ω : Type u} [has_one ω] :
(monad_cont.label α (writer_t ω m) β → writer_t ω m α) → writer_t ω m α

Equations
@[instance]
def writer_t.​monad_cont {m : Type u → Type v} [monad m] (ω : Type u) [monad m] [has_one ω] [monad_cont m] :

Equations
def state_t.​mk_label {m : Type u → Type v} [monad m] {α β σ : Type u} :
monad_cont.label (α × σ) m (β × σ) → monad_cont.label α (state_t σ m) β

Equations
theorem state_t.​goto_mk_label {m : Type u → Type v} [monad m] {α β σ : Type u} (x : monad_cont.label (α × σ) m (β × σ)) (i : α) :
monad_cont.goto (state_t.mk_label x) i = ⟨λ (s : σ), monad_cont.goto x (i, s)⟩

def state_t.​call_cc {m : Type u → Type v} [monad m] {σ : Type u} [monad_cont m] {α β : Type u} :
(monad_cont.label α (state_t σ m) β → state_t σ m α) → state_t σ m α

Equations
@[instance]
def state_t.​monad_cont {m : Type u → Type v} [monad m] {σ : Type u} [monad_cont m] :

Equations
def reader_t.​mk_label {m : Type u → Type v} [monad m] {α : Type u_1} {β : Type u} (ρ : Type u) :
monad_cont.label α m β → monad_cont.label α (reader_t ρ m) β

Equations
theorem reader_t.​goto_mk_label {m : Type u → Type v} [monad m] {α : Type u_1} {ρ β : Type u} (x : monad_cont.label α m β) (i : α) :

def reader_t.​call_cc {m : Type u → Type v} [monad m] {ε : Type u} [monad_cont m] {α β : Type u} :
(monad_cont.label α (reader_t ε m) β → reader_t ε m α) → reader_t ε m α

Equations
@[instance]
def reader_t.​monad_cont {m : Type u → Type v} [monad m] {ρ : Type u} [monad_cont m] :

Equations
def cont_t.​equiv {m₁ : Type u₀ → Type v₀} {m₂ : Type u₁ → Type v₁} {α₁ r₁ : Type u₀} {α₂ r₂ : Type u₁} :
m₁ r₁ ≃ m₂ r₂ → α₁ ≃ α₂ → cont_t r₁ m₁ α₁ ≃ cont_t r₂ m₂ α₂

reduce the equivalence between two continuation passing monads to the equivalence between their underlying monad

Equations