l3lab/ntp-mathlib huggingface dataset:
theorem to_map_eq_zero_iff {x : R} (hM : M ≤ nonZeroDivisors R) : algebraMap R S x = 0 ↔ x = 0 := by
  rw [← (algebraMap R S).map_zero]
  

Proof state:
R : Type u_1
inst✝⁴ : CommRing R
M : Submonoid R
S : Type u_2
inst✝³ : CommRing S
inst✝² : Algebra R S
P : Type u_3
inst✝¹ : CommRing P
K : Type u_4
inst✝ : IsLocalization M S
x : R
hM : M ≤ nonZeroDivisors R
⊢ (algebraMap R S) x = (algebraMap R S) 0 ↔ x = 0

Next tactic:
constructor
theorem to_map_eq_zero_iff {x : R} (hM : M ≤ nonZeroDivisors R) : algebraMap R S x = 0 ↔ x = 0 := by
  rw [← (algebraMap R S).map_zero]
  constructor <;> 

Proof state:
case mp
R : Type u_1
inst✝⁴ : CommRing R
M : Submonoid R
S : Type u_2
inst✝³ : CommRing S
inst✝² : Algebra R S
P : Type u_3
inst✝¹ : CommRing P
K : Type u_4
inst✝ : IsLocalization M S
x : R
hM : M ≤ nonZeroDivisors R
⊢ (algebraMap R S) x = (algebraMap R S) 0 → x = 0

Next tactic:
intro h
theorem to_map_eq_zero_iff {x : R} (hM : M ≤ nonZeroDivisors R) : algebraMap R S x = 0 ↔ x = 0 := by
  rw [← (algebraMap R S).map_zero]
  constructor <;> 

Proof state:
case mpr
R : Type u_1
inst✝⁴ : CommRing R
M : Submonoid R
S : Type u_2
inst✝³ : CommRing S
inst✝² : Algebra R S
P : Type u_3
inst✝¹ : CommRing P
K : Type u_4
inst✝ : IsLocalization M S
x : R
hM : M ≤ nonZeroDivisors R
⊢ x = 0 → (algebraMap R S) x = (algebraMap R S) 0

Next tactic:
intro h
theorem to_map_eq_zero_iff {x : R} (hM : M ≤ nonZeroDivisors R) : algebraMap R S x = 0 ↔ x = 0 := by
  rw [← (algebraMap R S).map_zero]
  constructor <;> intro h
  · 

Proof state:
case mp
R : Type u_1
inst✝⁴ : CommRing R
M : Submonoid R
S : Type u_2
inst✝³ : CommRing S
inst✝² : Algebra R S
P : Type u_3
inst✝¹ : CommRing P
K : Type u_4
inst✝ : IsLocalization M S
x : R
hM : M ≤ nonZeroDivisors R
h : (algebraMap R S) x = (algebraMap R S) 0
⊢ x = 0

Next tactic:
cases' (eq_iff_exists M S).mp h with c hc
theorem to_map_eq_zero_iff {x : R} (hM : M ≤ nonZeroDivisors R) : algebraMap R S x = 0 ↔ x = 0 := by
  rw [← (algebraMap R S).map_zero]
  constructor <;> intro h
  · cases' (eq_iff_exists M S).mp h with c hc
    

Proof state:
case mp.intro
R : Type u_1
inst✝⁴ : CommRing R
M : Submonoid R
S : Type u_2
inst✝³ : CommRing S
inst✝² : Algebra R S
P : Type u_3
inst✝¹ : CommRing P
K : Type u_4
inst✝ : IsLocalization M S
x : R
hM : M ≤ nonZeroDivisors R
h : (algebraMap R S) x = (algebraMap R S) 0
c : ↥M
hc : ↑c * x = ↑c * 0
⊢ x = 0

Next tactic:
rw [mul_zero, mul_comm] at hc
theorem to_map_eq_zero_iff {x : R} (hM : M ≤ nonZeroDivisors R) : algebraMap R S x = 0 ↔ x = 0 := by
  rw [← (algebraMap R S).map_zero]
  constructor <;> intro h
  · cases' (eq_iff_exists M S).mp h with c hc
    rw [mul_zero, mul_comm] at hc
    

Proof state:
case mp.intro
R : Type u_1
inst✝⁴ : CommRing R
M : Submonoid R
S : Type u_2
inst✝³ : CommRing S
inst✝² : Algebra R S
P : Type u_3
inst✝¹ : CommRing P
K : Type u_4
inst✝ : IsLocalization M S
x : R
hM : M ≤ nonZeroDivisors R
h : (algebraMap R S) x = (algebraMap R S) 0
c : ↥M
hc : x * ↑c = 0
⊢ x = 0

