l3lab/ntp-mathlib huggingface dataset:
/-- The function between prime spectra of commutative rings induced by a ring homomorphism.
This function is continuous. -/
def comap (f : R →+* S) : C(PrimeSpectrum S, PrimeSpectrum R) where
  toFun y := ⟨Ideal.comap f y.asIdeal, inferInstance⟩
  continuous_toFun := by
    simp only [continuous_iff_isClosed, isClosed_iff_zeroLocus]
    rintro _ ⟨s, rfl⟩
    

Proof state:
case intro
R : Type u
S : Type v
inst✝² : CommRing R
inst✝¹ : CommRing S
S' : Type u_1
inst✝ : CommRing S'
f : R →+* S
s : Set R
⊢ ∃ s_1,
    (fun y => { asIdeal := Ideal.comap f y.asIdeal, IsPrime := (_ : Ideal.IsPrime (Ideal.comap f y.asIdeal)) }) ⁻¹'
        zeroLocus s =
      zeroLocus s_1

Next tactic:
exact ⟨_, preimage_comap_zeroLocus_aux f s⟩
@[simp]
theorem comap_id : comap (RingHom.id R) = ContinuousMap.id _ := by
  

Proof state:
R : Type u
S : Type v
inst✝² : CommRing R
inst✝¹ : CommRing S
S' : Type u_1
inst✝ : CommRing S'
f : R →+* S
⊢ comap (RingHom.id R) = ContinuousMap.id (PrimeSpectrum R)

Next tactic:
ext
@[simp]
theorem comap_id : comap (RingHom.id R) = ContinuousMap.id _ := by
  ext
  

Proof state:
case h.asIdeal.h
R : Type u
S : Type v
inst✝² : CommRing R
inst✝¹ : CommRing S
S' : Type u_1
inst✝ : CommRing S'
f : R →+* S
a✝ : PrimeSpectrum R
x✝ : R
⊢ x✝ ∈ ((comap (RingHom.id R)) a✝).asIdeal ↔ x✝ ∈ ((ContinuousMap.id (PrimeSpectrum R)) a✝).asIdeal

Next tactic:
rfl
theorem localization_comap_inducing [Algebra R S] (M : Submonoid R) [IsLocalization M S] :
    Inducing (comap (algebraMap R S)) := by
  

Proof state:
R : Type u
S : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing S
S' : Type u_1
inst✝² : CommRing S'
f : R →+* S
inst✝¹ : Algebra R S
M : Submonoid R
inst✝ : IsLocalization M S
⊢ Inducing ⇑(comap (algebraMap R S))

Next tactic:
constructor
theorem localization_comap_inducing [Algebra R S] (M : Submonoid R) [IsLocalization M S] :
    Inducing (comap (algebraMap R S)) := by
  constructor
  

Proof state:
case induced
R : Type u
S : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing S
S' : Type u_1
inst✝² : CommRing S'
f : R →+* S
inst✝¹ : Algebra R S
M : Submonoid R
inst✝ : IsLocalization M S
⊢ zariskiTopology = TopologicalSpace.induced (⇑(comap (algebraMap R S))) zariskiTopology

Next tactic:
rw [TopologicalSpace.ext_iff]
theorem localization_comap_inducing [Algebra R S] (M : Submonoid R) [IsLocalization M S] :
    Inducing (comap (algebraMap R S)) := by
  constructor
  rw [TopologicalSpace.ext_iff]
  

Proof state:
case induced
R : Type u
S : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing S
S' : Type u_1
inst✝² : CommRing S'
f : R →+* S
inst✝¹ : Algebra R S
M : Submonoid R
inst✝ : IsLocalization M S
⊢ ∀ (s : Set (PrimeSpectrum S)), IsOpen s ↔ IsOpen s

Next tactic:
intro U
theorem localization_comap_inducing [Algebra R S] (M : Submonoid R) [IsLocalization M S] :
    Inducing (comap (algebraMap R S)) := by
  constructor
  rw [TopologicalSpace.ext_iff]
  intro U
  

Proof state:
case induced
R : Type u
S : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing S
S' : Type u_1
inst✝² : CommRing S'
f : R →+* S
inst✝¹ : Algebra R S
M : Submonoid R
inst✝ : IsLocalization M S
U : Set (PrimeSpectrum S)
⊢ IsOpen U ↔ IsOpen U

