l3lab/ntp-mathlib huggingface dataset:
theorem isTopologicalBasis_basic_opens :
    TopologicalSpace.IsTopologicalBasis
      (Set.range fun r : R => (basicOpen r : Set (PrimeSpectrum R))) := by
  apply TopologicalSpace.isTopologicalBasis_of_isOpen_of_nhds
  · rintro _ ⟨r, rfl⟩
    exact isOpen_basicOpen
  · rintro p U hp ⟨s, hs⟩
    rw [← compl_compl U, Set.mem_compl_iff, ← hs, mem_zeroLocus, Set.not_subset] at hp
    obtain ⟨f, hfs, hfp⟩ := hp
    refine' ⟨basicOpen f, ⟨f, rfl⟩, hfp, _⟩
    

Proof state:
case h_nhds.intro.intro.intro
R : Type u
S : Type v
inst✝¹ : CommRing R
inst✝ : CommRing S
p : PrimeSpectrum R
U : Set (PrimeSpectrum R)
s : Set R
hs : zeroLocus s = Uᶜ
f : R
hfs : f ∈ s
hfp : f ∉ ↑p.asIdeal
⊢ ↑(basicOpen f) ⊆ U

Next tactic:
rw [← Set.compl_subset_compl, ← hs, basicOpen_eq_zeroLocus_compl, compl_compl]
theorem isTopologicalBasis_basic_opens :
    TopologicalSpace.IsTopologicalBasis
      (Set.range fun r : R => (basicOpen r : Set (PrimeSpectrum R))) := by
  apply TopologicalSpace.isTopologicalBasis_of_isOpen_of_nhds
  · rintro _ ⟨r, rfl⟩
    exact isOpen_basicOpen
  · rintro p U hp ⟨s, hs⟩
    rw [← compl_compl U, Set.mem_compl_iff, ← hs, mem_zeroLocus, Set.not_subset] at hp
    obtain ⟨f, hfs, hfp⟩ := hp
    refine' ⟨basicOpen f, ⟨f, rfl⟩, hfp, _⟩
    rw [← Set.compl_subset_compl, ← hs, basicOpen_eq_zeroLocus_compl, compl_compl]
    

Proof state:
case h_nhds.intro.intro.intro
R : Type u
S : Type v
inst✝¹ : CommRing R
inst✝ : CommRing S
p : PrimeSpectrum R
U : Set (PrimeSpectrum R)
s : Set R
hs : zeroLocus s = Uᶜ
f : R
hfs : f ∈ s
hfp : f ∉ ↑p.asIdeal
⊢ zeroLocus s ⊆ zeroLocus {f}

Next tactic:
exact zeroLocus_anti_mono (Set.singleton_subset_iff.mpr hfs)
theorem isBasis_basic_opens : TopologicalSpace.Opens.IsBasis (Set.range (@basicOpen R _)) := by
  

Proof state:
R : Type u
S : Type v
inst✝¹ : CommRing R
inst✝ : CommRing S
⊢ TopologicalSpace.Opens.IsBasis (Set.range basicOpen)

Next tactic:
unfold TopologicalSpace.Opens.IsBasis
theorem isBasis_basic_opens : TopologicalSpace.Opens.IsBasis (Set.range (@basicOpen R _)) := by
  unfold TopologicalSpace.Opens.IsBasis
  

Proof state:
R : Type u
S : Type v
inst✝¹ : CommRing R
inst✝ : CommRing S
⊢ TopologicalSpace.IsTopologicalBasis (SetLike.coe '' Set.range basicOpen)

Next tactic:
convert isTopologicalBasis_basic_opens (R := R)
theorem isBasis_basic_opens : TopologicalSpace.Opens.IsBasis (Set.range (@basicOpen R _)) := by
  unfold TopologicalSpace.Opens.IsBasis
  convert isTopologicalBasis_basic_opens (R := R)
  

Proof state:
case h.e'_3
R : Type u
S : Type v
inst✝¹ : CommRing R
inst✝ : CommRing S
⊢ SetLike.coe '' Set.range basicOpen = Set.range fun r => ↑(basicOpen r)

Next tactic:
rw [← Set.range_comp]
theorem isBasis_basic_opens : TopologicalSpace.Opens.IsBasis (Set.range (@basicOpen R _)) := by
  unfold TopologicalSpace.Opens.IsBasis
  convert isTopologicalBasis_basic_opens (R := R)
  rw [← Set.range_comp]
  