Next tactic:
exact hM c.2 x hc
theorem to_map_eq_zero_iff {x : R} (hM : M ≤ nonZeroDivisors R) : algebraMap R S x = 0 ↔ x = 0 := by
  rw [← (algebraMap R S).map_zero]
  constructor <;> intro h
  · cases' (eq_iff_exists M S).mp h with c hc
    rw [mul_zero, mul_comm] at hc
    exact hM c.2 x hc
  · 

Proof state:
case mpr
R : Type u_1
inst✝⁴ : CommRing R
M : Submonoid R
S : Type u_2
inst✝³ : CommRing S
inst✝² : Algebra R S
P : Type u_3
inst✝¹ : CommRing P
K : Type u_4
inst✝ : IsLocalization M S
x : R
hM : M ≤ nonZeroDivisors R
h : x = 0
⊢ (algebraMap R S) x = (algebraMap R S) 0

Next tactic:
rw [h]
protected theorem injective (hM : M ≤ nonZeroDivisors R) : Injective (algebraMap R S) := by
  

Proof state:
R : Type u_1
inst✝⁴ : CommRing R
M : Submonoid R
S : Type u_2
inst✝³ : CommRing S
inst✝² : Algebra R S
P : Type u_3
inst✝¹ : CommRing P
K : Type u_4
inst✝ : IsLocalization M S
hM : M ≤ nonZeroDivisors R
⊢ Injective ⇑(algebraMap R S)

Next tactic:
rw [injective_iff_map_eq_zero (algebraMap R S)]
protected theorem injective (hM : M ≤ nonZeroDivisors R) : Injective (algebraMap R S) := by
  rw [injective_iff_map_eq_zero (algebraMap R S)]
  

Proof state:
R : Type u_1
inst✝⁴ : CommRing R
M : Submonoid R
S : Type u_2
inst✝³ : CommRing S
inst✝² : Algebra R S
P : Type u_3
inst✝¹ : CommRing P
K : Type u_4
inst✝ : IsLocalization M S
hM : M ≤ nonZeroDivisors R
⊢ ∀ (a : R), (algebraMap R S) a = 0 → a = 0

Next tactic:
intro a ha
protected theorem injective (hM : M ≤ nonZeroDivisors R) : Injective (algebraMap R S) := by
  rw [injective_iff_map_eq_zero (algebraMap R S)]
  intro a ha
  

Proof state:
R : Type u_1
inst✝⁴ : CommRing R
M : Submonoid R
S : Type u_2
inst✝³ : CommRing S
inst✝² : Algebra R S
P : Type u_3
inst✝¹ : CommRing P
K : Type u_4
inst✝ : IsLocalization M S
hM : M ≤ nonZeroDivisors R
a : R
ha : (algebraMap R S) a = 0
⊢ a = 0

Next tactic:
rwa [to_map_eq_zero_iff S hM] at ha
theorem sec_fst_ne_zero [Nontrivial R] [NoZeroDivisors S] (hM : M ≤ nonZeroDivisors R) {x : S}
    (hx : x ≠ 0) : (sec M x).fst ≠ 0 := by
  

Proof state:
R : Type u_1
inst✝⁶ : CommRing R
M : Submonoid R
S : Type u_2
inst✝⁵ : CommRing S
inst✝⁴ : Algebra R S
P : Type u_3
inst✝³ : CommRing P
K : Type u_4
inst✝² : IsLocalization M S
inst✝¹ : Nontrivial R
inst✝ : NoZeroDivisors S
hM : M ≤ nonZeroDivisors R
x : S
hx : x ≠ 0
⊢ (sec M x).1 ≠ 0

Next tactic:
have hsec := sec_spec M x
theorem sec_fst_ne_zero [Nontrivial R] [NoZeroDivisors S] (hM : M ≤ nonZeroDivisors R) {x : S}
    (hx : x ≠ 0) : (sec M x).fst ≠ 0 := by
  have hsec := sec_spec M x
  

