Datasets:

Modalities:
Text
Languages:
English
Libraries:
Datasets
License:
proof-pile / formal /lean /perfectoid /for_mathlib /topological_rings.lean
Zhangir Azerbayev
squashed?
4365a98
raw
history blame
6.75 kB
import topology.algebra.ring
import topology.algebra.open_subgroup
import ring_theory.subring
import ring_theory.ideal_operations
import for_mathlib.topological_groups
import for_mathlib.topology
universes u v
local prefix 𝓝:100 := nhds
local infixr ` Γ—αΆ  `:51 := filter.prod
variables {A : Type u} {B : Type v}
variables [comm_ring A] [topological_space A] [topological_ring A]
variables [comm_ring B] [topological_space B] [topological_ring B]
open set topological_ring
instance subring_has_zero (R : Type u) [comm_ring R] (S : set R) [HS : is_subring S] : has_zero S :=
⟨⟨0, is_add_submonoid.zero_mem S⟩⟩
instance topological_subring (Aβ‚€ : set A) [is_subring Aβ‚€] : topological_ring Aβ‚€ :=
{ continuous_neg := continuous_subtype_mk _ $ (continuous_neg A).comp continuous_subtype_val,
continuous_add := continuous_subtype_mk _ $
(continuous_subtype_val.comp continuous_fst).add
( continuous_subtype_val.comp continuous_snd),
continuous_mul := continuous_subtype_mk _ $
(continuous_subtype_val.comp continuous_fst).mul
(continuous_subtype_val.comp continuous_snd) }
lemma half_nhds {s : set A} (hs : s ∈ (nhds (0 : A))) :
βˆƒ V ∈ (nhds (0 : A)), βˆ€ v w ∈ V, v * w ∈ s :=
begin
have : ((Ξ»a:AΓ—A, a.1 * a.2) ⁻¹' s) ∈ (nhds ((0, 0) : A Γ— A)) :=
tendsto_mul (by simpa using hs),
rw nhds_prod_eq at this,
rcases filter.mem_prod_iff.1 this with ⟨V₁, H₁, Vβ‚‚, Hβ‚‚, H⟩,
exact ⟨V₁ ∩ Vβ‚‚, filter.inter_mem_sets H₁ Hβ‚‚, assume v w ⟨hv, _⟩ ⟨_, hw⟩, @H (v, w) ⟨hv, hw⟩⟩
end
-- lemma continuous_mul_left (a : A) : continuous (Ξ» x, a * x) :=
-- continuous_mul continuous_const continuous_id
--
-- lemma continuous_mul_right (a : A) : continuous (Ξ» x, x * a) :=
-- continuous_mul continuous_id continuous_const
lemma is_open_ideal_map_open_embedding {f : A β†’ B} [is_ring_hom f]
(emb : open_embedding f) (I : ideal A) (hI : is_open (↑I : set A)) :
is_open (↑(I.map f) : set B) :=
open_add_subgroup.is_open_of_open_add_subgroup
⟨⟨f '' I, emb.is_open_map _ hI, by apply_instance⟩, ideal.subset_span⟩
instance pi_topological_ring {I : Type*} {R : I β†’ Type*} [βˆ€ i, comm_ring (R i)] [βˆ€ i, topological_space (R i)]
[h : βˆ€ i, topological_ring (R i)] : topological_ring (Ξ  (i : I), R i) :=
{ continuous_add := continuous_piβ‚‚ (Ξ» i, (h i).continuous_add),
continuous_mul := continuous_piβ‚‚ (Ξ» i, (h i).continuous_mul),
continuous_neg := continuous_pi₁ (Ξ» i, (h i).continuous_neg) }
section
open function filter
lemma topological_ring.of_nice_nhds_zero (Ξ± : Type u) [ring Ξ±] [topological_space Ξ±]
(hadd : tendsto (uncurry' ((+) : Ξ± β†’ Ξ± β†’ Ξ±)) (𝓝 0 Γ—αΆ  𝓝 0) 𝓝 0)
(hneg : tendsto (Ξ» x, -x : Ξ± β†’ Ξ±) 𝓝 0 𝓝 0)
(hmul : tendsto (uncurry' ((*) : Ξ± β†’ Ξ± β†’ Ξ±)) (𝓝 0 Γ—αΆ  𝓝 0) 𝓝 0)
(hmul_left : βˆ€ (xβ‚€ : Ξ±), tendsto (Ξ» x : Ξ±, xβ‚€ * x) 𝓝 0 𝓝 0)
(hmul_right : βˆ€ (xβ‚€ : Ξ±), tendsto (Ξ» x : Ξ±, x * xβ‚€) 𝓝 0 𝓝 0)
(hleft : βˆ€ xβ‚€ : Ξ±, 𝓝 xβ‚€ = map (Ξ» x, xβ‚€+x) 𝓝 0) : topological_ring Ξ± :=
begin
refine {..topological_add_group.of_nice_nhds_zero Ξ± hadd hneg hleft, ..},
rw continuous_iff_continuous_at,
rintro ⟨xβ‚€, yβ‚€βŸ©,
rw [continuous_at, nhds_prod_eq, hleft xβ‚€, hleft yβ‚€, hleft (xβ‚€*yβ‚€), filter.prod_map_map_eq,
tendsto_map'_iff],
suffices :
tendsto ((Ξ» (x : Ξ±), x + xβ‚€ * yβ‚€) ∘ (Ξ» (p : Ξ± Γ— Ξ±), p.1 + p.2) ∘
(Ξ» (p : Ξ± Γ— Ξ±), (p.1*yβ‚€ + xβ‚€*p.2, p.1*p.2)))
(𝓝 0 Γ—αΆ  𝓝 0) (map (Ξ» (x : Ξ±), x + xβ‚€ * yβ‚€) 𝓝 0),
{ convert this using 1,
{ ext, simp only [comp_app, mul_add, add_mul], abel },
{ simp only [add_comm] } },
refine tendsto_map.comp (hadd.comp (tendsto.prod_mk _ hmul)),
{ change tendsto ((Ξ» p : Ξ± Γ— Ξ±, p.1 + p.2) ∘ Ξ» (x : Ξ± Γ— Ξ±), (x.1 * yβ‚€, xβ‚€ * x.2)) (𝓝 0 Γ—αΆ  𝓝 0) 𝓝 0,
exact hadd.comp (tendsto.prod_mk ((hmul_right yβ‚€).comp tendsto_fst)
((hmul_left xβ‚€).comp tendsto_snd)) }
end
end
local attribute [instance] pointwise_mul pointwise_add
class ring_filter_basis (Ξ± : Type u) [ring Ξ±] extends add_group_filter_basis Ξ± :=
(mul : βˆ€ {U}, U ∈ sets β†’ βˆƒ V ∈ sets, V * V βŠ† U)
(mul_left : βˆ€ (xβ‚€ : Ξ±) {U}, U ∈ sets β†’ βˆƒ V ∈ sets, V βŠ† (Ξ» x, xβ‚€*x) ⁻¹' U)
(mul_right : βˆ€ (xβ‚€ : Ξ±) {U}, U ∈ sets β†’ βˆƒ V ∈ sets, V βŠ† (Ξ» x, x*xβ‚€) ⁻¹' U)
namespace ring_filter_basis
lemma is_top_ring {Ξ± : Type u} [ring Ξ±] [t : topological_space Ξ±] (b : ring_filter_basis Ξ±)
(hnhds : βˆ€ xβ‚€ : Ξ±, 𝓝 xβ‚€ = b.to_add_group_filter_basis.N xβ‚€) : topological_ring Ξ± :=
begin
let basis := b.to_filter_basis,
have hnhds0 : 𝓝 0 = basis.filter, by rw [hnhds, b.to_add_group_filter_basis.N_zero],
apply topological_ring.of_nice_nhds_zero,
{ rw [hnhds0, ← basis.prod_filter, filter_basis.tendsto_both],
intros V V_in,
rcases add_group_filter_basis.add V_in with ⟨W, W_in, hW⟩,
use [set.prod W W, filter_basis.mem_prod_of_mem W_in W_in],
rwa [pointwise_add_eq_image, image_subset_iff] at hW },
{ rw [hnhds0, basis.tendsto_both],
exact b.neg },
{ rw [hnhds0, ← basis.prod_filter, filter_basis.tendsto_both],
intros V V_in,
rcases ring_filter_basis.mul V_in with ⟨W, W_in, hW⟩,
use [set.prod W W, filter_basis.mem_prod_of_mem W_in W_in],
rwa [pointwise_mul_eq_image, image_subset_iff] at hW },
{ simp only [hnhds0, basis.tendsto_both],
exact b.mul_left },
{ simp only [hnhds0, basis.tendsto_both],
exact b.mul_right },
{ exact hnhds0.symm β–Έ hnhds }
end
lemma is_topological_ring (Ξ± : Type u) [ring Ξ±] [t : topological_space Ξ±] [b : ring_filter_basis Ξ±]
(h : t = b.to_add_group_filter_basis.topology) : topological_ring Ξ± :=
begin
let nice := b.to_add_group_filter_basis.N_is_nice,
apply b.is_top_ring,
rw h,
intro xβ‚€,
exact topological_space.nhds_mk_of_nhds _ _ nice.1 nice.2,
end
local attribute [instance] add_group_filter_basis.topology
--meta instance cut_trace : has_bind tactic := by apply_instance
def workaround (Ξ± : Type u) [ring Ξ±] [ring_filter_basis Ξ±] : topological_space Ξ± :=
begin
apply add_group_filter_basis.topology,
apply_instance,
end
local attribute [instance] workaround
lemma topological_ring (Ξ± : Type u) [ring Ξ±] [b : ring_filter_basis Ξ±] : topological_ring Ξ± :=
is_topological_ring Ξ± rfl
end ring_filter_basis
lemma discrete_top_ring {R : Type*} [ring R] [topological_space R] [discrete_topology R] :
topological_ring R :=
{ continuous_mul := continuous_of_discrete_topology,
continuous_add := continuous_of_discrete_topology,
continuous_neg := continuous_of_discrete_topology }