Proof state:
case h.e'_3
R : Type u
S : Type v
inst✝¹ : CommRing R
inst✝ : CommRing S
⊢ Set.range (SetLike.coe ∘ basicOpen) = Set.range fun r => ↑(basicOpen r)

Next tactic:
rfl
@[simp]
theorem basicOpen_eq_bot_iff (f : R) : basicOpen f = ⊥ ↔ IsNilpotent f := by
  

Proof state:
R : Type u
S : Type v
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R
⊢ basicOpen f = ⊥ ↔ IsNilpotent f

Next tactic:
rw [← TopologicalSpace.Opens.coe_inj, basicOpen_eq_zeroLocus_compl]
@[simp]
theorem basicOpen_eq_bot_iff (f : R) : basicOpen f = ⊥ ↔ IsNilpotent f := by
  rw [← TopologicalSpace.Opens.coe_inj, basicOpen_eq_zeroLocus_compl]
  

Proof state:
R : Type u
S : Type v
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R
⊢ (zeroLocus {f})ᶜ = ↑⊥ ↔ IsNilpotent f

Next tactic:
simp only [Set.eq_univ_iff_forall, Set.singleton_subset_iff, TopologicalSpace.Opens.coe_bot,
    nilpotent_iff_mem_prime, Set.compl_empty_iff, mem_zeroLocus, SetLike.mem_coe]
@[simp]
theorem basicOpen_eq_bot_iff (f : R) : basicOpen f = ⊥ ↔ IsNilpotent f := by
  rw [← TopologicalSpace.Opens.coe_inj, basicOpen_eq_zeroLocus_compl]
  simp only [Set.eq_univ_iff_forall, Set.singleton_subset_iff, TopologicalSpace.Opens.coe_bot,
    nilpotent_iff_mem_prime, Set.compl_empty_iff, mem_zeroLocus, SetLike.mem_coe]
  

Proof state:
R : Type u
S : Type v
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R
⊢ (∀ (x : PrimeSpectrum R), f ∈ x.asIdeal) ↔ ∀ (J : Ideal R), Ideal.IsPrime J → f ∈ J

Next tactic:
exact ⟨fun h I hI => h ⟨I, hI⟩, fun h ⟨I, hI⟩ => h I hI⟩
theorem localization_away_comap_range (S : Type v) [CommRing S] [Algebra R S] (r : R)
    [IsLocalization.Away r S] : Set.range (comap (algebraMap R S)) = basicOpen r := by
  

Proof state:
R : Type u
S✝ : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing S✝
S : Type v
inst✝² : CommRing S
inst✝¹ : Algebra R S
r : R
inst✝ : IsLocalization.Away r S
⊢ Set.range ⇑(comap (algebraMap R S)) = ↑(basicOpen r)

Next tactic:
rw [localization_comap_range S (Submonoid.powers r)]
theorem localization_away_comap_range (S : Type v) [CommRing S] [Algebra R S] (r : R)
    [IsLocalization.Away r S] : Set.range (comap (algebraMap R S)) = basicOpen r := by
  rw [localization_comap_range S (Submonoid.powers r)]
  

Proof state:
R : Type u
S✝ : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing S✝
S : Type v
inst✝² : CommRing S
inst✝¹ : Algebra R S
r : R
inst✝ : IsLocalization.Away r S
⊢ {p | Disjoint ↑(Submonoid.powers r) ↑p.asIdeal} = ↑(basicOpen r)

Next tactic:
ext x
theorem localization_away_comap_range (S : Type v) [CommRing S] [Algebra R S] (r : R)
    [IsLocalization.Away r S] : Set.range (comap (algebraMap R S)) = basicOpen r := by
  rw [localization_comap_range S (Submonoid.powers r)]
  ext x
  

Proof state:
case h
R : Type u
S✝ : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing S✝
S : Type v
inst✝² : CommRing S
inst✝¹ : Algebra R S
r : R
inst✝ : IsLocalization.Away r S
x : PrimeSpectrum R
⊢ x ∈ {p | Disjoint ↑(Submonoid.powers r) ↑p.asIdeal} ↔ x ∈ ↑(basicOpen r)

Next tactic:
simp only [mem_zeroLocus, basicOpen_eq_zeroLocus_compl, SetLike.mem_coe, Set.mem_setOf_eq,
    Set.singleton_subset_iff, Set.mem_compl_iff, disjoint_iff_inf_le]
