Missing optimization: trivial cases
Open
@zwarich is already working on this.
Since Apr 29, 2025.
enhancement
low priority
P-low
- Dominant language
- Lean
- Stars
- 9.2k
- Forks
- 990
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 175
Description
In
@EStateM.Result.casesOn _x_3
(fun (a_7 a_8 : _obj) =>
@Lean.Elab.Term.elabTerm stx t _x_1 _x_1 a a_1 a_2 a_3 a_4 a_5 a_8)
fun (a a_7 : _obj) => EStateM.Result.error _neutral _neutral _neutral a a_7
the second case could be replaced by fun _ _ => _x_3 (but only after erasure), saving us from generating reset-reuse code. Funnily enough, in the fast path of reset-reuse this is already the produced code since it's clever enough not to re-set any fields when reusing _x_3. Also, cesimp contains an optimization in the other direction, so the new optimization should happen somewhere in between these two phases.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.