/- Adapted from Mapher `PoincareMT/Proofs/M03/ConnectionDifference.lean` at f927d9e1f0810042766d3b5f64d3f4da02ee93cc. See `references/ricci-flow/mapher/local-theory/port.json`. -/ import PoincareLib.Geometry.RicciFlow.Local.Connection.Family /-! # The actual difference of two Levi-Civita connections Mathlib's difference map takes the section value first and the direction second. Local frame evaluations give its joint regularity for two smooth metric families; Koszul uniqueness makes it zero for a common metric. -/ set_option autoImplicit false set_option maxHeartbeats 1800000 open scoped Manifold ContDiff Bundle Topology open Bundle Manifold Set universe u namespace PoincareMT.RicciFlow.Local variable {n : β„•} {M : Type u} [TopologicalSpace M] [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓑 n) ∞ M] theorem connection_difference_eq_zero {g : RiemannianMetric n M} (D D' : LeviCivitaData g) (x : M) : CovariantDerivative.difference D.connection D'.connection x = 0 := by apply ContinuousLinearMap.ext intro v have hv := FiberBundle.mdifferentiableAt_extend (𝓑 n) (EuclideanSpace ℝ (Fin n)) v have hdiff := IsCovariantDerivativeOn.difference_apply D.connection.isCovariantDerivativeOnUniv D'.connection.isCovariantDerivativeOnUniv (Set.mem_univ x) hv rw [FiberBundle.extend_apply_self] at hdiff change CovariantDerivative.difference D.connection D'.connection x v = D.connection (FiberBundle.extend (EuclideanSpace ℝ (Fin n)) v) x - D'.connection (FiberBundle.extend (EuclideanSpace ℝ (Fin n)) v) x at hdiff change CovariantDerivative.difference D.connection D'.connection x v = 0 rw [hdiff, D.connection_eq_at D' _ hv, sub_self] theorem contMDiffOn_connection_family_difference {g g' : ℝ β†’ RiemannianMetric n M} {J : Set ℝ} (hg : RiemannianMetric.IsSmoothFamilyOn g J) (hg' : RiemannianMetric.IsSmoothFamilyOn g' J) (D : (t : ℝ) β†’ LeviCivitaData (g t)) (D' : (t : ℝ) β†’ LeviCivitaData (g' t)) : ContMDiffOn (π“˜(ℝ, ℝ).prod (𝓑 n)) ((𝓑 n).prod π“˜(ℝ, EuclideanSpace ℝ (Fin n) β†’L[ℝ] EuclideanSpace ℝ (Fin n) β†’L[ℝ] EuclideanSpace ℝ (Fin n))) ∞ (fun p : ℝ Γ— M => Bundle.TotalSpace.mk' (EuclideanSpace ℝ (Fin n) β†’L[ℝ] EuclideanSpace ℝ (Fin n) β†’L[ℝ] EuclideanSpace ℝ (Fin n)) (E := fun x : M => TangentSpace (𝓑 n) x β†’L[ℝ] TangentSpace (𝓑 n) x β†’L[ℝ] TangentSpace (𝓑 n) x) p.2 (CovariantDerivative.difference (D p.1).connection (D' p.1).connection p.2)) (J Γ—Λ’ Set.univ) := by intro p hp let e := trivializationAt (EuclideanSpace ℝ (Fin n)) (TangentSpace (𝓑 n)) p.2 have hep : p.2 ∈ e.baseSet := FiberBundle.mem_baseSet_trivializationAt' p.2 let frame (a : EuclideanSpace ℝ (Fin n)) (x : M) : TangentSpace (𝓑 n) x := e.symmL ℝ x a have hframe (a : EuclideanSpace ℝ (Fin n)) : ContMDiffOn (𝓑 n) ((𝓑 n).prod π“˜(ℝ, EuclideanSpace ℝ (Fin n))) ∞ (T% (frame a)) e.baseSet := by rw [e.contMDiffOn_section_baseSet_iff (IB := (𝓑 n)) (n := ∞)] refine (contMDiffOn_const (c := a)).congr ?_ intro x hx simpa [frame, Trivialization.symmL_apply _ hx] using congrArg Prod.snd (e.apply_mk_symm hx a) let C (q : ℝ Γ— M) : EuclideanSpace ℝ (Fin n) β†’L[ℝ] EuclideanSpace ℝ (Fin n) β†’L[ℝ] EuclideanSpace ℝ (Fin n) := ContinuousLinearMap.inCoordinates (EuclideanSpace ℝ (Fin n)) (TangentSpace (𝓑 n)) (EuclideanSpace ℝ (Fin n) β†’L[ℝ] EuclideanSpace ℝ (Fin n)) (fun x => TangentSpace (𝓑 n) x β†’L[ℝ] TangentSpace (𝓑 n) x) p.2 q.2 p.2 q.2 (CovariantDerivative.difference (D q.1).connection (D' q.1).connection q.2) have hbase : βˆ€αΆ  q in 𝓝[J Γ—Λ’ (Set.univ : Set M)] p, q.2 ∈ e.baseSet := Filter.Eventually.filter_mono nhdsWithin_le_nhds (continuous_snd.continuousAt.preimage_mem_nhds (e.open_baseSet.mem_nhds hep)) have hsmall : J Γ—Λ’ e.baseSet ∈ 𝓝[J Γ—Λ’ (Set.univ : Set M)] p := by filter_upwards [self_mem_nhdsWithin, hbase] with q hq hqe exact ⟨hq.1, hqe⟩ have hC : ContMDiffWithinAt (π“˜(ℝ, ℝ).prod (𝓑 n)) π“˜(ℝ, EuclideanSpace ℝ (Fin n) β†’L[ℝ] EuclideanSpace ℝ (Fin n) β†’L[ℝ] EuclideanSpace ℝ (Fin n)) ∞ C (J Γ—Λ’ Set.univ) p := by apply contMDiffWithinAt_clm_apply_iff.mpr intro a apply contMDiffWithinAt_clm_apply_iff.mpr intro b have hs₁ := contMDiffOn_connection_family_apply hg D e.open_baseSet (frame a) (frame b) (hframe a) (hframe b) have hsβ‚‚ := contMDiffOn_connection_family_apply hg' D' e.open_baseSet (frame a) (frame b) (hframe a) (hframe b) have hc₁ := (Bundle.contMDiffWithinAt_totalSpace.mp ((hs₁ p ⟨hp.1, hep⟩).mono_of_mem_nhdsWithin hsmall)).2 have hcβ‚‚ := (Bundle.contMDiffWithinAt_totalSpace.mp ((hsβ‚‚ p ⟨hp.1, hep⟩).mono_of_mem_nhdsWithin hsmall)).2 apply (hc₁.sub hcβ‚‚).congr_of_eventuallyEq_of_mem _ hp filter_upwards [hbase] with q hq dsimp [C] rw [inCoordinates_apply_eqβ‚‚ (F₁ := EuclideanSpace ℝ (Fin n)) (Fβ‚‚ := EuclideanSpace ℝ (Fin n)) (F₃ := EuclideanSpace ℝ (Fin n)) (E₁ := TangentSpace (𝓑 n)) (Eβ‚‚ := TangentSpace (𝓑 n)) (E₃ := TangentSpace (𝓑 n)) hq hq hq] rw [← Trivialization.symmL_apply (R := ℝ) e hq a, ← Trivialization.symmL_apply (R := ℝ) e hq b] have ha := ((hframe a).contMDiffAt (e.open_baseSet.mem_nhds hq)).mdifferentiableAt (by simp) have hdiff := IsCovariantDerivativeOn.difference_apply (D q.1).connection.isCovariantDerivativeOnUniv (D' q.1).connection.isCovariantDerivativeOnUniv (Set.mem_univ q.2) ha change CovariantDerivative.difference (D q.1).connection (D' q.1).connection q.2 (frame a q.2) = (D q.1).connection (frame a) q.2 - (D' q.1).connection (frame a) q.2 at hdiff change e.linearMapAt ℝ q.2 (CovariantDerivative.difference (D q.1).connection (D' q.1).connection q.2 (frame a q.2) (frame b q.2)) = _ rw [hdiff, sub_apply, map_sub] simp only [Trivialization.linearMapAt_apply, if_pos hq] rfl let F : ℝ Γ— M β†’ TotalSpace (EuclideanSpace ℝ (Fin n) β†’L[ℝ] EuclideanSpace ℝ (Fin n) β†’L[ℝ] EuclideanSpace ℝ (Fin n)) (fun x => TangentSpace (𝓑 n) x β†’L[ℝ] TangentSpace (𝓑 n) x β†’L[ℝ] TangentSpace (𝓑 n) x) := fun q => TotalSpace.mk' (EuclideanSpace ℝ (Fin n) β†’L[ℝ] EuclideanSpace ℝ (Fin n) β†’L[ℝ] EuclideanSpace ℝ (Fin n)) q.2 (CovariantDerivative.difference (D q.1).connection (D' q.1).connection q.2) exact (contMDiffWithinAt_hom_bundle F (s := J Γ—Λ’ Set.univ) (xβ‚€ := p)).mpr ⟨contMDiffWithinAt_snd, hC⟩ end PoincareMT.RicciFlow.Local