Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Cslib/Algorithms/Lean/TimeM.lean
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,20 @@ instance : Monad TimeM where
pure := pure
bind := bind

instance : LawfulMonad TimeM := .mk'
(id_map := fun x => by rfl)
(pure_bind := by
intros
simp only [Bind.bind, Pure.pure]
rw [bind, pure]
simp)
(bind_assoc := by
intros
simp only [Bind.bind]
unfold bind
simp only [mk.injEq, true_and]
ac_rfl)

/-- Creates a `TimeM` computation with a specified value and time cost.
The time cost defaults to 1 if not provided. -/
@[simp, grind =] def tick {α : Type*} (a : α) (c : ℕ := 1) : TimeM α := ⟨a, c⟩
Expand Down
Loading