l3lab/ntp-mathlib huggingface dataset:
theorem toPrimeSpectrum_range :
    Set.range (@toPrimeSpectrum R _) = { x | IsClosed ({x} : Set <| PrimeSpectrum R) } := by
  simp only [isClosed_singleton_iff_isMaximal]
  

Proof state:
R : Type u
inst✝ : CommRing R
⊢ range toPrimeSpectrum = {x | Ideal.IsMaximal x.asIdeal}

Next tactic:
ext ⟨x, _⟩
theorem toPrimeSpectrum_range :
    Set.range (@toPrimeSpectrum R _) = { x | IsClosed ({x} : Set <| PrimeSpectrum R) } := by
  simp only [isClosed_singleton_iff_isMaximal]
  ext ⟨x, _⟩
  

Proof state:
case h.mk
R : Type u
inst✝ : CommRing R
x : Ideal R
IsPrime✝ : Ideal.IsPrime x
⊢ { asIdeal := x, IsPrime := IsPrime✝ } ∈ range toPrimeSpectrum ↔
    { asIdeal := x, IsPrime := IsPrime✝ } ∈ {x | Ideal.IsMaximal x.asIdeal}

Next tactic:
exact ⟨fun ⟨y, hy⟩ => hy ▸ y.IsMaximal, fun hx => ⟨⟨x, hx⟩, rfl⟩⟩
instance : T1Space <| MaximalSpectrum R :=
  ⟨fun x => isClosed_induced_iff.mpr
    ⟨{toPrimeSpectrum x}, (isClosed_singleton_iff_isMaximal _).mpr x.IsMaximal, by
      

Proof state:
R : Type u
inst✝ : CommRing R
x : MaximalSpectrum R
⊢ toPrimeSpectrum ⁻¹' {toPrimeSpectrum x} = {x}

Next tactic:
simpa only [← image_singleton] using preimage_image_eq {x} toPrimeSpectrum_injective
/-- An integral domain is equal to the intersection of its localizations at all its maximal ideals
viewed as subalgebras of its field of fractions. -/
theorem iInf_localization_eq_bot : (⨅ v : MaximalSpectrum R,
    Localization.subalgebra.ofField K _ v.asIdeal.primeCompl_le_nonZeroDivisors) = ⊥ := by
  

Proof state:
R : Type u
inst✝⁴ : CommRing R
inst✝³ : IsDomain R
K : Type v
inst✝² : Field K
inst✝¹ : Algebra R K
inst✝ : IsFractionRing R K
⊢ ⨅ v,
      Localization.subalgebra.ofField K (Ideal.primeCompl v.asIdeal)
        (_ : Ideal.primeCompl v.asIdeal ≤ nonZeroDivisors R) =
    ⊥

Next tactic:
ext x
/-- An integral domain is equal to the intersection of its localizations at all its maximal ideals
viewed as subalgebras of its field of fractions. -/
theorem iInf_localization_eq_bot : (⨅ v : MaximalSpectrum R,
    Localization.subalgebra.ofField K _ v.asIdeal.primeCompl_le_nonZeroDivisors) = ⊥ := by
  ext x
  

Proof state:
case h
R : Type u
inst✝⁴ : CommRing R
inst✝³ : IsDomain R
K : Type v
inst✝² : Field K
inst✝¹ : Algebra R K
inst✝ : IsFractionRing R K
x : K
⊢ x ∈
      ⨅ v,
        Localization.subalgebra.ofField K (Ideal.primeCompl v.asIdeal)
          (_ : Ideal.primeCompl v.asIdeal ≤ nonZeroDivisors R) ↔
    x ∈ ⊥

Next tactic:
rw [Algebra.mem_bot, Algebra.mem_iInf]
/-- An integral domain is equal to the intersection of its localizations at all its maximal ideals
viewed as subalgebras of its field of fractions. -/
theorem iInf_localization_eq_bot : (⨅ v : MaximalSpectrum R,
    Localization.subalgebra.ofField K _ v.asIdeal.primeCompl_le_nonZeroDivisors) = ⊥ := by
  ext x
  rw [Algebra.mem_bot, Algebra.mem_iInf]
  

