Skip to content

Commit

Permalink
chore: cleanup proof of satisfiesM_foldlM (#1039)
Browse files Browse the repository at this point in the history
  • Loading branch information
kim-em authored Nov 13, 2024
1 parent 66a3bd2 commit e0d8449
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions Batteries/Data/List/Monadic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@ namespace List
theorem satisfiesM_foldlM [Monad m] [LawfulMonad m] {f : β → α → m β} (h₀ : motive b)
(h₁ : ∀ (b) (_ : motive b) (a : α) (_ : a ∈ l), SatisfiesM motive (f b a)) :
SatisfiesM motive (List.foldlM f b l) := by
have g b hb a am := Classical.indefiniteDescription _ (h₁ b hb a am)
clear h₁
induction l generalizing b with
| nil => exact SatisfiesM.pure h₀
| cons hd tl ih =>
simp only [foldlM_cons]
apply SatisfiesM.bind_pre
let ⟨q, qh⟩ := g b h₀ hd (mem_cons_self hd tl)
exact ⟨(fun ⟨b, bh⟩ => ⟨b, ih bh (fun b bh a am => g b bh a (mem_cons_of_mem hd am))⟩) <$> q,
let ⟨q, qh⟩ := h₁ b h₀ hd (mem_cons_self hd tl)
exact ⟨(fun ⟨b, bh⟩ => ⟨b, ih bh (fun b bh a am => h₁ b bh a (mem_cons_of_mem hd am))⟩) <$> q,
by simpa using qh⟩

theorem satisfiesM_foldrM [Monad m] [LawfulMonad m] {f : α → β → m β} (h₀ : motive b)
Expand Down

0 comments on commit e0d8449

Please sign in to comment.