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

Commit 3e0c4d7

Browse files
committed
chore(topology/algebra/with_zero_topology): move to a new NS, used localized (#18560)
This way we can naturally use `scoped instance` in Lean 4.
1 parent 09f981f commit 3e0c4d7

2 files changed

Lines changed: 24 additions & 22 deletions

File tree

src/topology/algebra/valued_field.lean

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,21 +114,21 @@ begin
114114
end
115115

116116
section
117-
local attribute [instance] linear_ordered_comm_group_with_zero.topological_space
118117

118+
open_locale with_zero_topology
119119
open valued
120120

121121
lemma valued.continuous_valuation [valued K Γ₀] : continuous (v : K → Γ₀) :=
122122
begin
123123
rw continuous_iff_continuous_at,
124124
intro x,
125125
rcases eq_or_ne x 0 with rfl|h,
126-
{ rw [continuous_at, map_zero, linear_ordered_comm_group_with_zero.tendsto_zero],
126+
{ rw [continuous_at, map_zero, with_zero_topology.tendsto_zero],
127127
intros γ hγ,
128128
rw [filter.eventually, valued.mem_nhds_zero],
129129
use [units.mk0 γ hγ, subset.rfl] },
130130
{ have v_ne : (v x : Γ₀) ≠ 0, from (valuation.ne_zero_iff _).mpr h,
131-
rw [continuous_at, linear_ordered_comm_group_with_zero.tendsto_of_ne_zero v_ne],
131+
rw [continuous_at, with_zero_topology.tendsto_of_ne_zero v_ne],
132132
apply valued.loc_const v_ne },
133133
end
134134
end
@@ -193,7 +193,7 @@ instance completable : completable_top_field K :=
193193
end,
194194
..valued_ring.separated }
195195

196-
local attribute [instance] linear_ordered_comm_group_with_zero.topological_space
196+
open_locale with_zero_topology
197197

198198
/-- The extension of the valuation of a valued field to the completion of the field. -/
199199
noncomputable def extension : hat K → Γ₀ :=
@@ -255,7 +255,7 @@ lemma continuous_extension : continuous (valued.extension : hat K → Γ₀) :=
255255
rcases this with ⟨z₀, y₀, y₀_in, hz₀, z₀_ne⟩,
256256
have vz₀_ne: (v z₀ : Γ₀) ≠ 0 := by rwa valuation.ne_zero_iff,
257257
refine ⟨v z₀, _⟩,
258-
rw [linear_ordered_comm_group_with_zero.tendsto_of_ne_zero vz₀_ne, eventually_comap],
258+
rw [with_zero_topology.tendsto_of_ne_zero vz₀_ne, eventually_comap],
259259
filter_upwards [nhds_right] with x x_in a ha,
260260
rcases x_in with ⟨y, y_in, rfl⟩,
261261
have : (v (a * z₀⁻¹) : Γ₀) = 1,
@@ -326,7 +326,7 @@ begin
326326
{ exact this h, }, },
327327
intros h,
328328
have hγ₀ : extension ⁻¹' {γ₀} ∈ 𝓝 x := continuous_extension.continuous_at.preimage_mem_nhds
329-
(linear_ordered_comm_group_with_zero.singleton_mem_nhds_of_ne_zero h),
329+
(with_zero_topology.singleton_mem_nhds_of_ne_zero h),
330330
rw mem_closure_iff_nhds',
331331
refine ⟨λ hx, _, λ hx s hs, _⟩,
332332
{ obtain ⟨⟨-, y, hy₁ : v y < (γ : Γ₀), rfl⟩, hy₂⟩ := hx _ hγ₀,

src/topology/algebra/with_zero_topology.lean

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,15 @@ absolute value (resp. `p`-adic absolute value) on `ℚ` is extended to `ℝ` (re
2525
2626
## Implementation notes
2727
28-
This topology is not defined as an instance since it may not be the desired topology on
29-
a linearly ordered commutative group with zero. You can locally activate this topology using
30-
`local attribute [instance] linear_ordered_comm_group_with_zero.topological_space`
31-
All other instances will (`ordered_topology`, `t3_space`, `has_continuous_mul`) then follow.
32-
28+
This topology is not defined as a global instance since it may not be the desired topology on a
29+
linearly ordered commutative group with zero. You can locally activate this topology using
30+
`open_locale with_zero_topology`.
3331
-/
3432

3533
open_locale topology filter
3634
open topological_space filter set function
3735

38-
namespace linear_ordered_comm_group_with_zero
36+
namespace with_zero_topology
3937

4038
variables {α Γ₀ : Type*} [linear_ordered_comm_group_with_zero Γ₀] {γ γ₁ γ₂ : Γ₀} {l : filter α}
4139
{f : α → Γ₀}
@@ -45,7 +43,7 @@ A subset U is open if 0 ∉ U or if there is an invertible element γ₀ such th
4543
protected def topological_space : topological_space Γ₀ :=
4644
topological_space.mk_of_nhds $ update pure 0 $ ⨅ γ ≠ 0, 𝓟 (Iio γ)
4745

48-
local attribute [instance] linear_ordered_comm_group_with_zero.topological_space
46+
localized "attribute [instance] with_zero_topology.topological_space" in with_zero_topology
4947

5048
lemma nhds_eq_update : (𝓝 : Γ₀ → filter Γ₀) = update pure 0 (⨅ γ ≠ 0, 𝓟 (Iio γ)) :=
5149
funext $ nhds_mk_of_nhds_single $ le_infi₂ $ λ γ h₀, le_principal_iff.2 $ zero_lt_iff.2 h₀
@@ -134,8 +132,7 @@ is_open_iff.mpr $ imp_iff_not_or.mp $ λ ha, ⟨a, ne_of_gt ha, subset.rfl⟩
134132

135133
/-- The topology on a linearly ordered group with zero element adjoined is compatible with the order
136134
structure: the set `{p : Γ₀ × Γ₀ | p.1 ≤ p.2}` is closed. -/
137-
@[priority 100]
138-
instance order_closed_topology : order_closed_topology Γ₀ :=
135+
protected lemma order_closed_topology : order_closed_topology Γ₀ :=
139136
{ is_closed_le' :=
140137
begin
141138
simp only [← is_open_compl_iff, compl_set_of, not_le, is_open_iff_mem_nhds],
@@ -144,9 +141,10 @@ instance order_closed_topology : order_closed_topology Γ₀ :=
144141
exact Iio_mem_nhds hab
145142
end }
146143

144+
localized "attribute [instance] with_zero_topology.order_closed_topology" in with_zero_topology
145+
147146
/-- The topology on a linearly ordered group with zero element adjoined is T₃. -/
148-
@[priority 100]
149-
instance t3_space : t3_space Γ₀ :=
147+
lemma t3_space : t3_space Γ₀ :=
150148
{ to_regular_space := regular_space.of_lift'_closure $ λ γ,
151149
begin
152150
rcases ne_or_eq γ 0 with h₀|rfl,
@@ -156,10 +154,11 @@ instance t3_space : t3_space Γ₀ :=
156154
(λ x hx, is_closed_iff.2 $ or.inl $ zero_lt_iff.2 hx) },
157155
end }
158156

157+
localized "attribute [instance] with_zero_topology.t3_space" in with_zero_topology
158+
159159
/-- The topology on a linearly ordered group with zero element adjoined makes it a topological
160160
monoid. -/
161-
@[priority 100]
162-
instance : has_continuous_mul Γ₀ :=
161+
protected lemma has_continuous_mul : has_continuous_mul Γ₀ :=
163162
begin
164163
rw continuous_iff_continuous_at,
165164
rintros ⟨x, y⟩,
@@ -182,8 +181,11 @@ instance : has_continuous_mul Γ₀ :=
182181
exact pure_le_nhds (x * y) }
183182
end
184183

185-
@[priority 100]
186-
instance : has_continuous_inv₀ Γ₀ :=
184+
localized "attribute [instance] with_zero_topology.has_continuous_mul" in with_zero_topology
185+
186+
protected lemma has_continuous_inv₀ : has_continuous_inv₀ Γ₀ :=
187187
⟨λ γ h, by { rw [continuous_at, nhds_of_ne_zero h], exact pure_le_nhds γ⁻¹ }⟩
188188

189-
end linear_ordered_comm_group_with_zero
189+
localized "attribute [instance] with_zero_topology.has_continuous_inv₀" in with_zero_topology
190+
191+
end with_zero_topology

0 commit comments

Comments
 (0)