Proof state:
case h
R : Type u
inst✝⁴ : CommRing R
inst✝³ : IsDomain R
K : Type v
inst✝² : Field K
inst✝¹ : Algebra R K
inst✝ : IsFractionRing R K
x : K
⊢ (∀ (i : MaximalSpectrum R),
      x ∈
        Localization.subalgebra.ofField K (Ideal.primeCompl i.asIdeal)
          (_ : Ideal.primeCompl i.asIdeal ≤ nonZeroDivisors R)) ↔
    x ∈ range ⇑(algebraMap R K)

Next tactic:
constructor
/-- An integral domain is equal to the intersection of its localizations at all its maximal ideals
viewed as subalgebras of its field of fractions. -/
theorem iInf_localization_eq_bot : (⨅ v : MaximalSpectrum R,
    Localization.subalgebra.ofField K _ v.asIdeal.primeCompl_le_nonZeroDivisors) = ⊥ := by
  ext x
  rw [Algebra.mem_bot, Algebra.mem_iInf]
  constructor
  · 

Proof state:
case h.mp
R : Type u
inst✝⁴ : CommRing R
inst✝³ : IsDomain R
K : Type v
inst✝² : Field K
inst✝¹ : Algebra R K
inst✝ : IsFractionRing R K
x : K
⊢ (∀ (i : MaximalSpectrum R),
      x ∈
        Localization.subalgebra.ofField K (Ideal.primeCompl i.asIdeal)
          (_ : Ideal.primeCompl i.asIdeal ≤ nonZeroDivisors R)) →
    x ∈ range ⇑(algebraMap R K)

Next tactic:
contrapose
/-- An integral domain is equal to the intersection of its localizations at all its maximal ideals
viewed as subalgebras of its field of fractions. -/
theorem iInf_localization_eq_bot : (⨅ v : MaximalSpectrum R,
    Localization.subalgebra.ofField K _ v.asIdeal.primeCompl_le_nonZeroDivisors) = ⊥ := by
  ext x
  rw [Algebra.mem_bot, Algebra.mem_iInf]
  constructor
  · contrapose
    

Proof state:
case h.mp
R : Type u
inst✝⁴ : CommRing R
inst✝³ : IsDomain R
K : Type v
inst✝² : Field K
inst✝¹ : Algebra R K
inst✝ : IsFractionRing R K
x : K
⊢ x ∉ range ⇑(algebraMap R K) →
    ¬∀ (i : MaximalSpectrum R),
        x ∈
          Localization.subalgebra.ofField K (Ideal.primeCompl i.asIdeal)
            (_ : Ideal.primeCompl i.asIdeal ≤ nonZeroDivisors R)

Next tactic:
intro hrange hlocal
/-- An integral domain is equal to the intersection of its localizations at all its maximal ideals
viewed as subalgebras of its field of fractions. -/
theorem iInf_localization_eq_bot : (⨅ v : MaximalSpectrum R,
    Localization.subalgebra.ofField K _ v.asIdeal.primeCompl_le_nonZeroDivisors) = ⊥ := by
  ext x
  rw [Algebra.mem_bot, Algebra.mem_iInf]
  constructor
  · contrapose
    intro hrange hlocal
    

Proof state:
case h.mp
R : Type u
inst✝⁴ : CommRing R
inst✝³ : IsDomain R
K : Type v
inst✝² : Field K
inst✝¹ : Algebra R K
inst✝ : IsFractionRing R K
x : K
hrange : x ∉ range ⇑(algebraMap R K)
hlocal :
  ∀ (i : MaximalSpectrum R),
    x ∈
      Localization.subalgebra.ofField K (Ideal.primeCompl i.asIdeal)
        (_ : Ideal.primeCompl i.asIdeal ≤ nonZeroDivisors R)
