import PoincareLib.Geometry.Spacetime.Realization.Interval.Family import Mathlib.Analysis.Calculus.MeanValue /-! # Constancy from the actual normalized interval derivative -/ set_option autoImplicit false set_option backward.isDefEq.respectTransparency false open Set Function open scoped Manifold ContDiff Topology open PoincareMT namespace Poincare.Spacetime.Realization variable {E : Type*} [NormedAddCommGroup E] [NormedSpace โ„ E] theorem interval_function_smoothOn (I : SpacetimeInterval) {f : (smoothInterval I).Point โ†’ E} {g : โ„ โ†’ E} (hf : ContMDiff (๐“กโˆ‚ 1) ๐“˜(โ„, E) โˆž f) (hg : โˆ€ t : (smoothInterval I).Point, g t.val = f t) : ContMDiffOn ๐“˜(โ„) ๐“˜(โ„, E) โˆž g I.domain := by let := intervalChartedSpace I have h := interval_family_smoothOn (J := ๐“˜(โ„)) I (f := fun p : (smoothInterval I).Point ร— โ„ โ†ฆ f p.1) (g := fun p : โ„ ร— โ„ โ†ฆ g p.1) (hf.comp contMDiff_fst) (fun t _ โ†ฆ hg t) exact h.comp (contMDiff_id.prodMk (contMDiff_const (c := (0 : โ„)))).contMDiffOn (fun _ ht โ†ฆ โŸจht, mem_univ _โŸฉ) theorem interval_constant_of_derivative_zero (I : SpacetimeInterval) {f : (smoothInterval I).Point โ†’ E} (hf : ContMDiff (๐“กโˆ‚ 1) ๐“˜(โ„, E) โˆž f) (hz : โˆ€ t, mfderiv (๐“กโˆ‚ 1) ๐“˜(โ„, E) f t ((smoothInterval I).positiveTangent t) = 0) (s t : (smoothInterval I).Point) : f s = f t := by classical let := intervalChartedSpace I let g : โ„ โ†’ E := fun r โ†ฆ if hr : r โˆˆ I.domain then f โŸจr, hrโŸฉ else 0 have hg (r : (smoothInterval I).Point) : g r.val = f r := by dsimp [g] rw [dif_pos r.property] have hgs := interval_function_smoothOn I hf hg have hgz (r : โ„) (hr : r โˆˆ I.domain) : fderivWithin โ„ g I.domain r = 0 := by let q : (smoothInterval I).Point := โŸจr, hrโŸฉ have hc := mfderivWithin_comp (I := ๐“กโˆ‚ 1) (I' := ๐“˜(โ„)) (I'' := ๐“˜(โ„, E)) (s := univ) (u := I.domain) q ((hgs r hr).mdifferentiableWithinAt (by simp)) (((smoothInterval I).inclusion_smooth q).mdifferentiableAt (by simp)).mdifferentiableWithinAt (fun p _ โ†ฆ p.property) (uniqueMDiffWithinAt_univ (๐“กโˆ‚ 1)) have he : g โˆ˜ (Subtype.val : (smoothInterval I).Point โ†’ โ„) = f := funext hg simp only [mfderivWithin_univ, mfderivWithin_eq_fderivWithin] at hc have h := congrArg (fun L โ†ฆ L ((smoothInterval I).positiveTangent q)) hc have hn : mfderiv (๐“กโˆ‚ 1) ๐“˜(โ„) (Subtype.val : (smoothInterval I).Point โ†’ โ„) q ((smoothInterval I).positiveTangent q) = 1 := by rw [โ† (smoothInterval I).inclusionDerivative_eq] exact ((smoothInterval I).inclusionDerivative q).apply_symm_apply 1 change mfderiv (๐“กโˆ‚ 1) ๐“˜(โ„, E) (g โˆ˜ Subtype.val) q ((smoothInterval I).positiveTangent q) = fderivWithin โ„ g I.domain r (mfderiv (๐“กโˆ‚ 1) ๐“˜(โ„) (Subtype.val : (smoothInterval I).Point โ†’ โ„) q ((smoothInterval I).positiveTangent q)) at h rw [he, hn, hz q] at h exact ContinuousLinearMap.ext_ring h.symm rw [โ† hg s, โ† hg t] exact (interval_convex I).is_const_of_fderivWithin_eq_zero (fun r hr โ†ฆ ((hgs r hr).mdifferentiableWithinAt (by simp)).differentiableWithinAt) hgz s.property t.property end Poincare.Spacetime.Realization