Repository navigation
Conversation
PR summary 6a1f4f1876
|
| File | Base Count | Head Count | Change |
|---|---|---|---|
| Mathlib.Tactic.ToAdditive.Frontend | 51 | 52 | +1 (+1.96%) |
Import changes for all files
| Files | Import difference |
|---|---|
| There are 5576 files with changed transitive imports taking up over 238229 characters: this is too many to display! | |
You can run scripts/import_trans_difference.sh all locally to see the whole output. |
Declarations diff
+ declAbstractNestedProofs
+ declUnfoldAuxLemmas
- setInlineAttribute
You can run this locally as follows
## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>
## more verbose report:
./scripts/declarations_diff.sh long <optional_commit>The doc-module for script/declarations_diff.sh contains some details about this script.
No changes to technical debt.
You can run this locally as
./scripts/technical-debt-metrics.sh pr_summary
- The
relativevalue is the weighted sum of the differences with weight given by the inverse of the current value of the statistic. - The
absolutevalue is therelativevalue divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).
fpvandoorn
left a comment
There was a problem hiding this comment.
LGTM
Could you bench this if it compiles?
Could you add one or more tests?
| for n in findAuxDecls srcDecl.type pre do | ||
| transformDeclAux cfg pre tgt_pre n |
There was a problem hiding this comment.
Are these lines (and the few below this) still necessary?
It would be nice if you could specify in a comment somewhere which aux-decls we inline, and which ones we transform (and why). We call both of them "aux decls"/"aux lemmas", which is not very helpful.
There was a problem hiding this comment.
I've tried making the comments clearer. We're unfolding the "proof_nnn aux lemmas"; there are still aux decls that aren't unfolded.
I've also added a TODO to consider trying to additivize these aux lemmas and resort to unfolding them on failure.
I'm not sure exactly what kind of test to write. Any ideas?
There was a problem hiding this comment.
Maybe a test that tests whether abstractNestedProofs, i.e. testing for the existence of a nested abstracted proof in the body of a definition.
Maybe a test where simp generates an aux-lemma for the multiplicative version, where the aux-lemma cannot be additivized (by using a class with no additive counterpart, but using definitions that do have additive counterparts), but the whole declaration can be.
The last one is not that important, since I expect that Mathlib itself will have plenty of those tests.
There was a problem hiding this comment.
Could I ask you to write such test(s)? I won't be able to get to figuring out how to test this until this evening.
My motivation with this PR is getting mathlib to work on Lean v4.19.0, which is being released imminently.
There was a problem hiding this comment.
Ah, I didn't realize this was blocking the 4.19 release. Then let's merge this as is. The tests don't seem that important.
|
!bench |
|
Here are the benchmark results for commit aab9bef. Benchmark Metric Change
=================================================================
- ~Mathlib.CategoryTheory.Monoidal.Discrete instructions 31.3% |
3 files, Instructions +4.0⬝10⁹
4 files, Instructions +3.0⬝10⁹
14 files, Instructions +2.0⬝10⁹
52 files, Instructions +1.0⬝10⁹
|
|
As this PR is labelled bors merge |
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]>
|
Pull request successfully merged into master. Build succeeded: |
to_additive unfold aux lemmas before translationto_additive unfold aux lemmas before translation
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_additiveapproaches 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.checkinstead ofMeta.inferTypeto correctly check the type of the translated declaration.The aux lemma unfolding is necessary for the next Lean release (v4.19.0).