theorem localization_away_comap_range (S : Type v) [CommRing S] [Algebra R S] (r : R)
    [IsLocalization.Away r S] : Set.range (comap (algebraMap R S)) = basicOpen r := by
  rw [localization_comap_range S (Submonoid.powers r)]
  ext x
  simp only [mem_zeroLocus, basicOpen_eq_zeroLocus_compl, SetLike.mem_coe, Set.mem_setOf_eq,
    Set.singleton_subset_iff, Set.mem_compl_iff, disjoint_iff_inf_le]
  

Proof state:
case h
R : Type u
S✝ : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing S✝
S : Type v
inst✝² : CommRing S
inst✝¹ : Algebra R S
r : R
inst✝ : IsLocalization.Away r S
x : PrimeSpectrum R
⊢ ↑(Submonoid.powers r) ⊓ ↑x.asIdeal ≤ ⊥ ↔ r ∉ x.asIdeal

Next tactic:
constructor
theorem localization_away_comap_range (S : Type v) [CommRing S] [Algebra R S] (r : R)
    [IsLocalization.Away r S] : Set.range (comap (algebraMap R S)) = basicOpen r := by
  rw [localization_comap_range S (Submonoid.powers r)]
  ext x
  simp only [mem_zeroLocus, basicOpen_eq_zeroLocus_compl, SetLike.mem_coe, Set.mem_setOf_eq,
    Set.singleton_subset_iff, Set.mem_compl_iff, disjoint_iff_inf_le]
  constructor
  · 

Proof state:
case h.mp
R : Type u
S✝ : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing S✝
S : Type v
inst✝² : CommRing S
inst✝¹ : Algebra R S
r : R
inst✝ : IsLocalization.Away r S
x : PrimeSpectrum R
⊢ ↑(Submonoid.powers r) ⊓ ↑x.asIdeal ≤ ⊥ → r ∉ x.asIdeal

Next tactic:
intro h₁ h₂
theorem localization_away_comap_range (S : Type v) [CommRing S] [Algebra R S] (r : R)
    [IsLocalization.Away r S] : Set.range (comap (algebraMap R S)) = basicOpen r := by
  rw [localization_comap_range S (Submonoid.powers r)]
  ext x
  simp only [mem_zeroLocus, basicOpen_eq_zeroLocus_compl, SetLike.mem_coe, Set.mem_setOf_eq,
    Set.singleton_subset_iff, Set.mem_compl_iff, disjoint_iff_inf_le]
  constructor
  · intro h₁ h₂
    

Proof state:
case h.mp
R : Type u
S✝ : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing S✝
S : Type v
inst✝² : CommRing S
inst✝¹ : Algebra R S
r : R
inst✝ : IsLocalization.Away r S
x : PrimeSpectrum R
h₁ : ↑(Submonoid.powers r) ⊓ ↑x.asIdeal ≤ ⊥
h₂ : r ∈ x.asIdeal
⊢ False

Next tactic:
exact h₁ ⟨Submonoid.mem_powers r, h₂⟩
theorem localization_away_comap_range (S : Type v) [CommRing S] [Algebra R S] (r : R)
    [IsLocalization.Away r S] : Set.range (comap (algebraMap R S)) = basicOpen r := by
  rw [localization_comap_range S (Submonoid.powers r)]
  ext x
  simp only [mem_zeroLocus, basicOpen_eq_zeroLocus_compl, SetLike.mem_coe, Set.mem_setOf_eq,
    Set.singleton_subset_iff, Set.mem_compl_iff, disjoint_iff_inf_le]
  constructor
  · intro h₁ h₂
    exact h₁ ⟨Submonoid.mem_powers r, h₂⟩
  · 

Proof state:
case h.mpr
R : Type u
S✝ : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing S✝
S : Type v
inst✝² : CommRing S
inst✝¹ : Algebra R S
r : R
inst✝ : IsLocalization.Away r S
x : PrimeSpectrum R
⊢ r ∉ x.asIdeal → ↑(Submonoid.powers r) ⊓ ↑x.asIdeal ≤ ⊥

