Skip to content

Commit 70be100

Browse files
committed
refactor(Analysis): golf Mathlib/Analysis/Normed/Module/FiniteDimension (leanprover-community#39184)
- rewrites `SecondCountableTopology (E →L[𝕜] F)` using a finite-dimensional equivalence and `e₂.toHomeomorph.secondCountableTopology` - moves `ContinuousLinearEquiv.piRing` next to the argument that reuses it Extracted from leanprover-community#37968 [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/from-referrer/)
1 parent c642998 commit 70be100

1 file changed

Lines changed: 33 additions & 68 deletions

File tree

Mathlib/Analysis/Normed/Module/FiniteDimension.lean

Lines changed: 33 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,33 @@ theorem ContinuousLinearMap.isOpen_injective [FiniteDimensional 𝕜 E] :
258258
exact ⟨(K⁻¹ - ‖φ - φ₀‖₊)⁻¹, inv_pos_of_pos (tsub_pos_of_lt hφ),
259259
H.add_sub_lipschitzWith (φ - φ₀).lipschitz hφ⟩
260260

261+
open ContinuousLinearMap
262+
263+
/-- Continuous linear equivalence between continuous linear functions `𝕜ⁿ → E` and `Eⁿ`.
264+
The spaces `𝕜ⁿ` and `Eⁿ` are represented as `ι → 𝕜` and `ι → E`, respectively,
265+
where `ι` is a finite type. -/
266+
def ContinuousLinearEquiv.piRing (ι : Type*) [Fintype ι] [DecidableEq ι] :
267+
((ι → 𝕜) →L[𝕜] E) ≃L[𝕜] ι → E :=
268+
{ LinearMap.toContinuousLinearMap.symm.trans (LinearEquiv.piRing 𝕜 E ι 𝕜) with
269+
continuous_toFun := by
270+
refine continuous_pi fun i ↦ ?_
271+
exact (apply 𝕜 E (Pi.single i 1)).continuous
272+
continuous_invFun := by
273+
simp_rw [LinearEquiv.invFun_eq_symm, LinearEquiv.trans_symm, LinearEquiv.symm_symm]
274+
refine AddMonoidHomClass.continuous_of_bound
275+
(LinearMap.toContinuousLinearMap.toLinearMap.comp
276+
(LinearEquiv.piRing 𝕜 E ι 𝕜).symm.toLinearMap)
277+
(Fintype.card ι : ℝ) fun g ↦ ?_
278+
rw [← nsmul_eq_mul]
279+
refine opNorm_le_bound _ (nsmul_nonneg (norm_nonneg g) (Fintype.card ι)) fun t ↦ ?_
280+
simp_rw [LinearMap.coe_comp, LinearEquiv.coe_toLinearMap, Function.comp_apply,
281+
LinearMap.coe_toContinuousLinearMap', LinearEquiv.piRing_symm_apply]
282+
apply le_trans (norm_sum_le _ _)
283+
rw [smul_mul_assoc]
284+
refine Finset.sum_le_card_nsmul _ _ _ fun i _ ↦ ?_
285+
rw [norm_smul, mul_comm]
286+
gcongr <;> apply norm_le_pi_norm }
287+
261288
protected theorem LinearIndependent.eventually {ι} [Finite ι] {f : ι → E}
262289
(hf : LinearIndependent 𝕜 f) : ∀ᶠ g in 𝓝 f, LinearIndependent 𝕜 g := by
263290
cases nonempty_fintype ι
@@ -354,48 +381,12 @@ end Module.Basis
354381

355382
instance [FiniteDimensional 𝕜 E] [SecondCountableTopology F] :
356383
SecondCountableTopology (E →L[𝕜] F) := by
357-
set d := Module.finrank 𝕜 E
358-
suffices
359-
∀ ε > (0 : ℝ), ∃ n : (E →L[𝕜] F) → Fin d → ℕ, ∀ f g : E →L[𝕜] F, n f = n g → dist f g ≤ ε from
360-
Metric.secondCountable_of_countable_discretization fun ε ε_pos =>
361-
⟨Fin d → ℕ, by infer_instance, this ε ε_pos⟩
362-
intro ε ε_pos
363-
obtain ⟨u : ℕ → F, hu : DenseRange u⟩ := exists_dense_seq F
364-
let v := Module.finBasis 𝕜 E
365-
obtain
366-
⟨C : ℝ, C_pos : 0 < C, hC :
367-
∀ {φ : E →L[𝕜] F} {M : ℝ}, 0 ≤ M → (∀ i, ‖φ (v i)‖ ≤ M) → ‖φ‖ ≤ C * M⟩ :=
368-
v.exists_opNorm_le (E := E) (F := F)
369-
have h_2C : 0 < 2 * C := mul_pos zero_lt_two C_pos
370-
have hε2C : 0 < ε / (2 * C) := div_pos ε_pos h_2C
371-
have : ∀ φ : E →L[𝕜] F, ∃ n : Fin d → ℕ, ‖φ - (v.constrL <| u ∘ n)‖ ≤ ε / 2 := by
372-
intro φ
373-
have : ∀ i, ∃ n, ‖φ (v i) - u n‖ ≤ ε / (2 * C) := by
374-
simp only [norm_sub_rev]
375-
intro i
376-
have : φ (v i) ∈ closure (range u) := hu _
377-
obtain ⟨n, hn⟩ : ∃ n, ‖u n - φ (v i)‖ < ε / (2 * C) := by
378-
rw [mem_closure_iff_nhds_basis Metric.nhds_basis_ball] at this
379-
specialize this (ε / (2 * C)) hε2C
380-
simpa [dist_eq_norm]
381-
exact ⟨n, le_of_lt hn⟩
382-
choose n hn using this
383-
use n
384-
replace hn : ∀ i : Fin d, ‖(φ - (v.constrL <| u ∘ n)) (v i)‖ ≤ ε / (2 * C) := by simp [hn]
385-
have : C * (ε / (2 * C)) = ε / 2 := by
386-
rw [eq_div_iff (two_ne_zero : (2 : ℝ) ≠ 0), mul_comm, ← mul_assoc,
387-
mul_div_cancel₀ _ (ne_of_gt h_2C)]
388-
specialize hC (le_of_lt hε2C) hn
389-
rwa [this] at hC
390-
choose n hn using this
391-
set Φ := fun φ : E →L[𝕜] F => v.constrL <| u ∘ n φ
392-
simp_rw [← dist_eq_norm] at hn
393-
use n
394-
intro x y hxy
395-
calc
396-
dist x y ≤ dist x (Φ x) + dist (Φ x) y := dist_triangle _ _ _
397-
_ = dist x (Φ x) + dist y (Φ y) := by simp [Φ, hxy, dist_comm]
398-
_ ≤ ε := by linarith [hn x, hn y]
384+
let d := Module.finrank 𝕜 E
385+
let e₁ : E ≃L[𝕜] Fin d → 𝕜 :=
386+
ContinuousLinearEquiv.ofFinrankEq (finrank_fin_fun 𝕜).symm
387+
let e₂ : (E →L[𝕜] F) ≃L[𝕜] Fin d → F :=
388+
(e₁.arrowCongr (1 : F ≃L[𝕜] F)).trans (ContinuousLinearEquiv.piRing (Fin d))
389+
exact e₂.toHomeomorph.secondCountableTopology
399390

400391
theorem AffineSubspace.closed_of_finiteDimensional {P : Type*} [MetricSpace P]
401392
[NormedAddTorsor E P] (s : AffineSubspace 𝕜 P) [FiniteDimensional 𝕜 s.direction] :
@@ -492,32 +483,6 @@ end Riesz
492483

493484
open ContinuousLinearMap
494485

495-
/-- Continuous linear equivalence between continuous linear functions `𝕜ⁿ → E` and `Eⁿ`.
496-
The spaces `𝕜ⁿ` and `Eⁿ` are represented as `ι → 𝕜` and `ι → E`, respectively,
497-
where `ι` is a finite type. -/
498-
def ContinuousLinearEquiv.piRing (ι : Type*) [Fintype ι] [DecidableEq ι] :
499-
((ι → 𝕜) →L[𝕜] E) ≃L[𝕜] ι → E :=
500-
{ LinearMap.toContinuousLinearMap.symm.trans (LinearEquiv.piRing 𝕜 E ι 𝕜) with
501-
continuous_toFun := by
502-
refine continuous_pi fun i => ?_
503-
exact (ContinuousLinearMap.apply 𝕜 E (Pi.single i 1)).continuous
504-
continuous_invFun := by
505-
simp_rw [LinearEquiv.invFun_eq_symm, LinearEquiv.trans_symm, LinearEquiv.symm_symm]
506-
-- Note: added explicit type and removed `change` that tried to achieve the same
507-
refine AddMonoidHomClass.continuous_of_bound
508-
(LinearMap.toContinuousLinearMap.toLinearMap.comp
509-
(LinearEquiv.piRing 𝕜 E ι 𝕜).symm.toLinearMap)
510-
(Fintype.card ι : ℝ) fun g => ?_
511-
rw [← nsmul_eq_mul]
512-
refine opNorm_le_bound _ (nsmul_nonneg (norm_nonneg g) (Fintype.card ι)) fun t => ?_
513-
simp_rw [LinearMap.coe_comp, LinearEquiv.coe_toLinearMap, Function.comp_apply,
514-
LinearMap.coe_toContinuousLinearMap', LinearEquiv.piRing_symm_apply]
515-
apply le_trans (norm_sum_le _ _)
516-
rw [smul_mul_assoc]
517-
refine Finset.sum_le_card_nsmul _ _ _ fun i _ => ?_
518-
rw [norm_smul, mul_comm]
519-
gcongr <;> apply norm_le_pi_norm }
520-
521486
/-- A family of continuous linear maps is continuous within `s` at `x` iff all its applications
522487
are. -/
523488
theorem continuousWithinAt_clm_apply {X : Type*} [TopologicalSpace X] [FiniteDimensional 𝕜 E]

0 commit comments

Comments
 (0)