Skip to content

chore: cleanup proof of satisfiesM_foldlM #1039

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 13, 2024
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
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
Loading