Next tactic:
rintro h₁ _ ⟨⟨n, rfl⟩, h₃⟩
theorem localization_away_comap_range (S : Type v) [CommRing S] [Algebra R S] (r : R)
    [IsLocalization.Away r S] : Set.range (comap (algebraMap R S)) = basicOpen r := by
  rw [localization_comap_range S (Submonoid.powers r)]
  ext x
  simp only [mem_zeroLocus, basicOpen_eq_zeroLocus_compl, SetLike.mem_coe, Set.mem_setOf_eq,
    Set.singleton_subset_iff, Set.mem_compl_iff, disjoint_iff_inf_le]
  constructor
  · intro h₁ h₂
    exact h₁ ⟨Submonoid.mem_powers r, h₂⟩
  · rintro h₁ _ ⟨⟨n, rfl⟩, h₃⟩
    

Proof state:
case h.mpr.intro.intro
R : Type u
S✝ : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing S✝
S : Type v
inst✝² : CommRing S
inst✝¹ : Algebra R S
r : R
inst✝ : IsLocalization.Away r S
x : PrimeSpectrum R
h₁ : r ∉ x.asIdeal
n : ℕ
h₃ : (fun x => r ^ x) n ∈ ↑x.asIdeal
⊢ (fun x => r ^ x) n ∈ ⊥

Next tactic:
exact h₁ (x.2.mem_of_pow_mem _ h₃)
theorem localization_away_openEmbedding (S : Type v) [CommRing S] [Algebra R S] (r : R)
    [IsLocalization.Away r S] : OpenEmbedding (comap (algebraMap R S)) :=
  { toEmbedding := localization_comap_embedding S (Submonoid.powers r)
    open_range := by
      

Proof state:
R : Type u
S✝ : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing S✝
S : Type v
inst✝² : CommRing S
inst✝¹ : Algebra R S
r : R
inst✝ : IsLocalization.Away r S
⊢ IsOpen (Set.range ⇑(comap (algebraMap R S)))

Next tactic:
rw [localization_away_comap_range S r]
theorem localization_away_openEmbedding (S : Type v) [CommRing S] [Algebra R S] (r : R)
    [IsLocalization.Away r S] : OpenEmbedding (comap (algebraMap R S)) :=
  { toEmbedding := localization_comap_embedding S (Submonoid.powers r)
    open_range := by
      rw [localization_away_comap_range S r]
      

Proof state:
R : Type u
S✝ : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing S✝
S : Type v
inst✝² : CommRing S
inst✝¹ : Algebra R S
r : R
inst✝ : IsLocalization.Away r S
⊢ IsOpen ↑(basicOpen r)

Next tactic:
exact isOpen_basicOpen
theorem isCompact_basicOpen (f : R) : IsCompact (basicOpen f : Set (PrimeSpectrum R)) := by
  

Proof state:
R : Type u
S : Type v
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R
⊢ IsCompact ↑(basicOpen f)

Next tactic:
rw [← localization_away_comap_range (Localization (Submonoid.powers f))]
theorem isCompact_basicOpen (f : R) : IsCompact (basicOpen f : Set (PrimeSpectrum R)) := by
  rw [← localization_away_comap_range (Localization (Submonoid.powers f))]
  

Proof state:
R : Type u
S : Type v
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R
⊢ IsCompact (Set.range ⇑(comap (algebraMap R (Localization (Submonoid.powers f)))))

Next tactic:
exact isCompact_range (map_continuous _)
theorem le_iff_mem_closure (x y : PrimeSpectrum R) :
    x ≤ y ↔ y ∈ closure ({x} : Set (PrimeSpectrum R)) := by
  

Proof state:
R : Type u
S : Type v
inst✝¹ : CommRing R
inst✝ : CommRing S
x y : PrimeSpectrum R
⊢ x ≤ y ↔ y ∈ closure {x}

Next tactic:
rw [← asIdeal_le_asIdeal, ← zeroLocus_vanishingIdeal_eq_closure, mem_zeroLocus,
    vanishingIdeal_singleton, SetLike.coe_subset_coe]
/-- If `x` specializes to `y`, then there is a natural map from the localization of `y` to the
localization of `x`. -/
def localizationMapOfSpecializes {x y : PrimeSpectrum R} (h : x ⤳ y) :
    Localization.AtPrime y.asIdeal →+* Localization.AtPrime x.asIdeal :=
  @IsLocalization.lift _ _ _ _ _ _ _ _ Localization.isLocalization
    (algebraMap R (Localization.AtPrime x.asIdeal))
    (by
      

Proof state:
R : Type u
S : Type v
inst✝¹ : CommRing R
inst✝ : CommRing S
x y : PrimeSpectrum R
h : x ⤳ y
⊢ ∀ (y_1 : ↥(Ideal.primeCompl y.asIdeal)), IsUnit ((algebraMap R (Localization.AtPrime x.asIdeal)) ↑y_1)

Next tactic:
rintro ⟨a, ha⟩
/-- If `x` specializes to `y`, then there is a natural map from the localization of `y` to the
localization of `x`. -/
def localizationMapOfSpecializes {x y : PrimeSpectrum R} (h : x ⤳ y) :
    Localization.AtPrime y.asIdeal →+* Localization.AtPrime x.asIdeal :=
  @IsLocalization.lift _ _ _ _ _ _ _ _ Localization.isLocalization
    (algebraMap R (Localization.AtPrime x.asIdeal))
    (by
      rintro ⟨a, ha⟩
      

Proof state:
case mk
R : Type u
S : Type v
inst✝¹ : CommRing R
inst✝ : CommRing S
x y : PrimeSpectrum R
h : x ⤳ y
a : R
ha : a ∈ Ideal.primeCompl y.asIdeal
⊢ IsUnit ((algebraMap R (Localization.AtPrime x.asIdeal)) ↑{ val := a, property := ha })

Next tactic:
rw [← PrimeSpectrum.le_iff_specializes, ← asIdeal_le_asIdeal, ← SetLike.coe_subset_coe, ←
        Set.compl_subset_compl] at h
/-- If `x` specializes to `y`, then there is a natural map from the localization of `y` to the
localization of `x`. -/
def localizationMapOfSpecializes {x y : PrimeSpectrum R} (h : x ⤳ y) :
    Localization.AtPrime y.asIdeal →+* Localization.AtPrime x.asIdeal :=
  @IsLocalization.lift _ _ _ _ _ _ _ _ Localization.isLocalization
    (algebraMap R (Localization.AtPrime x.asIdeal))
    (by
      rintro ⟨a, ha⟩
      rw [← PrimeSpectrum.le_iff_specializes, ← asIdeal_le_asIdeal, ← SetLike.coe_subset_coe, ←
        Set.compl_subset_compl] at h
      

Proof state:
case mk
R : Type u
S : Type v
inst✝¹ : CommRing R
inst✝ : CommRing S
x y : PrimeSpectrum R
h : (↑y.asIdeal)ᶜ ⊆ (↑x.asIdeal)ᶜ
a : R
ha : a ∈ Ideal.primeCompl y.asIdeal
⊢ IsUnit ((algebraMap R (Localization.AtPrime x.asIdeal)) ↑{ val := a, property := ha })

Next tactic:
exact (IsLocalization.map_units (Localization.AtPrime x.asIdeal)
        ⟨a, show a ∈ x.asIdeal.primeCompl from h ha⟩ : _)
theorem isLocalRingHom_iff_comap_closedPoint {S : Type v} [CommRing S] [LocalRing S] (f : R →+* S) :
    IsLocalRingHom f ↔ PrimeSpectrum.comap f (closedPoint S) = closedPoint R := by
  -- Porting note : inline `this` does **not** work
  

Proof state:
R : Type u
S✝ : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing S✝
inst✝² : LocalRing R
S : Type v
inst✝¹ : CommRing S
inst✝ : LocalRing S
f : R →+* S
⊢ IsLocalRingHom f ↔ (PrimeSpectrum.comap f) (closedPoint S) = closedPoint R

Next tactic:
have := (local_hom_TFAE f).out 0 4
theorem isLocalRingHom_iff_comap_closedPoint {S : Type v} [CommRing S] [LocalRing S] (f : R →+* S) :
    IsLocalRingHom f ↔ PrimeSpectrum.comap f (closedPoint S) = closedPoint R := by
  -- Porting note : inline `this` does **not** work
  have := (local_hom_TFAE f).out 0 4
  

Proof state:
R : Type u
S✝ : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing S✝
inst✝² : LocalRing R
S : Type v
inst✝¹ : CommRing S
inst✝ : LocalRing S
f : R →+* S
this : IsLocalRingHom f ↔ Ideal.comap f (maximalIdeal S) = maximalIdeal R
⊢ IsLocalRingHom f ↔ (PrimeSpectrum.comap f) (closedPoint S) = closedPoint R

Next tactic:
rw [this, PrimeSpectrum.ext_iff]
theorem isLocalRingHom_iff_comap_closedPoint {S : Type v} [CommRing S] [LocalRing S] (f : R →+* S) :
    IsLocalRingHom f ↔ PrimeSpectrum.comap f (closedPoint S) = closedPoint R := by
  -- Porting note : inline `this` does **not** work
  have := (local_hom_TFAE f).out 0 4
  rw [this, PrimeSpectrum.ext_iff]
  

Proof state:
R : Type u
S✝ : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing S✝
inst✝² : LocalRing R
S : Type v
inst✝¹ : CommRing S
inst✝ : LocalRing S
f : R →+* S
this : IsLocalRingHom f ↔ Ideal.comap f (maximalIdeal S) = maximalIdeal R
⊢ Ideal.comap f (maximalIdeal S) = maximalIdeal R ↔
    ((PrimeSpectrum.comap f) (closedPoint S)).asIdeal = (closedPoint R).asIdeal

Next tactic:
rfl
theorem closedPoint_mem_iff (U : TopologicalSpace.Opens <| PrimeSpectrum R) :
    closedPoint R ∈ U ↔ U = ⊤ := by
  

Proof state:
R : Type u
S : Type v
inst✝² : CommRing R
inst✝¹ : CommRing S
inst✝ : LocalRing R
U : TopologicalSpace.Opens (PrimeSpectrum R)
⊢ closedPoint R ∈ U ↔ U = ⊤

Next tactic:
constructor
theorem closedPoint_mem_iff (U : TopologicalSpace.Opens <| PrimeSpectrum R) :
    closedPoint R ∈ U ↔ U = ⊤ := by
  constructor
  · 

Proof state:
case mp
R : Type u
S : Type v
inst✝² : CommRing R
inst✝¹ : CommRing S
inst✝ : LocalRing R
U : TopologicalSpace.Opens (PrimeSpectrum R)
⊢ closedPoint R ∈ U → U = ⊤

Next tactic:
rw [eq_top_iff]
theorem closedPoint_mem_iff (U : TopologicalSpace.Opens <| PrimeSpectrum R) :
    closedPoint R ∈ U ↔ U = ⊤ := by
  constructor
  · rw [eq_top_iff]
    

Proof state:
case mp
R : Type u
S : Type v
inst✝² : CommRing R
inst✝¹ : CommRing S
inst✝ : LocalRing R
U : TopologicalSpace.Opens (PrimeSpectrum R)
⊢ closedPoint R ∈ U → ⊤ ≤ U

Next tactic:
exact fun h x _ => (specializes_closedPoint x).mem_open U.2 h
theorem closedPoint_mem_iff (U : TopologicalSpace.Opens <| PrimeSpectrum R) :
    closedPoint R ∈ U ↔ U = ⊤ := by
  constructor
  · rw [eq_top_iff]
    exact fun h x _ => (specializes_closedPoint x).mem_open U.2 h
  · 

Proof state:
case mpr
R : Type u
S : Type v
inst✝² : CommRing R
inst✝¹ : CommRing S
inst✝ : LocalRing R
U : TopologicalSpace.Opens (PrimeSpectrum R)
⊢ U = ⊤ → closedPoint R ∈ U

Next tactic:
rintro rfl
theorem closedPoint_mem_iff (U : TopologicalSpace.Opens <| PrimeSpectrum R) :
    closedPoint R ∈ U ↔ U = ⊤ := by
  constructor
  · rw [eq_top_iff]
    exact fun h x _ => (specializes_closedPoint x).mem_open U.2 h
  · rintro rfl
    

Proof state:
case mpr
R : Type u
S : Type v
inst✝² : CommRing R
inst✝¹ : CommRing S
inst✝ : LocalRing R
⊢ closedPoint R ∈ ⊤

Next tactic:
trivial
@[simp]
theorem PrimeSpectrum.comap_residue (x : PrimeSpectrum (ResidueField R)) :
    PrimeSpectrum.comap (residue R) x = closedPoint R := by
  

Proof state:
R : Type u
S : Type v
inst✝² : CommRing R
inst✝¹ : CommRing S
inst✝ : LocalRing R
x : PrimeSpectrum (ResidueField R)
⊢ (PrimeSpectrum.comap (residue R)) x = closedPoint R

Next tactic:
rw [Subsingleton.elim x ⊥]
@[simp]
theorem PrimeSpectrum.comap_residue (x : PrimeSpectrum (ResidueField R)) :
    PrimeSpectrum.comap (residue R) x = closedPoint R := by
  rw [Subsingleton.elim x ⊥]
  

Proof state:
R : Type u
S : Type v
inst✝² : CommRing R
inst✝¹ : CommRing S
inst✝ : LocalRing R
x : PrimeSpectrum (ResidueField R)
⊢ (PrimeSpectrum.comap (residue R)) ⊥ = closedPoint R

Next tactic:
ext1
@[simp]
theorem PrimeSpectrum.comap_residue (x : PrimeSpectrum (ResidueField R)) :
    PrimeSpectrum.comap (residue R) x = closedPoint R := by
  rw [Subsingleton.elim x ⊥]
  ext1
  

Proof state:
case asIdeal
R : Type u
S : Type v
inst✝² : CommRing R
inst✝¹ : CommRing S
inst✝ : LocalRing R
x : PrimeSpectrum (ResidueField R)
⊢ ((PrimeSpectrum.comap (residue R)) ⊥).asIdeal = (closedPoint R).asIdeal

Next tactic:
exact Ideal.mk_ker
instance {ι : Type*} [Finite ι] {X : ι → Type*} [(i : ι) → TopologicalSpace (X i)]
    [(i : ι) → WeaklyLocallyCompactSpace (X i)] :
    WeaklyLocallyCompactSpace ((i : ι) → X i) where
  exists_compact_mem_nhds := fun f ↦ by
    

Proof state:
X✝ : Type u_1
Y : Type u_2
ι✝ : Type u_3
inst✝⁴ : TopologicalSpace X✝
inst✝³ : TopologicalSpace Y
s t : Set X✝
ι : Type u_4
inst✝² : Finite ι
X : ι → Type u_5
inst✝¹ : (i : ι) → TopologicalSpace (X i)
inst✝ : ∀ (i : ι), WeaklyLocallyCompactSpace (X i)
f : (i : ι) → X i
⊢ ∃ s, IsCompact s ∧ s ∈ 𝓝 f

Next tactic:
choose s hsc hs using fun i ↦ exists_compact_mem_nhds (f i)
instance {ι : Type*} [Finite ι] {X : ι → Type*} [(i : ι) → TopologicalSpace (X i)]
    [(i : ι) → WeaklyLocallyCompactSpace (X i)] :
    WeaklyLocallyCompactSpace ((i : ι) → X i) where
  exists_compact_mem_nhds := fun f ↦ by
    choose s hsc hs using fun i ↦ exists_compact_mem_nhds (f i)
    

Proof state:
X✝ : Type u_1
Y : Type u_2
ι✝ : Type u_3
inst✝⁴ : TopologicalSpace X✝
inst✝³ : TopologicalSpace Y
s✝ t : Set X✝
ι : Type u_4
inst✝² : Finite ι
X : ι → Type u_5
inst✝¹ : (i : ι) → TopologicalSpace (X i)
inst✝ : ∀ (i : ι), WeaklyLocallyCompactSpace (X i)
f : (i : ι) → X i
s : (i : ι) → Set (X i)
hsc : ∀ (i : ι), IsCompact (s i)
hs : ∀ (i : ι), s i ∈ 𝓝 (f i)
⊢ ∃ s, IsCompact s ∧ s ∈ 𝓝 f

Next tactic:
exact ⟨pi univ s, isCompact_univ_pi hsc, set_pi_mem_nhds univ.toFinite fun i _ ↦ hs i⟩
/-- In a weakly locally compact space,
every compact set is contained in the interior of a compact set. -/
theorem exists_compact_superset [WeaklyLocallyCompactSpace X] {K : Set X} (hK : IsCompact K) :
    ∃ K', IsCompact K' ∧ K ⊆ interior K' := by
  

Proof state:
X : Type u_1
Y : Type u_2
ι : Type u_3
inst✝² : TopologicalSpace X
inst✝¹ : TopologicalSpace Y
s t : Set X
inst✝ : WeaklyLocallyCompactSpace X
K : Set X
hK : IsCompact K
⊢ ∃ K', IsCompact K' ∧ K ⊆ interior K'

Next tactic:
choose s hc hmem using fun x : X ↦ exists_compact_mem_nhds x
/-- In a weakly locally compact space,
every compact set is contained in the interior of a compact set. -/
theorem exists_compact_superset [WeaklyLocallyCompactSpace X] {K : Set X} (hK : IsCompact K) :
    ∃ K', IsCompact K' ∧ K ⊆ interior K' := by
  choose s hc hmem using fun x : X ↦ exists_compact_mem_nhds x
  

Proof state:
X : Type u_1
Y : Type u_2
ι : Type u_3
inst✝² : TopologicalSpace X
inst✝¹ : TopologicalSpace Y
s✝ t : Set X
inst✝ : WeaklyLocallyCompactSpace X
K : Set X
hK : IsCompact K
s : X → Set X
hc : ∀ (x : X), IsCompact (s x)
hmem : ∀ (x : X), s x ∈ 𝓝 x
⊢ ∃ K', IsCompact K' ∧ K ⊆ interior K'

Next tactic:
rcases hK.elim_nhds_subcover _ fun x _ ↦ interior_mem_nhds.2 (hmem x) with ⟨I, -, hIK⟩
/-- In a weakly locally compact space,
every compact set is contained in the interior of a compact set. -/
theorem exists_compact_superset [WeaklyLocallyCompactSpace X] {K : Set X} (hK : IsCompact K) :
    ∃ K', IsCompact K' ∧ K ⊆ interior K' := by
  choose s hc hmem using fun x : X ↦ exists_compact_mem_nhds x
  rcases hK.elim_nhds_subcover _ fun x _ ↦ interior_mem_nhds.2 (hmem x) with ⟨I, -, hIK⟩
  

Proof state:
case intro.intro
X : Type u_1
Y : Type u_2
ι : Type u_3
inst✝² : TopologicalSpace X
inst✝¹ : TopologicalSpace Y
s✝ t : Set X
inst✝ : WeaklyLocallyCompactSpace X
K : Set X
hK : IsCompact K
s : X → Set X
hc : ∀ (x : X), IsCompact (s x)
hmem : ∀ (x : X), s x ∈ 𝓝 x
I : Finset X
hIK : K ⊆ ⋃ x ∈ I, interior (s x)
⊢ ∃ K', IsCompact K' ∧ K ⊆ interior K'

Next tactic:
refine ⟨⋃ x ∈ I, s x, I.isCompact_biUnion fun _ _ ↦ hc _, hIK.trans ?_⟩
/-- In a weakly locally compact space,
every compact set is contained in the interior of a compact set. -/
theorem exists_compact_superset [WeaklyLocallyCompactSpace X] {K : Set X} (hK : IsCompact K) :
    ∃ K', IsCompact K' ∧ K ⊆ interior K' := by
  choose s hc hmem using fun x : X ↦ exists_compact_mem_nhds x
  rcases hK.elim_nhds_subcover _ fun x _ ↦ interior_mem_nhds.2 (hmem x) with ⟨I, -, hIK⟩
  refine ⟨⋃ x ∈ I, s x, I.isCompact_biUnion fun _ _ ↦ hc _, hIK.trans ?_⟩
  

Proof state:
case intro.intro
X : Type u_1
Y : Type u_2
ι : Type u_3
inst✝² : TopologicalSpace X
inst✝¹ : TopologicalSpace Y
s✝ t : Set X
inst✝ : WeaklyLocallyCompactSpace X
K : Set X
hK : IsCompact K
s : X → Set X
hc : ∀ (x : X), IsCompact (s x)
hmem : ∀ (x : X), s x ∈ 𝓝 x
I : Finset X
hIK : K ⊆ ⋃ x ∈ I, interior (s x)
⊢ ⋃ x ∈ I, interior (s x) ⊆ interior (⋃ x ∈ I, s x)

Next tactic:
exact iUnion₂_subset fun x hx ↦ interior_mono <| subset_iUnion₂ (s := fun x _ ↦ s x) x hx
theorem compact_basis_nhds [LocallyCompactSpace X] (x : X) :
    (𝓝 x).HasBasis (fun s => s ∈ 𝓝 x ∧ IsCompact s) fun s => s :=
  hasBasis_self.2 <| by 

Proof state:
X : Type u_1
Y : Type u_2
ι : Type u_3
inst✝² : TopologicalSpace X
inst✝¹ : TopologicalSpace Y
s t : Set X
inst✝ : LocallyCompactSpace X
x : X
⊢ ∀ t ∈ 𝓝 x, ∃ r ∈ 𝓝 x, IsCompact r ∧ r ⊆ t

Next tactic:
simpa only [and_comm] using LocallyCompactSpace.local_compact_nhds x