Skip to content
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

perf: reduce elaboration time and proof size of tree map internals #7459

Merged
merged 9 commits into from
Mar 17, 2025

Conversation

Rob23oba
Copy link
Contributor

@Rob23oba Rob23oba commented Mar 12, 2025

There are several things done here:

  1. Use the modified simp_to_model which already exists in hash maps. This version of simp_to_model allows specifying the query operations to use in addition to the modifying operations. This is mostly to improve elaboration time and actually increases olean size.
  2. Instead of proving toListModel_balance directly, we write toListModel_balanceₘ and use that instead (this saves ~3 MB).
  3. Use fun_cases and dsimp instead of rw [x.eq_def] more frequently in Balancing.olean (this saves a bit over 2 MB).
  4. Mark updateCell and other functions dependent on it as noncomputable. The main problem with updateCell is how other functions, in particular glue, get recursively inlined, which blows the size of the IR (this saves ~1 MB).
  5. Instead of using simp_to_model to prove results on insert!, erase!, etc., simpas are used now, e.g. simpa only [insert_eq_insert!] using isEmpty_insert h. This mainly improves elaboration time although the olean size also goes down by ~0.3 MB.

@Rob23oba Rob23oba requested a review from TwoFX as a code owner March 12, 2025 16:07
@github-actions github-actions bot added the changelog-no Do not include this PR in the release changelog label Mar 12, 2025
@github-actions github-actions bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Mar 12, 2025
@leanprover-community-bot
Copy link
Collaborator

leanprover-community-bot commented Mar 12, 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 2363d2fa873a6e5f6e48505b3f1387583c5ef14c --onto 8fc8e8ed19ef218022f5a94cbf5e472e3b777e44. You can force Mathlib CI using the force-mathlib-ci label. (2025-03-12 17:07:21)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 2363d2fa873a6e5f6e48505b3f1387583c5ef14c --onto c1d145e9d70569274ac868805b4a8591d09718af. You can force Mathlib CI using the force-mathlib-ci label. (2025-03-13 17:10:58)

@TwoFX TwoFX self-assigned this Mar 13, 2025
Copy link
Member

@TwoFX TwoFX left a comment

Choose a reason for hiding this comment

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

Thanks!

@TwoFX TwoFX added this pull request to the merge queue Mar 17, 2025
Merged via the queue into leanprover:master with commit e77b528 Mar 17, 2025
14 checks passed
@Rob23oba Rob23oba deleted the treemap-optimizations branch March 17, 2025 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog-no Do not include this PR in the release changelog 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