AFTD Auto-Formalizing Theoretical Domains

Cslib.FreeM.liftM

defimported Lean

Interpret a FreeM F computation into any monad m by providing an interpretation function for the effect signature F. This function defines the *canonical interpreter* from the free monad FreeM F into the target monad m. It is the unique monad morphism that extends the effect handler interp : ∀ {β}, F β → m β via the universal property of FreeM.

Statement

set_option autoImplicit true in
set_option relaxedAutoImplicit true in
universe u v w w' w'' in
variable {F : Type u → Type v} {ι : Type u} {α : Type w} {β : Type w'} {γ : Type w''} in
variable {m : Type u → Type w} [Monad m] {α β : Type u} in
protected def Cslib.FreeM.liftM (interp : {ι : Type u} → F ι → m ι) : FreeM F α → m α
Defined in
CSLib, `Cslib.FreeM.liftM`
Lean proof
By Tanner Duve, Eric Wieser, from github.com/leanprover/cslib at 3951377e5a3f (Copyright (c) 2025 Tanner Duve. All rights reserved, Apache-2.0). Compiled here against leanprover/lean4:v4.33.1, Mathlib v4.33.1; written for leanprover/lean4:v4.33.0.
Verified
08 Oct 2026
Axioms
none listed
Built on 7
Used by 18

Lean source view module on GitHub

set_option autoImplicit true in
set_option relaxedAutoImplicit true in
universe u v w w' w'' in
variable {F : Type u → Type v} {ι : Type u} {α : Type w} {β : Type w'} {γ : Type w''} in
variable {m : Type u → Type w} [Monad m] {α β : Type u} in
/-- Interpret a `FreeM F` computation into any monad `m` by providing an interpretation function for the effect signature `F`. This function defines the *canonical interpreter* from the free monad `FreeM F` into the target monad `m`. It is the unique monad morphism that extends the effect handler `interp : ∀ {β}, F β → m β` via the universal property of `FreeM`. -/
protected def Cslib.FreeM.liftM (interp : {ι : Type u} → F ι → m ι) : FreeM F α → m α
  | .pure a => pure a
  | .liftBind op cont => interp op >>= fun result => (cont result).liftM interp
See it in the graphDiscuss this resultChallenge it