l3lab/ntp-mathlib huggingface dataset:
theorem range_finsuppTotal :
    LinearMap.range (finsuppTotal ι M I v) = I • Submodule.span R (Set.range v) := by
  ext
  rw [Submodule.mem_ideal_smul_span_iff_exists_sum]
  refine' ⟨fun ⟨f, h⟩ => ⟨Finsupp.mapRange.linearMap I.subtype f, fun i => (f i).2, h⟩, _⟩
  rintro ⟨a, ha, rfl⟩
  classical
    refine' ⟨a.mapRange (fun r => if h : r ∈ I then ⟨r, h⟩ else 0) (by simp), _⟩
    rw [finsuppTotal_apply, Finsupp.sum_mapRange_index]
    · apply Finsupp.sum_congr
      intro i _
      rw [dif_pos (ha i)]
    · 

Proof state:
case h.intro.intro
ι : Type u_1
M : Type u_2
inst✝² : AddCommGroup M
R : Type u_3
inst✝¹ : CommRing R
inst✝ : Module R M
I : Ideal R
v : ι → M
hv : Submodule.span R (Set.range v) = ⊤
a : ι →₀ R
ha : ∀ (i : ι), a i ∈ I
⊢ ∀ (a : ι), ↑0 • v a = 0

Next tactic:
exact fun _ => zero_smul _ _
/-- A basis on `S` gives a basis on `Ideal.span {x}`, by multiplying everything by `x`. -/
noncomputable def basisSpanSingleton (b : Basis ι R S) {x : S} (hx : x ≠ 0) :
    Basis ι R (span ({x} : Set S)) :=
  b.map <|
    LinearEquiv.ofInjective (Algebra.lmul R S x) (LinearMap.mul_injective hx) ≪≫ₗ
        LinearEquiv.ofEq _ _
          (by
            

Proof state:
ι : Type u_1
R : Type u_2
S : Type u_3
inst✝³ : CommSemiring R
inst✝² : CommRing S
inst✝¹ : IsDomain S
inst✝ : Algebra R S
b : Basis ι R S
x : S
hx : x ≠ 0
⊢ LinearMap.range ((Algebra.lmul R S) x) = Submodule.restrictScalars R (span {x})

Next tactic:
ext
/-- A basis on `S` gives a basis on `Ideal.span {x}`, by multiplying everything by `x`. -/
noncomputable def basisSpanSingleton (b : Basis ι R S) {x : S} (hx : x ≠ 0) :
    Basis ι R (span ({x} : Set S)) :=
  b.map <|
    LinearEquiv.ofInjective (Algebra.lmul R S x) (LinearMap.mul_injective hx) ≪≫ₗ
        LinearEquiv.ofEq _ _
          (by
            ext
            

Proof state:
case h
ι : Type u_1
R : Type u_2
S : Type u_3
inst✝³ : CommSemiring R
inst✝² : CommRing S
inst✝¹ : IsDomain S
inst✝ : Algebra R S
b : Basis ι R S
x : S
hx : x ≠ 0
x✝ : S
⊢ x✝ ∈ LinearMap.range ((Algebra.lmul R S) x) ↔ x✝ ∈ Submodule.restrictScalars R (span {x})

Next tactic:
simp [mem_span_singleton', mul_comm]
@[simp]
theorem basisSpanSingleton_apply (b : Basis ι R S) {x : S} (hx : x ≠ 0) (i : ι) :
    (basisSpanSingleton b hx i : S) = x * b i := by
  

Proof state:
ι : Type u_1
R : Type u_2
S : Type u_3
inst✝³ : CommSemiring R
inst✝² : CommRing S
inst✝¹ : IsDomain S
inst✝ : Algebra R S
b : Basis ι R S
x : S
hx : x ≠ 0
i : ι
⊢ ↑((basisSpanSingleton b hx) i) = x * b i

Next tactic:
simp only [basisSpanSingleton, Basis.map_apply, LinearEquiv.trans_apply,
    Submodule.restrictScalarsEquiv_apply, LinearEquiv.ofInjective_apply, LinearEquiv.coe_ofEq_apply,
    LinearEquiv.restrictScalars_apply, Algebra.coe_lmul_eq_mul, LinearMap.mul_apply']
@[simp]
theorem basisSpanSingleton_apply (b : Basis ι R S) {x : S} (hx : x ≠ 0) (i : ι) :
    (basisSpanSingleton b hx i : S) = x * b i := by
  simp only [basisSpanSingleton, Basis.map_apply, LinearEquiv.trans_apply,
    Submodule.restrictScalarsEquiv_apply, LinearEquiv.ofInjective_apply, LinearEquiv.coe_ofEq_apply,
    LinearEquiv.restrictScalars_apply, Algebra.coe_lmul_eq_mul, LinearMap.mul_apply']
  -- This used to be the end of the proof before leanprover/lean4#2644
  

Proof state:
ι : Type u_1
R : Type u_2
S : Type u_3
inst✝³ : CommSemiring R
inst✝² : CommRing S
inst✝¹ : IsDomain S
inst✝ : Algebra R S
b : Basis ι R S
x : S
hx : x ≠ 0
i : ι
⊢ ↑((LinearEquiv.ofEq (LinearMap.range ((Algebra.lmul R S) x)) (Submodule.restrictScalars R (span {x}))
          (_ : LinearMap.range ((Algebra.lmul R S) x) = Submodule.restrictScalars R (span {x})))
        ((LinearEquiv.ofInjective ((Algebra.lmul R S) x) (_ : Function.Injective ⇑((LinearMap.mul R S) x))) (b i))) =
    x * b i

Next tactic:
erw [LinearEquiv.coe_ofEq_apply, LinearEquiv.ofInjective_apply, Algebra.coe_lmul_eq_mul,
    LinearMap.mul_apply']
@[simp]
theorem constr_basisSpanSingleton {N : Type*} [Semiring N] [Module N S] [SMulCommClass R N S]
    (b : Basis ι R S) {x : S} (hx : x ≠ 0) :
    (b.constr N).toFun (((↑) : _ → S) ∘ (basisSpanSingleton b hx)) = Algebra.lmul R S x :=
  b.ext fun i => by
    

Proof state:
ι : Type u_1
R : Type u_2
S : Type u_3
inst✝⁶ : CommSemiring R
inst✝⁵ : CommRing S
inst✝⁴ : IsDomain S
inst✝³ : Algebra R S
N : Type u_4
inst✝² : Semiring N
inst✝¹ : Module N S
inst✝ : SMulCommClass R N S
b : Basis ι R S
x : S
hx : x ≠ 0
i : ι
⊢ (AddHom.toFun (↑(Basis.constr b N)).toAddHom (Subtype.val ∘ ⇑(basisSpanSingleton b hx))) (b i) =
    ((Algebra.lmul R S) x) (b i)

Next tactic:
erw [Basis.constr_basis, Function.comp_apply, basisSpanSingleton_apply, LinearMap.mul_apply']
theorem Associates.mk_ne_zero' {R : Type*} [CommSemiring R] {r : R} :
    Associates.mk (Ideal.span {r} : Ideal R) ≠ 0 ↔ r ≠ 0 := by
  

Proof state:
R : Type u_1
inst✝ : CommSemiring R
r : R
⊢ Associates.mk (Ideal.span {r}) ≠ 0 ↔ r ≠ 0

Next tactic:
rw [Associates.mk_ne_zero, Ideal.zero_eq_bot, Ne.def, Ideal.span_singleton_eq_bot]
/-- An element is in the kernel if and only if it maps to zero.-/
theorem mem_ker {r} : r ∈ ker f ↔ f r = 0 := by 

Proof state:
R : Type u
S : Type v
T : Type w
F : Type u_1
G : Type u_2
inst✝² : Semiring R
inst✝¹ : Semiring S
inst✝ : Semiring T
rcf : RingHomClass F R S
rcg : RingHomClass G T S
f : F
g : G
r : R
⊢ r ∈ ker f ↔ f r = 0

Next tactic:
rw [ker, Ideal.mem_comap, Submodule.mem_bot]
theorem comap_ker (f : S →+* R) (g : T →+* S) : f.ker.comap g = ker (f.comp g) := by
  

Proof state:
R : Type u
S : Type v
T : Type w
F : Type u_1
G : Type u_2
inst✝² : Semiring R
inst✝¹ : Semiring S
inst✝ : Semiring T
rcf : RingHomClass F R S
rcg : RingHomClass G T S
f✝ : F
g✝ : G
f : S →+* R
g : T →+* S
⊢ Ideal.comap g (ker f) = ker (comp f g)

Next tactic:
rw [RingHom.ker_eq_comap_bot, Ideal.comap_comap, RingHom.ker_eq_comap_bot]
/-- If the target is not the zero ring, then one is not in the kernel.-/
theorem not_one_mem_ker [Nontrivial S] (f : F) : (1 : R) ∉ ker f := by
  

Proof state:
R : Type u
S : Type v
T : Type w
F : Type u_1
G : Type u_2
inst✝³ : Semiring R
inst✝² : Semiring S
inst✝¹ : Semiring T
rcf : RingHomClass F R S
rcg : RingHomClass G T S
f✝ : F
g : G
inst✝ : Nontrivial S
f : F
⊢ 1 ∉ ker f

Next tactic:
rw [mem_ker, map_one]
/-- If the target is not the zero ring, then one is not in the kernel.-/
theorem not_one_mem_ker [Nontrivial S] (f : F) : (1 : R) ∉ ker f := by
  rw [mem_ker, map_one]
  

Proof state:
R : Type u
S : Type v
T : Type w
F : Type u_1
G : Type u_2
inst✝³ : Semiring R
inst✝² : Semiring S
inst✝¹ : Semiring T
rcf : RingHomClass F R S
rcg : RingHomClass G T S
f✝ : F
g : G
inst✝ : Nontrivial S
f : F
⊢ ¬1 = 0

Next tactic:
exact one_ne_zero
lemma _root_.Pi.ker_ringHom {ι : Type*} {R : ι → Type*} [∀ i, Semiring (R i)]
    (φ : ∀ i, S →+* R i) : ker (Pi.ringHom φ) = ⨅ i, ker (φ i) := by
  

Proof state:
R✝ : Type u
S : Type v
T : Type w
F : Type u_1
G : Type u_2
inst✝³ : Semiring R✝
inst✝² : Semiring S
inst✝¹ : Semiring T
rcf : RingHomClass F R✝ S
rcg : RingHomClass G T S
f : F
g : G
ι : Type u_3
R : ι → Type u_4
inst✝ : (i : ι) → Semiring (R i)
φ : (i : ι) → S →+* R i
⊢ ker (Pi.ringHom φ) = ⨅ i, ker (φ i)

Next tactic:
ext x
lemma _root_.Pi.ker_ringHom {ι : Type*} {R : ι → Type*} [∀ i, Semiring (R i)]
    (φ : ∀ i, S →+* R i) : ker (Pi.ringHom φ) = ⨅ i, ker (φ i) := by
  ext x
  

Proof state:
case h
R✝ : Type u
S : Type v
T : Type w
F : Type u_1
G : Type u_2
inst✝³ : Semiring R✝
inst✝² : Semiring S
inst✝¹ : Semiring T
rcf : RingHomClass F R✝ S
rcg : RingHomClass G T S
f : F
g : G
ι : Type u_3
R : ι → Type u_4
inst✝ : (i : ι) → Semiring (R i)
φ : (i : ι) → S →+* R i
x : S
⊢ x ∈ ker (Pi.ringHom φ) ↔ x ∈ ⨅ i, ker (φ i)

Next tactic:
simp [mem_ker, Ideal.mem_iInf, Function.funext_iff]
theorem injective_iff_ker_eq_bot : Function.Injective f ↔ ker f = ⊥ := by
  

Proof state:
R : Type u
S : Type v
T : Type w
F : Type u_1
inst✝¹ : Ring R
inst✝ : Semiring S
rc : RingHomClass F R S
f : F
⊢ Function.Injective ⇑f ↔ ker f = ⊥

Next tactic:
rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
theorem injective_iff_ker_eq_bot : Function.Injective f ↔ ker f = ⊥ := by
  rw [SetLike.ext'_iff, ker_eq, Set.ext_iff]
  

Proof state:
R : Type u
S : Type v
T : Type w
F : Type u_1
inst✝¹ : Ring R
inst✝ : Semiring S
rc : RingHomClass F R S
f : F
⊢ Function.Injective ⇑f ↔ ∀ (x : R), x ∈ ⇑f ⁻¹' {0} ↔ x ∈ ↑⊥

Next tactic:
exact injective_iff_map_eq_zero' f
theorem ker_eq_bot_iff_eq_zero : ker f = ⊥ ↔ ∀ x, f x = 0 → x = 0 := by
  

Proof state:
R : Type u
S : Type v
T : Type w
F : Type u_1
inst✝¹ : Ring R
inst✝ : Semiring S
rc : RingHomClass F R S
f : F
⊢ ker f = ⊥ ↔ ∀ (x : R), f x = 0 → x = 0

Next tactic:
rw [← injective_iff_map_eq_zero f, injective_iff_ker_eq_bot]
@[simp]
theorem ker_coe_equiv (f : R ≃+* S) : ker (f : R →+* S) = ⊥ := by
  

Proof state:
R : Type u
S : Type v
T : Type w
F : Type u_1
inst✝¹ : Ring R
inst✝ : Semiring S
rc : RingHomClass F R S
f✝ : F
f : R ≃+* S
⊢ ker ↑f = ⊥

Next tactic:
simpa only [← injective_iff_ker_eq_bot] using EquivLike.injective f
@[simp]
theorem ker_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') : ker f = ⊥ := by
  

Proof state:
R : Type u
S : Type v
T : Type w
F : Type u_1
inst✝² : Ring R
inst✝¹ : Semiring S
rc : RingHomClass F R S
f✝ : F
F' : Type u_2
inst✝ : RingEquivClass F' R S
f : F'
⊢ ker f = ⊥

Next tactic:
simpa only [← injective_iff_ker_eq_bot] using EquivLike.injective f
theorem sub_mem_ker_iff {x y} : x - y ∈ ker f ↔ f x = f y := by 

Proof state:
R : Type u
S : Type v
T : Type w
F : Type u_1
inst✝¹ : Ring R
inst✝ : Ring S
rc : RingHomClass F R S
f : F
x y : R
⊢ x - y ∈ ker f ↔ f x = f y

Next tactic:
rw [mem_ker, map_sub, sub_eq_zero]
/-- The kernel of a homomorphism to a domain is a prime ideal. -/
theorem ker_isPrime {F : Type*} [Ring R] [Ring S] [IsDomain S] [RingHomClass F R S] (f : F) :
    (ker f).IsPrime :=
  ⟨by
    

Proof state:
R : Type u
S : Type v
T : Type w
F : Type u_1
inst✝³ : Ring R
inst✝² : Ring S
inst✝¹ : IsDomain S
inst✝ : RingHomClass F R S
f : F
⊢ ker f ≠ ⊤

Next tactic:
rw [Ne.def, Ideal.eq_top_iff_one]
/-- The kernel of a homomorphism to a domain is a prime ideal. -/
theorem ker_isPrime {F : Type*} [Ring R] [Ring S] [IsDomain S] [RingHomClass F R S] (f : F) :
    (ker f).IsPrime :=
  ⟨by
    rw [Ne.def, Ideal.eq_top_iff_one]
    

Proof state:
R : Type u
S : Type v
T : Type w
F : Type u_1
inst✝³ : Ring R
inst✝² : Ring S
inst✝¹ : IsDomain S
inst✝ : RingHomClass F R S
f : F
⊢ 1 ∉ ker f

Next tactic:
exact not_one_mem_ker f
/-- The kernel of a homomorphism to a domain is a prime ideal. -/
theorem ker_isPrime {F : Type*} [Ring R] [Ring S] [IsDomain S] [RingHomClass F R S] (f : F) :
    (ker f).IsPrime :=
  ⟨by
    rw [Ne.def, Ideal.eq_top_iff_one]
    exact not_one_mem_ker f,
   fun {x y} => by
    

Proof state:
R : Type u
S : Type v
T : Type w
F : Type u_1
inst✝³ : Ring R
inst✝² : Ring S
inst✝¹ : IsDomain S
inst✝ : RingHomClass F R S
f : F
x y : R
⊢ x * y ∈ ker f → x ∈ ker f ∨ y ∈ ker f

Next tactic:
simpa only [mem_ker, map_mul] using @eq_zero_or_eq_zero_of_mul_eq_zero S _ _ _ _ _
/-- The kernel of a homomorphism to a field is a maximal ideal. -/
theorem ker_isMaximal_of_surjective {R K F : Type*} [Ring R] [Field K] [RingHomClass F R K] (f : F)
    (hf : Function.Surjective f) : (ker f).IsMaximal := by
  

Proof state:
R✝ : Type u
S : Type v
T : Type w
R : Type u_1
K : Type u_2
F : Type u_3
inst✝² : Ring R
inst✝¹ : Field K
inst✝ : RingHomClass F R K
f : F
hf : Function.Surjective ⇑f
⊢ Ideal.IsMaximal (ker f)

Next tactic:
refine'
    Ideal.isMaximal_iff.mpr
      ⟨fun h1 => one_ne_zero' K <| map_one f ▸ (mem_ker f).mp h1, fun J x hJ hxf hxJ => _⟩
/-- The kernel of a homomorphism to a field is a maximal ideal. -/
theorem ker_isMaximal_of_surjective {R K F : Type*} [Ring R] [Field K] [RingHomClass F R K] (f : F)
    (hf : Function.Surjective f) : (ker f).IsMaximal := by
  refine'
    Ideal.isMaximal_iff.mpr
      ⟨fun h1 => one_ne_zero' K <| map_one f ▸ (mem_ker f).mp h1, fun J x hJ hxf hxJ => _⟩
  

Proof state:
R✝ : Type u
S : Type v
T : Type w
R : Type u_1
K : Type u_2
F : Type u_3
inst✝² : Ring R
inst✝¹ : Field K
inst✝ : RingHomClass F R K
f : F
hf : Function.Surjective ⇑f
J : Ideal R
x : R
hJ : ker f ≤ J
hxf : x ∉ ker f
hxJ : x ∈ J
⊢ 1 ∈ J

Next tactic:
obtain ⟨y, hy⟩ := hf (f x)⁻¹
/-- The kernel of a homomorphism to a field is a maximal ideal. -/
theorem ker_isMaximal_of_surjective {R K F : Type*} [Ring R] [Field K] [RingHomClass F R K] (f : F)
    (hf : Function.Surjective f) : (ker f).IsMaximal := by
  refine'
    Ideal.isMaximal_iff.mpr
      ⟨fun h1 => one_ne_zero' K <| map_one f ▸ (mem_ker f).mp h1, fun J x hJ hxf hxJ => _⟩
  obtain ⟨y, hy⟩ := hf (f x)⁻¹
  

Proof state:
case intro
R✝ : Type u
S : Type v
T : Type w
R : Type u_1
K : Type u_2
F : Type u_3
inst✝² : Ring R
inst✝¹ : Field K
inst✝ : RingHomClass F R K
f : F
hf : Function.Surjective ⇑f
J : Ideal R
x : R
hJ : ker f ≤ J
hxf : x ∉ ker f
hxJ : x ∈ J
y : R
hy : f y = (f x)⁻¹
⊢ 1 ∈ J

Next tactic:
have H : 1 = y * x - (y * x - 1) := (sub_sub_cancel _ _).symm
/-- The kernel of a homomorphism to a field is a maximal ideal. -/
theorem ker_isMaximal_of_surjective {R K F : Type*} [Ring R] [Field K] [RingHomClass F R K] (f : F)
    (hf : Function.Surjective f) : (ker f).IsMaximal := by
  refine'
    Ideal.isMaximal_iff.mpr
      ⟨fun h1 => one_ne_zero' K <| map_one f ▸ (mem_ker f).mp h1, fun J x hJ hxf hxJ => _⟩
  obtain ⟨y, hy⟩ := hf (f x)⁻¹
  have H : 1 = y * x - (y * x - 1) := (sub_sub_cancel _ _).symm
  

Proof state:
case intro
R✝ : Type u
S : Type v
T : Type w
R : Type u_1
K : Type u_2
F : Type u_3
inst✝² : Ring R
inst✝¹ : Field K
inst✝ : RingHomClass F R K
f : F
hf : Function.Surjective ⇑f
J : Ideal R
x : R
hJ : ker f ≤ J
hxf : x ∉ ker f
hxJ : x ∈ J
y : R
hy : f y = (f x)⁻¹
H : 1 = y * x - (y * x - 1)
⊢ 1 ∈ J

Next tactic:
rw [H]
/-- The kernel of a homomorphism to a field is a maximal ideal. -/
theorem ker_isMaximal_of_surjective {R K F : Type*} [Ring R] [Field K] [RingHomClass F R K] (f : F)
    (hf : Function.Surjective f) : (ker f).IsMaximal := by
  refine'
    Ideal.isMaximal_iff.mpr
      ⟨fun h1 => one_ne_zero' K <| map_one f ▸ (mem_ker f).mp h1, fun J x hJ hxf hxJ => _⟩
  obtain ⟨y, hy⟩ := hf (f x)⁻¹
  have H : 1 = y * x - (y * x - 1) := (sub_sub_cancel _ _).symm
  rw [H]
  

Proof state:
case intro
R✝ : Type u
S : Type v
T : Type w
R : Type u_1
K : Type u_2
F : Type u_3
inst✝² : Ring R
inst✝¹ : Field K
inst✝ : RingHomClass F R K
f : F
hf : Function.Surjective ⇑f
J : Ideal R
x : R
hJ : ker f ≤ J
hxf : x ∉ ker f
hxJ : x ∈ J
y : R
hy : f y = (f x)⁻¹
H : 1 = y * x - (y * x - 1)
⊢ y * x - (y * x - 1) ∈ J

Next tactic:
refine' J.sub_mem (J.mul_mem_left _ hxJ) (hJ _)
/-- The kernel of a homomorphism to a field is a maximal ideal. -/
theorem ker_isMaximal_of_surjective {R K F : Type*} [Ring R] [Field K] [RingHomClass F R K] (f : F)
    (hf : Function.Surjective f) : (ker f).IsMaximal := by
  refine'
    Ideal.isMaximal_iff.mpr
      ⟨fun h1 => one_ne_zero' K <| map_one f ▸ (mem_ker f).mp h1, fun J x hJ hxf hxJ => _⟩
  obtain ⟨y, hy⟩ := hf (f x)⁻¹
  have H : 1 = y * x - (y * x - 1) := (sub_sub_cancel _ _).symm
  rw [H]
  refine' J.sub_mem (J.mul_mem_left _ hxJ) (hJ _)
  

Proof state:
case intro
R✝ : Type u
S : Type v
T : Type w
R : Type u_1
K : Type u_2
F : Type u_3
inst✝² : Ring R
inst✝¹ : Field K
inst✝ : RingHomClass F R K
f : F
hf : Function.Surjective ⇑f
J : Ideal R
x : R
hJ : ker f ≤ J
hxf : x ∉ ker f
hxJ : x ∈ J
y : R
hy : f y = (f x)⁻¹
H : 1 = y * x - (y * x - 1)
⊢ y * x - 1 ∈ ker f

Next tactic:
rw [mem_ker]
/-- The kernel of a homomorphism to a field is a maximal ideal. -/
theorem ker_isMaximal_of_surjective {R K F : Type*} [Ring R] [Field K] [RingHomClass F R K] (f : F)
    (hf : Function.Surjective f) : (ker f).IsMaximal := by
  refine'
    Ideal.isMaximal_iff.mpr
      ⟨fun h1 => one_ne_zero' K <| map_one f ▸ (mem_ker f).mp h1, fun J x hJ hxf hxJ => _⟩
  obtain ⟨y, hy⟩ := hf (f x)⁻¹
  have H : 1 = y * x - (y * x - 1) := (sub_sub_cancel _ _).symm
  rw [H]
  refine' J.sub_mem (J.mul_mem_left _ hxJ) (hJ _)
  rw [mem_ker]
  

Proof state:
case intro
R✝ : Type u
S : Type v
T : Type w
R : Type u_1
K : Type u_2
F : Type u_3
inst✝² : Ring R
inst✝¹ : Field K
inst✝ : RingHomClass F R K
f : F
hf : Function.Surjective ⇑f
J : Ideal R
x : R
hJ : ker f ≤ J
hxf : x ∉ ker f
hxJ : x ∈ J
y : R
hy : f y = (f x)⁻¹
H : 1 = y * x - (y * x - 1)
⊢ f (y * x - 1) = 0

Next tactic:
simp only [hy, map_sub, map_one, map_mul, inv_mul_cancel (mt (mem_ker f).mpr hxf), sub_self]
theorem map_eq_bot_iff_le_ker {I : Ideal R} (f : F) : I.map f = ⊥ ↔ I ≤ RingHom.ker f := by
  

Proof state:
R : Type u_1
S : Type u_2
F : Type u_3
inst✝¹ : Semiring R
inst✝ : Semiring S
rc : RingHomClass F R S
I : Ideal R
f : F
⊢ map f I = ⊥ ↔ I ≤ RingHom.ker f

Next tactic:
rw [RingHom.ker, eq_bot_iff, map_le_iff_le_comap]
theorem map_isPrime_of_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') {I : Ideal R}
    [IsPrime I] : IsPrime (map f I) := by
  

Proof state:
R : Type u_1
S : Type u_2
F : Type u_3
inst✝³ : Semiring R
inst✝² : Semiring S
rc : RingHomClass F R S
F' : Type u_4
inst✝¹ : RingEquivClass F' R S
f : F'
I : Ideal R
inst✝ : IsPrime I
⊢ IsPrime (map f I)

Next tactic:
have h : I.map f = I.map ((f : R ≃+* S) : R →+* S) := rfl
theorem map_isPrime_of_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') {I : Ideal R}
    [IsPrime I] : IsPrime (map f I) := by
  have h : I.map f = I.map ((f : R ≃+* S) : R →+* S) := rfl
  

Proof state:
R : Type u_1
S : Type u_2
F : Type u_3
inst✝³ : Semiring R
inst✝² : Semiring S
rc : RingHomClass F R S
F' : Type u_4
inst✝¹ : RingEquivClass F' R S
f : F'
I : Ideal R
inst✝ : IsPrime I
h : map f I = map (↑↑f) I
⊢ IsPrime (map f I)

Next tactic:
rw [h, map_comap_of_equiv I (f : R ≃+* S)]
theorem map_isPrime_of_equiv {F' : Type*} [RingEquivClass F' R S] (f : F') {I : Ideal R}
    [IsPrime I] : IsPrime (map f I) := by
  have h : I.map f = I.map ((f : R ≃+* S) : R →+* S) := rfl
  rw [h, map_comap_of_equiv I (f : R ≃+* S)]
  

Proof state:
R : Type u_1
S : Type u_2
F : Type u_3
inst✝³ : Semiring R
inst✝² : Semiring S
rc : RingHomClass F R S
F' : Type u_4
inst✝¹ : RingEquivClass F' R S
f : F'
I : Ideal R
inst✝ : IsPrime I
h : map f I = map (↑↑f) I
⊢ IsPrime (comap (RingEquiv.symm ↑f) I)

Next tactic:
exact Ideal.IsPrime.comap (RingEquiv.symm (f : R ≃+* S))
theorem map_sInf {A : Set (Ideal R)} {f : F} (hf : Function.Surjective f) :
    (∀ J ∈ A, RingHom.ker f ≤ J) → map f (sInf A) = sInf (map f '' A) := by
  

Proof state:
R : Type u_1
S : Type u_2
F : Type u_3
inst✝¹ : Ring R
inst✝ : Ring S
rc : RingHomClass F R S
A : Set (Ideal R)
f : F
hf : Function.Surjective ⇑f
⊢ (∀ J ∈ A, RingHom.ker f ≤ J) → map f (sInf A) = sInf (map f '' A)

Next tactic:
refine' fun h => le_antisymm (le_sInf _) _
theorem map_sInf {A : Set (Ideal R)} {f : F} (hf : Function.Surjective f) :
    (∀ J ∈ A, RingHom.ker f ≤ J) → map f (sInf A) = sInf (map f '' A) := by
  refine' fun h => le_antisymm (le_sInf _) _
  · 

Proof state:
case refine'_1
R : Type u_1
S : Type u_2
F : Type u_3
inst✝¹ : Ring R
inst✝ : Ring S
rc : RingHomClass F R S
A : Set (Ideal R)
f : F
hf : Function.Surjective ⇑f
h : ∀ J ∈ A, RingHom.ker f ≤ J
⊢ ∀ b ∈ map f '' A, map f (sInf A) ≤ b

Next tactic:
intro j hj y hy
theorem map_sInf {A : Set (Ideal R)} {f : F} (hf : Function.Surjective f) :
    (∀ J ∈ A, RingHom.ker f ≤ J) → map f (sInf A) = sInf (map f '' A) := by
  refine' fun h => le_antisymm (le_sInf _) _
  · intro j hj y hy
    

Proof state:
case refine'_1
R : Type u_1
S : Type u_2
F : Type u_3
inst✝¹ : Ring R
inst✝ : Ring S
rc : RingHomClass F R S
A : Set (Ideal R)
f : F
hf : Function.Surjective ⇑f
h : ∀ J ∈ A, RingHom.ker f ≤ J
j : Ideal S
hj : j ∈ map f '' A
y : S
hy : y ∈ map f (sInf A)
⊢ y ∈ j

Next tactic:
cases' (mem_map_iff_of_surjective f hf).1 hy with x hx
theorem map_sInf {A : Set (Ideal R)} {f : F} (hf : Function.Surjective f) :
    (∀ J ∈ A, RingHom.ker f ≤ J) → map f (sInf A) = sInf (map f '' A) := by
  refine' fun h => le_antisymm (le_sInf _) _
  · intro j hj y hy
    cases' (mem_map_iff_of_surjective f hf).1 hy with x hx
    

Proof state:
case refine'_1.intro
R : Type u_1
S : Type u_2
F : Type u_3
inst✝¹ : Ring R
inst✝ : Ring S
rc : RingHomClass F R S
A : Set (Ideal R)
f : F
hf : Function.Surjective ⇑f
h : ∀ J ∈ A, RingHom.ker f ≤ J
j : Ideal S
hj : j ∈ map f '' A
y : S
hy : y ∈ map f (sInf A)
x : R
hx : x ∈ sInf A ∧ f x = y
⊢ y ∈ j

Next tactic:
cases' (Set.mem_image _ _ _).mp hj with J hJ
theorem map_sInf {A : Set (Ideal R)} {f : F} (hf : Function.Surjective f) :
    (∀ J ∈ A, RingHom.ker f ≤ J) → map f (sInf A) = sInf (map f '' A) := by
  refine' fun h => le_antisymm (le_sInf _) _
  · intro j hj y hy
    cases' (mem_map_iff_of_surjective f hf).1 hy with x hx
    cases' (Set.mem_image _ _ _).mp hj with J hJ
    

Proof state:
case refine'_1.intro.intro
R : Type u_1
S : Type u_2
F : Type u_3
inst✝¹ : Ring R
inst✝ : Ring S
rc : RingHomClass F R S
A : Set (Ideal R)
f : F
hf : Function.Surjective ⇑f
h : ∀ J ∈ A, RingHom.ker f ≤ J
j : Ideal S
hj : j ∈ map f '' A
y : S
hy : y ∈ map f (sInf A)
x : R
hx : x ∈ sInf A ∧ f x = y
J : Ideal R
hJ : J ∈ A ∧ map f J = j
⊢ y ∈ j

Next tactic:
rw [← hJ.right, ← hx.right]
theorem map_sInf {A : Set (Ideal R)} {f : F} (hf : Function.Surjective f) :
    (∀ J ∈ A, RingHom.ker f ≤ J) → map f (sInf A) = sInf (map f '' A) := by
  refine' fun h => le_antisymm (le_sInf _) _
  · intro j hj y hy
    cases' (mem_map_iff_of_surjective f hf).1 hy with x hx
    cases' (Set.mem_image _ _ _).mp hj with J hJ
    rw [← hJ.right, ← hx.right]
    

Proof state:
case refine'_1.intro.intro
R : Type u_1
S : Type u_2
F : Type u_3
inst✝¹ : Ring R
inst✝ : Ring S
rc : RingHomClass F R S
A : Set (Ideal R)
f : F
hf : Function.Surjective ⇑f
h : ∀ J ∈ A, RingHom.ker f ≤ J
j : Ideal S
hj : j ∈ map f '' A
y : S
hy : y ∈ map f (sInf A)
x : R
hx : x ∈ sInf A ∧ f x = y
J : Ideal R
hJ : J ∈ A ∧ map f J = j
⊢ f x ∈ map f J

Next tactic:
exact mem_map_of_mem f (sInf_le_of_le hJ.left (le_of_eq rfl) hx.left)
theorem map_sInf {A : Set (Ideal R)} {f : F} (hf : Function.Surjective f) :
    (∀ J ∈ A, RingHom.ker f ≤ J) → map f (sInf A) = sInf (map f '' A) := by
  refine' fun h => le_antisymm (le_sInf _) _
  · intro j hj y hy
    cases' (mem_map_iff_of_surjective f hf).1 hy with x hx
    cases' (Set.mem_image _ _ _).mp hj with J hJ
    rw [← hJ.right, ← hx.right]
    exact mem_map_of_mem f (sInf_le_of_le hJ.left (le_of_eq rfl) hx.left)
  · 

Proof state:
case refine'_2
R : Type u_1
S : Type u_2
F : Type u_3
inst✝¹ : Ring R
inst✝ : Ring S
rc : RingHomClass F R S
A : Set (Ideal R)
f : F
hf : Function.Surjective ⇑f
h : ∀ J ∈ A, RingHom.ker f ≤ J
⊢ sInf (map f '' A) ≤ map f (sInf A)

Next tactic:
intro y hy
theorem map_sInf {A : Set (Ideal R)} {f : F} (hf : Function.Surjective f) :
    (∀ J ∈ A, RingHom.ker f ≤ J) → map f (sInf A) = sInf (map f '' A) := by
  refine' fun h => le_antisymm (le_sInf _) _
  · intro j hj y hy
    cases' (mem_map_iff_of_surjective f hf).1 hy with x hx
    cases' (Set.mem_image _ _ _).mp hj with J hJ
    rw [← hJ.right, ← hx.right]
    exact mem_map_of_mem f (sInf_le_of_le hJ.left (le_of_eq rfl) hx.left)
  · intro y hy
    

Proof state:
case refine'_2
R : Type u_1
S : Type u_2
F : Type u_3
inst✝¹ : Ring R
inst✝ : Ring S
rc : RingHomClass F R S
A : Set (Ideal R)
f : F
hf : Function.Surjective ⇑f
h : ∀ J ∈ A, RingHom.ker f ≤ J
y : S
hy : y ∈ sInf (map f '' A)
⊢ y ∈ map f (sInf A)

Next tactic:
cases' hf y with x hx
theorem map_sInf {A : Set (Ideal R)} {f : F} (hf : Function.Surjective f) :
    (∀ J ∈ A, RingHom.ker f ≤ J) → map f (sInf A) = sInf (map f '' A) := by
  refine' fun h => le_antisymm (le_sInf _) _
  · intro j hj y hy
    cases' (mem_map_iff_of_surjective f hf).1 hy with x hx
    cases' (Set.mem_image _ _ _).mp hj with J hJ
    rw [← hJ.right, ← hx.right]
    exact mem_map_of_mem f (sInf_le_of_le hJ.left (le_of_eq rfl) hx.left)
  · intro y hy
    cases' hf y with x hx
    

Proof state:
case refine'_2.intro
R : Type u_1
S : Type u_2
F : Type u_3
inst✝¹ : Ring R
inst✝ : Ring S
rc : RingHomClass F R S
A : Set (Ideal R)
f : F
hf : Function.Surjective ⇑f
h : ∀ J ∈ A, RingHom.ker f ≤ J
y : S
hy : y ∈ sInf (map f '' A)
x : R
hx : f x = y
⊢ y ∈ map f (sInf A)

Next tactic:
refine' hx ▸ mem_map_of_mem f _