chore: clean up backward.privateInPublic around d₂₃#40228
Conversation
PR summary 50583db8d7Import changes for modified filesNo significant changes to the import graph Import changes for all files
|
|
!bench |
|
Benchmark results for fd4f5a5 against 07c7e6d are in. There are significant results. @thorimur
Large changes (1✅)
|
| map_add' _ _ := by simp; abel | ||
| map_smul' _ _ := by abel_nf; simp } | ||
| def d₂₃ : twoCochain R L M →ₗ[R] L →ₗ[R] L →ₗ[R] L →ₗ[R] M := | ||
| let toFun (a : twoCochain R L M) : L →ₗ[R] L →ₗ[R] L →ₗ[R] M := { |
There was a problem hiding this comment.
Does this change the proof term? My rule of thumb was to always use letI --- but perhaps that's a bad idea here? (If so, can you add a comment about this, please, so this is not accidentally reverted?)
There was a problem hiding this comment.
It does change the final term - let will create a let binding in the final term, whereas letI won't create the binding, it's inlined instead. In effect, let gives us a local definition, whereas letI is as if there's no auxiliary definition at all.
There was a problem hiding this comment.
letI seems good here, especially since this is data. Here's the size comparison; the definition only gets smaller with letI (with sharing), and no proofs change size:
let:
total: 40407
[(LieModule.Cohomology.d₂₃, 1219),
(LieModule.Cohomology.d₂₃._abel_1, 1705),
(LieModule.Cohomology.d₂₃._proof_12, 6880),
(LieModule.Cohomology.d₂₃._abel_7, 1709),
(LieModule.Cohomology.d₂₃._proof_8, 3789),
(LieModule.Cohomology.d₂₃._proof_9, 6523),
(LieModule.Cohomology.d₂₃._abel_10, 1825),
(LieModule.Cohomology.d₂₃._abel_4, 1711),
(LieModule.Cohomology.d₂₃._proof_5, 2163),
(LieModule.Cohomology.d₂₃._proof_11, 5379),
(LieModule.Cohomology.d₂₃._proof_3, 2460),
(LieModule.Cohomology.d₂₃._proof_2, 1181),
(LieModule.Cohomology.d₂₃._proof_6, 3667),
(LieModule.Cohomology.d₂₃._proof_1, 196)]
letI
total: 40331
[(LieModule.Cohomology.d₂₃, 1143),
(LieModule.Cohomology.d₂₃._abel_1, 1705),
(LieModule.Cohomology.d₂₃._proof_12, 6880),
(LieModule.Cohomology.d₂₃._abel_7, 1709),
(LieModule.Cohomology.d₂₃._proof_8, 3789),
(LieModule.Cohomology.d₂₃._proof_9, 6523),
(LieModule.Cohomology.d₂₃._abel_10, 1825),
(LieModule.Cohomology.d₂₃._abel_4, 1711),
(LieModule.Cohomology.d₂₃._proof_5, 2163),
(LieModule.Cohomology.d₂₃._proof_11, 5379),
(LieModule.Cohomology.d₂₃._proof_3, 2460),
(LieModule.Cohomology.d₂₃._proof_2, 1181),
(LieModule.Cohomology.d₂₃._proof_6, 3667),
(LieModule.Cohomology.d₂₃._proof_1, 196)]
#time seems about the same. I'll !bench again just to be sure. :)
EDIT: oops, double-counted the main definition size.
Interesting, is there an existing way of tracking this? Also, what's the biggest without sharing, out of curiosity? |
Without sharing, it's: For some numbers, we used to have No automated way to check this yet; this is just a script I wrote. It's fairly straightforward, though. Should we put it somewhere? |
|
!bench |
|
Benchmark results for 50583db against 07c7e6d are in. There are significant results. @thorimur
Large changes (1✅)
|
Moves a single-use private declaration into a let declaration.
This reduces instructions in that file by ~29% (but this gets swallowed in the overall noise).
Note: currently
LieModule.Cohomology.d₂₃_aux._proof_17is the biggest proof in mathlib (counted with sharing) :) This PR changes it toCategoryTheory.Functor.IsDenseSubsite.isIso_ranCounit_app_of_isDenseSubsite.