AFTD Auto-Formalizing Theoretical Domains

Cslib.Algorithms.Lean.TimeM.instLawfulMonad

instanceimported Lean

TimeM is lawful so long as addition in the cost is associative and absorbs zero.

Statement

set_option autoImplicit true in
set_option relaxedAutoImplicit true in
instance Cslib.Algorithms.Lean.TimeM.instLawfulMonad [AddMonoid T'] : LawfulMonad (TimeM T')
Defined in
CSLib, `Cslib.Algorithms.Lean.TimeM.instLawfulMonad`
Lean proof
By Sorrachai Yingchareonthawornhcai, Eric Wieser, from github.com/leanprover/cslib at 3951377e5a3f (Copyright (c) 2025 Sorrachai Yingchareonthawornhcai. 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.
What was changed in Cslib.Algorithms.Lean.TimeM.instLawfulMonad
--- Cslib/Algorithms/Lean/TimeM.lean:118 ()
+++ as compiled here
@@ -1,3 +1,4 @@
-/-- `TimeM` is lawful so long as addition in the cost is associative and absorbs zero. -/
-instance [AddMonoid T] : LawfulMonad (TimeM T) := .mk'
+set_option autoImplicit true in
+set_option relaxedAutoImplicit true in
+instance Cslib.Algorithms.Lean.TimeM.instLawfulMonad [AddMonoid T'] : LawfulMonad (TimeM T') := .mk'
   (id_map := fun x => rfl)
Verified
08 Oct 2026
Axioms
none listed
Built on 20
Used by 18

Lean source view module on GitHub

set_option autoImplicit true in
set_option relaxedAutoImplicit true in
/-- `TimeM` is lawful so long as addition in the cost is associative and absorbs zero. -/
instance Cslib.Algorithms.Lean.TimeM.instLawfulMonad [AddMonoid T'] : LawfulMonad (TimeM T') := .mk'
  (id_map := fun x => rfl)
  (pure_bind := fun _ _ => by ext <;> simp)
  (bind_assoc := fun _ _ _ => by ext <;> simp [add_assoc])
  (seqLeft_eq := fun _ _ => by ext <;> simp)
  (bind_pure_comp := fun _ _ => by ext <;> simp)
See it in the graphDiscuss this resultChallenge it