⊢ False

Next tactic:
let denom : Ideal R := (Submodule.span R {1} : Submodule R K).colon (Submodule.span R {x})
/-- An integral domain is equal to the intersection of its localizations at all its maximal ideals
viewed as subalgebras of its field of fractions. -/
theorem iInf_localization_eq_bot : (⨅ v : MaximalSpectrum R,
    Localization.subalgebra.ofField K _ v.asIdeal.primeCompl_le_nonZeroDivisors) = ⊥ := by
  ext x
  rw [Algebra.mem_bot, Algebra.mem_iInf]
  constructor
  · contrapose
    intro hrange hlocal
    let denom : Ideal R := (Submodule.span R {1} : Submodule R K).colon (Submodule.span R {x})
    

Proof state:
case h.mp
R : Type u
inst✝⁴ : CommRing R
inst✝³ : IsDomain R
K : Type v
inst✝² : Field K
inst✝¹ : Algebra R K
inst✝ : IsFractionRing R K
x : K
hrange : x ∉ range ⇑(algebraMap R K)
hlocal :
  ∀ (i : MaximalSpectrum R),
    x ∈
      Localization.subalgebra.ofField K (Ideal.primeCompl i.asIdeal)
        (_ : Ideal.primeCompl i.asIdeal ≤ nonZeroDivisors R)
denom : Ideal R := Submodule.colon (Submodule.span R {1}) (Submodule.span R {x})
⊢ False

Next tactic:
have hdenom : (1 : R) ∉ denom := by
      intro hdenom
      rcases Submodule.mem_span_singleton.mp
        (Submodule.mem_colon.mp hdenom x <| Submodule.mem_span_singleton_self x) with ⟨y, hy⟩
      exact hrange ⟨y, by rw [← mul_one <| algebraMap R K y, ← Algebra.smul_def, hy, one_smul]⟩
/-- An integral domain is equal to the intersection of its localizations at all its maximal ideals
viewed as subalgebras of its field of fractions. -/
theorem iInf_localization_eq_bot : (⨅ v : MaximalSpectrum R,
    Localization.subalgebra.ofField K _ v.asIdeal.primeCompl_le_nonZeroDivisors) = ⊥ := by
  ext x
  rw [Algebra.mem_bot, Algebra.mem_iInf]
  constructor
  · contrapose
    intro hrange hlocal
    let denom : Ideal R := (Submodule.span R {1} : Submodule R K).colon (Submodule.span R {x})
    have hdenom : (1 : R) ∉ denom := by
      

Proof state:
R : Type u
inst✝⁴ : CommRing R
inst✝³ : IsDomain R
K : Type v
inst✝² : Field K
inst✝¹ : Algebra R K
inst✝ : IsFractionRing R K
x : K
hrange : x ∉ range ⇑(algebraMap R K)
hlocal :
  ∀ (i : MaximalSpectrum R),
    x ∈
      Localization.subalgebra.ofField K (Ideal.primeCompl i.asIdeal)
        (_ : Ideal.primeCompl i.asIdeal ≤ nonZeroDivisors R)
denom : Ideal R := Submodule.colon (Submodule.span R {1}) (Submodule.span R {x})
⊢ 1 ∉ denom

Next tactic:
intro hdenom
/-- An integral domain is equal to the intersection of its localizations at all its maximal ideals
viewed as subalgebras of its field of fractions. -/
theorem iInf_localization_eq_bot : (⨅ v : MaximalSpectrum R,
    Localization.subalgebra.ofField K _ v.asIdeal.primeCompl_le_nonZeroDivisors) = ⊥ := by
  ext x
  rw [Algebra.mem_bot, Algebra.mem_iInf]
  constructor
  · contrapose
    intro hrange hlocal
    let denom : Ideal R := (Submodule.span R {1} : Submodule R K).colon (Submodule.span R {x})
    have hdenom : (1 : R) ∉ denom := by
      intro hdenom
      