Proof state:
R : Type u_1
inst✝⁶ : CommRing R
M : Submonoid R
S : Type u_2
inst✝⁵ : CommRing S
inst✝⁴ : Algebra R S
P : Type u_3
inst✝³ : CommRing P
K : Type u_4
inst✝² : IsLocalization M S
inst✝¹ : Nontrivial R
inst✝ : NoZeroDivisors S
hM : M ≤ nonZeroDivisors R
x : S
hx : x ≠ 0
hsec : x * (algebraMap R S) ↑(sec M x).2 = (algebraMap R S) (sec M x).1
⊢ (sec M x).1 ≠ 0

Next tactic:
intro hfst
theorem sec_fst_ne_zero [Nontrivial R] [NoZeroDivisors S] (hM : M ≤ nonZeroDivisors R) {x : S}
    (hx : x ≠ 0) : (sec M x).fst ≠ 0 := by
  have hsec := sec_spec M x
  intro hfst
  

Proof state:
R : Type u_1
inst✝⁶ : CommRing R
M : Submonoid R
S : Type u_2
inst✝⁵ : CommRing S
inst✝⁴ : Algebra R S
P : Type u_3
inst✝³ : CommRing P
K : Type u_4
inst✝² : IsLocalization M S
inst✝¹ : Nontrivial R
inst✝ : NoZeroDivisors S
hM : M ≤ nonZeroDivisors R
x : S
hx : x ≠ 0
hsec : x * (algebraMap R S) ↑(sec M x).2 = (algebraMap R S) (sec M x).1
hfst : (sec M x).1 = 0
⊢ False

Next tactic:
rw [hfst, map_zero, mul_eq_zero, _root_.map_eq_zero_iff] at hsec
theorem sec_fst_ne_zero [Nontrivial R] [NoZeroDivisors S] (hM : M ≤ nonZeroDivisors R) {x : S}
    (hx : x ≠ 0) : (sec M x).fst ≠ 0 := by
  have hsec := sec_spec M x
  intro hfst
  rw [hfst, map_zero, mul_eq_zero, _root_.map_eq_zero_iff] at hsec
  · 

Proof state:
R : Type u_1
inst✝⁶ : CommRing R
M : Submonoid R
S : Type u_2
inst✝⁵ : CommRing S
inst✝⁴ : Algebra R S
P : Type u_3
inst✝³ : CommRing P
K : Type u_4
inst✝² : IsLocalization M S
inst✝¹ : Nontrivial R
inst✝ : NoZeroDivisors S
hM : M ≤ nonZeroDivisors R
x : S
hx : x ≠ 0
hsec : x = 0 ∨ ↑(sec M x).2 = 0
hfst : (sec M x).1 = 0
⊢ False

Next tactic:
exact Or.elim hsec hx (sec_snd_ne_zero hM x)
theorem sec_fst_ne_zero [Nontrivial R] [NoZeroDivisors S] (hM : M ≤ nonZeroDivisors R) {x : S}
    (hx : x ≠ 0) : (sec M x).fst ≠ 0 := by
  have hsec := sec_spec M x
  intro hfst
  rw [hfst, map_zero, mul_eq_zero, _root_.map_eq_zero_iff] at hsec
  · exact Or.elim hsec hx (sec_snd_ne_zero hM x)
  · 

Proof state:
case hf
R : Type u_1
inst✝⁶ : CommRing R
M : Submonoid R
S : Type u_2
inst✝⁵ : CommRing S
inst✝⁴ : Algebra R S
P : Type u_3
inst✝³ : CommRing P
K : Type u_4
inst✝² : IsLocalization M S
inst✝¹ : Nontrivial R
inst✝ : NoZeroDivisors S
hM : M ≤ nonZeroDivisors R
x : S
hx : x ≠ 0
hsec : x = 0 ∨ (algebraMap R S) ↑(sec M x).2 = 0
hfst : (sec M x).1 = 0
⊢ Injective ⇑(algebraMap R S)

Next tactic:
exact IsLocalization.injective S hM
/-- Injectivity of a map descends to the map induced on localizations. -/
theorem map_injective_of_injective (hg : Function.Injective g)
    [i : IsLocalization (M.map g : Submonoid P) Q] :
    Function.Injective (map Q g (Submonoid.le_comap_map M) : S → Q) := by
  

Proof state:
R : Type u_1
inst✝⁶ : CommRing R
M : Submonoid R
S : Type u_2
inst✝⁵ : CommRing S
inst✝⁴ : Algebra R S
P : Type u_3
inst✝³ : CommRing P
K : Type u_4
inst✝² : IsLocalization M S
Q : Type u_5
inst✝¹ : CommRing Q
g : R →+* P
inst✝ : Algebra P Q
hg : Injective ⇑g
i : IsLocalization (Submonoid.map g M) Q
⊢ Injective ⇑(map Q g (_ : M ≤ Submonoid.comap g (Submonoid.map g M)))

