Repository navigation
[Merged by Bors] - feat(to_additive): unfold lemmas generated by simp - #14628
fpvandoorn wants to merge 5 commits into
Conversation
PR summary 360d18f00a
|
| File | Base Count | Head Count | Change |
|---|---|---|---|
| Mathlib.Lean.Name | 3 | 4 | +1 (+33.33%) |
| Mathlib.Tactic.ToAdditive | 34 | 39 | +5 (+14.71%) |
Import changes for all files
| Files | Import difference |
|---|---|
| Too many changes (4249)! |
Declarations diff
+ Lean.Meta.unfoldAuxLemmas
+ Lean.Name.isAuxLemma
- addSimpAttr
- addSimpAttrFromSyntax
- addSimpTheorem'
- mkSimpTheoremsFromConst'
You can run this locally as follows
## summary with just the declaration names:
./scripts/no_lost_declarations.sh short <optional_commit>
## more verbose report:
./scripts/no_lost_declarations.sh <optional_commit>
kmill
left a comment
There was a problem hiding this comment.
Looks good to me. The best kind of feature is one that's implemented by mostly deleting code!
For due diligence, I'll mention that I think the whole auxLemma business is about trying to avoid re-typechecking proof terms, so unfolding auxLemmas defeats this optimization, however I don't believe that simp's auxLemmas tend to be very complicated.
|
What's the "feat" here? Is there any visible behavior change, or is this just internal cleanup? |
|
!bench |
|
Here are the benchmark results for commit 360d18f. |
|
See the issues that reference this: one feature request there is now fixed, another bug might be fixed (haven't tested) |
|
bors merge |
* This removes a bunch of hacky code * Thanks to @kmill for the idea * Also fix a bug in the implementation of `@[to_additive (attr := to_additive, x)]` * The removed test tested for an implementation detail. The rest of the test file (and Mathlib) still passes, which shows that it still works as desired.
|
Pull request successfully merged into master. Build succeeded: |
simpsimp
This PR changes how `to_additive` approaches translation by first unfolding all aux lemmas. Unfolding aux lemmas was previously added in #14628, since it was observed that aux lemmas tend not to have enough context to properly be additivized. This was added as a step after processing any aux decls. The change here is to make the unfolding happen before processing aux decls. We now also abstract nested proofs in additivized definitions. Additionally, we use `Meta.check` instead of `Meta.inferType` to correctly check the type of the translated declaration. The aux lemma unfolding is necessary for the next Lean release (v4.19.0). Co-authored-by: Floris van Doorn <[email protected]>
This PR changes how `to_additive` approaches translation by first unfolding all aux lemmas. Unfolding aux lemmas was previously added in #14628, since it was observed that aux lemmas tend not to have enough context to properly be additivized. This was added as a step after processing any aux decls. The change here is to make the unfolding happen before processing aux decls. We now also abstract nested proofs in additivized definitions. Additionally, we use `Meta.check` instead of `Meta.inferType` to correctly check the type of the translated declaration. The aux lemma unfolding is necessary for the next Lean release (v4.19.0). Co-authored-by: Floris van Doorn <[email protected]>
@[to_additive (attr := to_additive, x)]