Proof state:
R : Type u
inst✝⁴ : CommRing R
inst✝³ : IsDomain R
K : Type v
inst✝² : Field K
inst✝¹ : Algebra R K
inst✝ : IsFractionRing R K
x : K
hrange : x ∉ range ⇑(algebraMap R K)
hlocal :
  ∀ (i : MaximalSpectrum R),
    x ∈
      Localization.subalgebra.ofField K (Ideal.primeCompl i.asIdeal)
        (_ : Ideal.primeCompl i.asIdeal ≤ nonZeroDivisors R)
denom : Ideal R := Submodule.colon (Submodule.span R {1}) (Submodule.span R {x})
hdenom : 1 ∈ denom
⊢ False

Next tactic:
rcases Submodule.mem_span_singleton.mp
        (Submodule.mem_colon.mp hdenom x <| Submodule.mem_span_singleton_self x) with ⟨y, hy⟩
/-- An integral domain is equal to the intersection of its localizations at all its maximal ideals
viewed as subalgebras of its field of fractions. -/
theorem iInf_localization_eq_bot : (⨅ v : MaximalSpectrum R,
    Localization.subalgebra.ofField K _ v.asIdeal.primeCompl_le_nonZeroDivisors) = ⊥ := by
  ext x
  rw [Algebra.mem_bot, Algebra.mem_iInf]
  constructor
  · contrapose
    intro hrange hlocal
    let denom : Ideal R := (Submodule.span R {1} : Submodule R K).colon (Submodule.span R {x})
    have hdenom : (1 : R) ∉ denom := by
      intro hdenom
      rcases Submodule.mem_span_singleton.mp
        (Submodule.mem_colon.mp hdenom x <| Submodule.mem_span_singleton_self x) with ⟨y, hy⟩
      

Proof state:
case intro
R : Type u
inst✝⁴ : CommRing R
inst✝³ : IsDomain R
K : Type v
inst✝² : Field K
inst✝¹ : Algebra R K
inst✝ : IsFractionRing R K
x : K
hrange : x ∉ range ⇑(algebraMap R K)
hlocal :
  ∀ (i : MaximalSpectrum R),
    x ∈
      Localization.subalgebra.ofField K (Ideal.primeCompl i.asIdeal)
        (_ : Ideal.primeCompl i.asIdeal ≤ nonZeroDivisors R)
denom : Ideal R := Submodule.colon (Submodule.span R {1}) (Submodule.span R {x})
hdenom : 1 ∈ denom
y : R
hy : y • 1 = 1 • x
⊢ False

Next tactic:
exact hrange ⟨y, by rw [← mul_one <| algebraMap R K y, ← Algebra.smul_def, hy, one_smul]⟩
/-- An integral domain is equal to the intersection of its localizations at all its maximal ideals
viewed as subalgebras of its field of fractions. -/
theorem iInf_localization_eq_bot : (⨅ v : MaximalSpectrum R,
    Localization.subalgebra.ofField K _ v.asIdeal.primeCompl_le_nonZeroDivisors) = ⊥ := by
  ext x
  rw [Algebra.mem_bot, Algebra.mem_iInf]
  constructor
  · contrapose
    intro hrange hlocal
    let denom : Ideal R := (Submodule.span R {1} : Submodule R K).colon (Submodule.span R {x})
    have hdenom : (1 : R) ∉ denom := by
      intro hdenom
      rcases Submodule.mem_span_singleton.mp
        (Submodule.mem_colon.mp hdenom x <| Submodule.mem_span_singleton_self x) with ⟨y, hy⟩
      exact hrange ⟨y, by 

Proof state:
R : Type u
inst✝⁴ : CommRing R
inst✝³ : IsDomain R
K : Type v
inst✝² : Field K
inst✝¹ : Algebra R K
inst✝ : IsFractionRing R K
x : K
hrange : x ∉ range ⇑(algebraMap R K)
hlocal :
  ∀ (i : MaximalSpectrum R),
    x ∈
      Localization.subalgebra.ofField K (Ideal.primeCompl i.asIdeal)
        (_ : Ideal.primeCompl i.asIdeal ≤ nonZeroDivisors R)
denom : Ideal R := Submodule.colon (Submodule.span R {1}) (Submodule.span R {x})
hdenom : 1 ∈ denom
y : R
hy : y • 1 = 1 • x
⊢ (algebraMap R K) y = x

Next tactic:
rw [← mul_one <| algebraMap R K y, ← Algebra.smul_def, hy, one_smul]
/-- An integral domain is equal to the intersection of its localizations at all its maximal ideals
viewed as subalgebras of its field of fractions. -/
theorem iInf_localization_eq_bot : (⨅ v : MaximalSpectrum R,
    Localization.subalgebra.ofField K _ v.asIdeal.primeCompl_le_nonZeroDivisors) = ⊥ := by
  ext x
  rw [Algebra.mem_bot, Algebra.mem_iInf]
  constructor
  · contrapose
    intro hrange hlocal
    let denom : Ideal R := (Submodule.span R {1} : Submodule R K).colon (Submodule.span R {x})
    have hdenom : (1 : R) ∉ denom := by
      intro hdenom
      rcases Submodule.mem_span_singleton.mp
        (Submodule.mem_colon.mp hdenom x <| Submodule.mem_span_singleton_self x) with ⟨y, hy⟩
      exact hrange ⟨y, by rw [← mul_one <| algebraMap R K y, ← Algebra.smul_def, hy, one_smul]⟩
    

Proof state:
case h.mp
R : Type u
inst✝⁴ : CommRing R
inst✝³ : IsDomain R
K : Type v
inst✝² : Field K
inst✝¹ : Algebra R K
inst✝ : IsFractionRing R K
x : K
hrange : x ∉ range ⇑(algebraMap R K)
hlocal :
  ∀ (i : MaximalSpectrum R),
    x ∈
      Localization.subalgebra.ofField K (Ideal.primeCompl i.asIdeal)
        (_ : Ideal.primeCompl i.asIdeal ≤ nonZeroDivisors R)
denom : Ideal R := Submodule.colon (Submodule.span R {1}) (Submodule.span R {x})
hdenom : 1 ∉ denom
⊢ False

Next tactic:
rcases denom.exists_le_maximal fun h => (h ▸ hdenom) Submodule.mem_top with ⟨max, hmax, hle⟩
/-- An integral domain is equal to the intersection of its localizations at all its maximal ideals
viewed as subalgebras of its field of fractions. -/
theorem iInf_localization_eq_bot : (⨅ v : MaximalSpectrum R,
    Localization.subalgebra.ofField K _ v.asIdeal.primeCompl_le_nonZeroDivisors) = ⊥ := by
  ext x
  rw [Algebra.mem_bot, Algebra.mem_iInf]
  constructor
  · contrapose
    intro hrange hlocal
    let denom : Ideal R := (Submodule.span R {1} : Submodule R K).colon (Submodule.span R {x})
    have hdenom : (1 : R) ∉ denom := by
      intro hdenom
      rcases Submodule.mem_span_singleton.mp
        (Submodule.mem_colon.mp hdenom x <| Submodule.mem_span_singleton_self x) with ⟨y, hy⟩
      exact hrange ⟨y, by rw [← mul_one <| algebraMap R K y, ← Algebra.smul_def, hy, one_smul]⟩
    rcases denom.exists_le_maximal fun h => (h ▸ hdenom) Submodule.mem_top with ⟨max, hmax, hle⟩
    

Proof state:
case h.mp.intro.intro
R : Type u
inst✝⁴ : CommRing R
inst✝³ : IsDomain R
K : Type v
inst✝² : Field K
inst✝¹ : Algebra R K
inst✝ : IsFractionRing R K
x : K
hrange : x ∉ range ⇑(algebraMap R K)
hlocal :
  ∀ (i : MaximalSpectrum R),
    x ∈
      Localization.subalgebra.ofField K (Ideal.primeCompl i.asIdeal)
        (_ : Ideal.primeCompl i.asIdeal ≤ nonZeroDivisors R)
denom : Ideal R := Submodule.colon (Submodule.span R {1}) (Submodule.span R {x})
hdenom : 1 ∉ denom
max : Ideal R
hmax : Ideal.IsMaximal max
hle : denom ≤ max
⊢ False

Next tactic:
rcases hlocal ⟨max, hmax⟩ with ⟨n, d, hd, rfl⟩
/-- An integral domain is equal to the intersection of its localizations at all its maximal ideals
viewed as subalgebras of its field of fractions. -/
theorem iInf_localization_eq_bot : (⨅ v : MaximalSpectrum R,
    Localization.subalgebra.ofField K _ v.asIdeal.primeCompl_le_nonZeroDivisors) = ⊥ := by
  ext x
  rw [Algebra.mem_bot, Algebra.mem_iInf]
  constructor
  · contrapose
    intro hrange hlocal
    let denom : Ideal R := (Submodule.span R {1} : Submodule R K).colon (Submodule.span R {x})
    have hdenom : (1 : R) ∉ denom := by
      intro hdenom
      rcases Submodule.mem_span_singleton.mp
        (Submodule.mem_colon.mp hdenom x <| Submodule.mem_span_singleton_self x) with ⟨y, hy⟩
      exact hrange ⟨y, by rw [← mul_one <| algebraMap R K y, ← Algebra.smul_def, hy, one_smul]⟩
    rcases denom.exists_le_maximal fun h => (h ▸ hdenom) Submodule.mem_top with ⟨max, hmax, hle⟩
    rcases hlocal ⟨max, hmax⟩ with ⟨n, d, hd, rfl⟩
    

Proof state:
case h.mp.intro.intro.intro.intro.intro
R : Type u
inst✝⁴ : CommRing R
inst✝³ : IsDomain R
K : Type v
inst✝² : Field K
inst✝¹ : Algebra R K
inst✝ : IsFractionRing R K
max : Ideal R
hmax : Ideal.IsMaximal max
n d : R
hd : d ∈ Ideal.primeCompl { asIdeal := max, IsMaximal := hmax }.asIdeal
hrange : (algebraMap R K) n * ((algebraMap R K) d)⁻¹ ∉ range ⇑(algebraMap R K)
hlocal :
  ∀ (i : MaximalSpectrum R),
    (algebraMap R K) n * ((algebraMap R K) d)⁻¹ ∈
      Localization.subalgebra.ofField K (Ideal.primeCompl i.asIdeal)
        (_ : Ideal.primeCompl i.asIdeal ≤ nonZeroDivisors R)
denom : Ideal R :=
  Submodule.colon (Submodule.span R {1}) (Submodule.span R {(algebraMap R K) n * ((algebraMap R K) d)⁻¹})
hdenom : 1 ∉ denom
hle : denom ≤ max
⊢ False

Next tactic:
apply hd (hle <| Submodule.mem_colon.mpr fun _ hy => _)
/-- An integral domain is equal to the intersection of its localizations at all its maximal ideals
viewed as subalgebras of its field of fractions. -/
theorem iInf_localization_eq_bot : (⨅ v : MaximalSpectrum R,
    Localization.subalgebra.ofField K _ v.asIdeal.primeCompl_le_nonZeroDivisors) = ⊥ := by
  ext x
  rw [Algebra.mem_bot, Algebra.mem_iInf]
  constructor
  · contrapose
    intro hrange hlocal
    let denom : Ideal R := (Submodule.span R {1} : Submodule R K).colon (Submodule.span R {x})
    have hdenom : (1 : R) ∉ denom := by
      intro hdenom
      rcases Submodule.mem_span_singleton.mp
        (Submodule.mem_colon.mp hdenom x <| Submodule.mem_span_singleton_self x) with ⟨y, hy⟩
      exact hrange ⟨y, by rw [← mul_one <| algebraMap R K y, ← Algebra.smul_def, hy, one_smul]⟩
    rcases denom.exists_le_maximal fun h => (h ▸ hdenom) Submodule.mem_top with ⟨max, hmax, hle⟩
    rcases hlocal ⟨max, hmax⟩ with ⟨n, d, hd, rfl⟩
    apply hd (hle <| Submodule.mem_colon.mpr fun _ hy => _)
    

Proof state:
R : Type u
inst✝⁴ : CommRing R
inst✝³ : IsDomain R
K : Type v
inst✝² : Field K
inst✝¹ : Algebra R K
inst✝ : IsFractionRing R K
max : Ideal R
hmax : Ideal.IsMaximal max
n d : R
hd : d ∈ Ideal.primeCompl { asIdeal := max, IsMaximal := hmax }.asIdeal
hrange : (algebraMap R K) n * ((algebraMap R K) d)⁻¹ ∉ range ⇑(algebraMap R K)
hlocal :
  ∀ (i : MaximalSpectrum R),
    (algebraMap R K) n * ((algebraMap R K) d)⁻¹ ∈
      Localization.subalgebra.ofField K (Ideal.primeCompl i.asIdeal)
        (_ : Ideal.primeCompl i.asIdeal ≤ nonZeroDivisors R)
denom : Ideal R :=
  Submodule.colon (Submodule.span R {1}) (Submodule.span R {(algebraMap R K) n * ((algebraMap R K) d)⁻¹})
hdenom : 1 ∉ denom
hle : denom ≤ max
⊢ ∀ x ∈ Submodule.span R {(algebraMap R K) n * ((algebraMap R K) d)⁻¹}, d • x ∈ Submodule.span R {1}

Next tactic:
intro _ hy
/-- An integral domain is equal to the intersection of its localizations at all its maximal ideals
viewed as subalgebras of its field of fractions. -/
theorem iInf_localization_eq_bot : (⨅ v : MaximalSpectrum R,
    Localization.subalgebra.ofField K _ v.asIdeal.primeCompl_le_nonZeroDivisors) = ⊥ := by
  ext x
  rw [Algebra.mem_bot, Algebra.mem_iInf]
  constructor
  · contrapose
    intro hrange hlocal
    let denom : Ideal R := (Submodule.span R {1} : Submodule R K).colon (Submodule.span R {x})
    have hdenom : (1 : R) ∉ denom := by
      intro hdenom
      rcases Submodule.mem_span_singleton.mp
        (Submodule.mem_colon.mp hdenom x <| Submodule.mem_span_singleton_self x) with ⟨y, hy⟩
      exact hrange ⟨y, by rw [← mul_one <| algebraMap R K y, ← Algebra.smul_def, hy, one_smul]⟩
    rcases denom.exists_le_maximal fun h => (h ▸ hdenom) Submodule.mem_top with ⟨max, hmax, hle⟩
    rcases hlocal ⟨max, hmax⟩ with ⟨n, d, hd, rfl⟩
    apply hd (hle <| Submodule.mem_colon.mpr fun _ hy => _)
    intro _ hy
    

Proof state:
R : Type u
inst✝⁴ : CommRing R
inst✝³ : IsDomain R
K : Type v
inst✝² : Field K
inst✝¹ : Algebra R K
inst✝ : IsFractionRing R K
max : Ideal R
hmax : Ideal.IsMaximal max
n d : R
hd : d ∈ Ideal.primeCompl { asIdeal := max, IsMaximal := hmax }.asIdeal
hrange : (algebraMap R K) n * ((algebraMap R K) d)⁻¹ ∉ range ⇑(algebraMap R K)
hlocal :
  ∀ (i : MaximalSpectrum R),
    (algebraMap R K) n * ((algebraMap R K) d)⁻¹ ∈
      Localization.subalgebra.ofField K (Ideal.primeCompl i.asIdeal)
        (_ : Ideal.primeCompl i.asIdeal ≤ nonZeroDivisors R)
denom : Ideal R :=
  Submodule.colon (Submodule.span R {1}) (Submodule.span R {(algebraMap R K) n * ((algebraMap R K) d)⁻¹})
hdenom : 1 ∉ denom
hle : denom ≤ max
x✝ : K
hy : x✝ ∈ Submodule.span R {(algebraMap R K) n * ((algebraMap R K) d)⁻¹}
⊢ d • x✝ ∈ Submodule.span R {1}

Next tactic:
rcases Submodule.mem_span_singleton.mp hy with ⟨y, rfl⟩
/-- An integral domain is equal to the intersection of its localizations at all its maximal ideals
viewed as subalgebras of its field of fractions. -/
theorem iInf_localization_eq_bot : (⨅ v : MaximalSpectrum R,
    Localization.subalgebra.ofField K _ v.asIdeal.primeCompl_le_nonZeroDivisors) = ⊥ := by
  ext x
  rw [Algebra.mem_bot, Algebra.mem_iInf]
  constructor
  · contrapose
    intro hrange hlocal
    let denom : Ideal R := (Submodule.span R {1} : Submodule R K).colon (Submodule.span R {x})
    have hdenom : (1 : R) ∉ denom := by
      intro hdenom
      rcases Submodule.mem_span_singleton.mp
        (Submodule.mem_colon.mp hdenom x <| Submodule.mem_span_singleton_self x) with ⟨y, hy⟩
      exact hrange ⟨y, by rw [← mul_one <| algebraMap R K y, ← Algebra.smul_def, hy, one_smul]⟩
    rcases denom.exists_le_maximal fun h => (h ▸ hdenom) Submodule.mem_top with ⟨max, hmax, hle⟩
    rcases hlocal ⟨max, hmax⟩ with ⟨n, d, hd, rfl⟩
    apply hd (hle <| Submodule.mem_colon.mpr fun _ hy => _)
    intro _ hy
    rcases Submodule.mem_span_singleton.mp hy with ⟨y, rfl⟩
    

Proof state:
case intro
R : Type u
inst✝⁴ : CommRing R
inst✝³ : IsDomain R
K : Type v
inst✝² : Field K
inst✝¹ : Algebra R K
inst✝ : IsFractionRing R K
max : Ideal R
hmax : Ideal.IsMaximal max
n d : R
hd : d ∈ Ideal.primeCompl { asIdeal := max, IsMaximal := hmax }.asIdeal
hrange : (algebraMap R K) n * ((algebraMap R K) d)⁻¹ ∉ range ⇑(algebraMap R K)
hlocal :
  ∀ (i : MaximalSpectrum R),
    (algebraMap R K) n * ((algebraMap R K) d)⁻¹ ∈
      Localization.subalgebra.ofField K (Ideal.primeCompl i.asIdeal)
        (_ : Ideal.primeCompl i.asIdeal ≤ nonZeroDivisors R)
denom : Ideal R :=
  Submodule.colon (Submodule.span R {1}) (Submodule.span R {(algebraMap R K) n * ((algebraMap R K) d)⁻¹})
hdenom : 1 ∉ denom
hle : denom ≤ max
y : R
hy : y • ((algebraMap R K) n * ((algebraMap R K) d)⁻¹) ∈ Submodule.span R {(algebraMap R K) n * ((algebraMap R K) d)⁻¹}
⊢ d • y • ((algebraMap R K) n * ((algebraMap R K) d)⁻¹) ∈ Submodule.span R {1}

Next tactic:
exact Submodule.mem_span_singleton.mpr ⟨y * n, by
      rw [Algebra.smul_def, mul_one, map_mul, smul_comm, Algebra.smul_def, Algebra.smul_def,
        mul_comm <| algebraMap R K d,
        inv_mul_cancel_right₀ <|
          (map_ne_zero_iff _ <| NoZeroSMulDivisors.algebraMap_injective R K).mpr fun h =>
            (h ▸ hd) max.zero_mem]⟩