Next tactic:
rw [injective_iff_map_eq_zero]
/-- Injectivity of a map descends to the map induced on localizations. -/
theorem map_injective_of_injective (hg : Function.Injective g)
    [i : IsLocalization (M.map g : Submonoid P) Q] :
    Function.Injective (map Q g (Submonoid.le_comap_map M) : S → Q) := by
  rw [injective_iff_map_eq_zero]
  

Proof state:
R : Type u_1
inst✝⁶ : CommRing R
M : Submonoid R
S : Type u_2
inst✝⁵ : CommRing S
inst✝⁴ : Algebra R S
P : Type u_3
inst✝³ : CommRing P
K : Type u_4
inst✝² : IsLocalization M S
Q : Type u_5
inst✝¹ : CommRing Q
g : R →+* P
inst✝ : Algebra P Q
hg : Injective ⇑g
i : IsLocalization (Submonoid.map g M) Q
⊢ ∀ (a : S), (map Q g (_ : M ≤ Submonoid.comap g (Submonoid.map g M))) a = 0 → a = 0

Next tactic:
intro z hz
/-- Injectivity of a map descends to the map induced on localizations. -/
theorem map_injective_of_injective (hg : Function.Injective g)
    [i : IsLocalization (M.map g : Submonoid P) Q] :
    Function.Injective (map Q g (Submonoid.le_comap_map M) : S → Q) := by
  rw [injective_iff_map_eq_zero]
  intro z hz
  

Proof state:
R : Type u_1
inst✝⁶ : CommRing R
M : Submonoid R
S : Type u_2
inst✝⁵ : CommRing S
inst✝⁴ : Algebra R S
P : Type u_3
inst✝³ : CommRing P
K : Type u_4
inst✝² : IsLocalization M S
Q : Type u_5
inst✝¹ : CommRing Q
g : R →+* P
inst✝ : Algebra P Q
hg : Injective ⇑g
i : IsLocalization (Submonoid.map g M) Q
z : S
hz : (map Q g (_ : M ≤ Submonoid.comap g (Submonoid.map g M))) z = 0
⊢ z = 0

Next tactic:
obtain ⟨a, b, rfl⟩ := mk'_surjective M z
/-- Injectivity of a map descends to the map induced on localizations. -/
theorem map_injective_of_injective (hg : Function.Injective g)
    [i : IsLocalization (M.map g : Submonoid P) Q] :
    Function.Injective (map Q g (Submonoid.le_comap_map M) : S → Q) := by
  rw [injective_iff_map_eq_zero]
  intro z hz
  obtain ⟨a, b, rfl⟩ := mk'_surjective M z
  

Proof state:
case intro.intro
R : Type u_1
inst✝⁶ : CommRing R
M : Submonoid R
S : Type u_2
inst✝⁵ : CommRing S
inst✝⁴ : Algebra R S
P : Type u_3
inst✝³ : CommRing P
K : Type u_4
inst✝² : IsLocalization M S
Q : Type u_5
inst✝¹ : CommRing Q
g : R →+* P
inst✝ : Algebra P Q
hg : Injective ⇑g
i : IsLocalization (Submonoid.map g M) Q
a : R
b : ↥M
hz : (map Q g (_ : M ≤ Submonoid.comap g (Submonoid.map g M))) (mk' S a b) = 0
⊢ mk' S a b = 0

Next tactic:
rw [map_mk', mk'_eq_zero_iff] at hz
/-- Injectivity of a map descends to the map induced on localizations. -/
theorem map_injective_of_injective (hg : Function.Injective g)
    [i : IsLocalization (M.map g : Submonoid P) Q] :
    Function.Injective (map Q g (Submonoid.le_comap_map M) : S → Q) := by
  rw [injective_iff_map_eq_zero]
  intro z hz
  obtain ⟨a, b, rfl⟩ := mk'_surjective M z
  rw [map_mk', mk'_eq_zero_iff] at hz
  

Proof state:
case intro.intro
R : Type u_1
inst✝⁶ : CommRing R
M : Submonoid R
S : Type u_2
inst✝⁵ : CommRing S
inst✝⁴ : Algebra R S
P : Type u_3
inst✝³ : CommRing P
K : Type u_4
inst✝² : IsLocalization M S
Q : Type u_5
inst✝¹ : CommRing Q
g : R →+* P
inst✝ : Algebra P Q
hg : Injective ⇑g
i : IsLocalization (Submonoid.map g M) Q
a : R
b : ↥M
hz : ∃ m, ↑m * g a = 0
⊢ mk' S a b = 0

Next tactic:
obtain ⟨⟨m', hm'⟩, hm⟩ := hz
/-- Injectivity of a map descends to the map induced on localizations. -/
theorem map_injective_of_injective (hg : Function.Injective g)
    [i : IsLocalization (M.map g : Submonoid P) Q] :
    Function.Injective (map Q g (Submonoid.le_comap_map M) : S → Q) := by
  rw [injective_iff_map_eq_zero]
  intro z hz
  obtain ⟨a, b, rfl⟩ := mk'_surjective M z
  rw [map_mk', mk'_eq_zero_iff] at hz
  obtain ⟨⟨m', hm'⟩, hm⟩ := hz
  

Proof state:
case intro.intro.intro.mk
R : Type u_1
inst✝⁶ : CommRing R
M : Submonoid R
S : Type u_2
inst✝⁵ : CommRing S
inst✝⁴ : Algebra R S
P : Type u_3
inst✝³ : CommRing P
K : Type u_4
inst✝² : IsLocalization M S
Q : Type u_5
inst✝¹ : CommRing Q
g : R →+* P
inst✝ : Algebra P Q
hg : Injective ⇑g
i : IsLocalization (Submonoid.map g M) Q
a : R
b : ↥M
m' : P
hm' : m' ∈ Submonoid.map g M
hm : ↑{ val := m', property := hm' } * g a = 0
⊢ mk' S a b = 0

Next tactic:
rw [Submonoid.mem_map] at hm'
/-- Injectivity of a map descends to the map induced on localizations. -/
theorem map_injective_of_injective (hg : Function.Injective g)
    [i : IsLocalization (M.map g : Submonoid P) Q] :
    Function.Injective (map Q g (Submonoid.le_comap_map M) : S → Q) := by
  rw [injective_iff_map_eq_zero]
  intro z hz
  obtain ⟨a, b, rfl⟩ := mk'_surjective M z
  rw [map_mk', mk'_eq_zero_iff] at hz
  obtain ⟨⟨m', hm'⟩, hm⟩ := hz
  rw [Submonoid.mem_map] at hm'
  

Proof state:
case intro.intro.intro.mk
R : Type u_1
inst✝⁶ : CommRing R
M : Submonoid R
S : Type u_2
inst✝⁵ : CommRing S
inst✝⁴ : Algebra R S
P : Type u_3
inst✝³ : CommRing P
K : Type u_4
inst✝² : IsLocalization M S
Q : Type u_5
inst✝¹ : CommRing Q
g : R →+* P
inst✝ : Algebra P Q
hg : Injective ⇑g
i : IsLocalization (Submonoid.map g M) Q
a : R
b : ↥M
m' : P
hm'✝ : m' ∈ Submonoid.map g M
hm' : ∃ x ∈ M, g x = m'
hm : ↑{ val := m', property := hm'✝ } * g a = 0
⊢ mk' S a b = 0

Next tactic:
obtain ⟨n, hn, hnm⟩ := hm'
/-- Injectivity of a map descends to the map induced on localizations. -/
theorem map_injective_of_injective (hg : Function.Injective g)
    [i : IsLocalization (M.map g : Submonoid P) Q] :
    Function.Injective (map Q g (Submonoid.le_comap_map M) : S → Q) := by
  rw [injective_iff_map_eq_zero]
  intro z hz
  obtain ⟨a, b, rfl⟩ := mk'_surjective M z
  rw [map_mk', mk'_eq_zero_iff] at hz
  obtain ⟨⟨m', hm'⟩, hm⟩ := hz
  rw [Submonoid.mem_map] at hm'
  obtain ⟨n, hn, hnm⟩ := hm'
  

Proof state:
case intro.intro.intro.mk.intro.intro
R : Type u_1
inst✝⁶ : CommRing R
M : Submonoid R
S : Type u_2
inst✝⁵ : CommRing S
inst✝⁴ : Algebra R S
P : Type u_3
inst✝³ : CommRing P
K : Type u_4
inst✝² : IsLocalization M S
Q : Type u_5
inst✝¹ : CommRing Q
g : R →+* P
inst✝ : Algebra P Q
hg : Injective ⇑g
i : IsLocalization (Submonoid.map g M) Q
a : R
b : ↥M
m' : P
hm' : m' ∈ Submonoid.map g M
hm : ↑{ val := m', property := hm' } * g a = 0
n : R
hn : n ∈ M
hnm : g n = m'
⊢ mk' S a b = 0

Next tactic:
rw [Subtype.coe_mk, ← hnm, ← map_mul, ← map_zero g] at hm
/-- Injectivity of a map descends to the map induced on localizations. -/
theorem map_injective_of_injective (hg : Function.Injective g)
    [i : IsLocalization (M.map g : Submonoid P) Q] :
    Function.Injective (map Q g (Submonoid.le_comap_map M) : S → Q) := by
  rw [injective_iff_map_eq_zero]
  intro z hz
  obtain ⟨a, b, rfl⟩ := mk'_surjective M z
  rw [map_mk', mk'_eq_zero_iff] at hz
  obtain ⟨⟨m', hm'⟩, hm⟩ := hz
  rw [Submonoid.mem_map] at hm'
  obtain ⟨n, hn, hnm⟩ := hm'
  rw [Subtype.coe_mk, ← hnm, ← map_mul, ← map_zero g] at hm
  

Proof state:
case intro.intro.intro.mk.intro.intro
R : Type u_1
inst✝⁶ : CommRing R
M : Submonoid R
S : Type u_2
inst✝⁵ : CommRing S
inst✝⁴ : Algebra R S
P : Type u_3
inst✝³ : CommRing P
K : Type u_4
inst✝² : IsLocalization M S
Q : Type u_5
inst✝¹ : CommRing Q
g : R →+* P
inst✝ : Algebra P Q
hg : Injective ⇑g
i : IsLocalization (Submonoid.map g M) Q
a : R
b : ↥M
m' : P
hm' : m' ∈ Submonoid.map g M
n : R
hm : g (n * a) = g 0
hn : n ∈ M
hnm : g n = m'
⊢ mk' S a b = 0

Next tactic:
rw [mk'_eq_zero_iff]
/-- Injectivity of a map descends to the map induced on localizations. -/
theorem map_injective_of_injective (hg : Function.Injective g)
    [i : IsLocalization (M.map g : Submonoid P) Q] :
    Function.Injective (map Q g (Submonoid.le_comap_map M) : S → Q) := by
  rw [injective_iff_map_eq_zero]
  intro z hz
  obtain ⟨a, b, rfl⟩ := mk'_surjective M z
  rw [map_mk', mk'_eq_zero_iff] at hz
  obtain ⟨⟨m', hm'⟩, hm⟩ := hz
  rw [Submonoid.mem_map] at hm'
  obtain ⟨n, hn, hnm⟩ := hm'
  rw [Subtype.coe_mk, ← hnm, ← map_mul, ← map_zero g] at hm
  rw [mk'_eq_zero_iff]
  

Proof state:
case intro.intro.intro.mk.intro.intro
R : Type u_1
inst✝⁶ : CommRing R
M : Submonoid R
S : Type u_2
inst✝⁵ : CommRing S
inst✝⁴ : Algebra R S
P : Type u_3
inst✝³ : CommRing P
K : Type u_4
inst✝² : IsLocalization M S
Q : Type u_5
inst✝¹ : CommRing Q
g : R →+* P
inst✝ : Algebra P Q
hg : Injective ⇑g
i : IsLocalization (Submonoid.map g M) Q
a : R
b : ↥M
m' : P
hm' : m' ∈ Submonoid.map g M
n : R
hm : g (n * a) = g 0
hn : n ∈ M
hnm : g n = m'
⊢ ∃ m, ↑m * a = 0

Next tactic:
exact ⟨⟨n, hn⟩, hg hm⟩
/-- A `CommRing` `S` which is the localization of a ring `R` without zero divisors at a subset of
non-zero elements does not have zero divisors.
See note [reducible non-instances]. -/
@[reducible]
theorem noZeroDivisors_of_le_nonZeroDivisors [Algebra A S] {M : Submonoid A} [IsLocalization M S]
    (hM : M ≤ nonZeroDivisors A) : NoZeroDivisors S :=
  { eq_zero_or_eq_zero_of_mul_eq_zero := by
      

Proof state:
R : Type u_1
inst✝¹⁰ : CommRing R
M✝ : Submonoid R
S : Type u_2
inst✝⁹ : CommRing S
inst✝⁸ : Algebra R S
P : Type u_3
inst✝⁷ : CommRing P
K : Type u_4
inst✝⁶ : IsLocalization M✝ S
Q : Type u_5
inst✝⁵ : CommRing Q
g : R →+* P
inst✝⁴ : Algebra P Q
A : Type u_6
inst✝³ : CommRing A
inst✝² : IsDomain A
inst✝¹ : Algebra A S
M : Submonoid A
inst✝ : IsLocalization M S
hM : M ≤ nonZeroDivisors A
⊢ ∀ {a b : S}, a * b = 0 → a = 0 ∨ b = 0

Next tactic:
intro z w h
/-- A `CommRing` `S` which is the localization of a ring `R` without zero divisors at a subset of
non-zero elements does not have zero divisors.
See note [reducible non-instances]. -/
@[reducible]
theorem noZeroDivisors_of_le_nonZeroDivisors [Algebra A S] {M : Submonoid A} [IsLocalization M S]
    (hM : M ≤ nonZeroDivisors A) : NoZeroDivisors S :=
  { eq_zero_or_eq_zero_of_mul_eq_zero := by
      intro z w h
      

Proof state:
R : Type u_1
inst✝¹⁰ : CommRing R
M✝ : Submonoid R
S : Type u_2
inst✝⁹ : CommRing S
inst✝⁸ : Algebra R S
P : Type u_3
inst✝⁷ : CommRing P
K : Type u_4
inst✝⁶ : IsLocalization M✝ S
Q : Type u_5
inst✝⁵ : CommRing Q
g : R →+* P
inst✝⁴ : Algebra P Q
A : Type u_6
inst✝³ : CommRing A
inst✝² : IsDomain A
inst✝¹ : Algebra A S
M : Submonoid A
inst✝ : IsLocalization M S
hM : M ≤ nonZeroDivisors A
z w : S
h : z * w = 0
⊢ z = 0 ∨ w = 0

Next tactic:
cases' surj M z with x hx
/-- A `CommRing` `S` which is the localization of a ring `R` without zero divisors at a subset of
non-zero elements does not have zero divisors.
See note [reducible non-instances]. -/
@[reducible]
theorem noZeroDivisors_of_le_nonZeroDivisors [Algebra A S] {M : Submonoid A} [IsLocalization M S]
    (hM : M ≤ nonZeroDivisors A) : NoZeroDivisors S :=
  { eq_zero_or_eq_zero_of_mul_eq_zero := by
      intro z w h
      cases' surj M z with x hx
      

Proof state:
case intro
R : Type u_1
inst✝¹⁰ : CommRing R
M✝ : Submonoid R
S : Type u_2
inst✝⁹ : CommRing S
inst✝⁸ : Algebra R S
P : Type u_3
inst✝⁷ : CommRing P
K : Type u_4
inst✝⁶ : IsLocalization M✝ S
Q : Type u_5
inst✝⁵ : CommRing Q
g : R →+* P
inst✝⁴ : Algebra P Q
A : Type u_6
inst✝³ : CommRing A
inst✝² : IsDomain A
inst✝¹ : Algebra A S
M : Submonoid A
inst✝ : IsLocalization M S
hM : M ≤ nonZeroDivisors A
z w : S
h : z * w = 0
x : A × ↥M
hx : z * (algebraMap A S) ↑x.2 = (algebraMap A S) x.1
⊢ z = 0 ∨ w = 0

Next tactic:
cases' surj M w with y hy
/-- A `CommRing` `S` which is the localization of a ring `R` without zero divisors at a subset of
non-zero elements does not have zero divisors.
See note [reducible non-instances]. -/
@[reducible]
theorem noZeroDivisors_of_le_nonZeroDivisors [Algebra A S] {M : Submonoid A} [IsLocalization M S]
    (hM : M ≤ nonZeroDivisors A) : NoZeroDivisors S :=
  { eq_zero_or_eq_zero_of_mul_eq_zero := by
      intro z w h
      cases' surj M z with x hx
      cases' surj M w with y hy
      

Proof state:
case intro.intro
R : Type u_1
inst✝¹⁰ : CommRing R
M✝ : Submonoid R
S : Type u_2
inst✝⁹ : CommRing S
inst✝⁸ : Algebra R S
P : Type u_3
inst✝⁷ : CommRing P
K : Type u_4
inst✝⁶ : IsLocalization M✝ S
Q : Type u_5
inst✝⁵ : CommRing Q
g : R →+* P
inst✝⁴ : Algebra P Q
A : Type u_6
inst✝³ : CommRing A
inst✝² : IsDomain A
inst✝¹ : Algebra A S
M : Submonoid A
inst✝ : IsLocalization M S
hM : M ≤ nonZeroDivisors A
z w : S
h : z * w = 0
x : A × ↥M
hx : z * (algebraMap A S) ↑x.2 = (algebraMap A S) x.1
y : A × ↥M
hy : w * (algebraMap A S) ↑y.2 = (algebraMap A S) y.1
⊢ z = 0 ∨ w = 0

Next tactic:
have :
        z * w * algebraMap A S y.2 * algebraMap A S x.2 = algebraMap A S x.1 * algebraMap A S y.1 :=
        by rw [mul_assoc z, hy, ← hx]; ring
/-- A `CommRing` `S` which is the localization of a ring `R` without zero divisors at a subset of
non-zero elements does not have zero divisors.
See note [reducible non-instances]. -/
@[reducible]
theorem noZeroDivisors_of_le_nonZeroDivisors [Algebra A S] {M : Submonoid A} [IsLocalization M S]
    (hM : M ≤ nonZeroDivisors A) : NoZeroDivisors S :=
  { eq_zero_or_eq_zero_of_mul_eq_zero := by
      intro z w h
      cases' surj M z with x hx
      cases' surj M w with y hy
      have :
        z * w * algebraMap A S y.2 * algebraMap A S x.2 = algebraMap A S x.1 * algebraMap A S y.1 :=
        by 

Proof state:
R : Type u_1
inst✝¹⁰ : CommRing R
M✝ : Submonoid R
S : Type u_2
inst✝⁹ : CommRing S
inst✝⁸ : Algebra R S
P : Type u_3
inst✝⁷ : CommRing P
K : Type u_4
inst✝⁶ : IsLocalization M✝ S
Q : Type u_5
inst✝⁵ : CommRing Q
g : R →+* P
inst✝⁴ : Algebra P Q
A : Type u_6
inst✝³ : CommRing A
inst✝² : IsDomain A
inst✝¹ : Algebra A S
M : Submonoid A
inst✝ : IsLocalization M S
hM : M ≤ nonZeroDivisors A
z w : S
h : z * w = 0
x : A × ↥M
hx : z * (algebraMap A S) ↑x.2 = (algebraMap A S) x.1
y : A × ↥M
hy : w * (algebraMap A S) ↑y.2 = (algebraMap A S) y.1
⊢ z * w * (algebraMap A S) ↑y.2 * (algebraMap A S) ↑x.2 = (algebraMap A S) x.1 * (algebraMap A S) y.1

Next tactic:
rw [mul_assoc z, hy, ← hx]
/-- A `CommRing` `S` which is the localization of a ring `R` without zero divisors at a subset of
non-zero elements does not have zero divisors.
See note [reducible non-instances]. -/
@[reducible]
theorem noZeroDivisors_of_le_nonZeroDivisors [Algebra A S] {M : Submonoid A} [IsLocalization M S]
    (hM : M ≤ nonZeroDivisors A) : NoZeroDivisors S :=
  { eq_zero_or_eq_zero_of_mul_eq_zero := by
      intro z w h
      cases' surj M z with x hx
      cases' surj M w with y hy
      have :
        z * w * algebraMap A S y.2 * algebraMap A S x.2 = algebraMap A S x.1 * algebraMap A S y.1 :=
        by rw [mul_assoc z, hy, ← hx]; 

Proof state:
R : Type u_1
inst✝¹⁰ : CommRing R
M✝ : Submonoid R
S : Type u_2
inst✝⁹ : CommRing S
inst✝⁸ : Algebra R S
P : Type u_3
inst✝⁷ : CommRing P
K : Type u_4
inst✝⁶ : IsLocalization M✝ S
Q : Type u_5
inst✝⁵ : CommRing Q
g : R →+* P
inst✝⁴ : Algebra P Q
A : Type u_6
inst✝³ : CommRing A
inst✝² : IsDomain A
inst✝¹ : Algebra A S
M : Submonoid A
inst✝ : IsLocalization M S
hM : M ≤ nonZeroDivisors A
z w : S
h : z * w = 0
x : A × ↥M
hx : z * (algebraMap A S) ↑x.2 = (algebraMap A S) x.1
y : A × ↥M
hy : w * (algebraMap A S) ↑y.2 = (algebraMap A S) y.1
⊢ z * (algebraMap A S) y.1 * (algebraMap A S) ↑x.2 = z * (algebraMap A S) ↑x.2 * (algebraMap A S) y.1

Next tactic:
ring