Lean4
/-- reduce the equivalence between two continuation passing monads to the equivalence between
their underlying monad -/
def equiv {m₁ : Type u₀ → Type v₀} {m₂ : Type u₁ → Type v₁} {α₁ r₁ : Type u₀} {α₂ r₂ : Type u₁} (F : m₁ r₁ ≃ m₂ r₂)
(G : α₁ ≃ α₂) : ContT r₁ m₁ α₁ ≃ ContT r₂ m₂ α₂
where
toFun f r := F <| f fun x => F.symm <| r <| G x
invFun f r := F.symm <| f fun x => F <| r <| G.symm x
left_inv f := by funext r; simp
right_inv f := by funext r; simp