Next tactic:
rw [← isClosed_compl_iff, ← @isClosed_compl_iff (α := PrimeSpectrum S) (s := U)]
theorem localization_comap_inducing [Algebra R S] (M : Submonoid R) [IsLocalization M S] :
    Inducing (comap (algebraMap R S)) := by
  constructor
  rw [TopologicalSpace.ext_iff]
  intro U
  rw [← isClosed_compl_iff, ← @isClosed_compl_iff (α := PrimeSpectrum S) (s := U)]
  

Proof state:
case induced
R : Type u
S : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing S
S' : Type u_1
inst✝² : CommRing S'
f : R →+* S
inst✝¹ : Algebra R S
M : Submonoid R
inst✝ : IsLocalization M S
U : Set (PrimeSpectrum S)
⊢ IsClosed Uᶜ ↔ IsClosed Uᶜ

Next tactic:
generalize Uᶜ = Z
theorem localization_comap_inducing [Algebra R S] (M : Submonoid R) [IsLocalization M S] :
    Inducing (comap (algebraMap R S)) := by
  constructor
  rw [TopologicalSpace.ext_iff]
  intro U
  rw [← isClosed_compl_iff, ← @isClosed_compl_iff (α := PrimeSpectrum S) (s := U)]
  generalize Uᶜ = Z
  

Proof state:
case induced
R : Type u
S : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing S
S' : Type u_1
inst✝² : CommRing S'
f : R →+* S
inst✝¹ : Algebra R S
M : Submonoid R
inst✝ : IsLocalization M S
U Z : Set (PrimeSpectrum S)
⊢ IsClosed Z ↔ IsClosed Z

Next tactic:
simp_rw [isClosed_induced_iff, isClosed_iff_zeroLocus]
theorem localization_comap_inducing [Algebra R S] (M : Submonoid R) [IsLocalization M S] :
    Inducing (comap (algebraMap R S)) := by
  constructor
  rw [TopologicalSpace.ext_iff]
  intro U
  rw [← isClosed_compl_iff, ← @isClosed_compl_iff (α := PrimeSpectrum S) (s := U)]
  generalize Uᶜ = Z
  simp_rw [isClosed_induced_iff, isClosed_iff_zeroLocus]
  

Proof state:
case induced
R : Type u
S : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing S
S' : Type u_1
inst✝² : CommRing S'
f : R →+* S
inst✝¹ : Algebra R S
M : Submonoid R
inst✝ : IsLocalization M S
U Z : Set (PrimeSpectrum S)
⊢ (∃ s, Z = zeroLocus s) ↔ ∃ t, (∃ s, t = zeroLocus s) ∧ ⇑(comap (algebraMap R S)) ⁻¹' t = Z

Next tactic:
constructor
theorem localization_comap_inducing [Algebra R S] (M : Submonoid R) [IsLocalization M S] :
    Inducing (comap (algebraMap R S)) := by
  constructor
  rw [TopologicalSpace.ext_iff]
  intro U
  rw [← isClosed_compl_iff, ← @isClosed_compl_iff (α := PrimeSpectrum S) (s := U)]
  generalize Uᶜ = Z
  simp_rw [isClosed_induced_iff, isClosed_iff_zeroLocus]
  constructor
  · 

Proof state:
case induced.mp
R : Type u
S : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing S
S' : Type u_1
inst✝² : CommRing S'
f : R →+* S
inst✝¹ : Algebra R S
M : Submonoid R
inst✝ : IsLocalization M S
U Z : Set (PrimeSpectrum S)
⊢ (∃ s, Z = zeroLocus s) → ∃ t, (∃ s, t = zeroLocus s) ∧ ⇑(comap (algebraMap R S)) ⁻¹' t = Z

Next tactic:
rintro ⟨s, rfl⟩
theorem localization_comap_inducing [Algebra R S] (M : Submonoid R) [IsLocalization M S] :
    Inducing (comap (algebraMap R S)) := by
  constructor
  rw [TopologicalSpace.ext_iff]
  intro U
  rw [← isClosed_compl_iff, ← @isClosed_compl_iff (α := PrimeSpectrum S) (s := U)]
  generalize Uᶜ = Z
  simp_rw [isClosed_induced_iff, isClosed_iff_zeroLocus]
  constructor
  · rintro ⟨s, rfl⟩
    

Proof state:
case induced.mp.intro
R : Type u
S : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing S
S' : Type u_1
inst✝² : CommRing S'
f : R →+* S
inst✝¹ : Algebra R S
M : Submonoid R
inst✝ : IsLocalization M S
U : Set (PrimeSpectrum S)
s : Set S
⊢ ∃ t, (∃ s, t = zeroLocus s) ∧ ⇑(comap (algebraMap R S)) ⁻¹' t = zeroLocus s

Next tactic:
refine ⟨_, ⟨algebraMap R S ⁻¹' Ideal.span s, rfl⟩, ?_⟩
theorem localization_comap_inducing [Algebra R S] (M : Submonoid R) [IsLocalization M S] :
    Inducing (comap (algebraMap R S)) := by
  constructor
  rw [TopologicalSpace.ext_iff]
  intro U
  rw [← isClosed_compl_iff, ← @isClosed_compl_iff (α := PrimeSpectrum S) (s := U)]
  generalize Uᶜ = Z
  simp_rw [isClosed_induced_iff, isClosed_iff_zeroLocus]
  constructor
  · rintro ⟨s, rfl⟩
    refine ⟨_, ⟨algebraMap R S ⁻¹' Ideal.span s, rfl⟩, ?_⟩
    

Proof state:
case induced.mp.intro
R : Type u
S : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing S
S' : Type u_1
inst✝² : CommRing S'
f : R →+* S
inst✝¹ : Algebra R S
M : Submonoid R
inst✝ : IsLocalization M S
U : Set (PrimeSpectrum S)
s : Set S
⊢ ⇑(comap (algebraMap R S)) ⁻¹' zeroLocus (⇑(algebraMap R S) ⁻¹' ↑(Ideal.span s)) = zeroLocus s

Next tactic:
rw [preimage_comap_zeroLocus, ← zeroLocus_span, ← zeroLocus_span s]
theorem localization_comap_inducing [Algebra R S] (M : Submonoid R) [IsLocalization M S] :
    Inducing (comap (algebraMap R S)) := by
  constructor
  rw [TopologicalSpace.ext_iff]
  intro U
  rw [← isClosed_compl_iff, ← @isClosed_compl_iff (α := PrimeSpectrum S) (s := U)]
  generalize Uᶜ = Z
  simp_rw [isClosed_induced_iff, isClosed_iff_zeroLocus]
  constructor
  · rintro ⟨s, rfl⟩
    refine ⟨_, ⟨algebraMap R S ⁻¹' Ideal.span s, rfl⟩, ?_⟩
    rw [preimage_comap_zeroLocus, ← zeroLocus_span, ← zeroLocus_span s]
    

