Skip to content

feat: lemmas about List.filterM - #7423

Open
eric-wieser wants to merge 11 commits into
leanprover:masterfrom
eric-wieser:filterM_pure
Open

feat: lemmas about List.filterM#7423
eric-wieser wants to merge 11 commits into
leanprover:masterfrom
eric-wieser:filterM_pure

Conversation

@eric-wieser

@eric-wieser eric-wieser commented Mar 10, 2025

Copy link
Copy Markdown
Contributor

This PR adds proofs about List.filterM.

A few theorems moved to earlier files to make this possible.

@eric-wieser eric-wieser changed the title feat: lemmas about filterM feat: lemmas about List.filterM Dec 3, 2025

theorem filterM_cons {m : Type → Type v} [Monad m] [LawfulMonad m] {a : α} {as : List α} {p : α → m Bool} :
filterM p (a :: as) =
(do let pa ← p a; let as ← filterM p as; return if pa then a :: as else as) := by

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or would this be better with applicatives?

Suggested change
(do let pa ← p a; let as ← filterM p as; return if pa then a :: as else as) := by
(fun pa as => if pa then a :: as else as) <$> p a <*> filterM p as := by

@eric-wieser
eric-wieser marked this pull request as ready for review December 3, 2025 03:59
@kim-em kim-em added the awaiting-author Waiting for PR author to address issues label Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-author Waiting for PR author to address issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants