Repository navigation
Expand file tree
/
Copy pathSubmission.lean
More file actions
3158 lines (3155 loc) · 178 KB
/
Copy pathSubmission.lean
File metadata and controls
3158 lines (3155 loc) · 178 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import ChallengeDeps
import Submission.Helpers
open LeanEval.Geometry
open scoped Manifold ENNReal ContDiff
open Bundle
namespace Submission
theorem Helpers.hasDerivWithinAt_update_of_ode_limit
{E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
{F : E → E} {X : ℝ → E} {p : E} {a b : ℝ}
(hab : a < b) (hF : ContinuousAt F p)
(hX : ∀ t ∈ Set.Ioo a b, HasDerivAt X (F (X t)) t)
(hlim : Filter.Tendsto X (nhdsWithin b (Set.Ioo a b)) (nhds p)) :
HasDerivWithinAt (Function.update X b p) (F p) (Set.Iic b) b := by
classical
let Y : ℝ → E := Function.update X b p
have heq (t : ℝ) (ht : t < b) : Y =ᶠ[nhds t] X := by
filter_upwards [isOpen_ne.mem_nhds ht.ne] with s hs
exact Function.update_of_ne hs _ _
have hd (t : ℝ) (ht : t ∈ Set.Ioo a b) : HasDerivAt Y (F (X t)) t :=
(hX t ht).congr_of_eventuallyEq (heq t ht.2)
have hc : ContinuousWithinAt Y (Set.Ioo a b) b := by
apply continuousWithinAt_update_same.mpr
simpa only [Set.sdiff_singleton_eq_self (show b ∉ Set.Ioo a b by simp)] using hlim
have hlim' : Filter.Tendsto X (nhdsWithin b (Set.Iio b)) (nhds p) := by
rwa [nhdsWithin_Ioo_eq_nhdsLT hab] at hlim
apply hasDerivWithinAt_Iic_of_tendsto_deriv
(fun t ht => (hd t ht).differentiableAt.differentiableWithinAt) hc
(Ioo_mem_nhdsLT hab)
apply (hF.tendsto.comp hlim').congr'
filter_upwards [Ioo_mem_nhdsLT hab] with t ht
exact (hd t ht).deriv.symm
theorem Helpers.exists_ode_continuation_of_tendsto
{E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E]
{U : Set E} (hU : IsOpen U) {F : E → E}
(hF : ContDiffOn ℝ (↑(⊤ : ℕ∞) : WithTop ℕ∞) F U)
{X : ℝ → E} {p : E} {a b : ℝ} (hab : a < b) (hp : p ∈ U)
(hX : ∀ t ∈ Set.Ioo a b, HasDerivAt X (F (X t)) t)
(hlim : Filter.Tendsto X (nhdsWithin b (Set.Ioo a b)) (nhds p)) :
∃ δ > (0 : ℝ), ∃ Y : ℝ → E,
Y b = p ∧
ContDiffOn ℝ (↑(⊤ : ℕ∞) : WithTop ℕ∞) Y (Set.Ioo (b - δ) (b + δ)) ∧
(∀ t ∈ Set.Ioo (b - δ) (b + δ), Y t ∈ U ∧ HasDerivAt Y (F (Y t)) t) ∧
∀ t ∈ Set.Ioo (b - δ) b, Y t = X t := by
classical
have hFat := hF.contDiffAt (hU.mem_nhds hp)
obtain ⟨K, W, hW, hLip⟩ := (hFat.of_le (show (1 : WithTop ℕ∞) ≤ ↑(⊤ : ℕ∞) by simp)).exists_lipschitzOnWith
obtain ⟨R, hR, hRsub⟩ := Metric.mem_nhds_iff.mp (Filter.inter_mem hW (hU.mem_nhds hp))
have hRU : Metric.ball p R ⊆ U := fun z hz => (hRsub hz).2
have hLK : LipschitzOnWith K F (Metric.ball p R) :=
hLip.mono (fun z hz => (hRsub hz).1)
obtain ⟨r, hr, ε, hε, Φ, hΦ, hΦ0, hΦode⟩ :=
Helpers.exists_smooth_local_ode_flow (Metric.ball p R) Metric.isOpen_ball F
(hF.mono hRU) p (Metric.mem_ball_self hR)
let Y : ℝ → E := fun t => Φ (t - b, p)
have hYb : Y b = p := by
simpa only [Y, sub_self] using hΦ0 p (Metric.mem_ball_self hr)
have hYode (t : ℝ) (ht : t ∈ Set.Ioo (b - ε) (b + ε)) :
Y t ∈ Metric.ball p R ∧ HasDerivAt Y (F (Y t)) t := by
have ht' : t - b ∈ Set.Ioo (-ε) ε := by constructor <;> linarith [ht.1, ht.2]
have h := hΦode (t - b, p) ⟨ht', Metric.mem_ball_self hr⟩
refine ⟨h.1, ?_⟩
simpa only [Y, Function.comp_def, id_eq, one_smul] using
h.2.scomp t ((hasDerivAt_id t).sub_const b)
have hnear : ∀ᶠ t in nhdsWithin b (Set.Iio b), X t ∈ Metric.ball p R := by
have h := hlim.eventually (Metric.ball_mem_nhds p hR)
rwa [nhdsWithin_Ioo_eq_nhdsLT hab] at h
obtain ⟨d, hdb, hd⟩ := mem_nhdsLT_iff_exists_Ioo_subset.mp hnear
let δ : ℝ := min ε (b - max a d) / 2
have hgap : 0 < b - max a d := sub_pos.mpr (max_lt hab hdb)
have hδ : 0 < δ := half_pos (lt_min hε hgap)
have hδε : δ < ε := by dsimp [δ]; linarith [min_le_left ε (b - max a d)]
have hδgap : δ < b - max a d := by
dsimp [δ]
linarith [min_le_right ε (b - max a d)]
have haδ : a < b - δ := by linarith [le_max_left a d]
have hdδ : d < b - δ := by linarith [le_max_right a d]
have hsub (t : ℝ) (ht : t ∈ Set.Icc (b - δ) b) (htb : t ≠ b) :
t ∈ Set.Ioo a b := ⟨haδ.trans_le ht.1, lt_of_le_of_ne ht.2 htb⟩
let Z : ℝ → E := Function.update X b p
have hZb : Z b = p := by simp [Z]
have hZd (t : ℝ) (ht : t ∈ Set.Ioo a b) : HasDerivAt Z (F (Z t)) t := by
have heq : Z =ᶠ[nhds t] X := by
filter_upwards [isOpen_ne.mem_nhds ht.2.ne] with s hs
exact Function.update_of_ne hs _ _
have hz : Z t = X t := Function.update_of_ne ht.2.ne _ _
rw [hz]
exact (hX t ht).congr_of_eventuallyEq heq
have hZdb : HasDerivWithinAt Z (F p) (Set.Iic b) b :=
Helpers.hasDerivWithinAt_update_of_ode_limit hab hFat.continuousAt hX hlim
have hZcont : ContinuousOn Z (Set.Icc (b - δ) b) := by
intro t ht
by_cases htb : t = b
· subst t
exact hZdb.continuousWithinAt.mono (fun _ hz => hz.2)
· exact (hZd t (hsub t ht htb)).continuousAt.continuousWithinAt
have hZmem (t : ℝ) (ht : t ∈ Set.Icc (b - δ) b) : Z t ∈ Metric.ball p R := by
by_cases htb : t = b
· simpa only [htb, hZb] using Metric.mem_ball_self hR
· rw [show Z t = X t from Function.update_of_ne htb _ _]
exact hd ⟨hdδ.trans_le ht.1, lt_of_le_of_ne ht.2 htb⟩
have hYtime (t : ℝ) (ht : t ∈ Set.Icc (b - δ) b) :
t ∈ Set.Ioo (b - ε) (b + ε) := by constructor <;> linarith [ht.1, ht.2]
have hEq : Set.EqOn Z Y (Set.Icc (b - δ) b) := by
apply ODE_solution_unique_of_mem_Icc_left (v := fun _ => F)
(s := fun _ => Metric.ball p R) (fun _ _ => hLK)
hZcont ?_ (fun t ht => hZmem t ⟨ht.1.le, ht.2⟩)
(fun t ht => (hYode t (hYtime t ht)).2.continuousAt.continuousWithinAt)
(fun t ht => (hYode t (hYtime t ⟨ht.1.le, ht.2⟩)).2.hasDerivWithinAt)
(fun t ht => (hYode t (hYtime t ⟨ht.1.le, ht.2⟩)).1)
(hZb.trans hYb.symm)
intro t ht
by_cases htb : t = b
· subst t
simpa only [hZb] using hZdb
· exact (hZd t (hsub t ⟨ht.1.le, ht.2⟩ htb)).hasDerivWithinAt
refine ⟨δ, hδ, Y, hYb, ?_, ?_, ?_⟩
· apply hΦ.comp (contDiffOn_id.sub contDiffOn_const |>.prodMk contDiffOn_const)
intro t ht
change (t - b, p) ∈ Set.Ioo (-ε) ε ×ˢ Metric.ball p r
exact ⟨⟨by linarith [ht.1], by linarith [ht.2]⟩, Metric.mem_ball_self hr⟩
· intro t ht
have h := hYode t ⟨by linarith [ht.1], by linarith [ht.2]⟩
exact ⟨hRU h.1, h.2⟩
· intro t ht
exact (hEq ⟨ht.1.le, ht.2.le⟩).symm.trans (Function.update_of_ne ht.2.ne _ _)
theorem Helpers.exists_spray_continuation_of_phase_limit
{E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E]
{U : Set E} (hU : IsOpen U) {Γ : E → E →L[ℝ] E →L[ℝ] E}
(hΓ : ContDiffOn ℝ (↑(⊤ : ℕ∞) : WithTop ℕ∞) Γ U)
{x v : ℝ → E} {p w : E} {a b : ℝ} (hab : a < b) (hp : p ∈ U)
(hphase : ∀ t ∈ Set.Ioo a b,
HasDerivAt x (v t) t ∧ HasDerivAt v (-(Γ (x t) (v t) (v t))) t)
(hx : Filter.Tendsto x (nhdsWithin b (Set.Ioo a b)) (nhds p))
(hv : Filter.Tendsto v (nhdsWithin b (Set.Ioo a b)) (nhds w)) :
∃ δ > (0 : ℝ), ∃ X V : ℝ → E,
X b = p ∧ V b = w ∧
ContDiffOn ℝ (↑(⊤ : ℕ∞) : WithTop ℕ∞)
(fun t => (X t, V t)) (Set.Ioo (b - δ) (b + δ)) ∧
(∀ t ∈ Set.Ioo (b - δ) (b + δ), X t ∈ U ∧
HasDerivAt X (V t) t ∧ HasDerivAt V (-(Γ (X t) (V t) (V t))) t) ∧
∀ t ∈ Set.Ioo (b - δ) b, X t = x t ∧ V t = v t := by
let F : E × E → E × E := fun z => (z.2, -(Γ z.1 z.2 z.2))
have hF : ContDiffOn ℝ (↑(⊤ : ℕ∞) : WithTop ℕ∞) F (U ×ˢ Set.univ) :=
Helpers.contDiffOn_coordinate_spray hΓ
have hd (t : ℝ) (ht : t ∈ Set.Ioo a b) :
HasDerivAt (fun s => (x s, v s)) (F (x t, v t)) t :=
(hphase t ht).1.prodMk (hphase t ht).2
obtain ⟨δ, hδ, Y, hYb, hYs, hYode, hYeq⟩ :=
Helpers.exists_ode_continuation_of_tendsto (hU.prod isOpen_univ) hF hab
⟨hp, Set.mem_univ w⟩ hd (hx.prodMk_nhds hv)
refine ⟨δ, hδ, (fun t => (Y t).1), (fun t => (Y t).2),
congrArg Prod.fst hYb, congrArg Prod.snd hYb, ?_, ?_, ?_⟩
· simpa only [Prod.eta] using hYs
· intro t ht
have h := hYode t ht
exact ⟨h.1.1, h.2.fst, h.2.snd⟩
· intro t ht
exact ⟨congrArg Prod.fst (hYeq t ht), congrArg Prod.snd (hYeq t ht)⟩
theorem Helpers.exists_spray_continuation_of_bounded_velocity
{E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E]
{U : Set E} (hU : IsOpen U) {Γ : E → E →L[ℝ] E →L[ℝ] E}
(hΓ : ContDiffOn ℝ (↑(⊤ : ℕ∞) : WithTop ℕ∞) Γ U)
{x v : ℝ → E} {p : E} {a b : ℝ} (hab : a < b) (hp : p ∈ U)
(hphase : ∀ t ∈ Set.Ioo a b,
HasDerivAt x (v t) t ∧ HasDerivAt v (-(Γ (x t) (v t) (v t))) t)
(hx : Filter.Tendsto x (nhdsWithin b (Set.Ioo a b)) (nhds p))
(hv : ∃ K : ℝ, ∀ t ∈ Set.Ioo a b, ‖v t‖ ≤ K) :
∃ δ > (0 : ℝ), ∃ X V : ℝ → E,
X b = p ∧
ContDiffOn ℝ (↑(⊤ : ℕ∞) : WithTop ℕ∞)
(fun t => (X t, V t)) (Set.Ioo (b - δ) (b + δ)) ∧
(∀ t ∈ Set.Ioo (b - δ) (b + δ), X t ∈ U ∧
HasDerivAt X (V t) t ∧ HasDerivAt V (-(Γ (X t) (V t) (V t))) t) ∧
∀ t ∈ Set.Ioo (b - δ) b, X t = x t ∧ V t = v t := by
obtain ⟨w, hw⟩ := Helpers.exists_velocity_limit_of_bounded_spray_curve hab
(hΓ.contDiffAt (hU.mem_nhds hp)).continuousAt hx hv (fun t ht => (hphase t ht).2)
obtain ⟨δ, hδ, X, V, hXb, hVb, hC, hODE, heq⟩ :=
Helpers.exists_spray_continuation_of_phase_limit hU hΓ hab hp hphase hx hw
exact ⟨δ, hδ, X, V, hXb, hC, hODE, heq⟩
theorem Helpers.exists_spray_continuation_of_energy_bound
{E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E]
{U : Set E} (hU : IsOpen U)
{g : E → E →L[ℝ] E →L[ℝ] ℝ} {Γ : E → E →L[ℝ] E →L[ℝ] E}
(hg : ContinuousOn g U)
(hΓ : ContDiffOn ℝ (↑(⊤ : ℕ∞) : WithTop ℕ∞) Γ U)
{x v : ℝ → E} {p : E} {a b C : ℝ} (hab : a < b) (hp : p ∈ U)
(hpos : ∀ w : E, w ≠ 0 → 0 < g p w w)
(hphase : ∀ t ∈ Set.Ioo a b,
HasDerivAt x (v t) t ∧ HasDerivAt v (-(Γ (x t) (v t) (v t))) t)
(hx : Filter.Tendsto x (nhdsWithin b (Set.Ioo a b)) (nhds p))
(henergy : ∀ t ∈ Set.Ioo a b, g (x t) (v t) (v t) ≤ C ^ 2) :
∃ δ > (0 : ℝ), ∃ X V : ℝ → E,
X b = p ∧
ContDiffOn ℝ (↑(⊤ : ℕ∞) : WithTop ℕ∞)
(fun t => (X t, V t)) (Set.Ioo (b - δ) (b + δ)) ∧
(∀ t ∈ Set.Ioo (b - δ) (b + δ), X t ∈ U ∧
HasDerivAt X (V t) t ∧ HasDerivAt V (-(Γ (X t) (V t) (V t))) t) ∧
∀ t ∈ Set.Ioo (b - δ) b, X t = x t ∧ V t = v t := by
obtain ⟨w, hw⟩ := Helpers.velocity_limit_of_positive_metric_spray hab
(hg.continuousAt (hU.mem_nhds hp)) (hΓ.contDiffAt (hU.mem_nhds hp)).continuousAt
hpos hx (fun t ht => (hphase t ht).2) henergy
obtain ⟨δ, hδ, X, V, hXb, hVb, hC, hODE, heq⟩ :=
Helpers.exists_spray_continuation_of_phase_limit hU hΓ hab hp hphase hx hw
exact ⟨δ, hδ, X, V, hXb, hC, hODE, heq⟩
theorem Helpers.exists_energy_preserving_spray_continuation
{E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E]
{U : Set E} (hU : IsOpen U)
{g : E → E →L[ℝ] E →L[ℝ] ℝ} {Γ : E → E →L[ℝ] E →L[ℝ] E}
(hg : ContDiffOn ℝ 1 g U)
(hΓ : ContDiffOn ℝ (↑(⊤ : ℕ∞) : WithTop ℕ∞) Γ U)
(hsym : ∀ z u w, g z u w = g z w u)
(hKoszul : ∀ z ∈ U, ∀ u v w,
2 * g z (Γ z u v) w = (fderiv ℝ g z u) v w +
(fderiv ℝ g z v) u w - (fderiv ℝ g z w) u v)
{x v : ℝ → E} {p : E} {a b C : ℝ} (hab : a < b) (hp : p ∈ U)
(hpos : ∀ w : E, w ≠ 0 → 0 < g p w w)
(hphase : ∀ t ∈ Set.Ioo a b,
HasDerivAt x (v t) t ∧ HasDerivAt v (-(Γ (x t) (v t) (v t))) t)
(hx : Filter.Tendsto x (nhdsWithin b (Set.Ioo a b)) (nhds p))
(henergy : ∀ t ∈ Set.Ioo a b, g (x t) (v t) (v t) = C ^ 2) :
∃ δ > (0 : ℝ), ∃ X V : ℝ → E,
X b = p ∧
ContDiffOn ℝ (↑(⊤ : ℕ∞) : WithTop ℕ∞)
(fun t => (X t, V t)) (Set.Ioo (b - δ) (b + δ)) ∧
(∀ t ∈ Set.Ioo (b - δ) (b + δ), X t ∈ U ∧
HasDerivAt X (V t) t ∧ HasDerivAt V (-(Γ (X t) (V t) (V t))) t) ∧
(∀ t ∈ Set.Ioo (b - δ) (b + δ), g (X t) (V t) (V t) = C ^ 2) ∧
∀ t ∈ Set.Ioo (b - δ) b, X t = x t ∧ V t = v t := by
obtain ⟨δ, hδ, X, V, hXb, hC, hODE, heq⟩ :=
Helpers.exists_spray_continuation_of_energy_bound hU hg.continuousOn hΓ hab hp
hpos hphase hx (fun t ht => (henergy t ht).le)
let θ : ℝ := min δ (b - a) / 2
have hθ : 0 < θ := half_pos (lt_min hδ (sub_pos.mpr hab))
have hθδ : θ < δ := by dsimp [θ]; linarith [min_le_left δ (b - a)]
have hθab : θ < b - a := by dsimp [θ]; linarith [min_le_right δ (b - a)]
have hleft : b - θ ∈ Set.Ioo (b - δ) b := ⟨by linarith, by linarith⟩
have href : b - θ ∈ Set.Ioo (b - δ) (b + δ) :=
⟨hleft.1, by linarith⟩
have hEref : g (X (b - θ)) (V (b - θ)) (V (b - θ)) = C ^ 2 := by
rw [(heq _ hleft).1, (heq _ hleft).2]
exact henergy _ ⟨by linarith, hleft.2⟩
refine ⟨δ, hδ, X, V, hXb, hC, hODE, ?_, heq⟩
intro t ht
have hconst := Helpers.coordinate_geodesic_energy_eq
(Γ := fun z u v => Γ z u v) (g := g) (x := X) (v := V) isOpen_Ioo
(convex_Ioo (b - δ) (b + δ)).isPreconnected
(fun s hs => (hg.contDiffAt (hU.mem_nhds (hODE s hs).1)).differentiableAt (by simp))
hsym (fun s hs => hKoszul _ (hODE s hs).1)
(fun s hs => (hODE s hs).2.1) (fun s hs => (hODE s hs).2.2) ht href
exact hconst.trans hEref
theorem Helpers.exists_uniform_radius_control_of_joint_spray_inverse
{E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
{U : Set E} (hU : IsOpen U)
{g : E → E →L[ℝ] E →L[ℝ] ℝ} (hg : ContDiffOn ℝ 1 g U)
(hsym : ∀ x u v, g x u v = g x v u)
(hpos : ∀ x ∈ U, ∀ v, v ≠ 0 → 0 < g x v v)
{Γ : E → E →L[ℝ] E →L[ℝ] E}
(hKoszul : ∀ x ∈ U, ∀ u v w,
2 * g x (Γ x u v) w = (fderiv ℝ g x u) v w +
(fderiv ℝ g x v) u w - (fderiv ℝ g x w) u v)
{p : E} {r ε R τ : ℝ} {K : NNReal} (hr : 0 < r) (hε : 0 < ε)
(hτ : τ ∈ Set.Ioo (-ε) ε)
(hLip : LipschitzOnWith K (fun z : E × E => (z.2, -Γ z.1 z.2 z.2))
(Metric.ball (p, 0) R))
(hdom : ∀ z ∈ Metric.ball (p, (0 : E)) R, z.1 ∈ U)
{Φ : ℝ × (E × E) → E × E}
(hΦ : ContDiffOn ℝ 2 Φ (Set.Ioo (-ε) ε ×ˢ Metric.ball (p, 0) r))
(hΦ0 : ∀ z ∈ Metric.ball (p, 0) r, Φ (0, z) = z)
(hΦF : ∀ z ∈ Set.Ioo (-ε) ε ×ˢ Metric.ball (p, 0) r,
Φ z ∈ Metric.ball (p, 0) R ∧
HasDerivAt (fun t : ℝ => Φ (t, z.2))
((Φ z).2, -Γ (Φ z).1 (Φ z).2 (Φ z).2) z.1)
(hΦp : Φ (τ, (p, 0)) = (p, 0))
(e : OpenPartialHomeomorph (E × E) (E × E))
(he0 : (p, (0 : E)) ∈ e.source)
(hef : ∀ z : E × E, e z = (z.1, (Φ (τ, z)).1))
(hei : ContDiffAt ℝ (↑(⊤ : ℕ∞) : WithTop ℕ∞) e.symm (p, p)) :
∃ ρ > (0 : ℝ), Metric.ball p ρ ⊆ U ∧
ContDiffOn ℝ 1 (fun z : E × E => (e.symm z).2)
(Metric.ball p ρ ×ˢ Metric.ball p ρ) ∧
(∀ q ∈ Metric.ball p ρ, (q, (0 : E)) ∈ e.source ∧ e (q, 0) = (q, q)) ∧
∀ q ∈ Metric.ball p ρ,
(∀ z ∈ Metric.ball p ρ, (q, z) ∈ e.target ∧
e.symm (q, z) ∈ Metric.ball (p, 0) (r / 2)) ∧
(∀ d > (0 : ℝ), ContDiffOn ℝ 1
(fun z => Real.sqrt ((τ ^ 2 • g q) (e.symm (q, z)).2
(e.symm (q, z)).2 + d)) (Metric.ball p ρ)) ∧
(∀ d > (0 : ℝ), ∀ z ∈ Metric.ball p ρ, ∀ w : E,
|fderiv ℝ (fun y => Real.sqrt ((τ ^ 2 • g q) (e.symm (q, y)).2
(e.symm (q, y)).2 + d)) z w| ≤ Real.sqrt (g z w w)) := by
have hzero : (0 : ℝ) ∈ Set.Ioo (-ε) ε := ⟨by linarith, hε⟩
have hep : e (p, 0) = (p, p) := by rw [hef, hΦp]
have hpt : (p, p) ∈ e.target := hep ▸ e.map_source he0
have hback : e.symm (p, p) = (p, 0) := by rw [← hep]; exact e.left_inv he0
obtain ⟨A, hAp, hInvA⟩ := hei.contDiffOn (m := 1) (by simp) (by simp)
have hN : A ∩ (e.target ∩ e.symm ⁻¹' Metric.ball (p, (0 : E)) (r / 2)) ∈
nhds (p, p) :=
Filter.inter_mem hAp ((e.isOpen_inter_preimage_symm Metric.isOpen_ball).mem_nhds
⟨hpt, by
change e.symm (p, p) ∈ Metric.ball (p, 0) (r / 2)
rw [hback]; exact Metric.mem_ball_self (half_pos hr)⟩)
obtain ⟨b, hb, hbsub⟩ := Metric.mem_nhds_iff.mp hN
obtain ⟨a, ha, hasub⟩ := Metric.mem_nhds_iff.mp (e.open_source.mem_nhds he0)
let ρ := min b (min a (r / 2))
have hρ : 0 < ρ := lt_min hb (lt_min ha (half_pos hr))
have hρb : ρ ≤ b := min_le_left _ _
have hρa : ρ ≤ a := (min_le_right _ _).trans (min_le_left _ _)
have hρr : ρ ≤ r / 2 := (min_le_right _ _).trans (min_le_right _ _)
have hpairs {q z : E} (hq : q ∈ Metric.ball p ρ) (hz : z ∈ Metric.ball p ρ) :
(q, z) ∈ Metric.ball (p, p) b := by
simpa only [Metric.mem_ball, Prod.dist_eq, max_lt_iff] using
And.intro ((Metric.mem_ball.mp hq).trans_le hρb)
((Metric.mem_ball.mp hz).trans_le hρb)
have hbase {q : E} (hq : q ∈ Metric.ball p ρ) : dist q p < r / 2 :=
(Metric.mem_ball.mp hq).trans_le hρr
have hinitial {q u : E} (hq : q ∈ Metric.ball p ρ) (hu : ‖u‖ < r / 2) :
(q, u) ∈ Metric.ball (p, 0) r := by
rw [Metric.mem_ball, Prod.dist_eq, max_lt_iff, dist_zero_right]
exact ⟨by linarith [hbase hq], by linarith⟩
have hdiag {q : E} (hq : q ∈ Metric.ball p ρ) :
(q, (0 : E)) ∈ e.source ∧ e (q, 0) = (q, q) := by
have hq0 : (q, (0 : E)) ∈ Metric.ball (p, 0) r :=
hinitial hq (by simpa using half_pos hr)
have hqR : (q, (0 : E)) ∈ Metric.ball (p, 0) R := by
simpa only [hΦ0 _ hq0] using (hΦF (0, (q, 0)) ⟨hzero, hq0⟩).1
have hstationary := Helpers.eq_const_of_lipschitz_ode hLip hqR
(show ((0 : E), -Γ q 0 0) = (0 : E × E) by simp) hzero
(X := fun t => Φ (t, (q, 0)))
(fun t ht => ⟨(hΦF (t, (q, 0)) ⟨ht, hq0⟩).2,
(hΦF (t, (q, 0)) ⟨ht, hq0⟩).1⟩) (hΦ0 _ hq0)
refine ⟨hasub ?_, ?_⟩
· simpa [Metric.mem_ball, Prod.dist_eq, max_lt_iff, ha] using
(Metric.mem_ball.mp hq).trans_le hρa
· rw [hef, hstationary τ hτ]
have hUρ : Metric.ball p ρ ⊆ U := by
intro q hq
have hq0 := hinitial hq (u := 0) (by simpa using half_pos hr)
have hqR : (q, (0 : E)) ∈ Metric.ball (p, 0) R := by
simpa only [hΦ0 _ hq0] using (hΦF (0, (q, 0)) ⟨hzero, hq0⟩).1
exact hdom _ hqR
refine ⟨ρ, hρ, hUρ, contDiff_snd.comp_contDiffOn
(hInvA.mono (fun z hz => (hbsub (hpairs hz.1 hz.2)).1)),
(fun q hq => hdiag hq), ?_⟩
intro q hq
let f : E → E := fun z => (e.symm (q, z)).2
let F : E → E := fun u => (Φ (τ, (q, u))).1
have hf : ContDiffOn ℝ 1 f (Metric.ball p ρ) :=
contDiff_snd.comp_contDiffOn (hInvA.comp
(contDiffOn_const.prodMk contDiffOn_id)
(fun z hz => (hbsub (hpairs hq hz)).1))
have hFinv {z : E} (hz : z ∈ Metric.ball p ρ) : F (f z) = z := by
have hh := e.right_inv (hbsub (hpairs hq hz)).2.1
have hfirst : (e.symm (q, z)).1 = q := by
simpa only [hef] using congrArg Prod.fst hh
have hrep : (q, f z) = e.symm (q, z) := Prod.ext hfirst.symm rfl
change (Φ (τ, (q, f z))).1 = z
rw [hrep]
simpa only [hef] using congrArg Prod.snd hh
have hfnorm {z : E} (hz : z ∈ Metric.ball p ρ) : ‖f z‖ < r / 2 := by
have hh := (hbsub (hpairs hq hz)).2.2
simpa only [f, dist_zero_right] using
(max_lt_iff.mp (Metric.mem_ball.mp hh)).2
have hshift : Metric.ball (q, (0 : E)) (r / 2) ⊆ Metric.ball (p, 0) r := by
intro z hz
have hdist : dist (q, (0 : E)) (p, (0 : E)) < r / 2 := by
simpa [Prod.dist_eq] using hbase hq
exact Metric.mem_ball.mpr ((dist_triangle z (q, 0) (p, 0)).trans_lt
(by linarith [Metric.mem_ball.mp hz]))
have hΦq : ContDiffOn ℝ 2 Φ
(Set.Ioo (-ε) ε ×ˢ Metric.ball (q, 0) (r / 2)) :=
hΦ.mono (Set.prod_mono_right hshift)
have hODEq : ∀ z ∈ Set.Ioo (-ε) ε ×ˢ Metric.ball (q, 0) (r / 2),
(Φ z).1 ∈ U ∧ HasDerivAt (fun t : ℝ => Φ (t, z.2))
((Φ z).2, -Γ (Φ z).1 (Φ z).2 (Φ z).2) z.1 :=
fun z hz => ⟨hdom _ (hΦF z ⟨hz.1, hshift hz.2⟩).1,
(hΦF z ⟨hz.1, hshift hz.2⟩).2⟩
have hF : ContDiffOn ℝ 2 F (Metric.ball 0 (r / 2)) :=
contDiff_fst.comp_contDiffOn (hΦ.comp
(contDiffOn_const.prodMk (contDiffOn_const.prodMk contDiffOn_id))
(fun u hu => ⟨hτ, hinitial hq (by simpa using hu)⟩))
let B : E →L[ℝ] E →L[ℝ] ℝ := τ ^ 2 • g q
have hBsym : ∀ u v, B u v = B v u := by
intro u v
change τ ^ 2 * g q u v = τ ^ 2 * g q v u
rw [hsym]
have hn : ∀ z ∈ U, ∀ u, 0 ≤ g z u u := by
intro z hz u
by_cases hu : u = 0
· simp [hu]
· exact (hpos z hz u hu).le
refine ⟨(fun z hz => ⟨(hbsub (hpairs hq hz)).2.1,
(hbsub (hpairs hq hz)).2.2⟩), ?_, ?_⟩
· intro d hd
exact ((((contDiffOn_const (c := B)).clm_apply hf).clm_apply hf).add
contDiffOn_const).sqrt (fun z hz => ne_of_gt (by
have hbnonneg : 0 ≤ B (f z) (f z) :=
mul_nonneg (sq_nonneg τ) (hn q (hUρ hq) _)
linarith))
· intro d hd z hz w
have hdf := (hf.contDiffAt (Metric.isOpen_ball.mem_nhds hz)).differentiableAt_one
have hdz : f z ∈ Metric.ball 0 (r / 2) := by simpa using hfnorm hz
have hdF := (hF.contDiffAt (Metric.isOpen_ball.mem_nhds hdz)).differentiableAt
(by norm_num)
have hcomp := hdF.hasFDerivAt.comp z hdf.hasFDerivAt
have hEq : (fun y => F (f y)) =ᶠ[nhds z] id := by
filter_upwards [Metric.isOpen_ball.mem_nhds hz] with y hy using hFinv hy
have hid := hcomp.congr_of_eventuallyEq hEq.symm
have hcancel : ∀ u, fderiv ℝ F (f z) (fderiv ℝ f z u) = u := by
intro u
exact congrArg (fun L : E →L[ℝ] E => L u) (hid.unique (hasFDerivAt_id z))
apply Helpers.regularized_radius_fderiv_bound_of_gauss (g z) B (hsym z)
(hn z (hUρ hz)) hBsym hdf (fderiv ℝ F (f z)) ?_ hcancel hd w
have hv : (q, f z) ∈ Metric.ball (q, 0) (r / 2) := by
simpa [Metric.mem_ball, Prod.dist_eq] using hfnorm hz
have hscale : ∀ κ ∈ Set.Icc (0 : ℝ) 1,
(Φ (τ, (q, κ • f z))).1 = (Φ (κ * τ, (q, f z))).1 := by
intro κ hκ
apply congrArg Prod.fst
(Helpers.coordinate_spray_flow_rescale_in_common_ball Γ (fun t u => Φ (t, u)) p q
hε hLip (fun u hu => hΦ0 _ (hinitial hq hu))
(fun u hu t ht => ⟨(hΦF (t, (q, u)) ⟨abs_lt.mp ht, hinitial hq hu⟩).2,
(hΦF (t, (q, u)) ⟨abs_lt.mp ht, hinitial hq hu⟩).1⟩)
κ τ (f z) (by simpa [abs_of_nonneg hκ.1] using hκ.2)
(abs_lt.mpr hτ) (hfnorm hz))
have hgauss := Helpers.coordinate_spray_endpoint_gauss hU hg hsym hKoszul hε hΦq
(fun u hu => hΦ0 u (hshift hu)) hODEq hv hτ hscale
simpa only [F, f, B, hFinv hz, smul_apply, smul_eq_mul] using hgauss
theorem Helpers.exists_pairwise_radius_lower_bound_of_local_path_control : open scoped Bundle in
∀ {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
{H : Type*} [TopologicalSpace H] (I : ModelWithCorners ℝ E H)
(M : Type*) [EMetricSpace M] [ChartedSpace H M] [IsManifold I 1 M]
[Bundle.RiemannianBundle (fun x : M => TangentSpace I x)]
[IsRiemannianManifold I M] [ConnectedSpace M]
(p : M) (A : Set M) (hA : IsOpen A) (hpA : p ∈ A)
(ρ : M × M → ℝ) (hρ : ContinuousAt ρ (p, p))
(hρzero : ∀ q ∈ A, ρ (q, q) = 0)
(hρnonneg : ∀ q z, 0 ≤ ρ (q, z))
(hbound : ∀ q ∈ A, ∀ (γ : ℝ → M) (a b : ℝ), a ≤ b →
ContMDiffOn (modelWithCornersSelf ℝ ℝ) I 1 γ (Set.Icc a b) →
Set.MapsTo γ (Set.Icc a b) A →
enorm (ρ (q, γ b) - ρ (q, γ a)) ≤ Manifold.pathELength I γ a b),
∃ V : Set M, IsOpen V ∧ p ∈ V ∧ V ⊆ A ∧
∀ q ∈ V, ∀ z ∈ V, ENNReal.ofReal (ρ (q, z)) ≤ edist q z := by
intro E _ _ H _ I M _ _ _ _ _ _ p A hA hpA ρ hρ hρzero hρnonneg hbound
letI : MetricSpace M := EMetricSpace.toMetricSpace Helpers.edist_ne_top_of_preconnected
letI : (x : M) → NormedAddCommGroup (TangentSpace I x) := fun x =>
Bundle.instNormedAddCommGroupOfRiemannianBundleOfIsTopologicalAddGroupOfContinuousConstSMulReal
(E := fun x : M => TangentSpace I x) x
obtain ⟨R, hR, hRA⟩ := Metric.mem_nhds_iff.mp (hA.mem_nhds hpA)
have hsmall : {z : M × M | ρ z < R / 2} ∈ nhds (p, p) :=
hρ.preimage_mem_nhds (Iio_mem_nhds (by rw [hρzero p hpA]; exact half_pos hR))
obtain ⟨η, hη, hηρ⟩ := Metric.mem_nhds_iff.mp hsmall
let δ := min η (R / 4)
have hδ : 0 < δ := lt_min hη (by positivity)
have hnear {q : M} (hq : q ∈ Metric.ball p δ) : dist q p < R / 4 :=
(Metric.mem_ball.mp hq).trans_le (min_le_right _ _)
have hVA : Metric.ball p δ ⊆ A := fun q hq => hRA
(Metric.mem_ball.mpr (by linarith [hnear hq]))
refine ⟨Metric.ball p δ, Metric.isOpen_ball, Metric.mem_ball_self hδ, hVA, ?_⟩
intro q hq z hz
have hρsmall : ρ (q, z) < R / 2 := by
apply hηρ
simpa only [Metric.mem_ball, Prod.dist_eq, max_lt_iff] using
And.intro ((Metric.mem_ball.mp hq).trans_le (min_le_left _ _))
((Metric.mem_ball.mp hz).trans_le (min_le_left _ _))
rw [IsRiemannianManifold.out (I := I)]
by_contra h
obtain ⟨γ, hγ0, hγ1, hγ, hlen⟩ :=
Manifold.exists_lt_of_riemannianEDist_lt (lt_of_not_ge h)
by_cases hstay : Set.MapsTo γ (Set.Icc (0 : ℝ) 1) (Metric.ball p R)
· have hb := hbound q (hVA hq) γ 0 1 zero_le_one hγ
(fun t ht => hRA (hstay ht))
have hb' : ENNReal.ofReal (ρ (q, z)) ≤ Manifold.pathELength I γ 0 1 := by
simpa only [hγ0, hγ1, hρzero q (hVA hq), sub_zero,
Real.enorm_eq_ofReal (hρnonneg q z)] using hb
exact (not_lt_of_ge hb') hlen
· obtain ⟨t, ht, htU⟩ : ∃ t ∈ Set.Icc (0 : ℝ) 1, γ t ∉ Metric.ball p R := by
simpa only [Set.MapsTo, not_forall, exists_prop] using hstay
have hRle : R ≤ dist (γ t) p := not_lt.mp (by simpa [Metric.mem_ball] using htU)
have hpre : edist q (γ t) ≤ Manifold.pathELength I γ 0 1 := by
rw [IsRiemannianManifold.out (I := I)]
exact (Manifold.riemannianEDist_le_pathELength
(hγ.mono (Set.Icc_subset_Icc le_rfl ht.2)) hγ0 rfl ht.1).trans
(Manifold.pathELength_mono le_rfl ht.2)
have hfinite := (hlen.trans ENNReal.ofReal_lt_top).ne
have hpre' := ENNReal.toReal_mono hfinite hpre
have hlen' := (ENNReal.toReal_lt_toReal hfinite ENNReal.ofReal_ne_top).mpr hlen
simp only [edist_dist, ENNReal.toReal_ofReal dist_nonneg] at hpre'
rw [ENNReal.toReal_ofReal (hρnonneg q z)] at hlen'
have htri := dist_triangle (γ t) q p
rw [dist_comm (γ t) q] at htri
linarith [hnear hq]
theorem Helpers.exists_scaled_phase_endpoints_in_joint_spray_inverse
{E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
{Γ : E → E →L[ℝ] E →L[ℝ] E} {p : E}
{R r ε τ : ℝ} {K : NNReal} (hR : 0 < R) (hr : 0 < r)
(hε : 0 < ε) (hτ : 0 < τ) (hτε : τ < ε)
(hLip : LipschitzOnWith K (fun z : E × E => (z.2, -Γ z.1 z.2 z.2))
(Metric.ball (p, 0) R))
{Φ : ℝ × (E × E) → E × E}
(hΦ0 : ∀ z ∈ Metric.ball (p, 0) r, Φ (0, z) = z)
(hΦF : ∀ z ∈ Set.Ioo (-ε) ε ×ˢ Metric.ball (p, 0) r,
Φ z ∈ Metric.ball (p, 0) R ∧
HasDerivAt (fun t : ℝ => Φ (t, z.2))
((Φ z).2, -Γ (Φ z).1 (Φ z).2 (Φ z).2) z.1)
(e : OpenPartialHomeomorph (E × E) (E × E))
(he0 : (p, (0 : E)) ∈ e.source)
(hef : ∀ z : E × E, e z = (z.1, (Φ (τ, z)).1))
{x v : ℝ → E} {a : ℝ} (ha : 0 < a) (hx0 : x 0 = p)
(hx : ContinuousAt x 0) (hv : ContinuousAt v 0)
(hODE : ∀ t ∈ Set.Ioo (-a) a,
HasDerivAt x (v t) t ∧ HasDerivAt v (-Γ (x t) (v t) (v t)) t) :
∃ δ > (0 : ℝ), δ ≤ a ∧
∀ s ∈ Set.Ioo (-δ) δ, ∀ t ∈ Set.Ioo (-δ) δ, s ≤ t →
(x s, ((t - s) / τ) • v s) ∈ e.source ∧
e (x s, ((t - s) / τ) • v s) = (x s, x t) := by
let Z : ℝ × ℝ → E × E := fun z => (x z.1, z.2 • v z.1)
have hZ : ContinuousAt Z (0, 0) := by
have hx' : ContinuousAt (fun z : ℝ × ℝ => x z.1) (0, 0) :=
hx.comp (f := fun z : ℝ × ℝ => z.1) (x := (0, 0)) continuousAt_fst
have hv' : ContinuousAt (fun z : ℝ × ℝ => v z.1) (0, 0) :=
hv.comp (f := fun z : ℝ × ℝ => z.1) (x := (0, 0)) continuousAt_fst
exact hx'.prodMk (continuousAt_snd.smul hv')
have hZ0 : Z (0, 0) = (p, 0) := by simp [Z, hx0]
let S := e.source ∩ (Metric.ball (p, (0 : E)) r ∩ Metric.ball (p, 0) R)
have hS : S ∈ nhds (p, 0) := Filter.inter_mem (e.open_source.mem_nhds he0)
(Filter.inter_mem (Metric.ball_mem_nhds _ hr) (Metric.ball_mem_nhds _ hR))
obtain ⟨η, hη, hηsub⟩ := Metric.mem_nhds_iff.mp
(hZ.preimage_mem_nhds (hZ0.symm ▸ hS))
let δ := min (a / 2) (min (η / 2) (τ * η / 4))
have hδ : 0 < δ := lt_min (half_pos ha) (lt_min (half_pos hη) (by positivity))
have hδa : δ ≤ a := (min_le_left _ _).trans (by linarith)
have hδη : δ ≤ η / 2 := (min_le_right _ _).trans (min_le_left _ _)
have hδτη : δ ≤ τ * η / 4 := (min_le_right _ _).trans (min_le_right _ _)
refine ⟨δ, hδ, hδa, ?_⟩
intro s hs t ht hst
let κ := (t - s) / τ
have hκnonneg : 0 ≤ κ := div_nonneg (sub_nonneg.mpr hst) hτ.le
have hκτ : κ * τ = t - s := div_mul_cancel₀ _ hτ.ne'
have hκsmall : |κ| < η := by
rw [abs_of_nonneg hκnonneg]
apply (div_lt_iff₀ hτ).mpr
have := hs.1
have := ht.2
nlinarith
have hscaled {u : ℝ} (hu : u ∈ Set.Ioo (-δ) δ) : (x u, κ • v u) ∈ S := by
change Z (u, κ) ∈ S
apply hηsub
rw [Metric.mem_ball, Prod.dist_eq, max_lt_iff]
exact ⟨by simpa only [Real.dist_eq, sub_zero] using
(abs_lt.mpr hu).trans_le (hδη.trans (by linarith)), by
simpa only [Real.dist_eq, sub_zero] using hκsmall⟩
have hinterval {u : ℝ} (hu : u ∈ Set.Icc (0 : ℝ) τ) :
s + κ * u ∈ Set.Ioo (-δ) δ := by
have hlo : 0 ≤ κ * u := mul_nonneg hκnonneg hu.1
have hhi : κ * u ≤ κ * τ := mul_le_mul_of_nonneg_left hu.2 hκnonneg
constructor <;> linarith [hs.1, ht.2]
have htime {u : ℝ} (hu : u ∈ Set.Icc (0 : ℝ) τ) : u ∈ Set.Ioo (-ε) ε :=
⟨by linarith [hu.1], hu.2.trans_lt hτε⟩
have hD (u : ℝ) (hu : u ∈ Set.Icc (0 : ℝ) τ) :
HasDerivAt (fun z => (x (s + κ * z), κ • v (s + κ * z)))
(κ • v (s + κ * u), -Γ (x (s + κ * u))
(κ • v (s + κ * u)) (κ • v (s + κ * u))) u := by
have harg : s + κ * u ∈ Set.Ioo (-a) a :=
⟨(neg_le_neg hδa).trans_lt (hinterval hu).1, (hinterval hu).2.trans_le hδa⟩
have hdu : HasDerivAt (fun z : ℝ => s + κ * z) κ u := by
simpa using ((hasDerivAt_id u).const_mul κ).const_add s
have hdx := (hODE _ harg).1.scomp u hdu
have hdv := ((hODE _ harg).2.scomp u hdu).const_smul κ
simpa only [Function.comp_def, Pi.smul_apply, map_smul, smul_apply, smul_neg] using hdx.prodMk hdv
have hstart := hscaled hs
have hFlowC : ContinuousOn (fun u => Φ (u, (x s, κ • v s))) (Set.Icc 0 τ) :=
fun u hu => (hΦF (u, (x s, κ • v s)) ⟨htime hu, hstart.2.1⟩).2.continuousAt.continuousWithinAt
have hOldC : ContinuousOn (fun u => (x (s + κ * u), κ • v (s + κ * u)))
(Set.Icc 0 τ) := fun u hu => (hD u hu).continuousAt.continuousWithinAt
have huniq := ODE_solution_unique_of_mem_Icc_right
(v := fun _ (z : E × E) => (z.2, -Γ z.1 z.2 z.2))
(s := fun _ => Metric.ball (p, 0) R)
(fun _ _ => hLip) hFlowC
(fun u hu => (hΦF (u, (x s, κ • v s)) ⟨htime ⟨hu.1, hu.2.le⟩,
hstart.2.1⟩).2.hasDerivWithinAt)
(fun u hu => (hΦF (u, (x s, κ • v s)) ⟨htime ⟨hu.1, hu.2.le⟩,
hstart.2.1⟩).1) hOldC
(fun u hu => (hD u ⟨hu.1, hu.2.le⟩).hasDerivWithinAt)
(fun u hu => (hscaled (hinterval ⟨hu.1, hu.2.le⟩)).2.2)
(by simpa only [mul_zero, add_zero] using hΦ0 _ hstart.2.1)
have hend := huniq (show τ ∈ Set.Icc (0 : ℝ) τ from ⟨hτ.le, le_rfl⟩)
change Φ (τ, (x s, κ • v s)) =
(x (s + κ * τ), κ • v (s + κ * τ)) at hend
refine ⟨hstart.1, ?_⟩
change e (x s, κ • v s) = (x s, x t)
rw [hef, hend]
have heq : s + κ * τ = t := by linarith
simp only [heq]
theorem Helpers.exists_chart_pairwise_radius_lower_bound
{E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
{H : Type*} [TopologicalSpace H] (I : ModelWithCorners ℝ E H) [I.Boundaryless]
(M : Type*) [EMetricSpace M] [ChartedSpace H M] [IsManifold I 1 M]
[Bundle.RiemannianBundle (fun x : M => TangentSpace I x)]
[IsRiemannianManifold I M] [ConnectedSpace M]
(p : M) (g : E → E →L[ℝ] E →L[ℝ] ℝ)
(hg : ContinuousOn g (extChartAt I p).target)
(hnorm : ∀ z ∈ (extChartAt I p).target, ∀ w : E,
g z w w = ‖mfderivWithin (modelWithCornersSelf ℝ E) I
(extChartAt I p).symm (Set.range I) z w‖ ^ 2)
(e : OpenPartialHomeomorph (E × E) (E × E)) (τ ρ : ℝ) (hρ : 0 < ρ)
(hInv : ContDiffOn ℝ 1 (fun z : E × E => (e.symm z).2)
(Metric.ball (extChartAt I p p) ρ ×ˢ Metric.ball (extChartAt I p p) ρ))
(hdiag : ∀ q ∈ Metric.ball (extChartAt I p p) ρ,
(q, (0 : E)) ∈ e.source ∧ e (q, 0) = (q, q))
(hsmooth : ∀ q ∈ Metric.ball (extChartAt I p p) ρ, ∀ d > (0 : ℝ),
ContDiffOn ℝ 1 (fun z => Real.sqrt ((τ ^ 2 • g q) (e.symm (q, z)).2
(e.symm (q, z)).2 + d)) (Metric.ball (extChartAt I p p) ρ))
(hbound : ∀ q ∈ Metric.ball (extChartAt I p p) ρ, ∀ d > (0 : ℝ),
∀ z ∈ Metric.ball (extChartAt I p p) ρ, ∀ w : E,
|fderiv ℝ (fun y => Real.sqrt ((τ ^ 2 • g q) (e.symm (q, y)).2
(e.symm (q, y)).2 + d)) z w| ≤ Real.sqrt (g z w w)) :
∃ V : Set M, IsOpen V ∧ p ∈ V ∧
V ⊆ (extChartAt I p).source ∩ (extChartAt I p) ⁻¹' Metric.ball (extChartAt I p p) ρ ∧
∀ q ∈ V, ∀ z ∈ V,
ENNReal.ofReal (Real.sqrt ((τ ^ 2 • g (extChartAt I p q))
(e.symm (extChartAt I p q, extChartAt I p z)).2
(e.symm (extChartAt I p q, extChartAt I p z)).2)) ≤ edist q z := by
let A := (extChartAt I p).source ∩
(extChartAt I p) ⁻¹' Metric.ball (extChartAt I p p) ρ
have hA : IsOpen A := isOpen_extChartAt_preimage' p Metric.isOpen_ball
have hpA : p ∈ A := ⟨mem_extChartAt_source p, Metric.mem_ball_self hρ⟩
let F : E × E → ℝ := fun z =>
(τ ^ 2 • g z.1) (e.symm z).2 (e.symm z).2
let Q : M × M → ℝ := fun z => Real.sqrt (F (extChartAt I p z.1, extChartAt I p z.2))
have hG : ContinuousAt (fun z : E × E => g z.1) (extChartAt I p p, extChartAt I p p) :=
(hg.continuousAt ((isOpen_extChartAt_target p).mem_nhds
(mem_extChartAt_target p))).comp (f := fun z : E × E => z.1)
(x := (extChartAt I p p, extChartAt I p p)) continuousAt_fst
have hV : ContinuousAt (fun z : E × E => (e.symm z).2)
(extChartAt I p p, extChartAt I p p) :=
(hInv.contDiffAt ((Metric.isOpen_ball.prod Metric.isOpen_ball).mem_nhds
⟨Metric.mem_ball_self hρ, Metric.mem_ball_self hρ⟩)).continuousAt
have hB : ContinuousAt (fun z : E × E => τ ^ 2 • g z.1)
(extChartAt I p p, extChartAt I p p) := hG.const_smul (τ ^ 2)
have hF : ContinuousAt F (extChartAt I p p, extChartAt I p p) :=
(hB.clm_apply hV).clm_apply hV
have hC : ContinuousAt (fun z : M × M =>
(extChartAt I p z.1, extChartAt I p z.2)) (p, p) :=
((continuousAt_extChartAt p).comp (f := fun z : M × M => z.1)
(x := (p, p)) continuousAt_fst).prodMk
((continuousAt_extChartAt p).comp (f := fun z : M × M => z.2)
(x := (p, p)) continuousAt_snd)
have hQ : ContinuousAt Q (p, p) := hF.sqrt.comp
(f := fun z : M × M => (extChartAt I p z.1, extChartAt I p z.2))
(x := (p, p)) hC
apply Helpers.exists_pairwise_radius_lower_bound_of_local_path_control I M p A hA hpA
Q hQ ?_ (fun q z => Real.sqrt_nonneg _) ?_
· intro q hq
have hd := hdiag (extChartAt I p q) hq.2
have hi : e.symm (extChartAt I p q, extChartAt I p q) = (extChartAt I p q, 0) := by
rw [← hd.2]
exact e.left_inv hd.1
change Real.sqrt ((τ ^ 2 • g (extChartAt I p q))
(e.symm (extChartAt I p q, extChartAt I p q)).2
(e.symm (extChartAt I p q, extChartAt I p q)).2) = 0
rw [hi]
simp
· intro q hq γ a b hab hγ hγA
let P : E → ℝ := fun z => (τ ^ 2 • g (extChartAt I p q))
(e.symm (extChartAt I p q, z)).2 (e.symm (extChartAt I p q, z)).2
letI : (y : M) → NormedAddCommGroup (TangentSpace I y) := fun y =>
Bundle.instNormedAddCommGroupOfRiemannianBundleOfIsTopologicalAddGroupOfContinuousConstSMulReal
(E := fun x : M => TangentSpace I x) y
have hlim (z : M) : Filter.Tendsto
(fun d : ℝ => Real.sqrt (P (extChartAt I p z) + d))
(nhdsWithin 0 (Set.Ioi 0)) (nhds (Real.sqrt (P (extChartAt I p z)))) := by
have hc : Continuous (fun d : ℝ => Real.sqrt (P (extChartAt I p z) + d)) := by fun_prop
simpa only [add_zero] using
(hc.continuousAt (x := 0)).tendsto.mono_left nhdsWithin_le_nhds
change enorm (Real.sqrt (P (extChartAt I p (γ b))) -
Real.sqrt (P (extChartAt I p (γ a)))) ≤ _
apply le_of_tendsto (continuous_enorm.continuousAt.tendsto.comp
((hlim (γ b)).sub (hlim (γ a))))
filter_upwards [self_mem_nhdsWithin] with d hd
apply Helpers.enorm_sub_le_pathELength_of_coordinate_bound I A hA
(Metric.ball (extChartAt I p p) ρ) Metric.isOpen_ball (extChartAt I p)
(contMDiffOn_extChartAt.mono (fun _ hx => by
simpa only [extChartAt_source] using hx.1)) (fun _ hx => hx.2)
(fun z => Real.sqrt (P z + d)) (hsmooth _ hq.2 d hd) ?_ γ a b hab hγ hγA
intro z hz w
rw [Real.enorm_eq_ofReal_abs, ← ofReal_norm]
apply ENNReal.ofReal_le_ofReal
exact (hbound _ hq.2 d hd _ hz.2 _).trans_eq
(Helpers.sqrt_coordinate_metric_chart_derivative_eq_norm p g hnorm z hz.1 w)
theorem Helpers.coordinate_spray_locally_distance_linear
{E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E]
{H : Type*} [TopologicalSpace H] (I : ModelWithCorners ℝ E H) [I.Boundaryless]
(M : Type*) [EMetricSpace M] [ChartedSpace H M] [IsManifold I ∞ M]
[Bundle.RiemannianBundle (fun x : M => TangentSpace I x)]
[IsContMDiffRiemannianBundle I ∞ E (fun x : M => TangentSpace I x)]
[IsContinuousRiemannianBundle E (fun x : M => TangentSpace I x)]
[IsRiemannianManifold I M] [LocallyCompactSpace M] [ConnectedSpace M]
(p : M) (g : E → E →L[ℝ] E →L[ℝ] ℝ) (Γ : E → E →L[ℝ] E →L[ℝ] E)
(hg : ContDiffOn ℝ ∞ g (extChartAt I p).target)
(hΓ : ContDiffOn ℝ ∞ Γ (extChartAt I p).target)
(hsym : ∀ z u v, g z u v = g z v u)
(hpos : ∀ z ∈ (extChartAt I p).target, ∀ v : E, v ≠ 0 → 0 < g z v v)
(hnorm : ∀ z ∈ (extChartAt I p).target, ∀ v : E,
g z v v = ‖mfderivWithin (modelWithCornersSelf ℝ E) I
(extChartAt I p).symm (Set.range I) z v‖ ^ 2)
(hKoszul : ∀ z ∈ (extChartAt I p).target, ∀ u v w : E,
2 * g z (Γ z u v) w = (fderiv ℝ g z u) v w +
(fderiv ℝ g z v) u w - (fderiv ℝ g z w) u v)
{x v : ℝ → E} {ε : ℝ} {c : NNReal}
(hε : 0 < ε) (hx0 : x 0 = extChartAt I p p)
(hphase : ContDiffOn ℝ ∞ (fun t : ℝ => (x t, v t)) (Set.Ioo (-ε) ε))
(hODE : ∀ t ∈ Set.Ioo (-ε) ε, x t ∈ (extChartAt I p).target ∧
HasDerivAt x (v t) t ∧ HasDerivAt v (-(Γ (x t) (v t) (v t))) t)
(hEnergy : ∀ t ∈ Set.Ioo (-ε) ε, g (x t) (v t) (v t) = (c : ℝ) ^ 2) :
∃ δ > (0 : ℝ), δ ≤ ε ∧
∀ s ∈ Set.Ioo (-δ) δ, ∀ t ∈ Set.Ioo (-δ) δ,
edist ((extChartAt I p).symm (x s)) ((extChartAt I p).symm (x t)) =
(c : ENNReal) * ENNReal.ofReal |t - s| := by
let P := extChartAt I p p
have hU := isOpen_extChartAt_target (I := I) p
have hpU := mem_extChartAt_target (I := I) p
obtain ⟨R, hR, K, hLip, hdom, r, hr, a, ha, Φ, hΦ, hΦ0, hΦF, hΦp⟩ :=
Helpers.exists_coordinate_spray_flow_in_lipschitz_ball hU hΓ hpU
let τ := a / 2
have hτ : 0 < τ := half_pos ha
have hτa : τ < a := by dsimp [τ]; linarith
have hτtime : τ ∈ Set.Ioo (-a) a := ⟨by linarith, hτa⟩
have hΦat : ContDiffAt ℝ ∞ Φ (τ, (P, 0)) :=
hΦ.contDiffAt ((isOpen_Ioo.prod Metric.isOpen_ball).mem_nhds
⟨hτtime, Metric.mem_ball_self hr⟩)
have hlin := Helpers.coordinate_spray_flow_linearization hU hpU
((hΓ.contDiffAt (hU.mem_nhds hpU)).differentiableAt (by simp)) hr ha
(hΦ.of_le (by simp)) hΦ0 hΦp (fun z hz => (hΦF z hz).2)
obtain ⟨e, he0, hept, hef, he, hei⟩ :=
Helpers.exists_joint_inverse_of_spray_flow_linearization hτ.ne' hΦat (hΦp τ hτtime)
(hlin τ hτtime)
obtain ⟨ρ, hρ, hρU, hInv, hdiag, hcontrol⟩ :=
Helpers.exists_uniform_radius_control_of_joint_spray_inverse hU
(hg.of_le (by simp)) hsym hpos hKoszul hr ha hτtime hLip hdom
(hΦ.of_le (by simp)) hΦ0 hΦF (hΦp τ hτtime) e he0 hef hei
obtain ⟨V, hV, hpV, hVA, hLower⟩ :=
Helpers.exists_chart_pairwise_radius_lower_bound I M p g hg.continuousOn hnorm e τ ρ hρ
hInv hdiag (fun q hq => (hcontrol q hq).2.1)
(fun q hq => (hcontrol q hq).2.2)
have hzero : (0 : ℝ) ∈ Set.Ioo (-ε) ε := ⟨by linarith, hε⟩
have hphase0 := (hphase.contDiffAt (isOpen_Ioo.mem_nhds hzero)).continuousAt
obtain ⟨δ₀, hδ₀, hδ₀ε, hPair⟩ :=
Helpers.exists_scaled_phase_endpoints_in_joint_spray_inverse hR hr ha hτ hτa hLip
hΦ0 hΦF e he0 hef hε hx0 hphase0.fst hphase0.snd (fun t ht => (hODE t ht).2)
let η : ℝ → M := fun t => (extChartAt I p).symm (x t)
have hη0 : η 0 = p := by
change (extChartAt I p).symm (x 0) = p
rw [hx0]
exact (extChartAt I p).left_inv (mem_extChartAt_source p)
have hη : ContinuousAt η 0 :=
((continuousOn_extChartAt_symm p).continuousAt (hU.mem_nhds hpU)).comp_of_eq
hphase0.fst hx0
obtain ⟨b, hb, hbV⟩ := Metric.mem_nhds_iff.mp
(hη.preimage_mem_nhds (hV.mem_nhds (hη0.symm ▸ hpV)))
let δ := min δ₀ b
have hδ : 0 < δ := lt_min hδ₀ hb
have hsmall : Set.Ioo (-δ) δ ⊆ Set.Ioo (-δ₀) δ₀ := fun t ht =>
⟨(neg_le_neg (min_le_left _ _)).trans_lt ht.1, ht.2.trans_le (min_le_left _ _)⟩
have hold : Set.Ioo (-δ) δ ⊆ Set.Ioo (-ε) ε := fun t ht =>
⟨(neg_le_neg hδ₀ε).trans_lt (hsmall ht).1, (hsmall ht).2.trans_le hδ₀ε⟩
have hηV {t : ℝ} (ht : t ∈ Set.Ioo (-δ) δ) : η t ∈ V := by
apply hbV
simpa only [Metric.mem_ball, Real.dist_eq, sub_zero] using
(abs_lt.mpr ht).trans_le (min_le_right δ₀ b)
have hordered : ∀ s ∈ Set.Ioo (-δ) δ, ∀ t ∈ Set.Ioo (-δ) δ, s ≤ t →
edist (η s) (η t) = (c : ENNReal) * ENNReal.ofReal |t - s| := by
intro s hs t ht hst
have hsε := hold hs
have htε := hold ht
have hpair := hPair s (hsmall hs) t (hsmall ht) hst
have hi := e.left_inv hpair.1
rw [hpair.2] at hi
have hvel : (e.symm (x s, x t)).2 = ((t - s) / τ) • v s := congrArg Prod.snd hi
have hcoordS : extChartAt I p (η s) = x s :=
(extChartAt I p).right_inv (hODE s hsε).1
have hcoordT : extChartAt I p (η t) = x t :=
(extChartAt I p).right_inv (hODE t htε).1
have hRadius : Real.sqrt ((τ ^ 2 • g (x s)) (e.symm (x s, x t)).2
(e.symm (x s, x t)).2) = (c : ℝ) * (t - s) := by
rw [hvel]
have hsq : (τ ^ 2 • g (x s)) (((t - s) / τ) • v s)
(((t - s) / τ) • v s) = ((c : ℝ) * (t - s)) ^ 2 := by
simp only [smul_apply, map_smul, smul_eq_mul]
rw [hEnergy s hsε]
calc
_ = ((c : ℝ) * (τ * ((t - s) / τ))) ^ 2 := by ring
_ = ((c : ℝ) * (t - s)) ^ 2 := by
rw [mul_comm τ ((t - s) / τ), div_mul_cancel₀ _ hτ.ne']
rw [hsq, Real.sqrt_sq (mul_nonneg c.coe_nonneg (sub_nonneg.mpr hst))]
have hlower : ENNReal.ofReal ((c : ℝ) * (t - s)) ≤ edist (η s) (η t) := by
simpa only [hcoordS, hcoordT, hRadius] using
hLower (η s) (hηV hs) (η t) (hηV ht)
have hIcc : Set.Icc s t ⊆ Set.Ioo (-ε) ε := fun u hu =>
⟨hsε.1.trans_le hu.1, hu.2.trans_lt htε.2⟩
have hxc : ContDiffOn ℝ 1 x (Set.Icc s t) :=
((contDiff_fst.comp_contDiffOn hphase).of_le (by simp)).mono hIcc
have hupper := Helpers.riemannianEDist_inverse_chart_le_of_constant_energy I p g hnorm
x v s t (c : ℝ) hst c.coe_nonneg
(fun u hu => (hODE u (hIcc hu)).1) hxc
(fun u hu => (hODE u (hIcc hu)).2.1.hasDerivWithinAt)
(fun u hu => hEnergy u (hIcc hu))
have htarget : (c : ENNReal) * ENNReal.ofReal |t - s| =
ENNReal.ofReal ((c : ℝ) * (t - s)) := by
rw [abs_of_nonneg (sub_nonneg.mpr hst), ENNReal.ofReal_mul c.coe_nonneg,
ENNReal.ofReal_coe_nnreal]
rw [htarget]
apply le_antisymm ?_ hlower
rw [IsRiemannianManifold.out (I := I)]
simpa only [mul_comm (t - s) (c : ℝ)] using hupper
refine ⟨δ, hδ, (min_le_left δ₀ b).trans hδ₀ε, ?_⟩
intro s hs t ht
rcases le_total s t with hst | hts
· exact hordered s hs t ht hst
· simpa only [edist_comm, abs_sub_comm] using hordered t ht s hs hts
theorem Helpers.eq_of_bilinear_norm_add_ge
{E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
(B : E →L[ℝ] E →L[ℝ] ℝ) (hsym : ∀ u v, B u v = B v u)
(hpos : ∀ v : E, v ≠ 0 → 0 < B v v)
{u v : E} {c : ℝ} (hu : B u u = c ^ 2) (hv : B v v = c ^ 2)
(hadd : (2 * c) ^ 2 ≤ B (u + v) (u + v)) : u = v := by
by_contra hne
have hp := hpos (u - v) (sub_ne_zero.mpr hne)
simp only [map_sub, sub_apply, map_add, add_apply] at hp hadd
rw [hsym v u] at hp hadd
nlinarith
theorem Helpers.riemannianEDist_inverse_chart_le_of_speed_bound
{E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
{H : Type*} [TopologicalSpace H] (I : ModelWithCorners ℝ E H)
{M : Type*} [TopologicalSpace M] [ChartedSpace H M] [IsManifold I 1 M]
[Bundle.RiemannianBundle (fun z : M => TangentSpace I z)]
(p : M) (g : E → E →L[ℝ] E →L[ℝ] ℝ)
(hg : ∀ z ∈ (extChartAt I p).target, ∀ w : E,
g z w w = ‖mfderivWithin (modelWithCornersSelf ℝ E) I
(extChartAt I p).symm (Set.range I) z w‖ ^ 2)
(x v : ℝ → E) (a b k : ℝ) (hab : a ≤ b) (hk : 0 ≤ k)
(hx : Set.MapsTo x (Set.Icc a b) (extChartAt I p).target)
(hCx : ContDiffOn ℝ 1 x (Set.Icc a b))
(hderiv : ∀ t ∈ Set.Icc a b, HasDerivWithinAt x (v t) (Set.Icc a b) t)
(hspeed : ∀ t ∈ Set.Icc a b, Real.sqrt (g (x t) (v t) (v t)) ≤ k) :
Manifold.riemannianEDist I ((extChartAt I p).symm (x a))
((extChartAt I p).symm (x b)) ≤ ENNReal.ofReal ((b - a) * k) := by
rcases hab.eq_or_lt with rfl | hab'
· simp [Manifold.riemannianEDist_self]
have hpath : ContMDiffOn (modelWithCornersSelf ℝ ℝ) I 1
((extChartAt I p).symm ∘ x) (Set.Icc a b) :=
(contMDiffOn_extChartAt_symm p).comp (contMDiffOn_iff_contDiffOn.mpr hCx) hx
apply (Manifold.riemannianEDist_le_pathELength hpath rfl rfl hab).trans
rw [Manifold.pathELength_eq_lintegral_mfderivWithin_Icc]
calc
(∫⁻ t in Set.Icc a b, ‖mfderivWithin (modelWithCornersSelf ℝ ℝ) I
((extChartAt I p).symm ∘ x) (Set.Icc a b) t 1‖ₑ) ≤
∫⁻ _t in Set.Icc a b, ENNReal.ofReal k := by
apply MeasureTheory.setLIntegral_mono' measurableSet_Icc
intro t ht
rw [← ofReal_norm, Helpers.norm_mfderivWithin_inverse_chart_curve I p g hg x
(Set.Icc a b) t (v t) hx ht (uniqueDiffOn_Icc hab' t ht) (hderiv t ht)]
exact ENNReal.ofReal_le_ofReal (hspeed t ht)
_ = ENNReal.ofReal ((b - a) * k) := by
simp only [MeasureTheory.lintegral_const, MeasureTheory.Measure.restrict_apply_univ,
Real.volume_Icc, ← ENNReal.ofReal_mul hk, mul_comm k]
theorem Helpers.exists_inverse_chart_chord_bound
{E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
{H : Type*} [TopologicalSpace H] (I : ModelWithCorners ℝ E H) [I.Boundaryless]
{M : Type*} [TopologicalSpace M] [ChartedSpace H M] [IsManifold I 1 M]
[Bundle.RiemannianBundle (fun z : M => TangentSpace I z)]
(p : M) (g : E → E →L[ℝ] E →L[ℝ] ℝ)
(hg : ContinuousOn g (extChartAt I p).target)
(hnorm : ∀ z ∈ (extChartAt I p).target, ∀ w : E,
g z w w = ‖mfderivWithin (modelWithCornersSelf ℝ E) I
(extChartAt I p).symm (Set.range I) z w‖ ^ 2)
(w : E) (k : ℝ) (hk : Real.sqrt (g (extChartAt I p p) w w) < k) :
∃ r > (0 : ℝ), ∀ y z : E, ∀ h > (0 : ℝ),
y ∈ Metric.ball (extChartAt I p p) r →
z ∈ Metric.ball (extChartAt I p p) r →
h⁻¹ • (z - y) ∈ Metric.ball w r →
Manifold.riemannianEDist I ((extChartAt I p).symm y)
((extChartAt I p).symm z) ≤ ENNReal.ofReal (h * k) := by
let q := extChartAt I p p
have hgc : ContinuousAt g q := hg.continuousAt
((isOpen_extChartAt_target p).mem_nhds (mem_extChartAt_target p))
have hgprod : ContinuousAt (fun z : E × E => g z.1) (q,w) :=
ContinuousAt.comp (f := fun z : E × E => z.1) (x := (q,w)) hgc continuousAt_fst
have hsc : ContinuousAt (fun z : E × E => Real.sqrt (g z.1 z.2 z.2)) (q,w) :=
Real.continuous_sqrt.continuousAt.comp
((hgprod.clm_apply continuousAt_snd).clm_apply continuousAt_snd)
have hN : {z : E × E | z.1 ∈ (extChartAt I p).target ∧
Real.sqrt (g z.1 z.2 z.2) < k} ∈ nhds (q,w) :=
Filter.inter_mem
(continuousAt_fst.preimage_mem_nhds
((isOpen_extChartAt_target p).mem_nhds (mem_extChartAt_target p)))
(hsc.preimage_mem_nhds (Iio_mem_nhds hk))
obtain ⟨r,hr,hrN⟩ := Metric.mem_nhds_iff.mp hN
refine ⟨r,hr,?_⟩
intro y z h hh hy hz hd
let d : E := h⁻¹ • (z - y)
let l : ℝ → E := fun t => (1-t) • y + t • z
have hld (t : ℝ) (ht : t ∈ Set.Icc (0 : ℝ) 1) :
(l t,d) ∈ Metric.ball (q,w) r := by
rw [Metric.mem_ball,Prod.dist_eq,max_lt_iff]
refine ⟨?_,Metric.mem_ball.mp hd⟩
exact Metric.mem_ball.mp ((convex_ball q r) hy hz (by linarith [ht.1,ht.2])
ht.1 (by ring))
have hmaps : Set.MapsTo l (Set.Icc 0 1) (extChartAt I p).target :=
fun t ht => (hrN (hld t ht)).1
have hdx (t : ℝ) : HasDerivAt l (z-y) t := by
convert ((((hasDerivAt_const t (1 : ℝ)).sub (hasDerivAt_id t)).smul_const y).add
((hasDerivAt_id t).smul_const z)) using 1
· ext s
rfl
· simp only [zero_sub, neg_one_smul, one_smul]
abel
have heq : z-y = h • d := by dsimp [d]; rw [smul_inv_smul₀ hh.ne']
have hbound (t : ℝ) (ht : t ∈ Set.Icc (0 : ℝ) 1) :
Real.sqrt (g (l t) (z-y) (z-y)) ≤ h*k := by
rw [heq]
have he : g (l t) (h • d) (h • d) = h^2 * g (l t) d d := by
simp only [map_smul,smul_apply,smul_eq_mul]; ring
rw [he,Real.sqrt_mul (sq_nonneg h),Real.sqrt_sq hh.le]
exact mul_le_mul_of_nonneg_left (hrN (hld t ht)).2.le hh.le
have H := Helpers.riemannianEDist_inverse_chart_le_of_speed_bound I p g hnorm
l (fun _ => z-y) 0 1 (h*k) zero_le_one
(mul_nonneg hh.le ((Real.sqrt_nonneg _).trans hk.le)) hmaps (by dsimp [l]; fun_prop)
(fun t _ => (hdx t).hasDerivWithinAt) hbound
simpa [l] using H
theorem Helpers.chart_velocity_sum_lower_bound
{E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
{H : Type*} [TopologicalSpace H] (I : ModelWithCorners ℝ E H) [I.Boundaryless]
{M : Type*} [EMetricSpace M] [ChartedSpace H M] [IsManifold I 1 M]
[Bundle.RiemannianBundle (fun z : M => TangentSpace I z)]
[IsRiemannianManifold I M]
{γ : ℝ → M} {c : NNReal} {A D t₀ : ℝ}
(hlin : Helpers.MetricLocallyLinear γ c (Set.Ioo A D))
(ht₀ : t₀ ∈ Set.Ioo A D)
(g : E → E →L[ℝ] E →L[ℝ] ℝ)
(hg : ContinuousOn g (extChartAt I (γ t₀)).target)
(hnorm : ∀ z ∈ (extChartAt I (γ t₀)).target, ∀ w : E,
g z w w = ‖mfderivWithin (modelWithCornersSelf ℝ E) I
(extChartAt I (γ t₀)).symm (Set.range I) z w‖ ^ 2)
{u v : E}
(hu : HasDerivWithinAt (fun t => extChartAt I (γ t₀) (γ t)) u (Set.Ici t₀) t₀)
(hv : HasDerivWithinAt (fun t => extChartAt I (γ t₀) (γ t)) v (Set.Iic t₀) t₀) :
2 * (c : ℝ) ≤ Real.sqrt (g (extChartAt I (γ t₀) (γ t₀)) (u+v) (u+v)) := by
let p := γ t₀
let F : ℝ → E := fun t => extChartAt I p (γ t)
have hγ : ContinuousAt γ t₀ :=
hlin.continuousOn.continuousAt (isOpen_Ioo.mem_nhds ht₀)
have hF : ContinuousAt F t₀ := (continuousAt_extChartAt p).comp hγ
have hdu : HasDerivWithinAt (fun h : ℝ => F (t₀+h)) u (Set.Ici 0) 0 := by
simpa [Function.comp_def, F, p] using hu.scomp_of_eq (s := Set.Ici 0) 0
(((hasDerivAt_id (0 : ℝ)).const_add t₀).hasDerivWithinAt)
(fun h (hh : 0 ≤ h) => show t₀ ≤ t₀+h by linarith) (by simp)
have hdv : HasDerivWithinAt (fun h : ℝ => F (t₀-h)) (-v) (Set.Ici 0) 0 := by
simpa [Function.comp_def, F, p] using hv.scomp_of_eq (s := Set.Ici 0) 0
(((hasDerivAt_const (0 : ℝ) t₀).sub (hasDerivAt_id (0 : ℝ))).hasDerivWithinAt)
(fun h (hh : 0 ≤ h) => show t₀-h ≤ t₀ by linarith) (by simp)
have hX : HasDerivWithinAt (fun h : ℝ => F (t₀+h) - F (t₀-h)) (u+v)
(Set.Ioi 0) 0 := by
convert (hdu.sub hdv).Ioi_of_Ici using 1
simp only [sub_neg_eq_add]
have hrescale : Filter.Tendsto
(fun h : ℝ => h⁻¹ • (F (t₀+h) - F (t₀-h))) (nhdsWithin 0 (Set.Ioi 0))
(nhds (u+v)) := by
have hh := (hasDerivWithinAt_iff_tendsto_slope' (show (0 : ℝ) ∉ Set.Ioi 0 by simp)).mp hX
convert hh using 1
ext h
simp [slope_def_module]
by_contra hnot
have hlt := lt_of_not_ge hnot
obtain ⟨k,hk,hkc⟩ := exists_between hlt
obtain ⟨r,hr,hchord⟩ := Helpers.exists_inverse_chart_chord_bound I p g hg hnorm (u+v) k hk
have hplus : Filter.Tendsto (fun h : ℝ => t₀+h) (nhds 0) (nhds t₀) := by
simpa only [add_zero, Function.id_def] using
(tendsto_const_nhds.add (Filter.tendsto_id : Filter.Tendsto id (nhds (0 : ℝ)) (nhds 0)))
have hminus : Filter.Tendsto (fun h : ℝ => t₀-h) (nhds 0) (nhds t₀) := by
simpa only [sub_zero, Function.id_def] using
(tendsto_const_nhds.sub (Filter.tendsto_id : Filter.Tendsto id (nhds (0 : ℝ)) (nhds 0)))
have hR : ∀ᶠ h : ℝ in nhdsWithin 0 (Set.Ioi 0),
F (t₀+h) ∈ Metric.ball (extChartAt I p p) r := by
have H := hF.tendsto.comp hplus
exact (H.eventually (Metric.ball_mem_nhds _ hr)).filter_mono nhdsWithin_le_nhds
have hL : ∀ᶠ h : ℝ in nhdsWithin 0 (Set.Ioi 0),
F (t₀-h) ∈ Metric.ball (extChartAt I p p) r := by
have H := hF.tendsto.comp hminus
exact (H.eventually (Metric.ball_mem_nhds _ hr)).filter_mono nhdsWithin_le_nhds
have hSource : ∀ᶠ h : ℝ in nhds 0,
γ (t₀+h) ∈ (extChartAt I p).source ∧ γ (t₀-h) ∈ (extChartAt I p).source := by
have hS : ∀ᶠ t in nhds t₀, γ t ∈ (extChartAt I p).source :=
hγ.preimage_mem_nhds (extChartAt_source_mem_nhds (I := I) p)
exact (hplus.eventually hS).and (hminus.eventually hS)
obtain ⟨δ,hδ,hEq⟩ := hlin.on_open isOpen_Ioo ht₀
have hsmall : ∀ᶠ h : ℝ in nhdsWithin 0 (Set.Ioi 0), h < δ :=