Skip to content

fix: erase args for erased app params in toMono - #9224

Merged
zwarich merged 1 commit into
leanprover:masterfrom
zwarich:type-based-app-noncomputable
Jul 6, 2025
Merged

zwarich merged 1 commit into
leanprover:masterfrom
zwarich:type-based-app-noncomputable

Conversation

@zwarich

@zwarich zwarich commented Jul 6, 2025

Copy link
Copy Markdown
Contributor

This PR changes the toMono pass to consider the type of an application and erase all arguments corresponding to erased params. This enables a lightweight form of relevance analysis by changing the mono type of a decl. I would have liked to unify this with the behavior for constructors, but my attempt to give constructors the same behavior in #9222 (which was in preparation for this PR) had a minor performance regression that is really incidental to the change. Still, I decided to hold off on it for the time being. In the future, we can hopefully extend this to constructors, extern decls, etc.

@zwarich zwarich added the changelog-compiler Compiler, runtime, and FFI label Jul 6, 2025
@zwarich
zwarich requested a review from leodemoura as a code owner July 6, 2025 22:52
@zwarich
zwarich force-pushed the type-based-app-noncomputable branch from 3d9ab42 to 311820f Compare July 6, 2025 22:52
@zwarich
zwarich enabled auto-merge July 6, 2025 22:52
@zwarich zwarich changed the title fix: erase args for erased params in toMono fix: erase args for erased app params in toMono Jul 6, 2025
@zwarich
zwarich disabled auto-merge July 6, 2025 22:55
@zwarich

zwarich commented Jul 6, 2025

Copy link
Copy Markdown
Contributor Author

!bench

@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 Jul 6, 2025
@ghost

ghost commented Jul 6, 2025

Copy link
Copy Markdown

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 53d4139cf169f5e015e278f128dea648799d5971 --onto 5f818826d14a58b64d42fa8576003cd199adb50a. You can force Mathlib CI using the force-mathlib-ci label. (2025-07-06 23:14:04)

@leanprover-bot

Copy link
Copy Markdown
Collaborator

Reference manual CI status:

  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase 53d4139cf169f5e015e278f128dea648799d5971 --onto d3dda9f6d4428a906c096067ecb75e432afc4615. You can force reference manual CI using the force-manual-ci label. (2025-07-06 23:14:05)

@leanprover-bot

Copy link
Copy Markdown
Collaborator

Here are the benchmark results for commit 311820f.
There were significant changes against commit 53d4139:

  Benchmark                              Metric                       Change
  =====================================================================================
+ Init.Data.BitVec.Lemmas re-elab        branch-misses                 -2.7%  (-21.6 σ)
+ Init.Data.List.Sublist re-elab -j4     branch-misses                 -2.4% (-106.5 σ)
+ Std.Data.DHashMap.Internal.RawLemmas   branch-misses                 -4.0%  (-24.8 σ)
+ riscv-ast.lean                         task-clock                   -10.3%  (-60.7 σ)
- stdlib                                 let-to-have transformation     3.3%   (34.7 σ)

@zwarich
zwarich added this pull request to the merge queue Jul 6, 2025
Merged via the queue into leanprover:master with commit 9b7a14b Jul 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-compiler Compiler, runtime, and FFI 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.

2 participants