import PoincareLib.Geometry.Manifold.Flow.Uniqueness import Mathlib.Algebra.Order.Floor.Ring /-! # Forward manifold integral curves from finite continuation -/ noncomputable section set_option autoImplicit false set_option backward.isDefEq.respectTransparency false open Set Filter open scoped Manifold ContDiff Bundle Topology namespace Poincare.Manifold variable {n : β„•} {M : Type*} [TopologicalSpace M] [T2Space M] [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓑 n) ∞ M] /-- Arbitrarily long finite integral curves glue by uniqueness to one forward curve, preserving any common range constraint. -/ theorem exists_forward_integralCurve_of_finite_integralCurves {X : (x : M) β†’ TangentSpace (𝓑 n) x} {U K : Set M} (hU : IsOpen U) (hX : ContMDiffOn (𝓑 n) ((𝓑 n).prod (𝓑 n)) 1 (T% X) U) {x : M} (hfinite : βˆ€ k : β„•, βˆƒ a b : ℝ, a < 0 ∧ (k : ℝ) + 1 < b ∧ βˆƒ Ξ± : ℝ β†’ M, Ξ± 0 = x ∧ (βˆ€ t ∈ Ioo a b, Ξ± t ∈ U) ∧ IsMIntegralCurveOn (I := 𝓑 n) Ξ± X (Ioo a b) ∧ βˆ€ t ∈ Icc 0 ((k : ℝ) + 1), Ξ± t ∈ K) : βˆƒ a < 0, βˆƒ Ξ³ : ℝ β†’ M, Ξ³ 0 = x ∧ (βˆ€ t ∈ Ioi a, Ξ³ t ∈ U) ∧ IsMIntegralCurveOn (I := 𝓑 n) Ξ³ X (Ioi a) ∧ βˆ€ t : ℝ, 0 ≀ t β†’ Ξ³ t ∈ K := by choose a b ha hb Ξ± hinit hΞ±U hΞ± hK using hfinite have hagree (i j : β„•) : EqOn (Ξ± i) (Ξ± j) (Ioo (max (a i) (a j)) (min ((i : ℝ) + 1) ((j : ℝ) + 1))) := by have hi : Ioo (max (a i) (a j)) (min ((i : ℝ) + 1) ((j : ℝ) + 1)) βŠ† Ioo (a i) (b i) := Ioo_subset_Ioo (le_max_left _ _) ((min_le_left _ _).trans (hb i).le) have hj : Ioo (max (a i) (a j)) (min ((i : ℝ) + 1) ((j : ℝ) + 1)) βŠ† Ioo (a j) (b j) := Ioo_subset_Ioo (le_max_right _ _) ((min_le_right _ _).trans (hb j).le) exact eqOn_of_isMIntegralCurveOn hU hX isOpen_Ioo isPreconnected_Ioo (show 0 ∈ Ioo (max (a i) (a j)) (min ((i : ℝ) + 1) ((j : ℝ) + 1)) from ⟨max_lt (ha i) (ha j), lt_min (by positivity) (by positivity)⟩) (fun t ht => hΞ±U i t (hi ht)) ((hΞ± i).mono hi) ((hΞ± j).mono hj) ((hinit i).trans (hinit j).symm) let Ξ³ : ℝ β†’ M := fun t => if t < 0 then Ξ± 0 t else Ξ± ⌈tβŒ‰β‚Š t have heq (k : β„•) : EqOn Ξ³ (Ξ± k) (Ioo (max (a 0) (a k)) ((k : ℝ) + 1)) := by intro t ht dsimp only [Ξ³] split_ifs with ht0 Β· exact hagree 0 k ⟨ht.1, lt_min (by simpa using ht0.trans zero_lt_one) ht.2⟩ Β· exact hagree ⌈tβŒ‰β‚Š k ⟨(max_lt (ha _) (ha _)).trans_le (le_of_not_gt ht0), lt_min (by linarith [Nat.le_ceil t]) ht.2⟩ have hnear (t : ℝ) (ht : t ∈ Ioi (a 0)) : βˆƒ k : β„•, t ∈ Ioo (a k) (b k) ∧ Ξ³ =αΆ [𝓝 t] Ξ± k := by by_cases ht0 : t < 0 Β· refine ⟨0, ⟨ht, ht0.trans (by linarith [hb 0] : 0 < b 0)⟩, ?_⟩ filter_upwards [isOpen_Iio.mem_nhds ht0] with s hs exact if_pos hs Β· have ht0' := le_of_not_gt ht0 have htI : t ∈ Ioo (max (a 0) (a ⌈tβŒ‰β‚Š)) ((⌈tβŒ‰β‚Š : ℝ) + 1) := ⟨(max_lt (ha _) (ha _)).trans_le ht0', by linarith [Nat.le_ceil t]⟩ refine ⟨⌈tβŒ‰β‚Š, ⟨(ha _).trans_le ht0', htI.2.trans (hb _)⟩, ?_⟩ exact Filter.Eventually.mono (isOpen_Ioo.mem_nhds htI) fun _ hs => heq _ hs refine ⟨a 0, ha 0, Ξ³, ?_, ?_, ?_, ?_⟩ Β· simp [Ξ³, hinit] Β· intro t ht obtain ⟨k, hk, he⟩ := hnear t ht rw [he.self_of_nhds] exact hΞ±U k t hk Β· intro t ht obtain ⟨k, hk, he⟩ := hnear t ht have hd := (((hΞ± k).isMIntegralCurveAt (isOpen_Ioo.mem_nhds hk)).hasMFDerivAt.congr_of_eventuallyEq he).hasMFDerivWithinAt (s := Ioi (a 0)) convert hd using 1 rw [he.self_of_nhds] Β· intro t ht rw [show Ξ³ t = Ξ± ⌈tβŒ‰β‚Š t from if_neg (not_lt.mpr ht)] exact hK _ t ⟨ht, by linarith [Nat.le_ceil t]⟩ end Poincare.Manifold