-
Notifications
You must be signed in to change notification settings - Fork 251
/
Constructions.lean
1786 lines (1429 loc) · 79.5 KB
/
Constructions.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) 2017 Johannes Hölzl. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johannes Hölzl, Mario Carneiro, Patrick Massot
-/
import Mathlib.Topology.Maps
import Mathlib.Order.Filter.Pi
import Mathlib.Topology.NhdsSet
#align_import topology.constructions from "leanprover-community/mathlib"@"f7ebde7ee0d1505dfccac8644ae12371aa3c1c9f"
/-!
# Constructions of new topological spaces from old ones
This file constructs products, sums, subtypes and quotients of topological spaces
and sets up their basic theory, such as criteria for maps into or out of these
constructions to be continuous; descriptions of the open sets, neighborhood filters,
and generators of these constructions; and their behavior with respect to embeddings
and other specific classes of maps.
## Implementation note
The constructed topologies are defined using induced and coinduced topologies
along with the complete lattice structure on topologies. Their universal properties
(for example, a map `X → Y × Z` is continuous if and only if both projections
`X → Y`, `X → Z` are) follow easily using order-theoretic descriptions of
continuity. With more work we can also extract descriptions of the open sets,
neighborhood filters and so on.
## Tags
product, sum, disjoint union, subspace, quotient space
-/
noncomputable section
open scoped Classical
open Topology TopologicalSpace Set Filter Function
universe u v
variable {X : Type u} {Y : Type v} {Z W ε ζ : Type*}
section Constructions
instance instTopologicalSpaceSubtype {p : X → Prop} [t : TopologicalSpace X] :
TopologicalSpace (Subtype p) :=
induced (↑) t
instance {r : X → X → Prop} [t : TopologicalSpace X] : TopologicalSpace (Quot r) :=
coinduced (Quot.mk r) t
instance instTopologicalSpaceQuotient {s : Setoid X} [t : TopologicalSpace X] :
TopologicalSpace (Quotient s) :=
coinduced Quotient.mk' t
instance instTopologicalSpaceProd [t₁ : TopologicalSpace X] [t₂ : TopologicalSpace Y] :
TopologicalSpace (X × Y) :=
induced Prod.fst t₁ ⊓ induced Prod.snd t₂
instance instTopologicalSpaceSum [t₁ : TopologicalSpace X] [t₂ : TopologicalSpace Y] :
TopologicalSpace (X ⊕ Y) :=
coinduced Sum.inl t₁ ⊔ coinduced Sum.inr t₂
instance instTopologicalSpaceSigma {ι : Type*} {X : ι → Type v} [t₂ : ∀ i, TopologicalSpace (X i)] :
TopologicalSpace (Sigma X) :=
⨆ i, coinduced (Sigma.mk i) (t₂ i)
instance Pi.topologicalSpace {ι : Type*} {Y : ι → Type v} [t₂ : (i : ι) → TopologicalSpace (Y i)] :
TopologicalSpace ((i : ι) → Y i) :=
⨅ i, induced (fun f => f i) (t₂ i)
#align Pi.topological_space Pi.topologicalSpace
instance ULift.topologicalSpace [t : TopologicalSpace X] : TopologicalSpace (ULift.{v, u} X) :=
t.induced ULift.down
#align ulift.topological_space ULift.topologicalSpace
/-!
### `Additive`, `Multiplicative`
The topology on those type synonyms is inherited without change.
-/
section
variable [TopologicalSpace X]
open Additive Multiplicative
instance : TopologicalSpace (Additive X) := ‹TopologicalSpace X›
instance : TopologicalSpace (Multiplicative X) := ‹TopologicalSpace X›
instance [DiscreteTopology X] : DiscreteTopology (Additive X) := ‹DiscreteTopology X›
instance [DiscreteTopology X] : DiscreteTopology (Multiplicative X) := ‹DiscreteTopology X›
theorem continuous_ofMul : Continuous (ofMul : X → Additive X) := continuous_id
#align continuous_of_mul continuous_ofMul
theorem continuous_toMul : Continuous (toMul : Additive X → X) := continuous_id
#align continuous_to_mul continuous_toMul
theorem continuous_ofAdd : Continuous (ofAdd : X → Multiplicative X) := continuous_id
#align continuous_of_add continuous_ofAdd
theorem continuous_toAdd : Continuous (toAdd : Multiplicative X → X) := continuous_id
#align continuous_to_add continuous_toAdd
theorem isOpenMap_ofMul : IsOpenMap (ofMul : X → Additive X) := IsOpenMap.id
#align is_open_map_of_mul isOpenMap_ofMul
theorem isOpenMap_toMul : IsOpenMap (toMul : Additive X → X) := IsOpenMap.id
#align is_open_map_to_mul isOpenMap_toMul
theorem isOpenMap_ofAdd : IsOpenMap (ofAdd : X → Multiplicative X) := IsOpenMap.id
#align is_open_map_of_add isOpenMap_ofAdd
theorem isOpenMap_toAdd : IsOpenMap (toAdd : Multiplicative X → X) := IsOpenMap.id
#align is_open_map_to_add isOpenMap_toAdd
theorem isClosedMap_ofMul : IsClosedMap (ofMul : X → Additive X) := IsClosedMap.id
#align is_closed_map_of_mul isClosedMap_ofMul
theorem isClosedMap_toMul : IsClosedMap (toMul : Additive X → X) := IsClosedMap.id
#align is_closed_map_to_mul isClosedMap_toMul
theorem isClosedMap_ofAdd : IsClosedMap (ofAdd : X → Multiplicative X) := IsClosedMap.id
#align is_closed_map_of_add isClosedMap_ofAdd
theorem isClosedMap_toAdd : IsClosedMap (toAdd : Multiplicative X → X) := IsClosedMap.id
#align is_closed_map_to_add isClosedMap_toAdd
theorem nhds_ofMul (x : X) : 𝓝 (ofMul x) = map ofMul (𝓝 x) := rfl
#align nhds_of_mul nhds_ofMul
theorem nhds_ofAdd (x : X) : 𝓝 (ofAdd x) = map ofAdd (𝓝 x) := rfl
#align nhds_of_add nhds_ofAdd
theorem nhds_toMul (x : Additive X) : 𝓝 (toMul x) = map toMul (𝓝 x) := rfl
#align nhds_to_mul nhds_toMul
theorem nhds_toAdd (x : Multiplicative X) : 𝓝 (toAdd x) = map toAdd (𝓝 x) := rfl
#align nhds_to_add nhds_toAdd
end
/-!
### Order dual
The topology on this type synonym is inherited without change.
-/
section
variable [TopologicalSpace X]
open OrderDual
instance : TopologicalSpace Xᵒᵈ := ‹TopologicalSpace X›
instance [DiscreteTopology X] : DiscreteTopology Xᵒᵈ := ‹DiscreteTopology X›
theorem continuous_toDual : Continuous (toDual : X → Xᵒᵈ) := continuous_id
#align continuous_to_dual continuous_toDual
theorem continuous_ofDual : Continuous (ofDual : Xᵒᵈ → X) := continuous_id
#align continuous_of_dual continuous_ofDual
theorem isOpenMap_toDual : IsOpenMap (toDual : X → Xᵒᵈ) := IsOpenMap.id
#align is_open_map_to_dual isOpenMap_toDual
theorem isOpenMap_ofDual : IsOpenMap (ofDual : Xᵒᵈ → X) := IsOpenMap.id
#align is_open_map_of_dual isOpenMap_ofDual
theorem isClosedMap_toDual : IsClosedMap (toDual : X → Xᵒᵈ) := IsClosedMap.id
#align is_closed_map_to_dual isClosedMap_toDual
theorem isClosedMap_ofDual : IsClosedMap (ofDual : Xᵒᵈ → X) := IsClosedMap.id
#align is_closed_map_of_dual isClosedMap_ofDual
theorem nhds_toDual (x : X) : 𝓝 (toDual x) = map toDual (𝓝 x) := rfl
#align nhds_to_dual nhds_toDual
theorem nhds_ofDual (x : X) : 𝓝 (ofDual x) = map ofDual (𝓝 x) := rfl
#align nhds_of_dual nhds_ofDual
end
theorem Quotient.preimage_mem_nhds [TopologicalSpace X] [s : Setoid X] {V : Set <| Quotient s}
{x : X} (hs : V ∈ 𝓝 (Quotient.mk' x)) : Quotient.mk' ⁻¹' V ∈ 𝓝 x :=
preimage_nhds_coinduced hs
#align quotient.preimage_mem_nhds Quotient.preimage_mem_nhds
/-- The image of a dense set under `Quotient.mk'` is a dense set. -/
theorem Dense.quotient [Setoid X] [TopologicalSpace X] {s : Set X} (H : Dense s) :
Dense (Quotient.mk' '' s) :=
Quotient.surjective_Quotient_mk''.denseRange.dense_image continuous_coinduced_rng H
#align dense.quotient Dense.quotient
/-- The composition of `Quotient.mk'` and a function with dense range has dense range. -/
theorem DenseRange.quotient [Setoid X] [TopologicalSpace X] {f : Y → X} (hf : DenseRange f) :
DenseRange (Quotient.mk' ∘ f) :=
Quotient.surjective_Quotient_mk''.denseRange.comp hf continuous_coinduced_rng
#align dense_range.quotient DenseRange.quotient
instance {p : X → Prop} [TopologicalSpace X] [DiscreteTopology X] : DiscreteTopology (Subtype p) :=
⟨bot_unique fun s _ => ⟨(↑) '' s, isOpen_discrete _, preimage_image_eq _ Subtype.val_injective⟩⟩
instance Sum.discreteTopology [TopologicalSpace X] [TopologicalSpace Y] [h : DiscreteTopology X]
[hY : DiscreteTopology Y] : DiscreteTopology (X ⊕ Y) :=
⟨sup_eq_bot_iff.2 <| by simp [h.eq_bot, hY.eq_bot]⟩
#align sum.discrete_topology Sum.discreteTopology
instance Sigma.discreteTopology {ι : Type*} {Y : ι → Type v} [∀ i, TopologicalSpace (Y i)]
[h : ∀ i, DiscreteTopology (Y i)] : DiscreteTopology (Sigma Y) :=
⟨iSup_eq_bot.2 fun _ => by simp only [(h _).eq_bot, coinduced_bot]⟩
#align sigma.discrete_topology Sigma.discreteTopology
section Top
variable [TopologicalSpace X]
/-
The 𝓝 filter and the subspace topology.
-/
theorem mem_nhds_subtype (s : Set X) (x : { x // x ∈ s }) (t : Set { x // x ∈ s }) :
t ∈ 𝓝 x ↔ ∃ u ∈ 𝓝 (x : X), Subtype.val ⁻¹' u ⊆ t :=
mem_nhds_induced _ x t
#align mem_nhds_subtype mem_nhds_subtype
theorem nhds_subtype (s : Set X) (x : { x // x ∈ s }) : 𝓝 x = comap (↑) (𝓝 (x : X)) :=
nhds_induced _ x
#align nhds_subtype nhds_subtype
theorem nhdsWithin_subtype_eq_bot_iff {s t : Set X} {x : s} :
𝓝[((↑) : s → X) ⁻¹' t] x = ⊥ ↔ 𝓝[t] (x : X) ⊓ 𝓟 s = ⊥ := by
rw [inf_principal_eq_bot_iff_comap, nhdsWithin, nhdsWithin, comap_inf, comap_principal,
nhds_induced]
#align nhds_within_subtype_eq_bot_iff nhdsWithin_subtype_eq_bot_iff
theorem nhds_ne_subtype_eq_bot_iff {S : Set X} {x : S} :
𝓝[≠] x = ⊥ ↔ 𝓝[≠] (x : X) ⊓ 𝓟 S = ⊥ := by
rw [← nhdsWithin_subtype_eq_bot_iff, preimage_compl, ← image_singleton,
Subtype.coe_injective.preimage_image]
#align nhds_ne_subtype_eq_bot_iff nhds_ne_subtype_eq_bot_iff
theorem nhds_ne_subtype_neBot_iff {S : Set X} {x : S} :
(𝓝[≠] x).NeBot ↔ (𝓝[≠] (x : X) ⊓ 𝓟 S).NeBot := by
rw [neBot_iff, neBot_iff, not_iff_not, nhds_ne_subtype_eq_bot_iff]
#align nhds_ne_subtype_ne_bot_iff nhds_ne_subtype_neBot_iff
theorem discreteTopology_subtype_iff {S : Set X} :
DiscreteTopology S ↔ ∀ x ∈ S, 𝓝[≠] x ⊓ 𝓟 S = ⊥ := by
simp_rw [discreteTopology_iff_nhds_ne, SetCoe.forall', nhds_ne_subtype_eq_bot_iff]
#align discrete_topology_subtype_iff discreteTopology_subtype_iff
end Top
/-- A type synonym equipped with the topology whose open sets are the empty set and the sets with
finite complements. -/
def CofiniteTopology (X : Type*) := X
#align cofinite_topology CofiniteTopology
namespace CofiniteTopology
/-- The identity equivalence between `` and `CofiniteTopology `. -/
def of : X ≃ CofiniteTopology X :=
Equiv.refl X
#align cofinite_topology.of CofiniteTopology.of
instance [Inhabited X] : Inhabited (CofiniteTopology X) where default := of default
instance : TopologicalSpace (CofiniteTopology X) where
IsOpen s := s.Nonempty → Set.Finite sᶜ
isOpen_univ := by simp
isOpen_inter s t := by
rintro hs ht ⟨x, hxs, hxt⟩
rw [compl_inter]
exact (hs ⟨x, hxs⟩).union (ht ⟨x, hxt⟩)
isOpen_sUnion := by
rintro s h ⟨x, t, hts, hzt⟩
rw [Set.compl_sUnion]
exact Set.Finite.sInter (mem_image_of_mem _ hts) (h t hts ⟨x, hzt⟩)
theorem isOpen_iff {s : Set (CofiniteTopology X)} : IsOpen s ↔ s.Nonempty → sᶜ.Finite :=
Iff.rfl
#align cofinite_topology.is_open_iff CofiniteTopology.isOpen_iff
theorem isOpen_iff' {s : Set (CofiniteTopology X)} : IsOpen s ↔ s = ∅ ∨ sᶜ.Finite := by
simp only [isOpen_iff, nonempty_iff_ne_empty, or_iff_not_imp_left]
#align cofinite_topology.is_open_iff' CofiniteTopology.isOpen_iff'
theorem isClosed_iff {s : Set (CofiniteTopology X)} : IsClosed s ↔ s = univ ∨ s.Finite := by
simp only [← isOpen_compl_iff, isOpen_iff', compl_compl, compl_empty_iff]
#align cofinite_topology.is_closed_iff CofiniteTopology.isClosed_iff
theorem nhds_eq (x : CofiniteTopology X) : 𝓝 x = pure x ⊔ cofinite := by
ext U
rw [mem_nhds_iff]
constructor
· rintro ⟨V, hVU, V_op, haV⟩
exact mem_sup.mpr ⟨hVU haV, mem_of_superset (V_op ⟨_, haV⟩) hVU⟩
· rintro ⟨hU : x ∈ U, hU' : Uᶜ.Finite⟩
exact ⟨U, Subset.rfl, fun _ => hU', hU⟩
#align cofinite_topology.nhds_eq CofiniteTopology.nhds_eq
theorem mem_nhds_iff {x : CofiniteTopology X} {s : Set (CofiniteTopology X)} :
s ∈ 𝓝 x ↔ x ∈ s ∧ sᶜ.Finite := by simp [nhds_eq]
#align cofinite_topology.mem_nhds_iff CofiniteTopology.mem_nhds_iff
end CofiniteTopology
end Constructions
section Prod
variable [TopologicalSpace X] [TopologicalSpace Y] [TopologicalSpace Z] [TopologicalSpace W]
[TopologicalSpace ε] [TopologicalSpace ζ]
-- Porting note (#11215): TODO: Lean 4 fails to deduce implicit args
@[simp] theorem continuous_prod_mk {f : X → Y} {g : X → Z} :
(Continuous fun x => (f x, g x)) ↔ Continuous f ∧ Continuous g :=
(@continuous_inf_rng X (Y × Z) _ _ (TopologicalSpace.induced Prod.fst _)
(TopologicalSpace.induced Prod.snd _)).trans <|
continuous_induced_rng.and continuous_induced_rng
#align continuous_prod_mk continuous_prod_mk
@[continuity]
theorem continuous_fst : Continuous (@Prod.fst X Y) :=
(continuous_prod_mk.1 continuous_id).1
#align continuous_fst continuous_fst
/-- Postcomposing `f` with `Prod.fst` is continuous -/
@[fun_prop]
theorem Continuous.fst {f : X → Y × Z} (hf : Continuous f) : Continuous fun x : X => (f x).1 :=
continuous_fst.comp hf
#align continuous.fst Continuous.fst
/-- Precomposing `f` with `Prod.fst` is continuous -/
theorem Continuous.fst' {f : X → Z} (hf : Continuous f) : Continuous fun x : X × Y => f x.fst :=
hf.comp continuous_fst
#align continuous.fst' Continuous.fst'
theorem continuousAt_fst {p : X × Y} : ContinuousAt Prod.fst p :=
continuous_fst.continuousAt
#align continuous_at_fst continuousAt_fst
/-- Postcomposing `f` with `Prod.fst` is continuous at `x` -/
@[fun_prop]
theorem ContinuousAt.fst {f : X → Y × Z} {x : X} (hf : ContinuousAt f x) :
ContinuousAt (fun x : X => (f x).1) x :=
continuousAt_fst.comp hf
#align continuous_at.fst ContinuousAt.fst
/-- Precomposing `f` with `Prod.fst` is continuous at `(x, y)` -/
theorem ContinuousAt.fst' {f : X → Z} {x : X} {y : Y} (hf : ContinuousAt f x) :
ContinuousAt (fun x : X × Y => f x.fst) (x, y) :=
ContinuousAt.comp hf continuousAt_fst
#align continuous_at.fst' ContinuousAt.fst'
/-- Precomposing `f` with `Prod.fst` is continuous at `x : X × Y` -/
theorem ContinuousAt.fst'' {f : X → Z} {x : X × Y} (hf : ContinuousAt f x.fst) :
ContinuousAt (fun x : X × Y => f x.fst) x :=
hf.comp continuousAt_fst
#align continuous_at.fst'' ContinuousAt.fst''
theorem Filter.Tendsto.fst_nhds {l : Filter X} {f : X → Y × Z} {p : Y × Z}
(h : Tendsto f l (𝓝 p)) : Tendsto (fun a ↦ (f a).1) l (𝓝 <| p.1) :=
continuousAt_fst.tendsto.comp h
@[continuity]
theorem continuous_snd : Continuous (@Prod.snd X Y) :=
(continuous_prod_mk.1 continuous_id).2
#align continuous_snd continuous_snd
/-- Postcomposing `f` with `Prod.snd` is continuous -/
@[fun_prop]
theorem Continuous.snd {f : X → Y × Z} (hf : Continuous f) : Continuous fun x : X => (f x).2 :=
continuous_snd.comp hf
#align continuous.snd Continuous.snd
/-- Precomposing `f` with `Prod.snd` is continuous -/
theorem Continuous.snd' {f : Y → Z} (hf : Continuous f) : Continuous fun x : X × Y => f x.snd :=
hf.comp continuous_snd
#align continuous.snd' Continuous.snd'
theorem continuousAt_snd {p : X × Y} : ContinuousAt Prod.snd p :=
continuous_snd.continuousAt
#align continuous_at_snd continuousAt_snd
/-- Postcomposing `f` with `Prod.snd` is continuous at `x` -/
@[fun_prop]
theorem ContinuousAt.snd {f : X → Y × Z} {x : X} (hf : ContinuousAt f x) :
ContinuousAt (fun x : X => (f x).2) x :=
continuousAt_snd.comp hf
#align continuous_at.snd ContinuousAt.snd
/-- Precomposing `f` with `Prod.snd` is continuous at `(x, y)` -/
theorem ContinuousAt.snd' {f : Y → Z} {x : X} {y : Y} (hf : ContinuousAt f y) :
ContinuousAt (fun x : X × Y => f x.snd) (x, y) :=
ContinuousAt.comp hf continuousAt_snd
#align continuous_at.snd' ContinuousAt.snd'
/-- Precomposing `f` with `Prod.snd` is continuous at `x : X × Y` -/
theorem ContinuousAt.snd'' {f : Y → Z} {x : X × Y} (hf : ContinuousAt f x.snd) :
ContinuousAt (fun x : X × Y => f x.snd) x :=
hf.comp continuousAt_snd
#align continuous_at.snd'' ContinuousAt.snd''
theorem Filter.Tendsto.snd_nhds {l : Filter X} {f : X → Y × Z} {p : Y × Z}
(h : Tendsto f l (𝓝 p)) : Tendsto (fun a ↦ (f a).2) l (𝓝 <| p.2) :=
continuousAt_snd.tendsto.comp h
@[continuity, fun_prop]
theorem Continuous.prod_mk {f : Z → X} {g : Z → Y} (hf : Continuous f) (hg : Continuous g) :
Continuous fun x => (f x, g x) :=
continuous_prod_mk.2 ⟨hf, hg⟩
#align continuous.prod_mk Continuous.prod_mk
@[continuity]
theorem Continuous.Prod.mk (x : X) : Continuous fun y : Y => (x, y) :=
continuous_const.prod_mk continuous_id
#align continuous.prod.mk Continuous.Prod.mk
@[continuity]
theorem Continuous.Prod.mk_left (y : Y) : Continuous fun x : X => (x, y) :=
continuous_id.prod_mk continuous_const
#align continuous.prod.mk_left Continuous.Prod.mk_left
/-- If `f x y` is continuous in `x` for all `y ∈ s`,
then the set of `x` such that `f x` maps `s` to `t` is closed. -/
lemma IsClosed.setOf_mapsTo {α : Type*} {f : X → α → Z} {s : Set α} {t : Set Z} (ht : IsClosed t)
(hf : ∀ a ∈ s, Continuous (f · a)) : IsClosed {x | MapsTo (f x) s t} := by
simpa only [MapsTo, setOf_forall] using isClosed_biInter fun y hy ↦ ht.preimage (hf y hy)
theorem Continuous.comp₂ {g : X × Y → Z} (hg : Continuous g) {e : W → X} (he : Continuous e)
{f : W → Y} (hf : Continuous f) : Continuous fun w => g (e w, f w) :=
hg.comp <| he.prod_mk hf
#align continuous.comp₂ Continuous.comp₂
theorem Continuous.comp₃ {g : X × Y × Z → ε} (hg : Continuous g) {e : W → X} (he : Continuous e)
{f : W → Y} (hf : Continuous f) {k : W → Z} (hk : Continuous k) :
Continuous fun w => g (e w, f w, k w) :=
hg.comp₂ he <| hf.prod_mk hk
#align continuous.comp₃ Continuous.comp₃
theorem Continuous.comp₄ {g : X × Y × Z × ζ → ε} (hg : Continuous g) {e : W → X} (he : Continuous e)
{f : W → Y} (hf : Continuous f) {k : W → Z} (hk : Continuous k) {l : W → ζ}
(hl : Continuous l) : Continuous fun w => g (e w, f w, k w, l w) :=
hg.comp₃ he hf <| hk.prod_mk hl
#align continuous.comp₄ Continuous.comp₄
@[continuity]
theorem Continuous.prod_map {f : Z → X} {g : W → Y} (hf : Continuous f) (hg : Continuous g) :
Continuous fun p : Z × W => (f p.1, g p.2) :=
hf.fst'.prod_mk hg.snd'
#align continuous.prod_map Continuous.prod_map
/-- A version of `continuous_inf_dom_left` for binary functions -/
theorem continuous_inf_dom_left₂ {X Y Z} {f : X → Y → Z} {ta1 ta2 : TopologicalSpace X}
{tb1 tb2 : TopologicalSpace Y} {tc1 : TopologicalSpace Z}
(h : by haveI := ta1; haveI := tb1; exact Continuous fun p : X × Y => f p.1 p.2) : by
haveI := ta1 ⊓ ta2; haveI := tb1 ⊓ tb2; exact Continuous fun p : X × Y => f p.1 p.2 := by
have ha := @continuous_inf_dom_left _ _ id ta1 ta2 ta1 (@continuous_id _ (id _))
have hb := @continuous_inf_dom_left _ _ id tb1 tb2 tb1 (@continuous_id _ (id _))
have h_continuous_id := @Continuous.prod_map _ _ _ _ ta1 tb1 (ta1 ⊓ ta2) (tb1 ⊓ tb2) _ _ ha hb
exact @Continuous.comp _ _ _ (id _) (id _) _ _ _ h h_continuous_id
#align continuous_inf_dom_left₂ continuous_inf_dom_left₂
/-- A version of `continuous_inf_dom_right` for binary functions -/
theorem continuous_inf_dom_right₂ {X Y Z} {f : X → Y → Z} {ta1 ta2 : TopologicalSpace X}
{tb1 tb2 : TopologicalSpace Y} {tc1 : TopologicalSpace Z}
(h : by haveI := ta2; haveI := tb2; exact Continuous fun p : X × Y => f p.1 p.2) : by
haveI := ta1 ⊓ ta2; haveI := tb1 ⊓ tb2; exact Continuous fun p : X × Y => f p.1 p.2 := by
have ha := @continuous_inf_dom_right _ _ id ta1 ta2 ta2 (@continuous_id _ (id _))
have hb := @continuous_inf_dom_right _ _ id tb1 tb2 tb2 (@continuous_id _ (id _))
have h_continuous_id := @Continuous.prod_map _ _ _ _ ta2 tb2 (ta1 ⊓ ta2) (tb1 ⊓ tb2) _ _ ha hb
exact @Continuous.comp _ _ _ (id _) (id _) _ _ _ h h_continuous_id
#align continuous_inf_dom_right₂ continuous_inf_dom_right₂
/-- A version of `continuous_sInf_dom` for binary functions -/
theorem continuous_sInf_dom₂ {X Y Z} {f : X → Y → Z} {tas : Set (TopologicalSpace X)}
{tbs : Set (TopologicalSpace Y)} {tX : TopologicalSpace X} {tY : TopologicalSpace Y}
{tc : TopologicalSpace Z} (hX : tX ∈ tas) (hY : tY ∈ tbs)
(hf : Continuous fun p : X × Y => f p.1 p.2) : by
haveI := sInf tas; haveI := sInf tbs;
exact @Continuous _ _ _ tc fun p : X × Y => f p.1 p.2 := by
have hX := continuous_sInf_dom hX continuous_id
have hY := continuous_sInf_dom hY continuous_id
have h_continuous_id := @Continuous.prod_map _ _ _ _ tX tY (sInf tas) (sInf tbs) _ _ hX hY
exact @Continuous.comp _ _ _ (id _) (id _) _ _ _ hf h_continuous_id
#align continuous_Inf_dom₂ continuous_sInf_dom₂
theorem Filter.Eventually.prod_inl_nhds {p : X → Prop} {x : X} (h : ∀ᶠ x in 𝓝 x, p x) (y : Y) :
∀ᶠ x in 𝓝 (x, y), p (x : X × Y).1 :=
continuousAt_fst h
#align filter.eventually.prod_inl_nhds Filter.Eventually.prod_inl_nhds
theorem Filter.Eventually.prod_inr_nhds {p : Y → Prop} {y : Y} (h : ∀ᶠ x in 𝓝 y, p x) (x : X) :
∀ᶠ x in 𝓝 (x, y), p (x : X × Y).2 :=
continuousAt_snd h
#align filter.eventually.prod_inr_nhds Filter.Eventually.prod_inr_nhds
theorem Filter.Eventually.prod_mk_nhds {px : X → Prop} {x} (hx : ∀ᶠ x in 𝓝 x, px x) {py : Y → Prop}
{y} (hy : ∀ᶠ y in 𝓝 y, py y) : ∀ᶠ p in 𝓝 (x, y), px (p : X × Y).1 ∧ py p.2 :=
(hx.prod_inl_nhds y).and (hy.prod_inr_nhds x)
#align filter.eventually.prod_mk_nhds Filter.Eventually.prod_mk_nhds
theorem continuous_swap : Continuous (Prod.swap : X × Y → Y × X) :=
continuous_snd.prod_mk continuous_fst
#align continuous_swap continuous_swap
lemma isClosedMap_swap : IsClosedMap (Prod.swap : X × Y → Y × X) := fun s hs ↦ by
rw [image_swap_eq_preimage_swap]
exact hs.preimage continuous_swap
theorem Continuous.uncurry_left {f : X → Y → Z} (x : X) (h : Continuous (uncurry f)) :
Continuous (f x) :=
h.comp (Continuous.Prod.mk _)
#align continuous_uncurry_left Continuous.uncurry_left
theorem Continuous.uncurry_right {f : X → Y → Z} (y : Y) (h : Continuous (uncurry f)) :
Continuous fun a => f a y :=
h.comp (Continuous.Prod.mk_left _)
#align continuous_uncurry_right Continuous.uncurry_right
-- 2024-03-09
@[deprecated] alias continuous_uncurry_left := Continuous.uncurry_left
@[deprecated] alias continuous_uncurry_right := Continuous.uncurry_right
theorem continuous_curry {g : X × Y → Z} (x : X) (h : Continuous g) : Continuous (curry g x) :=
Continuous.uncurry_left x h
#align continuous_curry continuous_curry
theorem IsOpen.prod {s : Set X} {t : Set Y} (hs : IsOpen s) (ht : IsOpen t) : IsOpen (s ×ˢ t) :=
(hs.preimage continuous_fst).inter (ht.preimage continuous_snd)
#align is_open.prod IsOpen.prod
-- Porting note (#11215): TODO: Lean fails to find `t₁` and `t₂` by unification
theorem nhds_prod_eq {x : X} {y : Y} : 𝓝 (x, y) = 𝓝 x ×ˢ 𝓝 y := by
dsimp only [SProd.sprod]
rw [Filter.prod, instTopologicalSpaceProd, nhds_inf (t₁ := TopologicalSpace.induced Prod.fst _)
(t₂ := TopologicalSpace.induced Prod.snd _), nhds_induced, nhds_induced]
#align nhds_prod_eq nhds_prod_eq
-- Porting note: moved from `topology.continuous_on`
theorem nhdsWithin_prod_eq (x : X) (y : Y) (s : Set X) (t : Set Y) :
𝓝[s ×ˢ t] (x, y) = 𝓝[s] x ×ˢ 𝓝[t] y := by
simp only [nhdsWithin, nhds_prod_eq, ← prod_inf_prod, prod_principal_principal]
#align nhds_within_prod_eq nhdsWithin_prod_eq
#noalign continuous_uncurry_of_discrete_topology
theorem mem_nhds_prod_iff {x : X} {y : Y} {s : Set (X × Y)} :
s ∈ 𝓝 (x, y) ↔ ∃ u ∈ 𝓝 x, ∃ v ∈ 𝓝 y, u ×ˢ v ⊆ s := by rw [nhds_prod_eq, mem_prod_iff]
#align mem_nhds_prod_iff mem_nhds_prod_iff
theorem mem_nhdsWithin_prod_iff {x : X} {y : Y} {s : Set (X × Y)} {tx : Set X} {ty : Set Y} :
s ∈ 𝓝[tx ×ˢ ty] (x, y) ↔ ∃ u ∈ 𝓝[tx] x, ∃ v ∈ 𝓝[ty] y, u ×ˢ v ⊆ s := by
rw [nhdsWithin_prod_eq, mem_prod_iff]
-- Porting note: moved up
theorem Filter.HasBasis.prod_nhds {ιX ιY : Type*} {px : ιX → Prop} {py : ιY → Prop}
{sx : ιX → Set X} {sy : ιY → Set Y} {x : X} {y : Y} (hx : (𝓝 x).HasBasis px sx)
(hy : (𝓝 y).HasBasis py sy) :
(𝓝 (x, y)).HasBasis (fun i : ιX × ιY => px i.1 ∧ py i.2) fun i => sx i.1 ×ˢ sy i.2 := by
rw [nhds_prod_eq]
exact hx.prod hy
#align filter.has_basis.prod_nhds Filter.HasBasis.prod_nhds
-- Porting note: moved up
theorem Filter.HasBasis.prod_nhds' {ιX ιY : Type*} {pX : ιX → Prop} {pY : ιY → Prop}
{sx : ιX → Set X} {sy : ιY → Set Y} {p : X × Y} (hx : (𝓝 p.1).HasBasis pX sx)
(hy : (𝓝 p.2).HasBasis pY sy) :
(𝓝 p).HasBasis (fun i : ιX × ιY => pX i.1 ∧ pY i.2) fun i => sx i.1 ×ˢ sy i.2 :=
hx.prod_nhds hy
#align filter.has_basis.prod_nhds' Filter.HasBasis.prod_nhds'
theorem mem_nhds_prod_iff' {x : X} {y : Y} {s : Set (X × Y)} :
s ∈ 𝓝 (x, y) ↔ ∃ u v, IsOpen u ∧ x ∈ u ∧ IsOpen v ∧ y ∈ v ∧ u ×ˢ v ⊆ s :=
((nhds_basis_opens x).prod_nhds (nhds_basis_opens y)).mem_iff.trans <| by
simp only [Prod.exists, and_comm, and_assoc, and_left_comm]
#align mem_nhds_prod_iff' mem_nhds_prod_iff'
theorem Prod.tendsto_iff {X} (seq : X → Y × Z) {f : Filter X} (p : Y × Z) :
Tendsto seq f (𝓝 p) ↔
Tendsto (fun n => (seq n).fst) f (𝓝 p.fst) ∧ Tendsto (fun n => (seq n).snd) f (𝓝 p.snd) := by
rw [nhds_prod_eq, Filter.tendsto_prod_iff']
#align prod.tendsto_iff Prod.tendsto_iff
instance [DiscreteTopology X] [DiscreteTopology Y] : DiscreteTopology (X × Y) :=
discreteTopology_iff_nhds.2 fun (a, b) => by
rw [nhds_prod_eq, nhds_discrete X, nhds_discrete Y, prod_pure_pure]
theorem prod_mem_nhds_iff {s : Set X} {t : Set Y} {x : X} {y : Y} :
s ×ˢ t ∈ 𝓝 (x, y) ↔ s ∈ 𝓝 x ∧ t ∈ 𝓝 y := by rw [nhds_prod_eq, prod_mem_prod_iff]
#align prod_mem_nhds_iff prod_mem_nhds_iff
theorem prod_mem_nhds {s : Set X} {t : Set Y} {x : X} {y : Y} (hx : s ∈ 𝓝 x) (hy : t ∈ 𝓝 y) :
s ×ˢ t ∈ 𝓝 (x, y) :=
prod_mem_nhds_iff.2 ⟨hx, hy⟩
#align prod_mem_nhds prod_mem_nhds
theorem isOpen_setOf_disjoint_nhds_nhds : IsOpen { p : X × X | Disjoint (𝓝 p.1) (𝓝 p.2) } := by
simp only [isOpen_iff_mem_nhds, Prod.forall, mem_setOf_eq]
intro x y h
obtain ⟨U, hU, V, hV, hd⟩ := ((nhds_basis_opens x).disjoint_iff (nhds_basis_opens y)).mp h
exact mem_nhds_prod_iff'.mpr ⟨U, V, hU.2, hU.1, hV.2, hV.1, fun ⟨x', y'⟩ ⟨hx', hy'⟩ =>
disjoint_of_disjoint_of_mem hd (hU.2.mem_nhds hx') (hV.2.mem_nhds hy')⟩
#align is_open_set_of_disjoint_nhds_nhds isOpen_setOf_disjoint_nhds_nhds
theorem Filter.Eventually.prod_nhds {p : X → Prop} {q : Y → Prop} {x : X} {y : Y}
(hx : ∀ᶠ x in 𝓝 x, p x) (hy : ∀ᶠ y in 𝓝 y, q y) : ∀ᶠ z : X × Y in 𝓝 (x, y), p z.1 ∧ q z.2 :=
prod_mem_nhds hx hy
#align filter.eventually.prod_nhds Filter.Eventually.prod_nhds
theorem nhds_swap (x : X) (y : Y) : 𝓝 (x, y) = (𝓝 (y, x)).map Prod.swap := by
rw [nhds_prod_eq, Filter.prod_comm, nhds_prod_eq]; rfl
#align nhds_swap nhds_swap
theorem Filter.Tendsto.prod_mk_nhds {γ} {x : X} {y : Y} {f : Filter γ} {mx : γ → X} {my : γ → Y}
(hx : Tendsto mx f (𝓝 x)) (hy : Tendsto my f (𝓝 y)) :
Tendsto (fun c => (mx c, my c)) f (𝓝 (x, y)) := by
rw [nhds_prod_eq]; exact Filter.Tendsto.prod_mk hx hy
#align filter.tendsto.prod_mk_nhds Filter.Tendsto.prod_mk_nhds
theorem Filter.Eventually.curry_nhds {p : X × Y → Prop} {x : X} {y : Y}
(h : ∀ᶠ x in 𝓝 (x, y), p x) : ∀ᶠ x' in 𝓝 x, ∀ᶠ y' in 𝓝 y, p (x', y') := by
rw [nhds_prod_eq] at h
exact h.curry
#align filter.eventually.curry_nhds Filter.Eventually.curry_nhds
@[fun_prop]
theorem ContinuousAt.prod {f : X → Y} {g : X → Z} {x : X} (hf : ContinuousAt f x)
(hg : ContinuousAt g x) : ContinuousAt (fun x => (f x, g x)) x :=
hf.prod_mk_nhds hg
#align continuous_at.prod ContinuousAt.prod
theorem ContinuousAt.prod_map {f : X → Z} {g : Y → W} {p : X × Y} (hf : ContinuousAt f p.fst)
(hg : ContinuousAt g p.snd) : ContinuousAt (fun p : X × Y => (f p.1, g p.2)) p :=
hf.fst''.prod hg.snd''
#align continuous_at.prod_map ContinuousAt.prod_map
theorem ContinuousAt.prod_map' {f : X → Z} {g : Y → W} {x : X} {y : Y} (hf : ContinuousAt f x)
(hg : ContinuousAt g y) : ContinuousAt (fun p : X × Y => (f p.1, g p.2)) (x, y) :=
hf.fst'.prod hg.snd'
#align continuous_at.prod_map' ContinuousAt.prod_map'
theorem ContinuousAt.comp₂ {f : Y × Z → W} {g : X → Y} {h : X → Z} {x : X}
(hf : ContinuousAt f (g x, h x)) (hg : ContinuousAt g x) (hh : ContinuousAt h x) :
ContinuousAt (fun x ↦ f (g x, h x)) x :=
ContinuousAt.comp hf (hg.prod hh)
theorem ContinuousAt.comp₂_of_eq {f : Y × Z → W} {g : X → Y} {h : X → Z} {x : X} {y : Y × Z}
(hf : ContinuousAt f y) (hg : ContinuousAt g x) (hh : ContinuousAt h x) (e : (g x, h x) = y) :
ContinuousAt (fun x ↦ f (g x, h x)) x := by
rw [← e] at hf
exact hf.comp₂ hg hh
/-- Continuous functions on products are continuous in their first argument -/
theorem Continuous.curry_left {f : X × Y → Z} (hf : Continuous f) {y : Y} :
Continuous fun x ↦ f (x, y) :=
hf.comp (continuous_id.prod_mk continuous_const)
alias Continuous.along_fst := Continuous.curry_left
/-- Continuous functions on products are continuous in their second argument -/
theorem Continuous.curry_right {f : X × Y → Z} (hf : Continuous f) {x : X} :
Continuous fun y ↦ f (x, y) :=
hf.comp (continuous_const.prod_mk continuous_id)
alias Continuous.along_snd := Continuous.curry_right
-- todo: reformulate using `Set.image2`
-- todo: prove a version of `generateFrom_union` with `image2 (∩) s t` in the LHS and use it here
theorem prod_generateFrom_generateFrom_eq {X Y : Type*} {s : Set (Set X)} {t : Set (Set Y)}
(hs : ⋃₀ s = univ) (ht : ⋃₀ t = univ) :
@instTopologicalSpaceProd X Y (generateFrom s) (generateFrom t) =
generateFrom { g | ∃ u ∈ s, ∃ v ∈ t, g = u ×ˢ v } :=
let G := generateFrom { g | ∃ u ∈ s, ∃ v ∈ t, g = u ×ˢ v }
le_antisymm
(le_generateFrom fun g ⟨u, hu, v, hv, g_eq⟩ =>
g_eq.symm ▸
@IsOpen.prod _ _ (generateFrom s) (generateFrom t) _ _ (GenerateOpen.basic _ hu)
(GenerateOpen.basic _ hv))
(le_inf
(coinduced_le_iff_le_induced.mp <|
le_generateFrom fun u hu =>
have : ⋃ v ∈ t, u ×ˢ v = Prod.fst ⁻¹' u := by
simp_rw [← prod_iUnion, ← sUnion_eq_biUnion, ht, prod_univ]
show G.IsOpen (Prod.fst ⁻¹' u) by
rw [← this]
exact
isOpen_iUnion fun v =>
isOpen_iUnion fun hv => GenerateOpen.basic _ ⟨_, hu, _, hv, rfl⟩)
(coinduced_le_iff_le_induced.mp <|
le_generateFrom fun v hv =>
have : ⋃ u ∈ s, u ×ˢ v = Prod.snd ⁻¹' v := by
simp_rw [← iUnion_prod_const, ← sUnion_eq_biUnion, hs, univ_prod]
show G.IsOpen (Prod.snd ⁻¹' v) by
rw [← this]
exact
isOpen_iUnion fun u =>
isOpen_iUnion fun hu => GenerateOpen.basic _ ⟨_, hu, _, hv, rfl⟩))
#align prod_generate_from_generate_from_eq prod_generateFrom_generateFrom_eq
-- todo: use the previous lemma?
theorem prod_eq_generateFrom :
instTopologicalSpaceProd =
generateFrom { g | ∃ (s : Set X) (t : Set Y), IsOpen s ∧ IsOpen t ∧ g = s ×ˢ t } :=
le_antisymm (le_generateFrom fun g ⟨s, t, hs, ht, g_eq⟩ => g_eq.symm ▸ hs.prod ht)
(le_inf
(forall_mem_image.2 fun t ht =>
GenerateOpen.basic _ ⟨t, univ, by simpa [Set.prod_eq] using ht⟩)
(forall_mem_image.2 fun t ht =>
GenerateOpen.basic _ ⟨univ, t, by simpa [Set.prod_eq] using ht⟩))
#align prod_eq_generate_from prod_eq_generateFrom
-- Porting note (#11215): TODO: align with `mem_nhds_prod_iff'`
theorem isOpen_prod_iff {s : Set (X × Y)} :
IsOpen s ↔ ∀ a b, (a, b) ∈ s →
∃ u v, IsOpen u ∧ IsOpen v ∧ a ∈ u ∧ b ∈ v ∧ u ×ˢ v ⊆ s :=
isOpen_iff_mem_nhds.trans <| by simp_rw [Prod.forall, mem_nhds_prod_iff', and_left_comm]
#align is_open_prod_iff isOpen_prod_iff
/-- A product of induced topologies is induced by the product map -/
theorem prod_induced_induced (f : X → Y) (g : Z → W) :
@instTopologicalSpaceProd X Z (induced f ‹_›) (induced g ‹_›) =
induced (fun p => (f p.1, g p.2)) instTopologicalSpaceProd := by
delta instTopologicalSpaceProd
simp_rw [induced_inf, induced_compose]
rfl
#align prod_induced_induced prod_induced_induced
#noalign continuous_uncurry_of_discrete_topology_left
/-- Given a neighborhood `s` of `(x, x)`, then `(x, x)` has a square open neighborhood
that is a subset of `s`. -/
theorem exists_nhds_square {s : Set (X × X)} {x : X} (hx : s ∈ 𝓝 (x, x)) :
∃ U : Set X, IsOpen U ∧ x ∈ U ∧ U ×ˢ U ⊆ s := by
simpa [nhds_prod_eq, (nhds_basis_opens x).prod_self.mem_iff, and_assoc, and_left_comm] using hx
#align exists_nhds_square exists_nhds_square
/-- `Prod.fst` maps neighborhood of `x : X × Y` within the section `Prod.snd ⁻¹' {x.2}`
to `𝓝 x.1`. -/
theorem map_fst_nhdsWithin (x : X × Y) : map Prod.fst (𝓝[Prod.snd ⁻¹' {x.2}] x) = 𝓝 x.1 := by
refine' le_antisymm (continuousAt_fst.mono_left inf_le_left) fun s hs => _
rcases x with ⟨x, y⟩
rw [mem_map, nhdsWithin, mem_inf_principal, mem_nhds_prod_iff] at hs
rcases hs with ⟨u, hu, v, hv, H⟩
simp only [prod_subset_iff, mem_singleton_iff, mem_setOf_eq, mem_preimage] at H
exact mem_of_superset hu fun z hz => H _ hz _ (mem_of_mem_nhds hv) rfl
#align map_fst_nhds_within map_fst_nhdsWithin
@[simp]
theorem map_fst_nhds (x : X × Y) : map Prod.fst (𝓝 x) = 𝓝 x.1 :=
le_antisymm continuousAt_fst <| (map_fst_nhdsWithin x).symm.trans_le (map_mono inf_le_left)
#align map_fst_nhds map_fst_nhds
/-- The first projection in a product of topological spaces sends open sets to open sets. -/
theorem isOpenMap_fst : IsOpenMap (@Prod.fst X Y) :=
isOpenMap_iff_nhds_le.2 fun x => (map_fst_nhds x).ge
#align is_open_map_fst isOpenMap_fst
/-- `Prod.snd` maps neighborhood of `x : X × Y` within the section `Prod.fst ⁻¹' {x.1}`
to `𝓝 x.2`. -/
theorem map_snd_nhdsWithin (x : X × Y) : map Prod.snd (𝓝[Prod.fst ⁻¹' {x.1}] x) = 𝓝 x.2 := by
refine' le_antisymm (continuousAt_snd.mono_left inf_le_left) fun s hs => _
rcases x with ⟨x, y⟩
rw [mem_map, nhdsWithin, mem_inf_principal, mem_nhds_prod_iff] at hs
rcases hs with ⟨u, hu, v, hv, H⟩
simp only [prod_subset_iff, mem_singleton_iff, mem_setOf_eq, mem_preimage] at H
exact mem_of_superset hv fun z hz => H _ (mem_of_mem_nhds hu) _ hz rfl
#align map_snd_nhds_within map_snd_nhdsWithin
@[simp]
theorem map_snd_nhds (x : X × Y) : map Prod.snd (𝓝 x) = 𝓝 x.2 :=
le_antisymm continuousAt_snd <| (map_snd_nhdsWithin x).symm.trans_le (map_mono inf_le_left)
#align map_snd_nhds map_snd_nhds
/-- The second projection in a product of topological spaces sends open sets to open sets. -/
theorem isOpenMap_snd : IsOpenMap (@Prod.snd X Y) :=
isOpenMap_iff_nhds_le.2 fun x => (map_snd_nhds x).ge
#align is_open_map_snd isOpenMap_snd
/-- A product set is open in a product space if and only if each factor is open, or one of them is
empty -/
theorem isOpen_prod_iff' {s : Set X} {t : Set Y} :
IsOpen (s ×ˢ t) ↔ IsOpen s ∧ IsOpen t ∨ s = ∅ ∨ t = ∅ := by
rcases (s ×ˢ t).eq_empty_or_nonempty with h | h
· simp [h, prod_eq_empty_iff.1 h]
· have st : s.Nonempty ∧ t.Nonempty := prod_nonempty_iff.1 h
constructor
· intro (H : IsOpen (s ×ˢ t))
refine' Or.inl ⟨_, _⟩
show IsOpen s
· rw [← fst_image_prod s st.2]
exact isOpenMap_fst _ H
show IsOpen t
· rw [← snd_image_prod st.1 t]
exact isOpenMap_snd _ H
· intro H
simp only [st.1.ne_empty, st.2.ne_empty, not_false_iff, or_false_iff] at H
exact H.1.prod H.2
#align is_open_prod_iff' isOpen_prod_iff'
theorem closure_prod_eq {s : Set X} {t : Set Y} : closure (s ×ˢ t) = closure s ×ˢ closure t :=
Set.ext fun ⟨a, b⟩ => by
simp_rw [mem_prod, mem_closure_iff_nhdsWithin_neBot, nhdsWithin_prod_eq, prod_neBot]
#align closure_prod_eq closure_prod_eq
theorem interior_prod_eq (s : Set X) (t : Set Y) : interior (s ×ˢ t) = interior s ×ˢ interior t :=
Set.ext fun ⟨a, b⟩ => by simp only [mem_interior_iff_mem_nhds, mem_prod, prod_mem_nhds_iff]
#align interior_prod_eq interior_prod_eq
theorem frontier_prod_eq (s : Set X) (t : Set Y) :
frontier (s ×ˢ t) = closure s ×ˢ frontier t ∪ frontier s ×ˢ closure t := by
simp only [frontier, closure_prod_eq, interior_prod_eq, prod_diff_prod]
#align frontier_prod_eq frontier_prod_eq
@[simp]
theorem frontier_prod_univ_eq (s : Set X) :
frontier (s ×ˢ (univ : Set Y)) = frontier s ×ˢ univ := by
simp [frontier_prod_eq]
#align frontier_prod_univ_eq frontier_prod_univ_eq
@[simp]
theorem frontier_univ_prod_eq (s : Set Y) :
frontier ((univ : Set X) ×ˢ s) = univ ×ˢ frontier s := by
simp [frontier_prod_eq]
#align frontier_univ_prod_eq frontier_univ_prod_eq
theorem map_mem_closure₂ {f : X → Y → Z} {x : X} {y : Y} {s : Set X} {t : Set Y} {u : Set Z}
(hf : Continuous (uncurry f)) (hx : x ∈ closure s) (hy : y ∈ closure t)
(h : ∀ a ∈ s, ∀ b ∈ t, f a b ∈ u) : f x y ∈ closure u :=
have H₁ : (x, y) ∈ closure (s ×ˢ t) := by simpa only [closure_prod_eq] using mk_mem_prod hx hy
have H₂ : MapsTo (uncurry f) (s ×ˢ t) u := forall_prod_set.2 h
H₂.closure hf H₁
#align map_mem_closure₂ map_mem_closure₂
theorem IsClosed.prod {s₁ : Set X} {s₂ : Set Y} (h₁ : IsClosed s₁) (h₂ : IsClosed s₂) :
IsClosed (s₁ ×ˢ s₂) :=
closure_eq_iff_isClosed.mp <| by simp only [h₁.closure_eq, h₂.closure_eq, closure_prod_eq]
#align is_closed.prod IsClosed.prod
/-- The product of two dense sets is a dense set. -/
theorem Dense.prod {s : Set X} {t : Set Y} (hs : Dense s) (ht : Dense t) : Dense (s ×ˢ t) :=
fun x => by
rw [closure_prod_eq]
exact ⟨hs x.1, ht x.2⟩
#align dense.prod Dense.prod
/-- If `f` and `g` are maps with dense range, then `Prod.map f g` has dense range. -/
theorem DenseRange.prod_map {ι : Type*} {κ : Type*} {f : ι → Y} {g : κ → Z} (hf : DenseRange f)
(hg : DenseRange g) : DenseRange (Prod.map f g) := by
simpa only [DenseRange, prod_range_range_eq] using hf.prod hg
#align dense_range.prod_map DenseRange.prod_map
theorem Inducing.prod_map {f : X → Y} {g : Z → W} (hf : Inducing f) (hg : Inducing g) :
Inducing (Prod.map f g) :=
inducing_iff_nhds.2 fun (x, z) => by simp_rw [Prod.map_def, nhds_prod_eq, hf.nhds_eq_comap,
hg.nhds_eq_comap, prod_comap_comap_eq]
#align inducing.prod_mk Inducing.prod_map
@[simp]
theorem inducing_const_prod {x : X} {f : Y → Z} : (Inducing fun x' => (x, f x')) ↔ Inducing f := by
simp_rw [inducing_iff, instTopologicalSpaceProd, induced_inf, induced_compose, Function.comp,
induced_const, top_inf_eq]
#align inducing_const_prod inducing_const_prod
@[simp]
theorem inducing_prod_const {y : Y} {f : X → Z} : (Inducing fun x => (f x, y)) ↔ Inducing f := by
simp_rw [inducing_iff, instTopologicalSpaceProd, induced_inf, induced_compose, Function.comp,
induced_const, inf_top_eq]
#align inducing_prod_const inducing_prod_const
theorem Embedding.prod_map {f : X → Y} {g : Z → W} (hf : Embedding f) (hg : Embedding g) :
Embedding (Prod.map f g) :=
{ hf.toInducing.prod_map hg.toInducing with
inj := fun ⟨x₁, z₁⟩ ⟨x₂, z₂⟩ => by simp [hf.inj.eq_iff, hg.inj.eq_iff] }
#align embedding.prod_mk Embedding.prod_map
protected theorem IsOpenMap.prod {f : X → Y} {g : Z → W} (hf : IsOpenMap f) (hg : IsOpenMap g) :
IsOpenMap fun p : X × Z => (f p.1, g p.2) := by
rw [isOpenMap_iff_nhds_le]
rintro ⟨a, b⟩
rw [nhds_prod_eq, nhds_prod_eq, ← Filter.prod_map_map_eq]
exact Filter.prod_mono (hf.nhds_le a) (hg.nhds_le b)
#align is_open_map.prod IsOpenMap.prod
protected theorem OpenEmbedding.prod {f : X → Y} {g : Z → W} (hf : OpenEmbedding f)
(hg : OpenEmbedding g) : OpenEmbedding fun x : X × Z => (f x.1, g x.2) :=
openEmbedding_of_embedding_open (hf.1.prod_map hg.1) (hf.isOpenMap.prod hg.isOpenMap)
#align open_embedding.prod OpenEmbedding.prod
theorem embedding_graph {f : X → Y} (hf : Continuous f) : Embedding fun x => (x, f x) :=
embedding_of_embedding_compose (continuous_id.prod_mk hf) continuous_fst embedding_id
#align embedding_graph embedding_graph
theorem embedding_prod_mk (x : X) : Embedding (Prod.mk x : Y → X × Y) :=
embedding_of_embedding_compose (Continuous.Prod.mk x) continuous_snd embedding_id
end Prod
section Bool
lemma continuous_bool_rng [TopologicalSpace X] {f : X → Bool} (b : Bool) :
Continuous f ↔ IsClopen (f ⁻¹' {b}) := by
rw [continuous_discrete_rng, Bool.forall_bool' b, IsClopen, ← isOpen_compl_iff, ← preimage_compl,
Bool.compl_singleton, and_comm]
end Bool
section Sum
open Sum
variable [TopologicalSpace X] [TopologicalSpace Y] [TopologicalSpace Z] [TopologicalSpace W]
theorem continuous_sum_dom {f : X ⊕ Y → Z} :
Continuous f ↔ Continuous (f ∘ Sum.inl) ∧ Continuous (f ∘ Sum.inr) :=
(continuous_sup_dom (t₁ := TopologicalSpace.coinduced Sum.inl _)
(t₂ := TopologicalSpace.coinduced Sum.inr _)).trans <|
continuous_coinduced_dom.and continuous_coinduced_dom
#align continuous_sum_dom continuous_sum_dom
theorem continuous_sum_elim {f : X → Z} {g : Y → Z} :
Continuous (Sum.elim f g) ↔ Continuous f ∧ Continuous g :=
continuous_sum_dom
#align continuous_sum_elim continuous_sum_elim
@[continuity]
theorem Continuous.sum_elim {f : X → Z} {g : Y → Z} (hf : Continuous f) (hg : Continuous g) :
Continuous (Sum.elim f g) :=
continuous_sum_elim.2 ⟨hf, hg⟩
#align continuous.sum_elim Continuous.sum_elim
@[continuity]
theorem continuous_isLeft : Continuous (isLeft : X ⊕ Y → Bool) :=
continuous_sum_dom.2 ⟨continuous_const, continuous_const⟩
@[continuity]
theorem continuous_isRight : Continuous (isRight : X ⊕ Y → Bool) :=
continuous_sum_dom.2 ⟨continuous_const, continuous_const⟩
@[continuity]
-- Porting note: the proof was `continuous_sup_rng_left continuous_coinduced_rng`
theorem continuous_inl : Continuous (@inl X Y) := ⟨fun _ => And.left⟩
#align continuous_inl continuous_inl
@[continuity]
-- Porting note: the proof was `continuous_sup_rng_right continuous_coinduced_rng`
theorem continuous_inr : Continuous (@inr X Y) := ⟨fun _ => And.right⟩
#align continuous_inr continuous_inr
theorem isOpen_sum_iff {s : Set (X ⊕ Y)} : IsOpen s ↔ IsOpen (inl ⁻¹' s) ∧ IsOpen (inr ⁻¹' s) :=
Iff.rfl
#align is_open_sum_iff isOpen_sum_iff
-- Porting note (#10756): new theorem
theorem isClosed_sum_iff {s : Set (X ⊕ Y)} :
IsClosed s ↔ IsClosed (inl ⁻¹' s) ∧ IsClosed (inr ⁻¹' s) := by
simp only [← isOpen_compl_iff, isOpen_sum_iff, preimage_compl]
theorem isOpenMap_inl : IsOpenMap (@inl X Y) := fun u hu => by
simpa [isOpen_sum_iff, preimage_image_eq u Sum.inl_injective]
#align is_open_map_inl isOpenMap_inl
theorem isOpenMap_inr : IsOpenMap (@inr X Y) := fun u hu => by
simpa [isOpen_sum_iff, preimage_image_eq u Sum.inr_injective]
#align is_open_map_inr isOpenMap_inr
theorem openEmbedding_inl : OpenEmbedding (@inl X Y) :=
openEmbedding_of_continuous_injective_open continuous_inl inl_injective isOpenMap_inl
#align open_embedding_inl openEmbedding_inl
theorem openEmbedding_inr : OpenEmbedding (@inr X Y) :=
openEmbedding_of_continuous_injective_open continuous_inr inr_injective isOpenMap_inr
#align open_embedding_inr openEmbedding_inr
theorem embedding_inl : Embedding (@inl X Y) :=
openEmbedding_inl.1
#align embedding_inl embedding_inl
theorem embedding_inr : Embedding (@inr X Y) :=
openEmbedding_inr.1
#align embedding_inr embedding_inr
theorem isOpen_range_inl : IsOpen (range (inl : X → X ⊕ Y)) :=
openEmbedding_inl.2
#align is_open_range_inl isOpen_range_inl
theorem isOpen_range_inr : IsOpen (range (inr : Y → X ⊕ Y)) :=
openEmbedding_inr.2
#align is_open_range_inr isOpen_range_inr
theorem isClosed_range_inl : IsClosed (range (inl : X → X ⊕ Y)) := by
rw [← isOpen_compl_iff, compl_range_inl]
exact isOpen_range_inr
#align is_closed_range_inl isClosed_range_inl