Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 14d34b7

Browse files
committed
feat(topology/metric_space/*): additive/multiplicative/order_dual instances (#15704)
Transfer topology, bornology, uniform space and metric space instances to `additive`, `multiplicative` and `order_dual`.
1 parent e3d2f74 commit 14d34b7

9 files changed

Lines changed: 258 additions & 16 deletions

File tree

src/topology/algebra/group.lean

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -231,12 +231,12 @@ end
231231

232232
end pointwise_limits
233233

234-
instance additive.has_continuous_neg [h : topological_space H] [has_inv H]
235-
[has_continuous_inv H] : @has_continuous_neg (additive H) h _ :=
234+
instance [topological_space H] [has_inv H] [has_continuous_inv H] :
235+
has_continuous_neg (additive H) :=
236236
{ continuous_neg := @continuous_inv H _ _ _ }
237237

238-
instance multiplicative.has_continuous_inv [h : topological_space H] [has_neg H]
239-
[has_continuous_neg H] : @has_continuous_inv (multiplicative H) h _ :=
238+
instance [topological_space H] [has_neg H] [has_continuous_neg H] :
239+
has_continuous_inv (multiplicative H) :=
240240
{ continuous_inv := @continuous_neg H _ _ _ }
241241

242242
end continuous_inv
@@ -1131,12 +1131,12 @@ end
11311131

11321132
end filter_mul
11331133

1134-
instance additive.topological_add_group {G} [h : topological_space G]
1135-
[group G] [topological_group G] : @topological_add_group (additive G) h _ :=
1134+
instance {G} [topological_space G] [group G] [topological_group G] :
1135+
topological_add_group (additive G) :=
11361136
{ continuous_neg := @continuous_inv G _ _ _ }
11371137

1138-
instance multiplicative.topological_group {G} [h : topological_space G]
1139-
[add_group G] [topological_add_group G] : @topological_group (multiplicative G) h _ :=
1138+
instance {G} [topological_space G] [add_group G] [topological_add_group G] :
1139+
topological_group (multiplicative G) :=
11401140
{ continuous_inv := @continuous_neg G _ _ _ }
11411141

11421142
section quotient

src/topology/algebra/monoid.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -550,12 +550,12 @@ end
550550

551551
end
552552

553-
instance additive.has_continuous_add {M} [h : topological_space M] [has_mul M]
554-
[has_continuous_mul M] : @has_continuous_add (additive M) h _ :=
553+
instance [topological_space M] [has_mul M] [has_continuous_mul M] :
554+
has_continuous_add (additive M) :=
555555
{ continuous_add := @continuous_mul M _ _ _ }
556556

557-
instance multiplicative.has_continuous_mul {M} [h : topological_space M] [has_add M]
558-
[has_continuous_add M] : @has_continuous_mul (multiplicative M) h _ :=
557+
instance [topological_space M] [has_add M] [has_continuous_add M] :
558+
has_continuous_mul (multiplicative M) :=
559559
{ continuous_mul := @continuous_add M _ _ _ }
560560

561561
section lattice_ops

src/topology/algebra/order/basic.lean

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,6 @@ generally, and suffices to derive many interesting properties relating order and
9191
class order_closed_topology (α : Type*) [topological_space α] [preorder α] : Prop :=
9292
(is_closed_le' : is_closed {p:α×α | p.1 ≤ p.2})
9393

94-
instance : Π [topological_space α], topological_space αᵒᵈ := id
95-
9694
instance [topological_space α] [h : first_countable_topology α] : first_countable_topology αᵒᵈ := h
9795

9896
instance [topological_space α] [h : second_countable_topology α] : second_countable_topology αᵒᵈ :=

src/topology/bornology/constructions.lean

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,3 +145,23 @@ alias bounded_space_coe_set_iff ↔ _ bornology.is_bounded.bounded_space_coe
145145

146146
instance [bounded_space α] {p : α → Prop} : bounded_space (subtype p) :=
147147
(is_bounded.all {x | p x}).bounded_space_subtype
148+
149+
/-!
150+
### `additive`, `multiplicative`
151+
152+
The bornology on those type synonyms is inherited without change.
153+
-/
154+
155+
instance : bornology (additive α) := ‹bornology α›
156+
instance : bornology (multiplicative α) := ‹bornology α›
157+
instance [bounded_space α] : bounded_space (additive α) := ‹bounded_space α›
158+
instance [bounded_space α] : bounded_space (multiplicative α) := ‹bounded_space α›
159+
160+
/-!
161+
### Order dual
162+
163+
The bornology on this type synonym is inherited without change.
164+
-/
165+
166+
instance : bornology αᵒᵈ := ‹bornology α›
167+
instance [bounded_space α] : bounded_space αᵒᵈ := ‹bounded_space α›

src/topology/constructions.lean

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,76 @@ instance Pi.topological_space {β : α → Type v} [t₂ : Πa, topological_spac
6767
instance ulift.topological_space [t : topological_space α] : topological_space (ulift.{v u} α) :=
6868
t.induced ulift.down
6969

70+
/-!
71+
### `additive`, `multiplicative`
72+
73+
The topology on those type synonyms is inherited without change.
74+
-/
75+
76+
section
77+
variables [topological_space α]
78+
79+
open additive multiplicative
80+
81+
instance : topological_space (additive α) := ‹topological_space α›
82+
instance : topological_space (multiplicative α) := ‹topological_space α›
83+
instance [discrete_topology α] : discrete_topology (additive α) := ‹discrete_topology α›
84+
instance [discrete_topology α] : discrete_topology (multiplicative α) := ‹discrete_topology α›
85+
86+
lemma continuous_of_mul : continuous (of_mul : α → additive α) := continuous_id
87+
lemma continuous_to_mul : continuous (to_mul : additive α → α) := continuous_id
88+
lemma continuous_of_add : continuous (of_add : α → multiplicative α) := continuous_id
89+
lemma continuous_to_add : continuous (to_add : multiplicative α → α) := continuous_id
90+
91+
lemma is_open_map_of_mul : is_open_map (of_mul : α → additive α) := is_open_map.id
92+
lemma is_open_map_to_mul : is_open_map (to_mul : additive α → α) := is_open_map.id
93+
lemma is_open_map_of_add : is_open_map (of_add : α → multiplicative α) := is_open_map.id
94+
lemma is_open_map_to_add : is_open_map (to_add : multiplicative α → α) := is_open_map.id
95+
96+
lemma is_closed_map_of_mul : is_closed_map (of_mul : α → additive α) := is_closed_map.id
97+
lemma is_closed_map_to_mul : is_closed_map (to_mul : additive α → α) := is_closed_map.id
98+
lemma is_closed_map_of_add : is_closed_map (of_add : α → multiplicative α) := is_closed_map.id
99+
lemma is_closed_map_to_add : is_closed_map (to_add : multiplicative α → α) := is_closed_map.id
100+
101+
local attribute [semireducible] nhds
102+
103+
lemma nhds_of_mul (a : α) : 𝓝 (of_mul a) = map of_mul (𝓝 a) := rfl
104+
lemma nhds_of_add (a : α) : 𝓝 (of_add a) = map of_add (𝓝 a) := rfl
105+
lemma nhds_to_mul (a : additive α) : 𝓝 (to_mul a) = map to_mul (𝓝 a) := rfl
106+
lemma nhds_to_add (a : multiplicative α) : 𝓝 (to_add a) = map to_add (𝓝 a) := rfl
107+
108+
end
109+
110+
/-!
111+
### Order dual
112+
113+
The topology on this type synonym is inherited without change.
114+
-/
115+
116+
section
117+
variables [topological_space α]
118+
119+
open order_dual
120+
121+
instance : topological_space αᵒᵈ := ‹topological_space α›
122+
instance [discrete_topology α] : discrete_topology (αᵒᵈ) := ‹discrete_topology α›
123+
124+
lemma continuous_to_dual : continuous (to_dual : α → αᵒᵈ) := continuous_id
125+
lemma continuous_of_dual : continuous (of_dual : αᵒᵈ → α) := continuous_id
126+
127+
lemma is_open_map_to_dual : is_open_map (to_dual : α → αᵒᵈ) := is_open_map.id
128+
lemma is_open_map_of_dual : is_open_map (of_dual : αᵒᵈ → α) := is_open_map.id
129+
130+
lemma is_closed_map_to_dual : is_closed_map (to_dual : α → αᵒᵈ) := is_closed_map.id
131+
lemma is_closed_map_of_dual : is_closed_map (of_dual : αᵒᵈ → α) := is_closed_map.id
132+
133+
local attribute [semireducible] nhds
134+
135+
lemma nhds_to_dual (a : α) : 𝓝 (to_dual a) = map to_dual (𝓝 a) := rfl
136+
lemma nhds_of_dual (a : α) : 𝓝 (of_dual a) = map of_dual (𝓝 a) := rfl
137+
138+
end
139+
70140
lemma quotient.preimage_mem_nhds [topological_space α] [s : setoid α]
71141
{V : set $ quotient s} {a : α} (hs : V ∈ 𝓝 (quotient.mk a)) : quotient.mk ⁻¹' V ∈ 𝓝 a :=
72142
preimage_nhds_coinduced hs

src/topology/metric_space/algebra.lean

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,3 +176,12 @@ instance has_bounded_smul.op [has_smul αᵐᵒᵖ β] [is_central_scalar α β]
176176
by simpa only [op_smul_eq_smul] using dist_pair_smul x₁ x₂ y }
177177

178178
end has_bounded_smul
179+
180+
instance [monoid α] [has_lipschitz_mul α] : has_lipschitz_add (additive α) :=
181+
⟨@has_lipschitz_mul.lipschitz_mul α _ _ _⟩
182+
183+
instance [add_monoid α] [has_lipschitz_add α] : has_lipschitz_mul (multiplicative α) :=
184+
⟨@has_lipschitz_add.lipschitz_add α _ _ _⟩
185+
186+
@[to_additive] instance [monoid α] [has_lipschitz_mul α] : has_lipschitz_mul αᵒᵈ :=
187+
‹has_lipschitz_mul α›

src/topology/metric_space/basic.lean

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ open set filter topological_space bornology
5454
open_locale uniformity topological_space big_operators filter nnreal ennreal
5555

5656
universes u v w
57-
variables {α : Type u} {β : Type v}
57+
variables {α : Type u} {β : Type v} {X : Type*}
5858

5959
/-- Construct a uniform structure core from a distance function and metric space axioms.
6060
This is a technical construction that can be immediately used to construct a uniform structure
@@ -2881,3 +2881,75 @@ instance metric_space_quot {α : Type u} [pseudo_metric_space α] :
28812881
λxc yc zc, quotient.induction_on₃ xc yc zc (λx y z, pseudo_metric_space.dist_triangle _ _ _) }
28822882

28832883
end eq_rel
2884+
2885+
/-!
2886+
### `additive`, `multiplicative`
2887+
2888+
The distance on those type synonyms is inherited without change.
2889+
-/
2890+
2891+
open additive multiplicative
2892+
2893+
section
2894+
variables [has_dist X]
2895+
2896+
instance : has_dist (additive X) := ‹has_dist X›
2897+
instance : has_dist (multiplicative X) := ‹has_dist X›
2898+
2899+
@[simp] lemma dist_of_mul (a b : X) : dist (of_mul a) (of_mul b) = dist a b := rfl
2900+
@[simp] lemma dist_of_add (a b : X) : dist (of_add a) (of_add b) = dist a b := rfl
2901+
@[simp] lemma dist_to_mul (a b : additive X) : dist (to_mul a) (to_mul b) = dist a b := rfl
2902+
@[simp] lemma dist_to_add (a b : multiplicative X) : dist (to_add a) (to_add b) = dist a b := rfl
2903+
2904+
end
2905+
2906+
section
2907+
variables [pseudo_metric_space X]
2908+
2909+
instance : pseudo_metric_space (additive X) := ‹pseudo_metric_space X›
2910+
instance : pseudo_metric_space (multiplicative X) := ‹pseudo_metric_space X›
2911+
2912+
@[simp] lemma nndist_of_mul (a b : X) : nndist (of_mul a) (of_mul b) = nndist a b := rfl
2913+
@[simp] lemma nndist_of_add (a b : X) : nndist (of_add a) (of_add b) = nndist a b := rfl
2914+
@[simp] lemma nndist_to_mul (a b : additive X) : nndist (to_mul a) (to_mul b) = nndist a b := rfl
2915+
@[simp] lemma nndist_to_add (a b : multiplicative X) : nndist (to_add a) (to_add b) = nndist a b :=
2916+
rfl
2917+
2918+
end
2919+
2920+
instance [metric_space X] : metric_space (additive X) := ‹metric_space X›
2921+
instance [metric_space X] : metric_space (multiplicative X) := ‹metric_space X›
2922+
instance [pseudo_metric_space X] [proper_space X] : proper_space (additive X) := ‹proper_space X›
2923+
instance [pseudo_metric_space X] [proper_space X] : proper_space (multiplicative X) :=
2924+
‹proper_space X›
2925+
2926+
/-!
2927+
### Order dual
2928+
2929+
The distance on this type synonym is inherited without change.
2930+
-/
2931+
2932+
open order_dual
2933+
2934+
section
2935+
variables [has_dist X]
2936+
2937+
instance : has_dist Xᵒᵈ := ‹has_dist X›
2938+
2939+
@[simp] lemma dist_to_dual (a b : X) : dist (to_dual a) (to_dual b) = dist a b := rfl
2940+
@[simp] lemma dist_of_dual (a b : Xᵒᵈ) : dist (of_dual a) (of_dual b) = dist a b := rfl
2941+
2942+
end
2943+
2944+
section
2945+
variables [pseudo_metric_space X]
2946+
2947+
instance : pseudo_metric_space Xᵒᵈ := ‹pseudo_metric_space X›
2948+
2949+
@[simp] lemma nndist_to_dual (a b : X) : nndist (to_dual a) (to_dual b) = nndist a b := rfl
2950+
@[simp] lemma nndist_of_dual (a b : Xᵒᵈ) : nndist (of_dual a) (of_dual b) = nndist a b := rfl
2951+
2952+
end
2953+
2954+
instance [metric_space X] : metric_space Xᵒᵈ := ‹metric_space X›
2955+
instance [pseudo_metric_space X] [proper_space X] : proper_space Xᵒᵈ := ‹proper_space X›

src/topology/metric_space/emetric_space.lean

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ noncomputable theory
3333
open_locale uniformity topological_space big_operators filter nnreal ennreal
3434

3535
universes u v w
36-
variables {α : Type u} {β : Type v}
36+
variables {α : Type u} {β : Type v} {X : Type*}
3737

3838
/-- Characterizing uniformities associated to a (generalized) distance function `D`
3939
in terms of the elements of the uniformity. -/
@@ -1015,3 +1015,51 @@ by simp only [pos_iff_ne_zero, ne.def, diam_eq_zero_iff, set.subsingleton, not_f
10151015
end diam
10161016

10171017
end emetric
1018+
1019+
/-!
1020+
### `additive`, `multiplicative`
1021+
1022+
The distance on those type synonyms is inherited without change.
1023+
-/
1024+
1025+
open additive multiplicative
1026+
1027+
section
1028+
variables [has_edist X]
1029+
1030+
instance : has_edist (additive X) := ‹has_edist X›
1031+
instance : has_edist (multiplicative X) := ‹has_edist X›
1032+
1033+
@[simp] lemma edist_of_mul (a b : X) : edist (of_mul a) (of_mul b) = edist a b := rfl
1034+
@[simp] lemma edist_of_add (a b : X) : edist (of_add a) (of_add b) = edist a b := rfl
1035+
@[simp] lemma edist_to_mul (a b : additive X) : edist (to_mul a) (to_mul b) = edist a b := rfl
1036+
@[simp] lemma edist_to_add (a b : multiplicative X) : edist (to_add a) (to_add b) = edist a b := rfl
1037+
1038+
end
1039+
1040+
instance [pseudo_emetric_space X] : pseudo_emetric_space (additive X) := ‹pseudo_emetric_space X›
1041+
instance [pseudo_emetric_space X] : pseudo_emetric_space (multiplicative X) :=
1042+
‹pseudo_emetric_space X›
1043+
instance [emetric_space X] : emetric_space (additive X) := ‹emetric_space X›
1044+
instance [emetric_space X] : emetric_space (multiplicative X) := ‹emetric_space X›
1045+
1046+
/-!
1047+
### Order dual
1048+
1049+
The distance on this type synonym is inherited without change.
1050+
-/
1051+
1052+
open order_dual
1053+
1054+
section
1055+
variables [has_edist X]
1056+
1057+
instance : has_edist Xᵒᵈ := ‹has_edist X›
1058+
1059+
@[simp] lemma edist_to_dual (a b : X) : edist (to_dual a) (to_dual b) = edist a b := rfl
1060+
@[simp] lemma edist_of_dual (a b : Xᵒᵈ) : edist (of_dual a) (of_dual b) = edist a b := rfl
1061+
1062+
end
1063+
1064+
instance [pseudo_emetric_space X] : pseudo_emetric_space Xᵒᵈ := ‹pseudo_emetric_space X›
1065+
instance [emetric_space X] : emetric_space Xᵒᵈ := ‹emetric_space X›

src/topology/uniform_space/basic.lean

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,6 +1241,31 @@ instance : uniform_space bool := ⊥
12411241
instance : uniform_space ℕ := ⊥
12421242
instance : uniform_space ℤ := ⊥
12431243

1244+
section
1245+
variables [uniform_space α]
1246+
1247+
open additive multiplicative
1248+
1249+
instance : uniform_space (additive α) := ‹uniform_space α›
1250+
instance : uniform_space (multiplicative α) := ‹uniform_space α›
1251+
1252+
lemma uniform_continuous_of_mul : uniform_continuous (of_mul : α → additive α) :=
1253+
uniform_continuous_id
1254+
lemma uniform_continuous_to_mul : uniform_continuous (to_mul : additive α → α) :=
1255+
uniform_continuous_id
1256+
lemma uniform_continuous_of_add : uniform_continuous (of_add : α → multiplicative α) :=
1257+
uniform_continuous_id
1258+
lemma uniform_continuous_to_add : uniform_continuous (to_add : multiplicative α → α) :=
1259+
uniform_continuous_id
1260+
1261+
lemma uniformity_additive : 𝓤 (additive α) = (𝓤 α).map (prod.map of_mul of_mul) :=
1262+
by { convert map_id.symm, exact prod.map_id }
1263+
1264+
lemma uniformity_multiplicative : 𝓤 (multiplicative α) = (𝓤 α).map (prod.map of_add of_add) :=
1265+
by { convert map_id.symm, exact prod.map_id }
1266+
1267+
end
1268+
12441269
instance {p : α → Prop} [t : uniform_space α] : uniform_space (subtype p) :=
12451270
uniform_space.comap subtype.val t
12461271

0 commit comments

Comments
 (0)