Skip to content

feat: mark forIn_pure_yield lemmas simp#7433

Merged
kim-em merged 2 commits intoleanprover:masterfrom
eric-wieser:forIn_pure_yield
Mar 14, 2025
Merged

feat: mark forIn_pure_yield lemmas simp#7433
kim-em merged 2 commits intoleanprover:masterfrom
eric-wieser:forIn_pure_yield

Conversation

@eric-wieser
Copy link
Copy Markdown
Contributor

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

This PR makes simp able to simplify basic for loops in monads other than Id.

This is some prework for #7352, where the Id lemmas will be deprecated.

This means that `simp` works in monads other than `Id`.
@eric-wieser eric-wieser marked this pull request as ready for review March 10, 2025 23:20
@eric-wieser eric-wieser requested a review from kim-em as a code owner March 10, 2025 23:20
@eric-wieser
Copy link
Copy Markdown
Contributor Author

changelog-library

@github-actions github-actions bot added changelog-library Library toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN labels Mar 10, 2025
@ghost
Copy link
Copy Markdown

ghost commented Mar 10, 2025

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase d538e1cd90bc8dce3e8919d2ed496903577a63a9 --onto 7bfa8f6296ebfebc497d5b30d34f494bcc9782a2. You can force Mathlib CI using the force-mathlib-ci label. (2025-03-10 23:27:54)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase d538e1cd90bc8dce3e8919d2ed496903577a63a9 --onto 8fc8e8ed19ef218022f5a94cbf5e472e3b777e44. You can force Mathlib CI using the force-mathlib-ci label. (2025-03-11 23:03:09)

@hargoniX hargoniX changed the title feat: Mark forIn_pure_yield lemmas simp feat: mark forIn_pure_yield lemmas simp Mar 11, 2025
@nomeata
Copy link
Copy Markdown
Collaborator

nomeata commented Mar 11, 2025

Should we worry about this having a rather unspecific simp discrimination tree key? Or is it worthy trying this on every forIn loop?

@eric-wieser
Copy link
Copy Markdown
Contributor Author

eric-wieser commented Mar 11, 2025

The existing lemmas already have this problem:

import Lean

/--
info: @Eq
  _
  (@forIn' _ (List _) _ _ _ _ _ _ _ <other>)
  (@List.foldlM _ _ _ (@Subtype _ (@Membership.mem _ (List _) _ _)) <other> _ (@List.attach _ _))
-/
#guard_msgs in
#discr_tree_key List.forIn'_yield_eq_foldlM -- already `simp`

/--
info: @Eq
  _
  (@forIn' _ (List _) _ _ _ _ _ _ _ <other>)
  (@pure _ _ _ (@List.foldl _ (@Subtype _ (@Membership.mem _ (List _) _ _)) <other> _ (@List.attach _ _)))
-/
#guard_msgs in
#discr_tree_key List.forIn'_pure_yield_eq_foldl -- `simp` in this PR

@nomeata
Copy link
Copy Markdown
Collaborator

nomeata commented Mar 12, 2025

Thanks for checking

@kim-em kim-em added this pull request to the merge queue Mar 14, 2025
Merged via the queue into leanprover:master with commit 5c333d8 Mar 14, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-library Library toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants