import Mathlib import OAI.Analysis.BiholderTransport.Contact.GraphCompact import OAI.Analysis.BiholderTransport.CostGeometry.BranchActiveGrowth import OAI.Analysis.BiholderTransport.Coordinates.CutCharacterization import OAI.Analysis.BiholderTransport.Regularity.LimitGeometry namespace OAI noncomputable section open Set Filter Manifold Bundle open scoped Topology ContDiff namespace WeakMTWTransport variable {n : β„•} {M : Type*} [MetricSpace M] [CompactSpace M] [Nonempty M] [ChartedSpace (Model n) M] [IsManifold π“˜(ℝ,Model n) ∞ M] [RiemannianBundle (fun x : M => TangentSpace π“˜(ℝ,Model n) x)] [IsContMDiffRiemannianBundle π“˜(ℝ,Model n) ∞ (Model n) (fun x : M => TangentSpace π“˜(ℝ,Model n) x)] [IsRiemannianManifold π“˜(ℝ,Model n) M] lemma WeakMTW.isolated_graph_fiber_at_left_limit (hmtw : WeakMTW (n := n) (M := M)) {v : M β†’ ℝ} (hv : Continuous v) {T : ℝ} (hT : 0 tangentScale T w.1) := contMDiff_tangentScale.continuous.comp (continuous_const.prodMk continuous_subtype_val) have hproj : Continuous (fun w : subgradientGraph (n := n) (cTransform v) => w.1.1) := (FiberBundle.continuous_proj _ _).comp continuous_subtype_val have hcostz : cost z.1.1 (graphProjection (cTransform v) T z)= G (z.1.1,graphProjection (cTransform v) T z) := hbranch.self_of_nhds (hglobal z).1 filter_upwards [hscale.continuousAt.eventually hbranch, hscale.continuousAt.preimage_mem_nhds (hU.mem_nhds hzU), hproj.continuousAt.eventually hbase] with w hwG hwU hwbase he have hcostw : cost w.1.1 (graphProjection (cTransform v) T w)= G (w.1.1,graphProjection (cTransform v) T w) := hwG (hglobal w).1 have hsame : w.1.1=z.1.1 := by by_contra hn have hlt := hwbase hn change cTransform v z.1.1+G (z.1.1,graphProjection (cTransform v) T z)/T < cTransform v w.1.1+G (w.1.1,graphProjection (cTransform v) T z)/T at hlt rw [he] at hcostw rw [←hcostz,←hcostw] at hlt have hle := (hglobal w).2 z.1.1 rw [he] at hle exact (not_lt_of_ge hle) hlt apply Subtype.ext apply tangentScale_injective hT.ne' exact hUinj hwU hzU (Prod.ext hsame he) lemma WeakMTW.injective_graphProjection_at_left_limit (hmtw : WeakMTW (n := n) (M := M)) {v : M β†’ ℝ} (hv : Continuous v) {T : ℝ} (hT : 0 t) (b := 𝓝[<] T) Β· apply Filter.Eventually.frequently filter_upwards [(eventually_gt_nhds hT).filter_mono nhdsWithin_le_nhds, self_mem_nhdsWithin] with t ht htT exact ⟨hinj t ⟨ht,htT⟩,surjective_graphProjection (continuous_cTransform hv) ht⟩ Β· exact tendsto_id.mono_right nhdsWithin_le_nhds intro z w he have hconn := isPreconnected_fiber_of_mem_closure_bijective (graphProjection (n := n) (cTransform v)) (continuous_graphProjection_family _) hclosure (graphProjection (cTransform v) T z) have hs : {q : subgradientGraph (n := n) (cTransform v) | graphProjection (cTransform v) T q=graphProjection (cTransform v) T z}.Subsingleton := by apply fiber_subsingleton_of_preconnected_isolated hconn intro q hq obtain ⟨U,hUP,hU,hqU⟩ := mem_nhds_iff.mp (hmtw.isolated_graph_fiber_at_left_limit hv hT hT1 hinj q) refine ⟨U,hU,hqU,?_⟩ intro r hr exact hUP hr.1 (hr.2.trans hq.symm) exact hs rfl he.symm lemma WeakMTW.active_hull_precut_at_left_limit (hmtw : WeakMTW (n := n) (M := M)) {v : M β†’ ℝ} (hv : Continuous v) {T : ℝ} (hT : 0