-
Notifications
You must be signed in to change notification settings - Fork 259
/
PathConnected.lean
1327 lines (1107 loc) · 52.1 KB
/
PathConnected.lean
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
/-
Copyright (c) 2020 Patrick Massot. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Patrick Massot
-/
import Mathlib.Topology.Order.ProjIcc
import Mathlib.Topology.CompactOpen
import Mathlib.Topology.UnitInterval
#align_import topology.path_connected from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
/-!
# Path connectedness
## Main definitions
In the file the unit interval `[0, 1]` in `ℝ` is denoted by `I`, and `X` is a topological space.
* `Path (x y : X)` is the type of paths from `x` to `y`, i.e., continuous maps from `I` to `X`
mapping `0` to `x` and `1` to `y`.
* `Path.map` is the image of a path under a continuous map.
* `Joined (x y : X)` means there is a path between `x` and `y`.
* `Joined.somePath (h : Joined x y)` selects some path between two points `x` and `y`.
* `pathComponent (x : X)` is the set of points joined to `x`.
* `PathConnectedSpace X` is a predicate class asserting that `X` is non-empty and every two
points of `X` are joined.
Then there are corresponding relative notions for `F : Set X`.
* `JoinedIn F (x y : X)` means there is a path `γ` joining `x` to `y` with values in `F`.
* `JoinedIn.somePath (h : JoinedIn F x y)` selects a path from `x` to `y` inside `F`.
* `pathComponentIn F (x : X)` is the set of points joined to `x` in `F`.
* `IsPathConnected F` asserts that `F` is non-empty and every two
points of `F` are joined in `F`.
* `LocPathConnectedSpace X` is a predicate class asserting that `X` is locally path-connected:
each point has a basis of path-connected neighborhoods (we do *not* ask these to be open).
## Main theorems
* `Joined` and `JoinedIn F` are transitive relations.
One can link the absolute and relative version in two directions, using `(univ : Set X)` or the
subtype `↥F`.
* `pathConnectedSpace_iff_univ : PathConnectedSpace X ↔ IsPathConnected (univ : Set X)`
* `isPathConnected_iff_pathConnectedSpace : IsPathConnected F ↔ PathConnectedSpace ↥F`
For locally path connected spaces, we have
* `pathConnectedSpace_iff_connectedSpace : PathConnectedSpace X ↔ ConnectedSpace X`
* `IsOpen.isConnected_iff_isPathConnected (U_op : IsOpen U) : IsPathConnected U ↔ IsConnected U`
## Implementation notes
By default, all paths have `I` as their source and `X` as their target, but there is an
operation `Set.IccExtend` that will extend any continuous map `γ : I → X` into a continuous map
`IccExtend zero_le_one γ : ℝ → X` that is constant before `0` and after `1`.
This is used to define `Path.extend` that turns `γ : Path x y` into a continuous map
`γ.extend : ℝ → X` whose restriction to `I` is the original `γ`, and is equal to `x`
on `(-∞, 0]` and to `y` on `[1, +∞)`.
-/
noncomputable section
open scoped Classical
open Topology Filter unitInterval Set Function
variable {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] {x y z : X} {ι : Type*}
/-! ### Paths -/
/-- Continuous path connecting two points `x` and `y` in a topological space -/
-- porting note (#5171): removed @[nolint has_nonempty_instance]
structure Path (x y : X) extends C(I, X) where
/-- The start point of a `Path`. -/
source' : toFun 0 = x
/-- The end point of a `Path`. -/
target' : toFun 1 = y
#align path Path
instance Path.funLike : FunLike (Path x y) I X where
coe := fun γ ↦ ⇑γ.toContinuousMap
coe_injective' := fun γ₁ γ₂ h => by
simp only [DFunLike.coe_fn_eq] at h
cases γ₁; cases γ₂; congr
-- Porting note (#10754): added this instance so that we can use `FunLike.coe` for `CoeFun`
-- this also fixed very strange `simp` timeout issues
instance Path.continuousMapClass : ContinuousMapClass (Path x y) I X where
map_continuous γ := show Continuous γ.toContinuousMap by fun_prop
-- Porting note: not necessary in light of the instance above
/-
instance : CoeFun (Path x y) fun _ => I → X :=
⟨fun p => p.toFun⟩
-/
@[ext]
protected theorem Path.ext : ∀ {γ₁ γ₂ : Path x y}, (γ₁ : I → X) = γ₂ → γ₁ = γ₂ := by
rintro ⟨⟨x, h11⟩, h12, h13⟩ ⟨⟨x, h21⟩, h22, h23⟩ rfl
rfl
#align path.ext Path.ext
namespace Path
@[simp]
theorem coe_mk_mk (f : I → X) (h₁) (h₂ : f 0 = x) (h₃ : f 1 = y) :
⇑(mk ⟨f, h₁⟩ h₂ h₃ : Path x y) = f :=
rfl
#align path.coe_mk Path.coe_mk_mk
-- Porting note: the name `Path.coe_mk` better refers to a new lemma below
variable (γ : Path x y)
@[continuity]
protected theorem continuous : Continuous γ :=
γ.continuous_toFun
#align path.continuous Path.continuous
@[simp]
protected theorem source : γ 0 = x :=
γ.source'
#align path.source Path.source
@[simp]
protected theorem target : γ 1 = y :=
γ.target'
#align path.target Path.target
/-- See Note [custom simps projection]. We need to specify this projection explicitly in this case,
because it is a composition of multiple projections. -/
def simps.apply : I → X :=
γ
#align path.simps.apply Path.simps.apply
initialize_simps_projections Path (toFun → simps.apply, -toContinuousMap)
@[simp]
theorem coe_toContinuousMap : ⇑γ.toContinuousMap = γ :=
rfl
#align path.coe_to_continuous_map Path.coe_toContinuousMap
-- Porting note: this is needed because of the `Path.continuousMapClass` instance
@[simp]
theorem coe_mk : ⇑(γ : C(I, X)) = γ :=
rfl
/-- Any function `φ : Π (a : α), Path (x a) (y a)` can be seen as a function `α × I → X`. -/
instance hasUncurryPath {X α : Type*} [TopologicalSpace X] {x y : α → X} :
HasUncurry (∀ a : α, Path (x a) (y a)) (α × I) X :=
⟨fun φ p => φ p.1 p.2⟩
#align path.has_uncurry_path Path.hasUncurryPath
/-- The constant path from a point to itself -/
@[refl, simps]
def refl (x : X) : Path x x where
toFun _t := x
continuous_toFun := continuous_const
source' := rfl
target' := rfl
#align path.refl Path.refl
@[simp]
theorem refl_range {a : X} : range (Path.refl a) = {a} := by simp [Path.refl, CoeFun.coe]
#align path.refl_range Path.refl_range
/-- The reverse of a path from `x` to `y`, as a path from `y` to `x` -/
@[symm, simps]
def symm (γ : Path x y) : Path y x where
toFun := γ ∘ σ
continuous_toFun := by continuity
source' := by simpa [-Path.target] using γ.target
target' := by simpa [-Path.source] using γ.source
#align path.symm Path.symm
@[simp]
theorem symm_symm (γ : Path x y) : γ.symm.symm = γ := by
ext t
show γ (σ (σ t)) = γ t
rw [unitInterval.symm_symm]
#align path.symm_symm Path.symm_symm
theorem symm_bijective : Function.Bijective (Path.symm : Path x y → Path y x) :=
Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩
@[simp]
theorem refl_symm {a : X} : (Path.refl a).symm = Path.refl a := by
ext
rfl
#align path.refl_symm Path.refl_symm
@[simp]
theorem symm_range {a b : X} (γ : Path a b) : range γ.symm = range γ := by
ext x
simp only [mem_range, Path.symm, DFunLike.coe, unitInterval.symm, SetCoe.exists, comp_apply,
Subtype.coe_mk]
constructor <;> rintro ⟨y, hy, hxy⟩ <;> refine ⟨1 - y, mem_iff_one_sub_mem.mp hy, ?_⟩ <;>
convert hxy
simp
#align path.symm_range Path.symm_range
/-! #### Space of paths -/
open ContinuousMap
/- porting note: because of the `DFunLike` instance, we already have a coercion to `C(I, X)`
so we avoid adding another.
--instance : Coe (Path x y) C(I, X) :=
--⟨fun γ => γ.1⟩
-/
/-- The following instance defines the topology on the path space to be induced from the
compact-open topology on the space `C(I,X)` of continuous maps from `I` to `X`.
-/
instance topologicalSpace : TopologicalSpace (Path x y) :=
TopologicalSpace.induced ((↑) : _ → C(I, X)) ContinuousMap.compactOpen
theorem continuous_eval : Continuous fun p : Path x y × I => p.1 p.2 :=
ContinuousMap.continuous_eval.comp <|
(continuous_induced_dom (α := Path x y)).prod_map continuous_id
#align path.continuous_eval Path.continuous_eval
@[continuity]
theorem _root_.Continuous.path_eval {Y} [TopologicalSpace Y] {f : Y → Path x y} {g : Y → I}
(hf : Continuous f) (hg : Continuous g) : Continuous fun y => f y (g y) :=
Continuous.comp continuous_eval (hf.prod_mk hg)
#align continuous.path_eval Continuous.path_eval
theorem continuous_uncurry_iff {Y} [TopologicalSpace Y] {g : Y → Path x y} :
Continuous ↿g ↔ Continuous g :=
Iff.symm <| continuous_induced_rng.trans
⟨fun h => continuous_uncurry_of_continuous ⟨_, h⟩,
continuous_of_continuous_uncurry (fun (y : Y) ↦ ContinuousMap.mk (g y))⟩
#align path.continuous_uncurry_iff Path.continuous_uncurry_iff
/-- A continuous map extending a path to `ℝ`, constant before `0` and after `1`. -/
def extend : ℝ → X :=
IccExtend zero_le_one γ
#align path.extend Path.extend
/-- See Note [continuity lemma statement]. -/
theorem _root_.Continuous.path_extend {γ : Y → Path x y} {f : Y → ℝ} (hγ : Continuous ↿γ)
(hf : Continuous f) : Continuous fun t => (γ t).extend (f t) :=
Continuous.IccExtend hγ hf
#align continuous.path_extend Continuous.path_extend
/-- A useful special case of `Continuous.path_extend`. -/
@[continuity, fun_prop]
theorem continuous_extend : Continuous γ.extend :=
γ.continuous.Icc_extend'
#align path.continuous_extend Path.continuous_extend
theorem _root_.Filter.Tendsto.path_extend
{l r : Y → X} {y : Y} {l₁ : Filter ℝ} {l₂ : Filter X} {γ : ∀ y, Path (l y) (r y)}
(hγ : Tendsto (↿γ) (𝓝 y ×ˢ l₁.map (projIcc 0 1 zero_le_one)) l₂) :
Tendsto (↿fun x => (γ x).extend) (𝓝 y ×ˢ l₁) l₂ :=
Filter.Tendsto.IccExtend _ hγ
#align filter.tendsto.path_extend Filter.Tendsto.path_extend
theorem _root_.ContinuousAt.path_extend {g : Y → ℝ} {l r : Y → X} (γ : ∀ y, Path (l y) (r y))
{y : Y} (hγ : ContinuousAt (↿γ) (y, projIcc 0 1 zero_le_one (g y))) (hg : ContinuousAt g y) :
ContinuousAt (fun i => (γ i).extend (g i)) y :=
hγ.IccExtend (fun x => γ x) hg
#align continuous_at.path_extend ContinuousAt.path_extend
@[simp]
theorem extend_extends {a b : X} (γ : Path a b) {t : ℝ}
(ht : t ∈ (Icc 0 1 : Set ℝ)) : γ.extend t = γ ⟨t, ht⟩ :=
IccExtend_of_mem _ γ ht
#align path.extend_extends Path.extend_extends
theorem extend_zero : γ.extend 0 = x := by simp
#align path.extend_zero Path.extend_zero
theorem extend_one : γ.extend 1 = y := by simp
#align path.extend_one Path.extend_one
@[simp]
theorem extend_extends' {a b : X} (γ : Path a b) (t : (Icc 0 1 : Set ℝ)) : γ.extend t = γ t :=
IccExtend_val _ γ t
#align path.extend_extends' Path.extend_extends'
@[simp]
theorem extend_range {a b : X} (γ : Path a b) :
range γ.extend = range γ :=
IccExtend_range _ γ
#align path.extend_range Path.extend_range
theorem extend_of_le_zero {a b : X} (γ : Path a b) {t : ℝ}
(ht : t ≤ 0) : γ.extend t = a :=
(IccExtend_of_le_left _ _ ht).trans γ.source
#align path.extend_of_le_zero Path.extend_of_le_zero
theorem extend_of_one_le {a b : X} (γ : Path a b) {t : ℝ}
(ht : 1 ≤ t) : γ.extend t = b :=
(IccExtend_of_right_le _ _ ht).trans γ.target
#align path.extend_of_one_le Path.extend_of_one_le
@[simp]
theorem refl_extend {a : X} : (Path.refl a).extend = fun _ => a :=
rfl
#align path.refl_extend Path.refl_extend
/-- The path obtained from a map defined on `ℝ` by restriction to the unit interval. -/
def ofLine {f : ℝ → X} (hf : ContinuousOn f I) (h₀ : f 0 = x) (h₁ : f 1 = y) : Path x y where
toFun := f ∘ ((↑) : unitInterval → ℝ)
continuous_toFun := hf.comp_continuous continuous_subtype_val Subtype.prop
source' := h₀
target' := h₁
#align path.of_line Path.ofLine
theorem ofLine_mem {f : ℝ → X} (hf : ContinuousOn f I) (h₀ : f 0 = x) (h₁ : f 1 = y) :
∀ t, ofLine hf h₀ h₁ t ∈ f '' I := fun ⟨t, t_in⟩ => ⟨t, t_in, rfl⟩
#align path.of_line_mem Path.ofLine_mem
attribute [local simp] Iic_def
/-- Concatenation of two paths from `x` to `y` and from `y` to `z`, putting the first
path on `[0, 1/2]` and the second one on `[1/2, 1]`. -/
@[trans]
def trans (γ : Path x y) (γ' : Path y z) : Path x z where
toFun := (fun t : ℝ => if t ≤ 1 / 2 then γ.extend (2 * t) else γ'.extend (2 * t - 1)) ∘ (↑)
continuous_toFun := by
refine
(Continuous.if_le ?_ ?_ continuous_id continuous_const (by norm_num)).comp
continuous_subtype_val <;>
fun_prop
source' := by norm_num
target' := by norm_num
#align path.trans Path.trans
theorem trans_apply (γ : Path x y) (γ' : Path y z) (t : I) :
(γ.trans γ') t =
if h : (t : ℝ) ≤ 1 / 2 then γ ⟨2 * t, (mul_pos_mem_iff zero_lt_two).2 ⟨t.2.1, h⟩⟩
else γ' ⟨2 * t - 1, two_mul_sub_one_mem_iff.2 ⟨(not_le.1 h).le, t.2.2⟩⟩ :=
show ite _ _ _ = _ by split_ifs <;> rw [extend_extends]
#align path.trans_apply Path.trans_apply
@[simp]
theorem trans_symm (γ : Path x y) (γ' : Path y z) : (γ.trans γ').symm = γ'.symm.trans γ.symm := by
ext t
simp only [trans_apply, ← one_div, symm_apply, not_le, Function.comp_apply]
split_ifs with h h₁ h₂ <;> rw [coe_symm_eq] at h
· have ht : (t : ℝ) = 1 / 2 := by linarith
norm_num [ht]
· refine congr_arg _ (Subtype.ext ?_)
norm_num [sub_sub_eq_add_sub, mul_sub]
· refine congr_arg _ (Subtype.ext ?_)
norm_num [mul_sub, h]
ring -- TODO norm_num should really do this
· exfalso
linarith
#align path.trans_symm Path.trans_symm
@[simp]
theorem refl_trans_refl {a : X} :
(Path.refl a).trans (Path.refl a) = Path.refl a := by
ext
simp only [Path.trans, ite_self, one_div, Path.refl_extend]
rfl
#align path.refl_trans_refl Path.refl_trans_refl
theorem trans_range {a b c : X} (γ₁ : Path a b) (γ₂ : Path b c) :
range (γ₁.trans γ₂) = range γ₁ ∪ range γ₂ := by
rw [Path.trans]
apply eq_of_subset_of_subset
· rintro x ⟨⟨t, ht0, ht1⟩, hxt⟩
by_cases h : t ≤ 1 / 2
· left
use ⟨2 * t, ⟨by linarith, by linarith⟩⟩
rw [← γ₁.extend_extends]
rwa [coe_mk_mk, Function.comp_apply, if_pos h] at hxt
· right
use ⟨2 * t - 1, ⟨by linarith, by linarith⟩⟩
rw [← γ₂.extend_extends]
rwa [coe_mk_mk, Function.comp_apply, if_neg h] at hxt
· rintro x (⟨⟨t, ht0, ht1⟩, hxt⟩ | ⟨⟨t, ht0, ht1⟩, hxt⟩)
· use ⟨t / 2, ⟨by linarith, by linarith⟩⟩
have : t / 2 ≤ 1 / 2 := (div_le_div_right (zero_lt_two : (0 : ℝ) < 2)).mpr ht1
rw [coe_mk_mk, Function.comp_apply, if_pos this, Subtype.coe_mk]
ring_nf
rwa [γ₁.extend_extends]
· by_cases h : t = 0
· use ⟨1 / 2, ⟨by linarith, by linarith⟩⟩
rw [coe_mk_mk, Function.comp_apply, if_pos le_rfl, Subtype.coe_mk,
mul_one_div_cancel (two_ne_zero' ℝ)]
rw [γ₁.extend_one]
rwa [← γ₂.extend_extends, h, γ₂.extend_zero] at hxt
· use ⟨(t + 1) / 2, ⟨by linarith, by linarith⟩⟩
replace h : t ≠ 0 := h
have ht0 := lt_of_le_of_ne ht0 h.symm
have : ¬(t + 1) / 2 ≤ 1 / 2 := by
rw [not_le]
linarith
rw [coe_mk_mk, Function.comp_apply, Subtype.coe_mk, if_neg this]
ring_nf
rwa [γ₂.extend_extends]
#align path.trans_range Path.trans_range
/-- Image of a path from `x` to `y` by a map which is continuous on the path. -/
def map' (γ : Path x y) {f : X → Y} (h : ContinuousOn f (range γ)) : Path (f x) (f y) where
toFun := f ∘ γ
continuous_toFun := h.comp_continuous γ.continuous (fun x ↦ mem_range_self x)
source' := by simp
target' := by simp
/-- Image of a path from `x` to `y` by a continuous map -/
def map (γ : Path x y) {f : X → Y} (h : Continuous f) :
Path (f x) (f y) := γ.map' h.continuousOn
#align path.map Path.map
@[simp]
theorem map_coe (γ : Path x y) {f : X → Y} (h : Continuous f) :
(γ.map h : I → Y) = f ∘ γ := by
ext t
rfl
#align path.map_coe Path.map_coe
@[simp]
theorem map_symm (γ : Path x y) {f : X → Y} (h : Continuous f) :
(γ.map h).symm = γ.symm.map h :=
rfl
#align path.map_symm Path.map_symm
@[simp]
theorem map_trans (γ : Path x y) (γ' : Path y z) {f : X → Y}
(h : Continuous f) : (γ.trans γ').map h = (γ.map h).trans (γ'.map h) := by
ext t
rw [trans_apply, map_coe, Function.comp_apply, trans_apply]
split_ifs <;> rfl
#align path.map_trans Path.map_trans
@[simp]
theorem map_id (γ : Path x y) : γ.map continuous_id = γ := by
ext
rfl
#align path.map_id Path.map_id
@[simp]
theorem map_map (γ : Path x y) {Z : Type*} [TopologicalSpace Z]
{f : X → Y} (hf : Continuous f) {g : Y → Z} (hg : Continuous g) :
(γ.map hf).map hg = γ.map (hg.comp hf) := by
ext
rfl
#align path.map_map Path.map_map
/-- Casting a path from `x` to `y` to a path from `x'` to `y'` when `x' = x` and `y' = y` -/
def cast (γ : Path x y) {x' y'} (hx : x' = x) (hy : y' = y) : Path x' y' where
toFun := γ
continuous_toFun := γ.continuous
source' := by simp [hx]
target' := by simp [hy]
#align path.cast Path.cast
@[simp]
theorem symm_cast {a₁ a₂ b₁ b₂ : X} (γ : Path a₂ b₂) (ha : a₁ = a₂) (hb : b₁ = b₂) :
(γ.cast ha hb).symm = γ.symm.cast hb ha :=
rfl
#align path.symm_cast Path.symm_cast
@[simp]
theorem trans_cast {a₁ a₂ b₁ b₂ c₁ c₂ : X} (γ : Path a₂ b₂)
(γ' : Path b₂ c₂) (ha : a₁ = a₂) (hb : b₁ = b₂) (hc : c₁ = c₂) :
(γ.cast ha hb).trans (γ'.cast hb hc) = (γ.trans γ').cast ha hc :=
rfl
#align path.trans_cast Path.trans_cast
@[simp]
theorem cast_coe (γ : Path x y) {x' y'} (hx : x' = x) (hy : y' = y) : (γ.cast hx hy : I → X) = γ :=
rfl
#align path.cast_coe Path.cast_coe
@[continuity, fun_prop]
theorem symm_continuous_family {ι : Type*} [TopologicalSpace ι]
{a b : ι → X} (γ : ∀ t : ι, Path (a t) (b t)) (h : Continuous ↿γ) :
Continuous ↿fun t => (γ t).symm :=
h.comp (continuous_id.prod_map continuous_symm)
#align path.symm_continuous_family Path.symm_continuous_family
@[continuity]
theorem continuous_symm : Continuous (symm : Path x y → Path y x) :=
continuous_uncurry_iff.mp <| symm_continuous_family _ (continuous_fst.path_eval continuous_snd)
#align path.continuous_symm Path.continuous_symm
@[continuity]
theorem continuous_uncurry_extend_of_continuous_family {ι : Type*} [TopologicalSpace ι]
{a b : ι → X} (γ : ∀ t : ι, Path (a t) (b t)) (h : Continuous ↿γ) :
Continuous ↿fun t => (γ t).extend := by
apply h.comp (continuous_id.prod_map continuous_projIcc)
exact zero_le_one
#align path.continuous_uncurry_extend_of_continuous_family Path.continuous_uncurry_extend_of_continuous_family
@[continuity]
theorem trans_continuous_family {ι : Type*} [TopologicalSpace ι]
{a b c : ι → X} (γ₁ : ∀ t : ι, Path (a t) (b t)) (h₁ : Continuous ↿γ₁)
(γ₂ : ∀ t : ι, Path (b t) (c t)) (h₂ : Continuous ↿γ₂) :
Continuous ↿fun t => (γ₁ t).trans (γ₂ t) := by
have h₁' := Path.continuous_uncurry_extend_of_continuous_family γ₁ h₁
have h₂' := Path.continuous_uncurry_extend_of_continuous_family γ₂ h₂
simp only [HasUncurry.uncurry, CoeFun.coe, Path.trans, (· ∘ ·)]
refine Continuous.if_le ?_ ?_ (continuous_subtype_val.comp continuous_snd) continuous_const ?_
· change
Continuous ((fun p : ι × ℝ => (γ₁ p.1).extend p.2) ∘ Prod.map id (fun x => 2 * x : I → ℝ))
exact h₁'.comp (continuous_id.prod_map <| continuous_const.mul continuous_subtype_val)
· change
Continuous ((fun p : ι × ℝ => (γ₂ p.1).extend p.2) ∘ Prod.map id (fun x => 2 * x - 1 : I → ℝ))
exact
h₂'.comp
(continuous_id.prod_map <|
(continuous_const.mul continuous_subtype_val).sub continuous_const)
· rintro st hst
simp [hst, mul_inv_cancel (two_ne_zero' ℝ)]
#align path.trans_continuous_family Path.trans_continuous_family
@[continuity]
theorem _root_.Continuous.path_trans {f : Y → Path x y} {g : Y → Path y z} :
Continuous f → Continuous g → Continuous fun t => (f t).trans (g t) := by
intro hf hg
apply continuous_uncurry_iff.mp
exact trans_continuous_family _ (continuous_uncurry_iff.mpr hf) _ (continuous_uncurry_iff.mpr hg)
#align continuous.path_trans Continuous.path_trans
@[continuity]
theorem continuous_trans {x y z : X} : Continuous fun ρ : Path x y × Path y z => ρ.1.trans ρ.2 :=
continuous_fst.path_trans continuous_snd
#align path.continuous_trans Path.continuous_trans
/-! #### Product of paths -/
section Prod
variable {a₁ a₂ a₃ : X} {b₁ b₂ b₃ : Y}
/-- Given a path in `X` and a path in `Y`, we can take their pointwise product to get a path in
`X × Y`. -/
protected def prod (γ₁ : Path a₁ a₂) (γ₂ : Path b₁ b₂) : Path (a₁, b₁) (a₂, b₂) where
toContinuousMap := ContinuousMap.prodMk γ₁.toContinuousMap γ₂.toContinuousMap
source' := by simp
target' := by simp
#align path.prod Path.prod
@[simp]
theorem prod_coe (γ₁ : Path a₁ a₂) (γ₂ : Path b₁ b₂) :
⇑(γ₁.prod γ₂) = fun t => (γ₁ t, γ₂ t) :=
rfl
#align path.prod_coe_fn Path.prod_coe
/-- Path composition commutes with products -/
theorem trans_prod_eq_prod_trans (γ₁ : Path a₁ a₂) (δ₁ : Path a₂ a₃) (γ₂ : Path b₁ b₂)
(δ₂ : Path b₂ b₃) : (γ₁.prod γ₂).trans (δ₁.prod δ₂) = (γ₁.trans δ₁).prod (γ₂.trans δ₂) := by
ext t <;>
unfold Path.trans <;>
simp only [Path.coe_mk_mk, Path.prod_coe, Function.comp_apply] <;>
split_ifs <;>
rfl
#align path.trans_prod_eq_prod_trans Path.trans_prod_eq_prod_trans
end Prod
section Pi
variable {χ : ι → Type*} [∀ i, TopologicalSpace (χ i)] {as bs cs : ∀ i, χ i}
/-- Given a family of paths, one in each Xᵢ, we take their pointwise product to get a path in
Π i, Xᵢ. -/
protected def pi (γ : ∀ i, Path (as i) (bs i)) : Path as bs where
toContinuousMap := ContinuousMap.pi fun i => (γ i).toContinuousMap
source' := by simp
target' := by simp
#align path.pi Path.pi
@[simp]
theorem pi_coe (γ : ∀ i, Path (as i) (bs i)) : ⇑(Path.pi γ) = fun t i => γ i t :=
rfl
#align path.pi_coe_fn Path.pi_coe
/-- Path composition commutes with products -/
theorem trans_pi_eq_pi_trans (γ₀ : ∀ i, Path (as i) (bs i)) (γ₁ : ∀ i, Path (bs i) (cs i)) :
(Path.pi γ₀).trans (Path.pi γ₁) = Path.pi fun i => (γ₀ i).trans (γ₁ i) := by
ext t i
unfold Path.trans
simp only [Path.coe_mk_mk, Function.comp_apply, pi_coe]
split_ifs <;> rfl
#align path.trans_pi_eq_pi_trans Path.trans_pi_eq_pi_trans
end Pi
/-! #### Pointwise multiplication/addition of two paths in a topological (additive) group -/
/-- Pointwise multiplication of paths in a topological group. The additive version is probably more
useful. -/
@[to_additive "Pointwise addition of paths in a topological additive group."]
protected def mul [Mul X] [ContinuousMul X] {a₁ b₁ a₂ b₂ : X} (γ₁ : Path a₁ b₁) (γ₂ : Path a₂ b₂) :
Path (a₁ * a₂) (b₁ * b₂) :=
(γ₁.prod γ₂).map continuous_mul
#align path.mul Path.mul
#align path.add Path.add
@[to_additive]
protected theorem mul_apply [Mul X] [ContinuousMul X] {a₁ b₁ a₂ b₂ : X} (γ₁ : Path a₁ b₁)
(γ₂ : Path a₂ b₂) (t : unitInterval) : (γ₁.mul γ₂) t = γ₁ t * γ₂ t :=
rfl
#align path.mul_apply Path.mul_apply
#align path.add_apply Path.add_apply
/-! #### Truncating a path -/
/-- `γ.truncate t₀ t₁` is the path which follows the path `γ` on the
time interval `[t₀, t₁]` and stays still otherwise. -/
def truncate {X : Type*} [TopologicalSpace X] {a b : X} (γ : Path a b) (t₀ t₁ : ℝ) :
Path (γ.extend <| min t₀ t₁) (γ.extend t₁) where
toFun s := γ.extend (min (max s t₀) t₁)
continuous_toFun :=
γ.continuous_extend.comp ((continuous_subtype_val.max continuous_const).min continuous_const)
source' := by
simp only [min_def, max_def']
norm_cast
split_ifs with h₁ h₂ h₃ h₄
· simp [γ.extend_of_le_zero h₁]
· congr
linarith
· have h₄ : t₁ ≤ 0 := le_of_lt (by simpa using h₂)
simp [γ.extend_of_le_zero h₄, γ.extend_of_le_zero h₁]
all_goals rfl
target' := by
simp only [min_def, max_def']
norm_cast
split_ifs with h₁ h₂ h₃
· simp [γ.extend_of_one_le h₂]
· rfl
· have h₄ : 1 ≤ t₀ := le_of_lt (by simpa using h₁)
simp [γ.extend_of_one_le h₄, γ.extend_of_one_le (h₄.trans h₃)]
· rfl
#align path.truncate Path.truncate
/-- `γ.truncateOfLE t₀ t₁ h`, where `h : t₀ ≤ t₁` is `γ.truncate t₀ t₁`
casted as a path from `γ.extend t₀` to `γ.extend t₁`. -/
def truncateOfLE {X : Type*} [TopologicalSpace X] {a b : X} (γ : Path a b) {t₀ t₁ : ℝ}
(h : t₀ ≤ t₁) : Path (γ.extend t₀) (γ.extend t₁) :=
(γ.truncate t₀ t₁).cast (by rw [min_eq_left h]) rfl
#align path.truncate_of_le Path.truncateOfLE
theorem truncate_range {a b : X} (γ : Path a b) {t₀ t₁ : ℝ} :
range (γ.truncate t₀ t₁) ⊆ range γ := by
rw [← γ.extend_range]
simp only [range_subset_iff, SetCoe.exists, SetCoe.forall]
intro x _hx
simp only [DFunLike.coe, Path.truncate, mem_range_self]
#align path.truncate_range Path.truncate_range
/-- For a path `γ`, `γ.truncate` gives a "continuous family of paths", by which we
mean the uncurried function which maps `(t₀, t₁, s)` to `γ.truncate t₀ t₁ s` is continuous. -/
@[continuity]
theorem truncate_continuous_family {a b : X} (γ : Path a b) :
Continuous (fun x => γ.truncate x.1 x.2.1 x.2.2 : ℝ × ℝ × I → X) :=
γ.continuous_extend.comp
(((continuous_subtype_val.comp (continuous_snd.comp continuous_snd)).max continuous_fst).min
(continuous_fst.comp continuous_snd))
#align path.truncate_continuous_family Path.truncate_continuous_family
@[continuity]
theorem truncate_const_continuous_family {a b : X} (γ : Path a b)
(t : ℝ) : Continuous ↿(γ.truncate t) := by
have key : Continuous (fun x => (t, x) : ℝ × I → ℝ × ℝ × I) := by fun_prop
exact γ.truncate_continuous_family.comp key
#align path.truncate_const_continuous_family Path.truncate_const_continuous_family
@[simp]
theorem truncate_self {a b : X} (γ : Path a b) (t : ℝ) :
γ.truncate t t = (Path.refl <| γ.extend t).cast (by rw [min_self]) rfl := by
ext x
rw [cast_coe]
simp only [truncate, DFunLike.coe, refl, min_def, max_def]
split_ifs with h₁ h₂ <;> congr
#align path.truncate_self Path.truncate_self
@[simp 1001] -- Porting note: increase `simp` priority so left-hand side doesn't simplify
theorem truncate_zero_zero {a b : X} (γ : Path a b) :
γ.truncate 0 0 = (Path.refl a).cast (by rw [min_self, γ.extend_zero]) γ.extend_zero := by
convert γ.truncate_self 0
#align path.truncate_zero_zero Path.truncate_zero_zero
@[simp 1001] -- Porting note: increase `simp` priority so left-hand side doesn't simplify
theorem truncate_one_one {a b : X} (γ : Path a b) :
γ.truncate 1 1 = (Path.refl b).cast (by rw [min_self, γ.extend_one]) γ.extend_one := by
convert γ.truncate_self 1
#align path.truncate_one_one Path.truncate_one_one
@[simp]
theorem truncate_zero_one {a b : X} (γ : Path a b) :
γ.truncate 0 1 = γ.cast (by simp [zero_le_one, extend_zero]) (by simp) := by
ext x
rw [cast_coe]
have : ↑x ∈ (Icc 0 1 : Set ℝ) := x.2
rw [truncate, coe_mk_mk, max_eq_left this.1, min_eq_left this.2, extend_extends']
#align path.truncate_zero_one Path.truncate_zero_one
/-! #### Reparametrising a path -/
/-- Given a path `γ` and a function `f : I → I` where `f 0 = 0` and `f 1 = 1`, `γ.reparam f` is the
path defined by `γ ∘ f`.
-/
def reparam (γ : Path x y) (f : I → I) (hfcont : Continuous f) (hf₀ : f 0 = 0) (hf₁ : f 1 = 1) :
Path x y where
toFun := γ ∘ f
continuous_toFun := by fun_prop
source' := by simp [hf₀]
target' := by simp [hf₁]
#align path.reparam Path.reparam
@[simp]
theorem coe_reparam (γ : Path x y) {f : I → I} (hfcont : Continuous f) (hf₀ : f 0 = 0)
(hf₁ : f 1 = 1) : ⇑(γ.reparam f hfcont hf₀ hf₁) = γ ∘ f :=
rfl
#align path.coe_to_fun Path.coe_reparam
-- Porting note: this seems like it was poorly named (was: `coe_to_fun`)
@[simp]
theorem reparam_id (γ : Path x y) : γ.reparam id continuous_id rfl rfl = γ := by
ext
rfl
#align path.reparam_id Path.reparam_id
theorem range_reparam (γ : Path x y) {f : I → I} (hfcont : Continuous f) (hf₀ : f 0 = 0)
(hf₁ : f 1 = 1) : range (γ.reparam f hfcont hf₀ hf₁) = range γ := by
change range (γ ∘ f) = range γ
have : range f = univ := by
rw [range_iff_surjective]
intro t
have h₁ : Continuous (Set.IccExtend (zero_le_one' ℝ) f) := by continuity
have := intermediate_value_Icc (zero_le_one' ℝ) h₁.continuousOn
· rw [IccExtend_left, IccExtend_right, Icc.mk_zero, Icc.mk_one, hf₀, hf₁] at this
rcases this t.2 with ⟨w, hw₁, hw₂⟩
rw [IccExtend_of_mem _ _ hw₁] at hw₂
exact ⟨_, hw₂⟩
rw [range_comp, this, image_univ]
#align path.range_reparam Path.range_reparam
theorem refl_reparam {f : I → I} (hfcont : Continuous f) (hf₀ : f 0 = 0) (hf₁ : f 1 = 1) :
(refl x).reparam f hfcont hf₀ hf₁ = refl x := by
ext
simp
#align path.refl_reparam Path.refl_reparam
end Path
/-! ### Being joined by a path -/
/-- The relation "being joined by a path". This is an equivalence relation. -/
def Joined (x y : X) : Prop :=
Nonempty (Path x y)
#align joined Joined
@[refl]
theorem Joined.refl (x : X) : Joined x x :=
⟨Path.refl x⟩
#align joined.refl Joined.refl
/-- When two points are joined, choose some path from `x` to `y`. -/
def Joined.somePath (h : Joined x y) : Path x y :=
Nonempty.some h
#align joined.some_path Joined.somePath
@[symm]
theorem Joined.symm {x y : X} (h : Joined x y) : Joined y x :=
⟨h.somePath.symm⟩
#align joined.symm Joined.symm
@[trans]
theorem Joined.trans {x y z : X} (hxy : Joined x y) (hyz : Joined y z) : Joined x z :=
⟨hxy.somePath.trans hyz.somePath⟩
#align joined.trans Joined.trans
variable (X)
/-- The setoid corresponding the equivalence relation of being joined by a continuous path. -/
def pathSetoid : Setoid X where
r := Joined
iseqv := Equivalence.mk Joined.refl Joined.symm Joined.trans
#align path_setoid pathSetoid
/-- The quotient type of points of a topological space modulo being joined by a continuous path. -/
def ZerothHomotopy :=
Quotient (pathSetoid X)
#align zeroth_homotopy ZerothHomotopy
instance ZerothHomotopy.inhabited : Inhabited (ZerothHomotopy ℝ) :=
⟨@Quotient.mk' ℝ (pathSetoid ℝ) 0⟩
variable {X}
/-! ### Being joined by a path inside a set -/
/-- The relation "being joined by a path in `F`". Not quite an equivalence relation since it's not
reflexive for points that do not belong to `F`. -/
def JoinedIn (F : Set X) (x y : X) : Prop :=
∃ γ : Path x y, ∀ t, γ t ∈ F
#align joined_in JoinedIn
variable {F : Set X}
theorem JoinedIn.mem (h : JoinedIn F x y) : x ∈ F ∧ y ∈ F := by
rcases h with ⟨γ, γ_in⟩
have : γ 0 ∈ F ∧ γ 1 ∈ F := by constructor <;> apply γ_in
simpa using this
#align joined_in.mem JoinedIn.mem
theorem JoinedIn.source_mem (h : JoinedIn F x y) : x ∈ F :=
h.mem.1
#align joined_in.source_mem JoinedIn.source_mem
theorem JoinedIn.target_mem (h : JoinedIn F x y) : y ∈ F :=
h.mem.2
#align joined_in.target_mem JoinedIn.target_mem
/-- When `x` and `y` are joined in `F`, choose a path from `x` to `y` inside `F` -/
def JoinedIn.somePath (h : JoinedIn F x y) : Path x y :=
Classical.choose h
#align joined_in.some_path JoinedIn.somePath
theorem JoinedIn.somePath_mem (h : JoinedIn F x y) (t : I) : h.somePath t ∈ F :=
Classical.choose_spec h t
#align joined_in.some_path_mem JoinedIn.somePath_mem
/-- If `x` and `y` are joined in the set `F`, then they are joined in the subtype `F`. -/
theorem JoinedIn.joined_subtype (h : JoinedIn F x y) :
Joined (⟨x, h.source_mem⟩ : F) (⟨y, h.target_mem⟩ : F) :=
⟨{ toFun := fun t => ⟨h.somePath t, h.somePath_mem t⟩
continuous_toFun := by fun_prop
source' := by simp
target' := by simp }⟩
#align joined_in.joined_subtype JoinedIn.joined_subtype
theorem JoinedIn.ofLine {f : ℝ → X} (hf : ContinuousOn f I) (h₀ : f 0 = x) (h₁ : f 1 = y)
(hF : f '' I ⊆ F) : JoinedIn F x y :=
⟨Path.ofLine hf h₀ h₁, fun t => hF <| Path.ofLine_mem hf h₀ h₁ t⟩
#align joined_in.of_line JoinedIn.ofLine
theorem JoinedIn.joined (h : JoinedIn F x y) : Joined x y :=
⟨h.somePath⟩
#align joined_in.joined JoinedIn.joined
theorem joinedIn_iff_joined (x_in : x ∈ F) (y_in : y ∈ F) :
JoinedIn F x y ↔ Joined (⟨x, x_in⟩ : F) (⟨y, y_in⟩ : F) :=
⟨fun h => h.joined_subtype, fun h => ⟨h.somePath.map continuous_subtype_val, by simp⟩⟩
#align joined_in_iff_joined joinedIn_iff_joined
@[simp]
theorem joinedIn_univ : JoinedIn univ x y ↔ Joined x y := by
simp [JoinedIn, Joined, exists_true_iff_nonempty]
#align joined_in_univ joinedIn_univ
theorem JoinedIn.mono {U V : Set X} (h : JoinedIn U x y) (hUV : U ⊆ V) : JoinedIn V x y :=
⟨h.somePath, fun t => hUV (h.somePath_mem t)⟩
#align joined_in.mono JoinedIn.mono
theorem JoinedIn.refl (h : x ∈ F) : JoinedIn F x x :=
⟨Path.refl x, fun _t => h⟩
#align joined_in.refl JoinedIn.refl
@[symm]
theorem JoinedIn.symm (h : JoinedIn F x y) : JoinedIn F y x := by
cases' h.mem with hx hy
simp_all [joinedIn_iff_joined]
exact h.symm
#align joined_in.symm JoinedIn.symm
theorem JoinedIn.trans (hxy : JoinedIn F x y) (hyz : JoinedIn F y z) : JoinedIn F x z := by
cases' hxy.mem with hx hy
cases' hyz.mem with hx hy
simp_all [joinedIn_iff_joined]
exact hxy.trans hyz
#align joined_in.trans JoinedIn.trans
theorem Specializes.joinedIn (h : x ⤳ y) (hx : x ∈ F) (hy : y ∈ F) : JoinedIn F x y := by
refine ⟨⟨⟨Set.piecewise {1} (const I y) (const I x), ?_⟩, by simp, by simp⟩, fun t ↦ ?_⟩
· exact isClosed_singleton.continuous_piecewise_of_specializes continuous_const continuous_const
fun _ ↦ h
· simp only [Path.coe_mk_mk, piecewise]
split_ifs <;> assumption
theorem Inseparable.joinedIn (h : Inseparable x y) (hx : x ∈ F) (hy : y ∈ F) : JoinedIn F x y :=
h.specializes.joinedIn hx hy
/-! ### Path component -/
/-- The path component of `x` is the set of points that can be joined to `x`. -/
def pathComponent (x : X) :=
{ y | Joined x y }
#align path_component pathComponent
@[simp]
theorem mem_pathComponent_self (x : X) : x ∈ pathComponent x :=
Joined.refl x
#align mem_path_component_self mem_pathComponent_self
@[simp]
theorem pathComponent.nonempty (x : X) : (pathComponent x).Nonempty :=
⟨x, mem_pathComponent_self x⟩
#align path_component.nonempty pathComponent.nonempty
theorem mem_pathComponent_of_mem (h : x ∈ pathComponent y) : y ∈ pathComponent x :=
Joined.symm h
#align mem_path_component_of_mem mem_pathComponent_of_mem
theorem pathComponent_symm : x ∈ pathComponent y ↔ y ∈ pathComponent x :=
⟨fun h => mem_pathComponent_of_mem h, fun h => mem_pathComponent_of_mem h⟩
#align path_component_symm pathComponent_symm
theorem pathComponent_congr (h : x ∈ pathComponent y) : pathComponent x = pathComponent y := by
ext z
constructor
· intro h'
rw [pathComponent_symm]
exact (h.trans h').symm
· intro h'
rw [pathComponent_symm] at h' ⊢
exact h'.trans h
#align path_component_congr pathComponent_congr
theorem pathComponent_subset_component (x : X) : pathComponent x ⊆ connectedComponent x :=
fun y h =>
(isConnected_range h.somePath.continuous).subset_connectedComponent ⟨0, by simp⟩ ⟨1, by simp⟩
#align path_component_subset_component pathComponent_subset_component
/-- The path component of `x` in `F` is the set of points that can be joined to `x` in `F`. -/
def pathComponentIn (x : X) (F : Set X) :=
{ y | JoinedIn F x y }
#align path_component_in pathComponentIn
@[simp]
theorem pathComponentIn_univ (x : X) : pathComponentIn x univ = pathComponent x := by
simp [pathComponentIn, pathComponent, JoinedIn, Joined, exists_true_iff_nonempty]
#align path_component_in_univ pathComponentIn_univ
theorem Joined.mem_pathComponent (hyz : Joined y z) (hxy : y ∈ pathComponent x) :
z ∈ pathComponent x :=
hxy.trans hyz
#align joined.mem_path_component Joined.mem_pathComponent
/-! ### Path connected sets -/
/-- A set `F` is path connected if it contains a point that can be joined to all other in `F`. -/
def IsPathConnected (F : Set X) : Prop :=
∃ x ∈ F, ∀ {y}, y ∈ F → JoinedIn F x y
#align is_path_connected IsPathConnected
theorem isPathConnected_iff_eq : IsPathConnected F ↔ ∃ x ∈ F, pathComponentIn x F = F := by
constructor <;> rintro ⟨x, x_in, h⟩ <;> use x, x_in
· ext y
exact ⟨fun hy => hy.mem.2, h⟩
· intro y y_in
rwa [← h] at y_in
#align is_path_connected_iff_eq isPathConnected_iff_eq
theorem IsPathConnected.joinedIn (h : IsPathConnected F) :
∀ᵉ (x ∈ F) (y ∈ F), JoinedIn F x y := fun _x x_in _y y_in =>
let ⟨_b, _b_in, hb⟩ := h
(hb x_in).symm.trans (hb y_in)
#align is_path_connected.joined_in IsPathConnected.joinedIn
theorem isPathConnected_iff :
IsPathConnected F ↔ F.Nonempty ∧ ∀ᵉ (x ∈ F) (y ∈ F), JoinedIn F x y :=
⟨fun h =>
⟨let ⟨b, b_in, _hb⟩ := h; ⟨b, b_in⟩, h.joinedIn⟩,
fun ⟨⟨b, b_in⟩, h⟩ => ⟨b, b_in, fun x_in => h _ b_in _ x_in⟩⟩
#align is_path_connected_iff isPathConnected_iff
/-- If `f` is continuous on `F` and `F` is path-connected, so is `f(F)`. -/
theorem IsPathConnected.image' (hF : IsPathConnected F)
{f : X → Y} (hf : ContinuousOn f F) : IsPathConnected (f '' F) := by
rcases hF with ⟨x, x_in, hx⟩
use f x, mem_image_of_mem f x_in
rintro _ ⟨y, y_in, rfl⟩
refine ⟨(hx y_in).somePath.map' ?_, fun t ↦ ⟨_, (hx y_in).somePath_mem t, rfl⟩⟩
exact hf.mono (range_subset_iff.2 (hx y_in).somePath_mem)
/-- If `f` is continuous and `F` is path-connected, so is `f(F)`. -/
theorem IsPathConnected.image (hF : IsPathConnected F) {f : X → Y}
(hf : Continuous f) : IsPathConnected (f '' F) := hF.image' hf.continuousOn
#align is_path_connected.image IsPathConnected.image
/-- If `f : X → Y` is a `Inducing`, `f(F)` is path-connected iff `F` is. -/
nonrec theorem Inducing.isPathConnected_iff {f : X → Y} (hf : Inducing f) :
IsPathConnected F ↔ IsPathConnected (f '' F) := by
refine ⟨fun hF ↦ hF.image hf.continuous, fun hF ↦ ?_⟩
simp? [isPathConnected_iff] at hF ⊢ says
simp only [isPathConnected_iff, image_nonempty, mem_image, forall_exists_index,
and_imp, forall_apply_eq_imp_iff₂] at hF ⊢
refine ⟨hF.1, fun x hx y hy ↦ ?_⟩