Proof state:
case induced.mp.intro
R : Type u
S : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing S
S' : Type u_1
inst✝² : CommRing S'
f : R →+* S
inst✝¹ : Algebra R S
M : Submonoid R
inst✝ : IsLocalization M S
U : Set (PrimeSpectrum S)
s : Set S
⊢ zeroLocus ↑(Ideal.span (⇑(algebraMap R S) '' (⇑(algebraMap R S) ⁻¹' ↑(Ideal.span s)))) = zeroLocus ↑(Ideal.span s)

Next tactic:
congr 2
theorem localization_comap_inducing [Algebra R S] (M : Submonoid R) [IsLocalization M S] :
    Inducing (comap (algebraMap R S)) := by
  constructor
  rw [TopologicalSpace.ext_iff]
  intro U
  rw [← isClosed_compl_iff, ← @isClosed_compl_iff (α := PrimeSpectrum S) (s := U)]
  generalize Uᶜ = Z
  simp_rw [isClosed_induced_iff, isClosed_iff_zeroLocus]
  constructor
  · rintro ⟨s, rfl⟩
    refine ⟨_, ⟨algebraMap R S ⁻¹' Ideal.span s, rfl⟩, ?_⟩
    rw [preimage_comap_zeroLocus, ← zeroLocus_span, ← zeroLocus_span s]
    congr 2
    

Proof state:
case induced.mp.intro
R : Type u
S : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing S
S' : Type u_1
inst✝² : CommRing S'
f : R →+* S
inst✝¹ : Algebra R S
M : Submonoid R
inst✝ : IsLocalization M S
U : Set (PrimeSpectrum S)
s : Set S
⊢ zeroLocus ↑(Ideal.span (⇑(algebraMap R S) '' (⇑(algebraMap R S) ⁻¹' ↑(Ideal.span s)))) = zeroLocus ↑(Ideal.span s)

Next tactic:
exact congr_arg (zeroLocus ·) <| Submodule.carrier_inj.mpr
      (IsLocalization.map_comap M S (Ideal.span s))
theorem localization_comap_inducing [Algebra R S] (M : Submonoid R) [IsLocalization M S] :
    Inducing (comap (algebraMap R S)) := by
  constructor
  rw [TopologicalSpace.ext_iff]
  intro U
  rw [← isClosed_compl_iff, ← @isClosed_compl_iff (α := PrimeSpectrum S) (s := U)]
  generalize Uᶜ = Z
  simp_rw [isClosed_induced_iff, isClosed_iff_zeroLocus]
  constructor
  · rintro ⟨s, rfl⟩
    refine ⟨_, ⟨algebraMap R S ⁻¹' Ideal.span s, rfl⟩, ?_⟩
    rw [preimage_comap_zeroLocus, ← zeroLocus_span, ← zeroLocus_span s]
    congr 2
    exact congr_arg (zeroLocus ·) <| Submodule.carrier_inj.mpr
      (IsLocalization.map_comap M S (Ideal.span s))
  · 

Proof state:
case induced.mpr
R : Type u
S : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing S
S' : Type u_1
inst✝² : CommRing S'
f : R →+* S
inst✝¹ : Algebra R S
M : Submonoid R
inst✝ : IsLocalization M S
U Z : Set (PrimeSpectrum S)
⊢ (∃ t, (∃ s, t = zeroLocus s) ∧ ⇑(comap (algebraMap R S)) ⁻¹' t = Z) → ∃ s, Z = zeroLocus s

Next tactic:
rintro ⟨_, ⟨t, rfl⟩, rfl⟩
theorem localization_comap_inducing [Algebra R S] (M : Submonoid R) [IsLocalization M S] :
    Inducing (comap (algebraMap R S)) := by
  constructor
  rw [TopologicalSpace.ext_iff]
  intro U
  rw [← isClosed_compl_iff, ← @isClosed_compl_iff (α := PrimeSpectrum S) (s := U)]
  generalize Uᶜ = Z
  simp_rw [isClosed_induced_iff, isClosed_iff_zeroLocus]
  constructor
  · rintro ⟨s, rfl⟩
    refine ⟨_, ⟨algebraMap R S ⁻¹' Ideal.span s, rfl⟩, ?_⟩
    rw [preimage_comap_zeroLocus, ← zeroLocus_span, ← zeroLocus_span s]
    congr 2
    exact congr_arg (zeroLocus ·) <| Submodule.carrier_inj.mpr
      (IsLocalization.map_comap M S (Ideal.span s))
  · rintro ⟨_, ⟨t, rfl⟩, rfl⟩
    

Proof state:
case induced.mpr.intro.intro.intro
R : Type u
S : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing S
S' : Type u_1
inst✝² : CommRing S'
f : R →+* S
inst✝¹ : Algebra R S
M : Submonoid R
inst✝ : IsLocalization M S
U : Set (PrimeSpectrum S)
t : Set R
⊢ ∃ s, ⇑(comap (algebraMap R S)) ⁻¹' zeroLocus t = zeroLocus s

Next tactic:
rw [preimage_comap_zeroLocus]
theorem localization_comap_inducing [Algebra R S] (M : Submonoid R) [IsLocalization M S] :
    Inducing (comap (algebraMap R S)) := by
  constructor
  rw [TopologicalSpace.ext_iff]
  intro U
  rw [← isClosed_compl_iff, ← @isClosed_compl_iff (α := PrimeSpectrum S) (s := U)]
  generalize Uᶜ = Z
  simp_rw [isClosed_induced_iff, isClosed_iff_zeroLocus]
  constructor
  · rintro ⟨s, rfl⟩
    refine ⟨_, ⟨algebraMap R S ⁻¹' Ideal.span s, rfl⟩, ?_⟩
    rw [preimage_comap_zeroLocus, ← zeroLocus_span, ← zeroLocus_span s]
    congr 2
    exact congr_arg (zeroLocus ·) <| Submodule.carrier_inj.mpr
      (IsLocalization.map_comap M S (Ideal.span s))
  · rintro ⟨_, ⟨t, rfl⟩, rfl⟩
    rw [preimage_comap_zeroLocus]
    

Proof state:
case induced.mpr.intro.intro.intro
R : Type u
S : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing S
S' : Type u_1
inst✝² : CommRing S'
f : R →+* S
inst✝¹ : Algebra R S
M : Submonoid R
inst✝ : IsLocalization M S
U : Set (PrimeSpectrum S)
t : Set R
⊢ ∃ s, zeroLocus (⇑(algebraMap R S) '' t) = zeroLocus s

Next tactic:
exact ⟨_, rfl⟩
theorem localization_comap_injective [Algebra R S] (M : Submonoid R) [IsLocalization M S] :
    Function.Injective (comap (algebraMap R S)) := by
  

Proof state:
R : Type u
S : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing S
S' : Type u_1
inst✝² : CommRing S'
f : R →+* S
inst✝¹ : Algebra R S
M : Submonoid R
inst✝ : IsLocalization M S
⊢ Function.Injective ⇑(comap (algebraMap R S))

Next tactic:
intro p q h
theorem localization_comap_injective [Algebra R S] (M : Submonoid R) [IsLocalization M S] :
    Function.Injective (comap (algebraMap R S)) := by
  intro p q h
  

Proof state:
R : Type u
S : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing S
S' : Type u_1
inst✝² : CommRing S'
f : R →+* S
inst✝¹ : Algebra R S
M : Submonoid R
inst✝ : IsLocalization M S
p q : PrimeSpectrum S
h : (comap (algebraMap R S)) p = (comap (algebraMap R S)) q
⊢ p = q

Next tactic:
replace h := congr_arg (fun x : PrimeSpectrum R => Ideal.map (algebraMap R S) x.asIdeal) h
theorem localization_comap_injective [Algebra R S] (M : Submonoid R) [IsLocalization M S] :
    Function.Injective (comap (algebraMap R S)) := by
  intro p q h
  replace h := congr_arg (fun x : PrimeSpectrum R => Ideal.map (algebraMap R S) x.asIdeal) h
  

Proof state:
R : Type u
S : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing S
S' : Type u_1
inst✝² : CommRing S'
f : R →+* S
inst✝¹ : Algebra R S
M : Submonoid R
inst✝ : IsLocalization M S
p q : PrimeSpectrum S
h :
  (fun x => Ideal.map (algebraMap R S) x.asIdeal) ((comap (algebraMap R S)) p) =
    (fun x => Ideal.map (algebraMap R S) x.asIdeal) ((comap (algebraMap R S)) q)
⊢ p = q

Next tactic:
dsimp only [comap, ContinuousMap.coe_mk] at h
theorem localization_comap_injective [Algebra R S] (M : Submonoid R) [IsLocalization M S] :
    Function.Injective (comap (algebraMap R S)) := by
  intro p q h
  replace h := congr_arg (fun x : PrimeSpectrum R => Ideal.map (algebraMap R S) x.asIdeal) h
  dsimp only [comap, ContinuousMap.coe_mk] at h
  

Proof state:
R : Type u
S : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing S
S' : Type u_1
inst✝² : CommRing S'
f : R →+* S
inst✝¹ : Algebra R S
M : Submonoid R
inst✝ : IsLocalization M S
p q : PrimeSpectrum S
h :
  Ideal.map (algebraMap R S) (Ideal.comap (algebraMap R S) p.asIdeal) =
    Ideal.map (algebraMap R S) (Ideal.comap (algebraMap R S) q.asIdeal)
⊢ p = q

Next tactic:
rw [IsLocalization.map_comap M S, IsLocalization.map_comap M S] at h
theorem localization_comap_injective [Algebra R S] (M : Submonoid R) [IsLocalization M S] :
    Function.Injective (comap (algebraMap R S)) := by
  intro p q h
  replace h := congr_arg (fun x : PrimeSpectrum R => Ideal.map (algebraMap R S) x.asIdeal) h
  dsimp only [comap, ContinuousMap.coe_mk] at h
  rw [IsLocalization.map_comap M S, IsLocalization.map_comap M S] at h
  

Proof state:
R : Type u
S : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing S
S' : Type u_1
inst✝² : CommRing S'
f : R →+* S
inst✝¹ : Algebra R S
M : Submonoid R
inst✝ : IsLocalization M S
p q : PrimeSpectrum S
h : p.asIdeal = q.asIdeal
⊢ p = q

Next tactic:
ext1
theorem localization_comap_injective [Algebra R S] (M : Submonoid R) [IsLocalization M S] :
    Function.Injective (comap (algebraMap R S)) := by
  intro p q h
  replace h := congr_arg (fun x : PrimeSpectrum R => Ideal.map (algebraMap R S) x.asIdeal) h
  dsimp only [comap, ContinuousMap.coe_mk] at h
  rw [IsLocalization.map_comap M S, IsLocalization.map_comap M S] at h
  ext1
  

Proof state:
case asIdeal
R : Type u
S : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing S
S' : Type u_1
inst✝² : CommRing S'
f : R →+* S
inst✝¹ : Algebra R S
M : Submonoid R
inst✝ : IsLocalization M S
p q : PrimeSpectrum S
h : p.asIdeal = q.asIdeal
⊢ p.asIdeal = q.asIdeal

Next tactic:
exact h
theorem localization_comap_range [Algebra R S] (M : Submonoid R) [IsLocalization M S] :
    Set.range (comap (algebraMap R S)) = { p | Disjoint (M : Set R) p.asIdeal } := by
  

Proof state:
R : Type u
S : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing S
S' : Type u_1
inst✝² : CommRing S'
f : R →+* S
inst✝¹ : Algebra R S
M : Submonoid R
inst✝ : IsLocalization M S
⊢ Set.range ⇑(comap (algebraMap R S)) = {p | Disjoint ↑M ↑p.asIdeal}

Next tactic:
ext x
theorem localization_comap_range [Algebra R S] (M : Submonoid R) [IsLocalization M S] :
    Set.range (comap (algebraMap R S)) = { p | Disjoint (M : Set R) p.asIdeal } := by
  ext x
  

Proof state:
case h
R : Type u
S : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing S
S' : Type u_1
inst✝² : CommRing S'
f : R →+* S
inst✝¹ : Algebra R S
M : Submonoid R
inst✝ : IsLocalization M S
x : PrimeSpectrum R
⊢ x ∈ Set.range ⇑(comap (algebraMap R S)) ↔ x ∈ {p | Disjoint ↑M ↑p.asIdeal}

Next tactic:
constructor
theorem localization_comap_range [Algebra R S] (M : Submonoid R) [IsLocalization M S] :
    Set.range (comap (algebraMap R S)) = { p | Disjoint (M : Set R) p.asIdeal } := by
  ext x
  constructor
  · 

Proof state:
case h.mp
R : Type u
S : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing S
S' : Type u_1
inst✝² : CommRing S'
f : R →+* S
inst✝¹ : Algebra R S
M : Submonoid R
inst✝ : IsLocalization M S
x : PrimeSpectrum R
⊢ x ∈ Set.range ⇑(comap (algebraMap R S)) → x ∈ {p | Disjoint ↑M ↑p.asIdeal}

Next tactic:
simp_rw [disjoint_iff_inf_le]
theorem localization_comap_range [Algebra R S] (M : Submonoid R) [IsLocalization M S] :
    Set.range (comap (algebraMap R S)) = { p | Disjoint (M : Set R) p.asIdeal } := by
  ext x
  constructor
  · simp_rw [disjoint_iff_inf_le]
    

Proof state:
case h.mp
R : Type u
S : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing S
S' : Type u_1
inst✝² : CommRing S'
f : R →+* S
inst✝¹ : Algebra R S
M : Submonoid R
inst✝ : IsLocalization M S
x : PrimeSpectrum R
⊢ x ∈ Set.range ⇑(comap (algebraMap R S)) → x ∈ {p | ↑M ⊓ ↑p.asIdeal ≤ ⊥}

Next tactic:
rintro ⟨p, rfl⟩ x ⟨hx₁, hx₂⟩
theorem localization_comap_range [Algebra R S] (M : Submonoid R) [IsLocalization M S] :
    Set.range (comap (algebraMap R S)) = { p | Disjoint (M : Set R) p.asIdeal } := by
  ext x
  constructor
  · simp_rw [disjoint_iff_inf_le]
    rintro ⟨p, rfl⟩ x ⟨hx₁, hx₂⟩
    

Proof state:
case h.mp.intro.intro
R : Type u
S : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing S
S' : Type u_1
inst✝² : CommRing S'
f : R →+* S
inst✝¹ : Algebra R S
M : Submonoid R
inst✝ : IsLocalization M S
p : PrimeSpectrum S
x : R
hx₁ : x ∈ ↑M
hx₂ : x ∈ ↑((comap (algebraMap R S)) p).asIdeal
⊢ x ∈ ⊥

Next tactic:
exact (p.2.1 : ¬_) (p.asIdeal.eq_top_of_isUnit_mem hx₂ (IsLocalization.map_units S ⟨x, hx₁⟩))
theorem localization_comap_range [Algebra R S] (M : Submonoid R) [IsLocalization M S] :
    Set.range (comap (algebraMap R S)) = { p | Disjoint (M : Set R) p.asIdeal } := by
  ext x
  constructor
  · simp_rw [disjoint_iff_inf_le]
    rintro ⟨p, rfl⟩ x ⟨hx₁, hx₂⟩
    exact (p.2.1 : ¬_) (p.asIdeal.eq_top_of_isUnit_mem hx₂ (IsLocalization.map_units S ⟨x, hx₁⟩))
  · 

Proof state:
case h.mpr
R : Type u
S : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing S
S' : Type u_1
inst✝² : CommRing S'
f : R →+* S
inst✝¹ : Algebra R S
M : Submonoid R
inst✝ : IsLocalization M S
x : PrimeSpectrum R
⊢ x ∈ {p | Disjoint ↑M ↑p.asIdeal} → x ∈ Set.range ⇑(comap (algebraMap R S))

Next tactic:
intro h
theorem localization_comap_range [Algebra R S] (M : Submonoid R) [IsLocalization M S] :
    Set.range (comap (algebraMap R S)) = { p | Disjoint (M : Set R) p.asIdeal } := by
  ext x
  constructor
  · simp_rw [disjoint_iff_inf_le]
    rintro ⟨p, rfl⟩ x ⟨hx₁, hx₂⟩
    exact (p.2.1 : ¬_) (p.asIdeal.eq_top_of_isUnit_mem hx₂ (IsLocalization.map_units S ⟨x, hx₁⟩))
  · intro h
    

Proof state:
case h.mpr
R : Type u
S : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing S
S' : Type u_1
inst✝² : CommRing S'
f : R →+* S
inst✝¹ : Algebra R S
M : Submonoid R
inst✝ : IsLocalization M S
x : PrimeSpectrum R
h : x ∈ {p | Disjoint ↑M ↑p.asIdeal}
⊢ x ∈ Set.range ⇑(comap (algebraMap R S))

Next tactic:
use ⟨x.asIdeal.map (algebraMap R S), IsLocalization.isPrime_of_isPrime_disjoint M S _ x.2 h⟩
theorem localization_comap_range [Algebra R S] (M : Submonoid R) [IsLocalization M S] :
    Set.range (comap (algebraMap R S)) = { p | Disjoint (M : Set R) p.asIdeal } := by
  ext x
  constructor
  · simp_rw [disjoint_iff_inf_le]
    rintro ⟨p, rfl⟩ x ⟨hx₁, hx₂⟩
    exact (p.2.1 : ¬_) (p.asIdeal.eq_top_of_isUnit_mem hx₂ (IsLocalization.map_units S ⟨x, hx₁⟩))
  · intro h
    use ⟨x.asIdeal.map (algebraMap R S), IsLocalization.isPrime_of_isPrime_disjoint M S _ x.2 h⟩
    

Proof state:
case h
R : Type u
S : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing S
S' : Type u_1
inst✝² : CommRing S'
f : R →+* S
inst✝¹ : Algebra R S
M : Submonoid R
inst✝ : IsLocalization M S
x : PrimeSpectrum R
h : x ∈ {p | Disjoint ↑M ↑p.asIdeal}
⊢ (comap (algebraMap R S))
      { asIdeal := Ideal.map (algebraMap R S) x.asIdeal,
        IsPrime := (_ : Ideal.IsPrime (Ideal.map (algebraMap R S) x.asIdeal)) } =
    x

Next tactic:
ext1
theorem localization_comap_range [Algebra R S] (M : Submonoid R) [IsLocalization M S] :
    Set.range (comap (algebraMap R S)) = { p | Disjoint (M : Set R) p.asIdeal } := by
  ext x
  constructor
  · simp_rw [disjoint_iff_inf_le]
    rintro ⟨p, rfl⟩ x ⟨hx₁, hx₂⟩
    exact (p.2.1 : ¬_) (p.asIdeal.eq_top_of_isUnit_mem hx₂ (IsLocalization.map_units S ⟨x, hx₁⟩))
  · intro h
    use ⟨x.asIdeal.map (algebraMap R S), IsLocalization.isPrime_of_isPrime_disjoint M S _ x.2 h⟩
    ext1
    

Proof state:
case h.asIdeal
R : Type u
S : Type v
inst✝⁴ : CommRing R
inst✝³ : CommRing S
S' : Type u_1
inst✝² : CommRing S'
f : R →+* S
inst✝¹ : Algebra R S
M : Submonoid R
inst✝ : IsLocalization M S
x : PrimeSpectrum R
h : x ∈ {p | Disjoint ↑M ↑p.asIdeal}
⊢ ((comap (algebraMap R S))
        { asIdeal := Ideal.map (algebraMap R S) x.asIdeal,
          IsPrime := (_ : Ideal.IsPrime (Ideal.map (algebraMap R S) x.asIdeal)) }).asIdeal =
    x.asIdeal

Next tactic:
exact IsLocalization.comap_map_of_isPrime_disjoint M S _ x.2 h
theorem comap_inducing_of_surjective (hf : Surjective f) : Inducing (comap f) where
  induced := by
    

Proof state:
R : Type u
S : Type v
inst✝² : CommRing R
inst✝¹ : CommRing S
S' : Type u_1
inst✝ : CommRing S'
f : R →+* S
hf : Surjective ⇑f
⊢ zariskiTopology = TopologicalSpace.induced (⇑(comap f)) zariskiTopology

Next tactic:
simp_rw [TopologicalSpace.ext_iff, ← isClosed_compl_iff,
      ← @isClosed_compl_iff (PrimeSpectrum S)
        ((TopologicalSpace.induced (comap f) zariskiTopology)), isClosed_induced_iff,
      isClosed_iff_zeroLocus]
theorem comap_inducing_of_surjective (hf : Surjective f) : Inducing (comap f) where
  induced := by
    simp_rw [TopologicalSpace.ext_iff, ← isClosed_compl_iff,
      ← @isClosed_compl_iff (PrimeSpectrum S)
        ((TopologicalSpace.induced (comap f) zariskiTopology)), isClosed_induced_iff,
      isClosed_iff_zeroLocus]
    

Proof state:
R : Type u
S : Type v
inst✝² : CommRing R
inst✝¹ : CommRing S
S' : Type u_1
inst✝ : CommRing S'
f : R →+* S
hf : Surjective ⇑f
⊢ ∀ (s : Set (PrimeSpectrum S)), (∃ s_1, sᶜ = zeroLocus s_1) ↔ ∃ t, (∃ s, t = zeroLocus s) ∧ ⇑(comap f) ⁻¹' t = sᶜ

Next tactic:
refine' fun s =>
      ⟨fun ⟨F, hF⟩ =>
        ⟨zeroLocus (f ⁻¹' F), ⟨f ⁻¹' F, rfl⟩, by
          rw [preimage_comap_zeroLocus, Function.Surjective.image_preimage hf, hF]⟩,
        _⟩