A tail monad is a monad whose bind operation preserves a chosen ordering of the continuation.
Specifically, MonadTail m asserts that every m β carries a chain-complete partial order (CCPO)
and that >>= is monotone in its second (continuation) argument with respect to that order.
This is a weaker requirement than MonoBind, which requires monotonicity in both arguments.
MonadTail is sufficient for partial_fixpoint-like recursive definitions where the
recursive call only appears in the continuation (second argument) of >>=.
Every
m βwithNonempty βhas a chain-complete partial order.- bind_mono_right {α β : Type u} {a : m α} {f₁ f₂ : α → m β} [Nonempty β] (h : ∀ (x : α), PartialOrder.rel (f₁ x) (f₂ x)) : PartialOrder.rel (a >>= f₁) (a >>= f₂)
Bind is monotone in the second (continuation) argument.
Instances
@[implicit_reducible]
noncomputable def
Lean.Order.ST.bot'
{α σ : Type}
[Nonempty α]
(s : Void σ)
:
FlatOrder { val := Classical.ofNonempty, state := Classical.choice ⋯ }
Instances For
@[implicit_reducible]
instance
Lean.Order.instMonadTailStateRefT'
{ω σ : Type}
{m : Type → Type}
[Monad m]
[MonadTail m]
:
MonadTail (StateRefT' ω σ m)