l3lab/ntp-mathlib huggingface dataset:
@[simp]
theorem smul_top_eq_map {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
    (I : Ideal R) : I • (⊤ : Submodule R S) = (I.map (algebraMap R S)).restrictScalars R := by
  refine'
    le_antisymm (Submodule.smul_le.mpr fun r hr y _ => _) fun x hx =>
      Submodule.span_induction hx _ _ _ _
  · rw [Algebra.smul_def]
    exact mul_mem_right _ _ (mem_map_of_mem _ hr)
  · rintro _ ⟨x, hx, rfl⟩
    rw [← mul_one (algebraMap R S x), ← Algebra.smul_def]
    exact Submodule.smul_mem_smul hx Submodule.mem_top
  · exact Submodule.zero_mem _
  · 

Proof state:
case refine'_4
R✝ : Type u
S✝ : Type v
F : Type u_1
inst✝⁴ : Semiring R✝
inst✝³ : Semiring S✝
rc : RingHomClass F R✝ S✝
f : F
I✝ J : Ideal R✝
K L : Ideal S✝
G : Type u_2
rcg : RingHomClass G S✝ R✝
ι : Sort u_3
R : Type u_4
S : Type u_5
inst✝² : CommSemiring R
inst✝¹ : CommSemiring S
inst✝ : Algebra R S
I : Ideal R
x : S
hx : x ∈ Submodule.restrictScalars R (map (algebraMap R S) I)
⊢ ∀ (x y : S), x ∈ I • ⊤ → y ∈ I • ⊤ → x + y ∈ I • ⊤

Next tactic:
intro x y
@[simp]
theorem smul_top_eq_map {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
    (I : Ideal R) : I • (⊤ : Submodule R S) = (I.map (algebraMap R S)).restrictScalars R := by
  refine'
    le_antisymm (Submodule.smul_le.mpr fun r hr y _ => _) fun x hx =>
      Submodule.span_induction hx _ _ _ _
  · rw [Algebra.smul_def]
    exact mul_mem_right _ _ (mem_map_of_mem _ hr)
  · rintro _ ⟨x, hx, rfl⟩
    rw [← mul_one (algebraMap R S x), ← Algebra.smul_def]
    exact Submodule.smul_mem_smul hx Submodule.mem_top
  · exact Submodule.zero_mem _
  · intro x y
    

Proof state:
case refine'_4
R✝ : Type u
S✝ : Type v
F : Type u_1
inst✝⁴ : Semiring R✝
inst✝³ : Semiring S✝
rc : RingHomClass F R✝ S✝
f : F
I✝ J : Ideal R✝
K L : Ideal S✝
G : Type u_2
rcg : RingHomClass G S✝ R✝
ι : Sort u_3
R : Type u_4
S : Type u_5
inst✝² : CommSemiring R
inst✝¹ : CommSemiring S
inst✝ : Algebra R S
I : Ideal R
x✝ : S
hx : x✝ ∈ Submodule.restrictScalars R (map (algebraMap R S) I)
x y : S
⊢ x ∈ I • ⊤ → y ∈ I • ⊤ → x + y ∈ I • ⊤

Next tactic:
exact Submodule.add_mem _
@[simp]
theorem smul_top_eq_map {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
    (I : Ideal R) : I • (⊤ : Submodule R S) = (I.map (algebraMap R S)).restrictScalars R := by
  refine'
    le_antisymm (Submodule.smul_le.mpr fun r hr y _ => _) fun x hx =>
      Submodule.span_induction hx _ _ _ _
  · rw [Algebra.smul_def]
    exact mul_mem_right _ _ (mem_map_of_mem _ hr)
  · rintro _ ⟨x, hx, rfl⟩
    rw [← mul_one (algebraMap R S x), ← Algebra.smul_def]
    exact Submodule.smul_mem_smul hx Submodule.mem_top
  · exact Submodule.zero_mem _
  · intro x y
    exact Submodule.add_mem _
  

Proof state:
case refine'_5
R✝ : Type u
S✝ : Type v
F : Type u_1
inst✝⁴ : Semiring R✝
inst✝³ : Semiring S✝
rc : RingHomClass F R✝ S✝
f : F
I✝ J : Ideal R✝
K L : Ideal S✝
G : Type u_2
rcg : RingHomClass G S✝ R✝
ι : Sort u_3
R : Type u_4
S : Type u_5
inst✝² : CommSemiring R
inst✝¹ : CommSemiring S
inst✝ : Algebra R S
I : Ideal R
x : S
hx : x ∈ Submodule.restrictScalars R (map (algebraMap R S) I)
⊢ ∀ (a x : S), x ∈ I • ⊤ → a • x ∈ I • ⊤

Next tactic:
intro a x hx
@[simp]
theorem smul_top_eq_map {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
    (I : Ideal R) : I • (⊤ : Submodule R S) = (I.map (algebraMap R S)).restrictScalars R := by
  refine'
    le_antisymm (Submodule.smul_le.mpr fun r hr y _ => _) fun x hx =>
      Submodule.span_induction hx _ _ _ _
  · rw [Algebra.smul_def]
    exact mul_mem_right _ _ (mem_map_of_mem _ hr)
  · rintro _ ⟨x, hx, rfl⟩
    rw [← mul_one (algebraMap R S x), ← Algebra.smul_def]
    exact Submodule.smul_mem_smul hx Submodule.mem_top
  · exact Submodule.zero_mem _
  · intro x y
    exact Submodule.add_mem _
  intro a x hx
  

Proof state:
case refine'_5
R✝ : Type u
S✝ : Type v
F : Type u_1
inst✝⁴ : Semiring R✝
inst✝³ : Semiring S✝
rc : RingHomClass F R✝ S✝
f : F
I✝ J : Ideal R✝
K L : Ideal S✝
G : Type u_2
rcg : RingHomClass G S✝ R✝
ι : Sort u_3
R : Type u_4
S : Type u_5
inst✝² : CommSemiring R
inst✝¹ : CommSemiring S
inst✝ : Algebra R S
I : Ideal R
x✝ : S
hx✝ : x✝ ∈ Submodule.restrictScalars R (map (algebraMap R S) I)
a x : S
hx : x ∈ I • ⊤
⊢ a • x ∈ I • ⊤

Next tactic:
refine' Submodule.smul_induction_on hx _ _
@[simp]
theorem smul_top_eq_map {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
    (I : Ideal R) : I • (⊤ : Submodule R S) = (I.map (algebraMap R S)).restrictScalars R := by
  refine'
    le_antisymm (Submodule.smul_le.mpr fun r hr y _ => _) fun x hx =>
      Submodule.span_induction hx _ _ _ _
  · rw [Algebra.smul_def]
    exact mul_mem_right _ _ (mem_map_of_mem _ hr)
  · rintro _ ⟨x, hx, rfl⟩
    rw [← mul_one (algebraMap R S x), ← Algebra.smul_def]
    exact Submodule.smul_mem_smul hx Submodule.mem_top
  · exact Submodule.zero_mem _
  · intro x y
    exact Submodule.add_mem _
  intro a x hx
  refine' Submodule.smul_induction_on hx _ _
  · 

Proof state:
case refine'_5.refine'_1
R✝ : Type u
S✝ : Type v
F : Type u_1
inst✝⁴ : Semiring R✝
inst✝³ : Semiring S✝
rc : RingHomClass F R✝ S✝
f : F
I✝ J : Ideal R✝
K L : Ideal S✝
G : Type u_2
rcg : RingHomClass G S✝ R✝
ι : Sort u_3
R : Type u_4
S : Type u_5
inst✝² : CommSemiring R
inst✝¹ : CommSemiring S
inst✝ : Algebra R S
I : Ideal R
x✝ : S
hx✝ : x✝ ∈ Submodule.restrictScalars R (map (algebraMap R S) I)
a x : S
hx : x ∈ I • ⊤
⊢ ∀ r ∈ I, ∀ n ∈ ⊤, a • r • n ∈ I • ⊤

Next tactic:
intro r hr s _
@[simp]
theorem smul_top_eq_map {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
    (I : Ideal R) : I • (⊤ : Submodule R S) = (I.map (algebraMap R S)).restrictScalars R := by
  refine'
    le_antisymm (Submodule.smul_le.mpr fun r hr y _ => _) fun x hx =>
      Submodule.span_induction hx _ _ _ _
  · rw [Algebra.smul_def]
    exact mul_mem_right _ _ (mem_map_of_mem _ hr)
  · rintro _ ⟨x, hx, rfl⟩
    rw [← mul_one (algebraMap R S x), ← Algebra.smul_def]
    exact Submodule.smul_mem_smul hx Submodule.mem_top
  · exact Submodule.zero_mem _
  · intro x y
    exact Submodule.add_mem _
  intro a x hx
  refine' Submodule.smul_induction_on hx _ _
  · intro r hr s _
    

Proof state:
case refine'_5.refine'_1
R✝ : Type u
S✝ : Type v
F : Type u_1
inst✝⁴ : Semiring R✝
inst✝³ : Semiring S✝
rc : RingHomClass F R✝ S✝
f : F
I✝ J : Ideal R✝
K L : Ideal S✝
G : Type u_2
rcg : RingHomClass G S✝ R✝
ι : Sort u_3
R : Type u_4
S : Type u_5
inst✝² : CommSemiring R
inst✝¹ : CommSemiring S
inst✝ : Algebra R S
I : Ideal R
x✝ : S
hx✝ : x✝ ∈ Submodule.restrictScalars R (map (algebraMap R S) I)
a x : S
hx : x ∈ I • ⊤
r : R
hr : r ∈ I
s : S
a✝ : s ∈ ⊤
⊢ a • r • s ∈ I • ⊤

Next tactic:
rw [smul_comm]
@[simp]
theorem smul_top_eq_map {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
    (I : Ideal R) : I • (⊤ : Submodule R S) = (I.map (algebraMap R S)).restrictScalars R := by
  refine'
    le_antisymm (Submodule.smul_le.mpr fun r hr y _ => _) fun x hx =>
      Submodule.span_induction hx _ _ _ _
  · rw [Algebra.smul_def]
    exact mul_mem_right _ _ (mem_map_of_mem _ hr)
  · rintro _ ⟨x, hx, rfl⟩
    rw [← mul_one (algebraMap R S x), ← Algebra.smul_def]
    exact Submodule.smul_mem_smul hx Submodule.mem_top
  · exact Submodule.zero_mem _
  · intro x y
    exact Submodule.add_mem _
  intro a x hx
  refine' Submodule.smul_induction_on hx _ _
  · intro r hr s _
    rw [smul_comm]
    

Proof state:
case refine'_5.refine'_1
R✝ : Type u
S✝ : Type v
F : Type u_1
inst✝⁴ : Semiring R✝
inst✝³ : Semiring S✝
rc : RingHomClass F R✝ S✝
f : F
I✝ J : Ideal R✝
K L : Ideal S✝
G : Type u_2
rcg : RingHomClass G S✝ R✝
ι : Sort u_3
R : Type u_4
S : Type u_5
inst✝² : CommSemiring R
inst✝¹ : CommSemiring S
inst✝ : Algebra R S
I : Ideal R
x✝ : S
hx✝ : x✝ ∈ Submodule.restrictScalars R (map (algebraMap R S) I)
a x : S
hx : x ∈ I • ⊤
r : R
hr : r ∈ I
s : S
a✝ : s ∈ ⊤
⊢ r • a • s ∈ I • ⊤

Next tactic:
exact Submodule.smul_mem_smul hr Submodule.mem_top
@[simp]
theorem smul_top_eq_map {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
    (I : Ideal R) : I • (⊤ : Submodule R S) = (I.map (algebraMap R S)).restrictScalars R := by
  refine'
    le_antisymm (Submodule.smul_le.mpr fun r hr y _ => _) fun x hx =>
      Submodule.span_induction hx _ _ _ _
  · rw [Algebra.smul_def]
    exact mul_mem_right _ _ (mem_map_of_mem _ hr)
  · rintro _ ⟨x, hx, rfl⟩
    rw [← mul_one (algebraMap R S x), ← Algebra.smul_def]
    exact Submodule.smul_mem_smul hx Submodule.mem_top
  · exact Submodule.zero_mem _
  · intro x y
    exact Submodule.add_mem _
  intro a x hx
  refine' Submodule.smul_induction_on hx _ _
  · intro r hr s _
    rw [smul_comm]
    exact Submodule.smul_mem_smul hr Submodule.mem_top
  · 

Proof state:
case refine'_5.refine'_2
R✝ : Type u
S✝ : Type v
F : Type u_1
inst✝⁴ : Semiring R✝
inst✝³ : Semiring S✝
rc : RingHomClass F R✝ S✝
f : F
I✝ J : Ideal R✝
K L : Ideal S✝
G : Type u_2
rcg : RingHomClass G S✝ R✝
ι : Sort u_3
R : Type u_4
S : Type u_5
inst✝² : CommSemiring R
inst✝¹ : CommSemiring S
inst✝ : Algebra R S
I : Ideal R
x✝ : S
hx✝ : x✝ ∈ Submodule.restrictScalars R (map (algebraMap R S) I)
a x : S
hx : x ∈ I • ⊤
⊢ ∀ (x y : S), a • x ∈ I • ⊤ → a • y ∈ I • ⊤ → a • (x + y) ∈ I • ⊤

Next tactic:
intro x y hx hy
@[simp]
theorem smul_top_eq_map {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
    (I : Ideal R) : I • (⊤ : Submodule R S) = (I.map (algebraMap R S)).restrictScalars R := by
  refine'
    le_antisymm (Submodule.smul_le.mpr fun r hr y _ => _) fun x hx =>
      Submodule.span_induction hx _ _ _ _
  · rw [Algebra.smul_def]
    exact mul_mem_right _ _ (mem_map_of_mem _ hr)
  · rintro _ ⟨x, hx, rfl⟩
    rw [← mul_one (algebraMap R S x), ← Algebra.smul_def]
    exact Submodule.smul_mem_smul hx Submodule.mem_top
  · exact Submodule.zero_mem _
  · intro x y
    exact Submodule.add_mem _
  intro a x hx
  refine' Submodule.smul_induction_on hx _ _
  · intro r hr s _
    rw [smul_comm]
    exact Submodule.smul_mem_smul hr Submodule.mem_top
  · intro x y hx hy
    

Proof state:
case refine'_5.refine'_2
R✝ : Type u
S✝ : Type v
F : Type u_1
inst✝⁴ : Semiring R✝
inst✝³ : Semiring S✝
rc : RingHomClass F R✝ S✝
f : F
I✝ J : Ideal R✝
K L : Ideal S✝
G : Type u_2
rcg : RingHomClass G S✝ R✝
ι : Sort u_3
R : Type u_4
S : Type u_5
inst✝² : CommSemiring R
inst✝¹ : CommSemiring S
inst✝ : Algebra R S
I : Ideal R
x✝¹ : S
hx✝¹ : x✝¹ ∈ Submodule.restrictScalars R (map (algebraMap R S) I)
a x✝ : S
hx✝ : x✝ ∈ I • ⊤
x y : S
hx : a • x ∈ I • ⊤
hy : a • y ∈ I • ⊤
⊢ a • (x + y) ∈ I • ⊤

Next tactic:
rw [smul_add]
@[simp]
theorem smul_top_eq_map {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S]
    (I : Ideal R) : I • (⊤ : Submodule R S) = (I.map (algebraMap R S)).restrictScalars R := by
  refine'
    le_antisymm (Submodule.smul_le.mpr fun r hr y _ => _) fun x hx =>
      Submodule.span_induction hx _ _ _ _
  · rw [Algebra.smul_def]
    exact mul_mem_right _ _ (mem_map_of_mem _ hr)
  · rintro _ ⟨x, hx, rfl⟩
    rw [← mul_one (algebraMap R S x), ← Algebra.smul_def]
    exact Submodule.smul_mem_smul hx Submodule.mem_top
  · exact Submodule.zero_mem _
  · intro x y
    exact Submodule.add_mem _
  intro a x hx
  refine' Submodule.smul_induction_on hx _ _
  · intro r hr s _
    rw [smul_comm]
    exact Submodule.smul_mem_smul hr Submodule.mem_top
  · intro x y hx hy
    rw [smul_add]
    

Proof state:
case refine'_5.refine'_2
R✝ : Type u
S✝ : Type v
F : Type u_1
inst✝⁴ : Semiring R✝
inst✝³ : Semiring S✝
rc : RingHomClass F R✝ S✝
f : F
I✝ J : Ideal R✝
K L : Ideal S✝
G : Type u_2
rcg : RingHomClass G S✝ R✝
ι : Sort u_3
R : Type u_4
S : Type u_5
inst✝² : CommSemiring R
inst✝¹ : CommSemiring S
inst✝ : Algebra R S
I : Ideal R
x✝¹ : S
hx✝¹ : x✝¹ ∈ Submodule.restrictScalars R (map (algebraMap R S) I)
a x✝ : S
hx✝ : x✝ ∈ I • ⊤
x y : S
hx : a • x ∈ I • ⊤
hy : a • y ∈ I • ⊤
⊢ a • x + a • y ∈ I • ⊤

Next tactic:
exact Submodule.add_mem _ hx hy
theorem comap_bot_le_of_injective : comap f ⊥ ≤ I := by
  

Proof state:
R : Type u
S : Type v
F : Type u_1
inst✝¹ : Semiring R
inst✝ : Semiring S
rc : RingHomClass F R S
f : F
I J : Ideal R
K L : Ideal S
G : Type u_2
rcg : RingHomClass G S R
ι : Sort u_3
hf : Function.Injective ⇑f
⊢ comap f ⊥ ≤ I

Next tactic:
refine' le_trans (fun x hx => _) bot_le
theorem comap_bot_le_of_injective : comap f ⊥ ≤ I := by
  refine' le_trans (fun x hx => _) bot_le
  

Proof state:
R : Type u
S : Type v
F : Type u_1
inst✝¹ : Semiring R
inst✝ : Semiring S
rc : RingHomClass F R S
f : F
I J : Ideal R
K L : Ideal S
G : Type u_2
rcg : RingHomClass G S R
ι : Sort u_3
hf : Function.Injective ⇑f
x : R
hx : x ∈ comap f ⊥
⊢ x ∈ ⊥

Next tactic:
rw [mem_comap, Submodule.mem_bot, ← map_zero f] at hx
theorem comap_bot_le_of_injective : comap f ⊥ ≤ I := by
  refine' le_trans (fun x hx => _) bot_le
  rw [mem_comap, Submodule.mem_bot, ← map_zero f] at hx
  

Proof state:
R : Type u
S : Type v
F : Type u_1
inst✝¹ : Semiring R
inst✝ : Semiring S
rc : RingHomClass F R S
f : F
I J : Ideal R
K L : Ideal S
G : Type u_2
rcg : RingHomClass G S R
ι : Sort u_3
hf : Function.Injective ⇑f
x : R
hx : f x = f 0
⊢ x ∈ ⊥

Next tactic:
exact Eq.symm (hf hx) ▸ Submodule.zero_mem ⊥
/-- If `f : R ≃+* S` is a ring isomorphism and `I : Ideal R`, then `map f.symm (map f I) = I`. -/
@[simp]
theorem map_of_equiv (I : Ideal R) (f : R ≃+* S) :
    (I.map (f : R →+* S)).map (f.symm : S →+* R) = I := by
  

Proof state:
R : Type u
S : Type v
F : Type u_1
inst✝¹ : Semiring R
inst✝ : Semiring S
rc : RingHomClass F R S
f✝ : F
I✝ J : Ideal R
K L : Ideal S
G : Type u_2
rcg : RingHomClass G S R
ι : Sort u_3
I : Ideal R
f : R ≃+* S
⊢ map (↑(RingEquiv.symm f)) (map (↑f) I) = I

Next tactic:
rw [← RingEquiv.toRingHom_eq_coe, ← RingEquiv.toRingHom_eq_coe, map_map,
    RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, map_id]
/-- If `f : R ≃+* S` is a ring isomorphism and `I : Ideal R`,
  then `comap f (comap f.symm I) = I`. -/
@[simp]
theorem comap_of_equiv (I : Ideal R) (f : R ≃+* S) :
    (I.comap (f.symm : S →+* R)).comap (f : R →+* S) = I := by
  

Proof state:
R : Type u
S : Type v
F : Type u_1
inst✝¹ : Semiring R
inst✝ : Semiring S
rc : RingHomClass F R S
f✝ : F
I✝ J : Ideal R
K L : Ideal S
G : Type u_2
rcg : RingHomClass G S R
ι : Sort u_3
I : Ideal R
f : R ≃+* S
⊢ comap (↑f) (comap (↑(RingEquiv.symm f)) I) = I

Next tactic:
rw [← RingEquiv.toRingHom_eq_coe, ← RingEquiv.toRingHom_eq_coe, comap_comap,
    RingEquiv.toRingHom_eq_coe, RingEquiv.toRingHom_eq_coe, RingEquiv.symm_comp, comap_id]
theorem comap_map_of_surjective (I : Ideal R) : comap f (map f I) = I ⊔ comap f ⊥ :=
  le_antisymm
    (fun r h =>
      let ⟨s, hsi, hfsr⟩ := mem_image_of_mem_map_of_surjective f hf h
      Submodule.mem_sup.2
        ⟨s, hsi, r - s, (Submodule.mem_bot S).2 <| by 

Proof state:
R : Type u
S : Type v
F : Type u_1
inst✝² : Ring R
inst✝¹ : Ring S
inst✝ : RingHomClass F R S
f : F
I✝ : Ideal R
hf : Function.Surjective ⇑f
I : Ideal R
r : R
h : f r ∈ map f I
s : R
hsi : s ∈ ↑I
hfsr : f s = f r
⊢ f (r - s) = 0

Next tactic:
rw [map_sub, hfsr, sub_self]
theorem map_eq_top_or_isMaximal_of_surjective {I : Ideal R} (H : IsMaximal I) :
    map f I = ⊤ ∨ IsMaximal (map f I) := by
  

Proof state:
R : Type u
S : Type v
F : Type u_1
inst✝² : Ring R
inst✝¹ : Ring S
inst✝ : RingHomClass F R S
f : F
I✝ : Ideal R
hf : Function.Surjective ⇑f
I : Ideal R
H : IsMaximal I
⊢ map f I = ⊤ ∨ IsMaximal (map f I)

Next tactic:
refine' or_iff_not_imp_left.2 fun ne_top => ⟨⟨fun h => ne_top h, fun J hJ => _⟩⟩
theorem map_eq_top_or_isMaximal_of_surjective {I : Ideal R} (H : IsMaximal I) :
    map f I = ⊤ ∨ IsMaximal (map f I) := by
  refine' or_iff_not_imp_left.2 fun ne_top => ⟨⟨fun h => ne_top h, fun J hJ => _⟩⟩
  · 

Proof state:
R : Type u
S : Type v
F : Type u_1
inst✝² : Ring R
inst✝¹ : Ring S
inst✝ : RingHomClass F R S
f : F
I✝ : Ideal R
hf : Function.Surjective ⇑f
I : Ideal R
H : IsMaximal I
ne_top : ¬map f I = ⊤
J : Ideal S
hJ : map f I < J
⊢ J = ⊤

Next tactic:
refine'
      (relIsoOfSurjective f hf).injective
        (Subtype.ext_iff.2 (Eq.trans (H.1.2 (comap f J) (lt_of_le_of_ne _ _)) comap_top.symm))
theorem map_eq_top_or_isMaximal_of_surjective {I : Ideal R} (H : IsMaximal I) :
    map f I = ⊤ ∨ IsMaximal (map f I) := by
  refine' or_iff_not_imp_left.2 fun ne_top => ⟨⟨fun h => ne_top h, fun J hJ => _⟩⟩
  · refine'
      (relIsoOfSurjective f hf).injective
        (Subtype.ext_iff.2 (Eq.trans (H.1.2 (comap f J) (lt_of_le_of_ne _ _)) comap_top.symm))
    · 

Proof state:
case refine'_1
R : Type u
S : Type v
F : Type u_1
inst✝² : Ring R
inst✝¹ : Ring S
inst✝ : RingHomClass F R S
f : F
I✝ : Ideal R
hf : Function.Surjective ⇑f
I : Ideal R
H : IsMaximal I
ne_top : ¬map f I = ⊤
J : Ideal S
hJ : map f I < J
⊢ I ≤ comap f J

Next tactic:
exact map_le_iff_le_comap.1 (le_of_lt hJ)
theorem map_eq_top_or_isMaximal_of_surjective {I : Ideal R} (H : IsMaximal I) :
    map f I = ⊤ ∨ IsMaximal (map f I) := by
  refine' or_iff_not_imp_left.2 fun ne_top => ⟨⟨fun h => ne_top h, fun J hJ => _⟩⟩
  · refine'
      (relIsoOfSurjective f hf).injective
        (Subtype.ext_iff.2 (Eq.trans (H.1.2 (comap f J) (lt_of_le_of_ne _ _)) comap_top.symm))
    · exact map_le_iff_le_comap.1 (le_of_lt hJ)
    · 

Proof state:
case refine'_2
R : Type u
S : Type v
F : Type u_1
inst✝² : Ring R
inst✝¹ : Ring S
inst✝ : RingHomClass F R S
f : F
I✝ : Ideal R
hf : Function.Surjective ⇑f
I : Ideal R
H : IsMaximal I
ne_top : ¬map f I = ⊤
J : Ideal S
hJ : map f I < J
⊢ I ≠ comap f J

Next tactic:
exact fun h => hJ.right (le_map_of_comap_le_of_surjective f hf (le_of_eq h.symm))
theorem comap_isMaximal_of_surjective {K : Ideal S} [H : IsMaximal K] : IsMaximal (comap f K) := by
  

Proof state:
R : Type u
S : Type v
F : Type u_1
inst✝² : Ring R
inst✝¹ : Ring S
inst✝ : RingHomClass F R S
f : F
I : Ideal R
hf : Function.Surjective ⇑f
K : Ideal S
H : IsMaximal K
⊢ IsMaximal (comap f K)

Next tactic:
refine' ⟨⟨comap_ne_top _ H.1.1, fun J hJ => _⟩⟩
theorem comap_isMaximal_of_surjective {K : Ideal S} [H : IsMaximal K] : IsMaximal (comap f K) := by
  refine' ⟨⟨comap_ne_top _ H.1.1, fun J hJ => _⟩⟩
  

Proof state:
R : Type u
S : Type v
F : Type u_1
inst✝² : Ring R
inst✝¹ : Ring S
inst✝ : RingHomClass F R S
f : F
I : Ideal R
hf : Function.Surjective ⇑f
K : Ideal S
H : IsMaximal K
J : Ideal R
hJ : comap f K < J
⊢ J = ⊤

Next tactic:
suffices map f J = ⊤ by
    have := congr_arg (comap f) this
    rw [comap_top, comap_map_of_surjective _ hf, eq_top_iff] at this
    rw [eq_top_iff]
    exact le_trans this (sup_le (le_of_eq rfl) (le_trans (comap_mono bot_le) (le_of_lt hJ)))
theorem comap_isMaximal_of_surjective {K : Ideal S} [H : IsMaximal K] : IsMaximal (comap f K) := by
  refine' ⟨⟨comap_ne_top _ H.1.1, fun J hJ => _⟩⟩
  suffices map f J = ⊤ by
    

Proof state:
R : Type u
S : Type v
F : Type u_1
inst✝² : Ring R
inst✝¹ : Ring S
inst✝ : RingHomClass F R S
f : F
I : Ideal R
hf : Function.Surjective ⇑f
K : Ideal S
H : IsMaximal K
J : Ideal R
hJ : comap f K < J
this : map f J = ⊤
⊢ J = ⊤

Next tactic:
have := congr_arg (comap f) this
theorem comap_isMaximal_of_surjective {K : Ideal S} [H : IsMaximal K] : IsMaximal (comap f K) := by
  refine' ⟨⟨comap_ne_top _ H.1.1, fun J hJ => _⟩⟩
  suffices map f J = ⊤ by
    have := congr_arg (comap f) this
    

Proof state:
R : Type u
S : Type v
F : Type u_1
inst✝² : Ring R
inst✝¹ : Ring S
inst✝ : RingHomClass F R S
f : F
I : Ideal R
hf : Function.Surjective ⇑f
K : Ideal S
H : IsMaximal K
J : Ideal R
hJ : comap f K < J
this✝ : map f J = ⊤
this : comap f (map f J) = comap f ⊤
⊢ J = ⊤

Next tactic:
rw [comap_top, comap_map_of_surjective _ hf, eq_top_iff] at this
theorem comap_isMaximal_of_surjective {K : Ideal S} [H : IsMaximal K] : IsMaximal (comap f K) := by
  refine' ⟨⟨comap_ne_top _ H.1.1, fun J hJ => _⟩⟩
  suffices map f J = ⊤ by
    have := congr_arg (comap f) this
    rw [comap_top, comap_map_of_surjective _ hf, eq_top_iff] at this
    

Proof state:
R : Type u
S : Type v
F : Type u_1
inst✝² : Ring R
inst✝¹ : Ring S
inst✝ : RingHomClass F R S
f : F
I : Ideal R
hf : Function.Surjective ⇑f
K : Ideal S
H : IsMaximal K
J : Ideal R
hJ : comap f K < J
this✝ : map f J = ⊤
this : ⊤ ≤ J ⊔ comap f ⊥
⊢ J = ⊤

Next tactic:
rw [eq_top_iff]
theorem comap_isMaximal_of_surjective {K : Ideal S} [H : IsMaximal K] : IsMaximal (comap f K) := by
  refine' ⟨⟨comap_ne_top _ H.1.1, fun J hJ => _⟩⟩
  suffices map f J = ⊤ by
    have := congr_arg (comap f) this
    rw [comap_top, comap_map_of_surjective _ hf, eq_top_iff] at this
    rw [eq_top_iff]
    

Proof state:
R : Type u
S : Type v
F : Type u_1
inst✝² : Ring R
inst✝¹ : Ring S
inst✝ : RingHomClass F R S
f : F
I : Ideal R
hf : Function.Surjective ⇑f
K : Ideal S
H : IsMaximal K
J : Ideal R
hJ : comap f K < J
this✝ : map f J = ⊤
this : ⊤ ≤ J ⊔ comap f ⊥
⊢ ⊤ ≤ J

Next tactic:
exact le_trans this (sup_le (le_of_eq rfl) (le_trans (comap_mono bot_le) (le_of_lt hJ)))
theorem comap_isMaximal_of_surjective {K : Ideal S} [H : IsMaximal K] : IsMaximal (comap f K) := by
  refine' ⟨⟨comap_ne_top _ H.1.1, fun J hJ => _⟩⟩
  suffices map f J = ⊤ by
    have := congr_arg (comap f) this
    rw [comap_top, comap_map_of_surjective _ hf, eq_top_iff] at this
    rw [eq_top_iff]
    exact le_trans this (sup_le (le_of_eq rfl) (le_trans (comap_mono bot_le) (le_of_lt hJ)))
  

Proof state:
R : Type u
S : Type v
F : Type u_1
inst✝² : Ring R
inst✝¹ : Ring S
inst✝ : RingHomClass F R S
f : F
I : Ideal R
hf : Function.Surjective ⇑f
K : Ideal S
H : IsMaximal K
J : Ideal R
hJ : comap f K < J
⊢ map f J = ⊤

Next tactic:
refine'
    H.1.2 (map f J)
      (lt_of_le_of_ne (le_map_of_comap_le_of_surjective _ hf (le_of_lt hJ)) fun h =>
        ne_of_lt hJ (_root_.trans (congr_arg (comap f) h) _))
theorem comap_isMaximal_of_surjective {K : Ideal S} [H : IsMaximal K] : IsMaximal (comap f K) := by
  refine' ⟨⟨comap_ne_top _ H.1.1, fun J hJ => _⟩⟩
  suffices map f J = ⊤ by
    have := congr_arg (comap f) this
    rw [comap_top, comap_map_of_surjective _ hf, eq_top_iff] at this
    rw [eq_top_iff]
    exact le_trans this (sup_le (le_of_eq rfl) (le_trans (comap_mono bot_le) (le_of_lt hJ)))
  refine'
    H.1.2 (map f J)
      (lt_of_le_of_ne (le_map_of_comap_le_of_surjective _ hf (le_of_lt hJ)) fun h =>
        ne_of_lt hJ (_root_.trans (congr_arg (comap f) h) _))
  

Proof state:
R : Type u
S : Type v
F : Type u_1
inst✝² : Ring R
inst✝¹ : Ring S
inst✝ : RingHomClass F R S
f : F
I : Ideal R
hf : Function.Surjective ⇑f
K : Ideal S
H : IsMaximal K
J : Ideal R
hJ : comap f K < J
h : K = map f J
⊢ comap f (map f J) = J

Next tactic:
rw [comap_map_of_surjective _ hf, sup_eq_left]
theorem comap_isMaximal_of_surjective {K : Ideal S} [H : IsMaximal K] : IsMaximal (comap f K) := by
  refine' ⟨⟨comap_ne_top _ H.1.1, fun J hJ => _⟩⟩
  suffices map f J = ⊤ by
    have := congr_arg (comap f) this
    rw [comap_top, comap_map_of_surjective _ hf, eq_top_iff] at this
    rw [eq_top_iff]
    exact le_trans this (sup_le (le_of_eq rfl) (le_trans (comap_mono bot_le) (le_of_lt hJ)))
  refine'
    H.1.2 (map f J)
      (lt_of_le_of_ne (le_map_of_comap_le_of_surjective _ hf (le_of_lt hJ)) fun h =>
        ne_of_lt hJ (_root_.trans (congr_arg (comap f) h) _))
  rw [comap_map_of_surjective _ hf, sup_eq_left]
  

Proof state:
R : Type u
S : Type v
F : Type u_1
inst✝² : Ring R
inst✝¹ : Ring S
inst✝ : RingHomClass F R S
f : F
I : Ideal R
hf : Function.Surjective ⇑f
K : Ideal S
H : IsMaximal K
J : Ideal R
hJ : comap f K < J
h : K = map f J
⊢ comap f ⊥ ≤ J

Next tactic:
exact le_trans (comap_mono bot_le) (le_of_lt hJ)
theorem map.isMaximal {I : Ideal R} (H : IsMaximal I) : IsMaximal (map f I) := by
  

Proof state:
R : Type u
S : Type v
F : Type u_1
inst✝² : Ring R
inst✝¹ : Ring S
inst✝ : RingHomClass F R S
f : F
I✝ : Ideal R
hf : Function.Bijective ⇑f
I : Ideal R
H : IsMaximal I
⊢ IsMaximal (map f I)

Next tactic:
refine'
    or_iff_not_imp_left.1 (map_eq_top_or_isMaximal_of_surjective f hf.right H) fun h => H.1.1 _
theorem map.isMaximal {I : Ideal R} (H : IsMaximal I) : IsMaximal (map f I) := by
  refine'
    or_iff_not_imp_left.1 (map_eq_top_or_isMaximal_of_surjective f hf.right H) fun h => H.1.1 _
  

Proof state:
R : Type u
S : Type v
F : Type u_1
inst✝² : Ring R
inst✝¹ : Ring S
inst✝ : RingHomClass F R S
f : F
I✝ : Ideal R
hf : Function.Bijective ⇑f
I : Ideal R
H : IsMaximal I
h : map f I = ⊤
⊢ I = ⊤

Next tactic:
calc
    I = comap f (map f I) := ((relIsoOfBijective f hf).right_inv I).symm
    _ = comap f ⊤ := by rw [h]
    _ = ⊤ := by rw [comap_top]