Skip to content

Commit 8a1b0d1

Browse files
b-mehtaRaggedR
authored andcommitted
chore(LongestPole): private an import to reduce the rebuild pole (leanprover-community#39609)
The aim of this PR is to make tweaks to imports to make the *rebuild* time shorter by making more use of the module system. This is measured in the "lakeprof" report in the radar: https://speed.lean-lang.org/mathlib4-out/396c763262259f066f3837c32643dd752994ca6d/ The first block shows the longest pole when building mathlib, and the second shows it when a rebuild occurs; and as a result of this PR, the relative difference is increased by quite a bit. Note that the "lakeprof/longest rebuild path//wall-clock" is somewhat noisy, but the relative difference should be measured with somewhat less noise. This was done manually, by taking the second-slowest file in the rebuild path, and tweaking imports around it.
1 parent bfed280 commit 8a1b0d1

12 files changed

Lines changed: 67 additions & 34 deletions

File tree

Mathlib/Analysis/Distribution/SchwartzSpace/Basic.lean

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,19 @@ Authors: Moritz Doll
55
-/
66
module
77

8-
public import Mathlib.Analysis.LocallyConvex.WithSeminorms
8+
public import Mathlib.Analysis.Calculus.IteratedDeriv.Defs
9+
public import Mathlib.Analysis.Distribution.TemperateGrowth
910
public import Mathlib.Analysis.Normed.Group.ZeroAtInfty
10-
public import Mathlib.Analysis.Normed.Lp.SmoothApprox
1111
public import Mathlib.Analysis.SpecialFunctions.Pow.Real
12-
public import Mathlib.Analysis.Distribution.TemperateGrowth
13-
public import Mathlib.Topology.Algebra.UniformFilterBasis
1412
public import Mathlib.MeasureTheory.Function.L2Space
13+
public import Mathlib.Tactic.FunProp
14+
public import Mathlib.Topology.Algebra.UniformFilterBasis
15+
16+
import Mathlib.Analysis.Calculus.ContDiff.Bounds
17+
import Mathlib.Analysis.Calculus.ContDiff.Operations
18+
import Mathlib.Analysis.Normed.Lp.SmoothApprox
19+
import Mathlib.Tactic.MoveAdd
20+
1521

1622
/-!
1723
# Schwartz space
@@ -230,7 +236,7 @@ variable [NormedField 𝕜] [NormedSpace 𝕜 F] [SMulCommClass ℝ 𝕜 F] [Nor
230236
instance instSMul : SMul 𝕜 𝓢(E, F) :=
231237
fun c f =>
232238
{ toFun := c • (f : E → F)
233-
smooth' := (f.smooth _).const_smul c
239+
smooth' := by exact (f.smooth _).const_smul c
234240
decay' k n := by
235241
use f.seminormAux k n * ‖c‖
236242
intro x
@@ -263,13 +269,13 @@ private theorem seminormAux_smul_le (k n : ℕ) (c : 𝕜) (f : 𝓢(E, F)) :
263269
instance instNSMul : SMul ℕ 𝓢(E, F) :=
264270
fun c f =>
265271
{ toFun := c • (f : E → F)
266-
smooth' := (f.smooth _).const_smul c
272+
smooth' := by exact (f.smooth _).const_smul c
267273
decay' := by simpa [← Nat.cast_smul_eq_nsmul ℝ] using ((c : ℝ) • f).decay' }⟩
268274

269275
instance instZSMul : SMul ℤ 𝓢(E, F) :=
270276
fun c f =>
271277
{ toFun := c • (f : E → F)
272-
smooth' := (f.smooth _).const_smul c
278+
smooth' := by exact (f.smooth _).const_smul c
273279
decay' := by simpa [← Int.cast_smul_eq_zsmul ℝ] using ((c : ℝ) • f).decay' }⟩
274280

275281
end SMul
@@ -278,7 +284,7 @@ section Zero
278284

279285
instance instZero : Zero 𝓢(E, F) :=
280286
⟨{ toFun := fun _ => 0
281-
smooth' := contDiff_const
287+
smooth' := by exact contDiff_const
282288
decay' := fun _ _ => ⟨1, fun _ => by simp⟩ }⟩
283289

284290
instance instInhabited : Inhabited 𝓢(E, F) :=
@@ -305,7 +311,7 @@ section Neg
305311

306312
instance instNeg : Neg 𝓢(E, F) :=
307313
fun f =>
308-
⟨-f, (f.smooth _).neg, fun k n => by
314+
⟨-f, by exact (f.smooth _).neg, fun k n => by
309315
use f.seminormAux k n
310316
intro x
311317
grw [f.decay_neg_aux k n x, f.le_seminormAux k n x]⟩⟩
@@ -319,7 +325,7 @@ section Add
319325

320326
instance instAdd : Add 𝓢(E, F) :=
321327
fun f g =>
322-
⟨f + g, (f.smooth _).add (g.smooth _), fun k n => by
328+
⟨f + g, by exact (f.smooth _).add (g.smooth _), fun k n => by
323329
use f.seminormAux k n + g.seminormAux k n
324330
intro x
325331
grw [decay_add_le_aux k n f g x, f.le_seminormAux k n x, g.le_seminormAux k n x]⟩⟩
@@ -341,7 +347,7 @@ section Sub
341347

342348
instance instSub : Sub 𝓢(E, F) :=
343349
fun f g =>
344-
⟨f - g, (f.smooth _).sub (g.smooth _), by
350+
⟨f - g, by exact (f.smooth _).sub (g.smooth _), by
345351
intro k n
346352
refine ⟨f.seminormAux k n + g.seminormAux k n, fun x => ?_⟩
347353
grw [← f.le_seminormAux k n x, ← g.le_seminormAux k n x]
@@ -681,11 +687,11 @@ variable [NormedSpace 𝕜 E] [NormedSpace 𝕜 G]
681687
/-- The map `f ↦ (x ↦ B (f x) (g x))` as a continuous `𝕜`-linear map on Schwartz space,
682688
where `B` is a continuous `𝕜`-linear map and `g` is a function of temperate growth. -/
683689
def bilinLeftCLM (B : E →L[𝕜] F →L[𝕜] G) {g : D → F} (hg : g.HasTemperateGrowth) :
684-
𝓢(D, E) →L[𝕜] 𝓢(D, G) := by
685-
refine mkCLM (fun f x => B (f x) (g x))
690+
𝓢(D, E) →L[𝕜] 𝓢(D, G) :=
691+
mkCLM (fun f x => B (f x) (g x))
686692
(fun _ _ _ => by simp) (fun _ _ _ => by simp)
687693
(fun f => (B.bilinearRestrictScalars ℝ).isBoundedBilinearMap.contDiff.comp
688-
((f.smooth ⊤).prodMk hg.1)) ?_
694+
((f.smooth ⊤).prodMk hg.1)) <| by
689695
rintro ⟨k, n⟩
690696
rcases hg.norm_iteratedFDeriv_le_uniform n with ⟨l, C, hC, hgrowth⟩
691697
use
@@ -917,9 +923,9 @@ variable [NormedSpace 𝕜 F]
917923
/-- Composition with a function on the right is a continuous linear map on Schwartz space
918924
provided that the function is temperate and growths polynomially near infinity. -/
919925
def compCLM {g : D → E} (hg : g.HasTemperateGrowth)
920-
(hg_upper : ∃ (k : ℕ) (C : ℝ), ∀ x, ‖x‖ ≤ C * (1 + ‖g x‖) ^ k) : 𝓢(E, F) →L[𝕜] 𝓢(D, F) := by
921-
refine mkCLM (fun f => f ∘ g) (fun _ _ _ => by simp) (fun _ _ _ => rfl)
922-
(fun f => (f.smooth ⊤).comp hg.1) ?_
926+
(hg_upper : ∃ (k : ℕ) (C : ℝ), ∀ x, ‖x‖ ≤ C * (1 + ‖g x‖) ^ k) : 𝓢(E, F) →L[𝕜] 𝓢(D, F) :=
927+
mkCLM (fun f => f ∘ g) (fun _ _ _ => by simp) (fun _ _ _ => rfl)
928+
(fun f => (f.smooth ⊤).comp hg.1) <| by
923929
rintro ⟨k, n⟩
924930
rcases hg.norm_iteratedFDeriv_le_uniform n with ⟨l, C, hC, hgrowth⟩
925931
rcases hg_upper with ⟨kg, Cg, hg_upper'⟩

Mathlib/Analysis/Distribution/TemperateGrowth.lean

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,18 @@ Authors: Moritz Doll, Anatole Dedecker, Sébastien Gouëzel
55
-/
66
module
77

8-
public import Mathlib.Analysis.Calculus.ContDiff.Bounds
9-
public import Mathlib.Analysis.SpecialFunctions.JapaneseBracket
10-
public import Mathlib.Analysis.InnerProductSpace.Calculus
8+
public import Mathlib.Analysis.Calculus.ContDiff.FTaylorSeries
9+
public import Mathlib.Analysis.Calculus.ContDiff.Defs
10+
public import Mathlib.Analysis.InnerProductSpace.Defs
11+
public import Mathlib.MeasureTheory.Function.L1Space.Integrable
12+
public import Mathlib.MeasureTheory.Integral.Bochner.Basic
1113
public import Mathlib.Tactic.MoveAdd
1214

15+
import Mathlib.Analysis.Calculus.ContDiff.Bounds
16+
import Mathlib.Analysis.InnerProductSpace.Calculus
17+
import Mathlib.Analysis.SpecialFunctions.JapaneseBracket
18+
import Mathlib.Analysis.SpecialFunctions.Pow.Deriv
19+
1320
/-! # Functions and measures of temperate growth -/
1421

1522
@[expose] public section

Mathlib/Analysis/Fourier/FourierTransformDeriv.lean

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ Authors: Alex Kontorovich, David Loeffler, Heather Macbeth, Sébastien Gouëzel
55
-/
66
module
77

8-
public import Mathlib.Analysis.Calculus.ParametricIntegral
9-
public import Mathlib.Analysis.Calculus.ContDiff.CPolynomial
8+
public import Mathlib.Analysis.Calculus.FDeriv.Analytic
109
public import Mathlib.Analysis.Fourier.AddCircle
1110
public import Mathlib.Analysis.Fourier.FourierTransform
12-
public import Mathlib.Analysis.Calculus.FDeriv.Analytic
13-
public import Mathlib.Analysis.Calculus.LineDeriv.IntegrationByParts
14-
public import Mathlib.Analysis.Calculus.ContDiff.Bounds
11+
12+
import Mathlib.Analysis.Calculus.ContDiff.Bounds
13+
import Mathlib.Analysis.Calculus.ContDiff.CPolynomial
14+
import Mathlib.Analysis.Calculus.LineDeriv.IntegrationByParts
15+
import Mathlib.Analysis.Calculus.ParametricIntegral
1516

1617
/-!
1718
# Derivatives of the Fourier transform

Mathlib/Analysis/SpecialFunctions/Complex/LogBounds.lean

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ public import Mathlib.Analysis.SpecialFunctions.Integrals.Basic
1010
public import Mathlib.Analysis.Calculus.Deriv.Shift
1111
public import Mathlib.Analysis.SpecificLimits.RCLike
1212

13+
import Mathlib.Analysis.SpecialFunctions.Complex.LogDeriv
14+
1315
/-!
1416
# Estimates for the complex logarithm
1517

Mathlib/Analysis/SpecialFunctions/Gamma/Digamma.lean

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ module
88
public import Mathlib.Analysis.Meromorphic.Complex
99
public import Mathlib.NumberTheory.Harmonic.GammaDeriv
1010

11+
import Mathlib.Analysis.SpecialFunctions.Complex.LogDeriv
12+
1113
/-!
1214
# The digamma function
1315

Mathlib/Analysis/SpecialFunctions/Gaussian/PoissonSummation.lean

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ Authors: David Loeffler
55
-/
66
module
77

8-
public import Mathlib.Analysis.SpecialFunctions.Gaussian.FourierTransform
98
public import Mathlib.Analysis.Fourier.PoissonSummation
109

10+
import Mathlib.Analysis.SpecialFunctions.Gaussian.FourierTransform
11+
1112
/-!
1213
# Poisson summation applied to the Gaussian
1314

Mathlib/Analysis/SpecialFunctions/Integrability/Basic.lean

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ module
77

88
public import Mathlib.Analysis.SpecialFunctions.Log.NegMulLog
99
public import Mathlib.Analysis.SpecialFunctions.NonIntegrable
10-
public import Mathlib.Analysis.SpecialFunctions.Pow.Deriv
10+
11+
import Mathlib.Analysis.SpecialFunctions.Pow.Deriv
1112

1213
/-!
1314
# Integrability of Special Functions

Mathlib/Analysis/SpecialFunctions/Integrability/LogMeromorphic.lean

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ public import Mathlib.Analysis.SpecialFunctions.Log.PosLog
1212
public import Mathlib.LinearAlgebra.Complex.FiniteDimensional
1313
public import Mathlib.MeasureTheory.Integral.CircleIntegral
1414

15+
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv
16+
1517
/-!
1618
# Integrability for Logarithms of Meromorphic Functions
1719

Mathlib/Analysis/SpecialFunctions/Integrals/LogTrigonometric.lean

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ module
77

88
public import Mathlib.Analysis.SpecialFunctions.Integrability.LogMeromorphic
99

10+
import Mathlib.Analysis.Analytic.Order
11+
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv
12+
1013
/-!
1114
# Integral of `log ∘ sin`
1215

Mathlib/Analysis/SpecialFunctions/JapaneseBracket.lean

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@ Authors: Moritz Doll
55
-/
66
module
77

8-
public import Mathlib.Analysis.SpecialFunctions.Integrability.Basic
9-
public import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar
10-
public import Mathlib.MeasureTheory.Integral.Layercake
8+
public import Mathlib.MeasureTheory.Function.L1Space.Integrable
9+
public import Mathlib.MeasureTheory.Measure.Haar.OfBasis
10+
11+
import Mathlib.Analysis.SpecialFunctions.Integrability.Basic
12+
import Mathlib.MeasureTheory.Integral.Layercake
13+
import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar
1114

1215
/-!
1316
# Japanese Bracket

0 commit comments

Comments
 (0)