chore: unprotect List.foldlM (#7003)

This commit is contained in:
Kim Morrison 2025-02-10 09:54:51 +11:00 committed by GitHub
parent bcffbdd3a1
commit 7f3e170509
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View file

@ -3653,7 +3653,7 @@ theorem toListRev_toArray (l : List α) : l.toArray.toListRev = l.reverse := by
l.toArray.mapM f = List.toArray <$> l.mapM f := by
simp only [← mapM'_eq_mapM, mapM_eq_foldlM]
suffices ∀ init : Array β,
foldlM (fun bs a => bs.push <$> f a) init l.toArray = (init ++ toArray ·) <$> mapM' f l by
Array.foldlM (fun bs a => bs.push <$> f a) init l.toArray = (init ++ toArray ·) <$> mapM' f l by
simpa using this #[]
intro init
induction l generalizing init with

View file

@ -161,7 +161,7 @@ foldlM f x₀ [a, b, c] = do
```
-/
@[specialize]
protected def foldlM {m : Type u → Type v} [Monad m] {s : Type u} {α : Type w} : (f : s → α → m s) → (init : s) → List α → m s
def foldlM {m : Type u → Type v} [Monad m] {s : Type u} {α : Type w} : (f : s → α → m s) → (init : s) → List α → m s
| _, s, [] => pure s
| f, s, a :: as => do
let s' ← f s a